Changeset 904b1bc in mainline for uspace/lib/usbhost/src


Ignore:
Timestamp:
2018-05-22T10:36:58Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a4eb3ba2
Parents:
4f8772d4
git-author:
Jiri Svoboda <jiri@…> (2018-05-21 17:36:30)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-22 10:36:58)
Message:

Fix remaining ccheck issues.

Location:
uspace/lib/usbhost/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/ddf_helpers.c

    r4f8772d4 r904b1bc  
    6666 */
    6767static errno_t register_endpoint(ddf_fun_t *fun, usb_pipe_desc_t *pipe_desc,
    68      const usb_endpoint_descriptors_t *ep_desc)
     68    const usb_endpoint_descriptors_t *ep_desc)
    6969{
    7070        assert(fun);
     
    9292}
    9393
    94  /**
    95   * DDF usbhc_iface callback. Unregister endpoint that makes the other end of
    96   * the pipe described.
    97   *
    98   * @param fun DDF function of the device in question.
    99   * @param pipe_desc Pipe description.
    100   * @return Error code.
    101   */
     94/**
     95 * DDF usbhc_iface callback. Unregister endpoint that makes the other end of
     96 * the pipe described.
     97 *
     98 * @param fun DDF function of the device in question.
     99 * @param pipe_desc Pipe description.
     100 * @return Error code.
     101 */
    102102static errno_t unregister_endpoint(ddf_fun_t *fun, const usb_pipe_desc_t *pipe_desc)
    103103{
     
    182182        }
    183183
    184         /* If the driver didn't name the dev when enumerating,
     184        /*
     185         * If the driver didn't name the dev when enumerating,
    185186         * do it in some generic way.
    186187         */
     
    281282        assert(dev);
    282283
    283         const usb_target_t target = {{
    284                 .address = dev->address,
    285                 .endpoint = ifreq->endpoint,
    286                 .stream = ifreq->stream,
    287         }};
     284        const usb_target_t target = {
     285                {
     286                        .address = dev->address,
     287                        .endpoint = ifreq->endpoint,
     288                        .stream = ifreq->stream,
     289                }
     290        };
    288291
    289292        if (!usb_target_is_valid(&target))
  • uspace/lib/usbhost/src/usb2_bus.c

    r4f8772d4 r904b1bc  
    8989}
    9090
    91 static const usb_target_t usb2_default_target = {{
    92         .address = USB_ADDRESS_DEFAULT,
    93         .endpoint = 0,
    94 }};
     91static const usb_target_t usb2_default_target = {
     92        {
     93                .address = USB_ADDRESS_DEFAULT,
     94                .endpoint = 0,
     95        }
     96};
    9597
    9698/**
     
    120122
    121123        usb_endpoint_descriptors_t ep0_desc = {
    122             .endpoint.max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE,
     124                .endpoint.max_packet_size = CTRL_PIPE_MIN_PACKET_SIZE,
    123125        };
    124126
  • uspace/lib/usbhost/src/utility.c

    r4f8772d4 r904b1bc  
    8484        }
    8585
    86         const usb_target_t control_ep = {{
    87                 .address = dev->address,
    88                 .endpoint = 0,
    89         }};
     86        const usb_target_t control_ep = {
     87                {
     88                        .address = dev->address,
     89                        .endpoint = 0,
     90                }
     91        };
    9092
    9193        usb_standard_device_descriptor_t desc = { 0 };
     
    123125int hc_get_device_desc(device_t *device, usb_standard_device_descriptor_t *desc)
    124126{
    125         const usb_target_t control_ep = {{
    126                 .address = device->address,
    127                 .endpoint = 0,
    128         }};
     127        const usb_target_t control_ep = {
     128                {
     129                        .address = device->address,
     130                        .endpoint = 0,
     131                }
     132        };
    129133
    130134        /* Get std device descriptor */
     
    147151int hc_get_hub_desc(device_t *device, usb_hub_descriptor_header_t *desc)
    148152{
    149         const usb_target_t control_ep = {{
    150                 .address = device->address,
    151                 .endpoint = 0,
    152         }};
    153 
    154         const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER
    155                 ? USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB;
     153        const usb_target_t control_ep = {
     154                {
     155                        .address = device->address,
     156                        .endpoint = 0,
     157                }
     158        };
     159
     160        const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER ?
     161            USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB;
    156162
    157163        const usb_device_request_setup_packet_t get_hub_desc = {
    158                 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST
    159                     | (USB_REQUEST_TYPE_CLASS << 5)
    160                     | USB_REQUEST_RECIPIENT_DEVICE,
     164                .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST |
     165                    (USB_REQUEST_TYPE_CLASS << 5) |
     166                    USB_REQUEST_RECIPIENT_DEVICE,
    161167                .request = USB_DEVREQ_GET_DESCRIPTOR,
    162168                .value = uint16_host2usb(type << 8),
     
    244250void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t reset_cb)
    245251{
    246         if (batch->ep->transfer_type != USB_TRANSFER_CONTROL
    247             || batch->dir != USB_DIRECTION_OUT)
     252        if (batch->ep->transfer_type != USB_TRANSFER_CONTROL ||
     253            batch->dir != USB_DIRECTION_OUT)
    248254                return;
    249255
    250256        const usb_device_request_setup_packet_t *request = &batch->setup.packet;
    251         device_t * const dev = batch->ep->device;
    252 
    253         switch (request->request)
    254         {
    255         /* Clear Feature ENPOINT_STALL */
     257        device_t *const dev = batch->ep->device;
     258
     259        switch (request->request) {
     260                /* Clear Feature ENPOINT_STALL */
    256261        case USB_DEVREQ_CLEAR_FEATURE: /*resets only cleared ep */
    257262                /* 0x2 ( HOST to device | STANDART | TO ENPOINT) */
     
    273278        case USB_DEVREQ_SET_CONFIGURATION:
    274279        case USB_DEVREQ_SET_INTERFACE:
    275                 /* Recipient must be device, this resets all endpoints,
     280                /*
     281                 * Recipient must be device, this resets all endpoints,
    276282                 * In fact there should be no endpoints but EP 0 registered
    277283                 * as different interfaces use different endpoints,
    278284                 * unless you're changing configuration or alternative
    279                  * interface of an already setup device. */
     285                 * interface of an already setup device.
     286                 */
    280287                if (!(request->request_type & SETUP_REQUEST_TYPE_DEVICE_TO_HOST))
    281288                        for (usb_endpoint_t i = 0; i < 2 * USB_ENDPOINT_MAX; ++i)
Note: See TracChangeset for help on using the changeset viewer.