Changeset 904b1bc in mainline for uspace/lib/usbhost/src/utility.c


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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.