Changeset 18b6a88 in mainline for uspace/drv/bus/usb/uhci/uhci_batch.c


Ignore:
Timestamp:
2018-04-15T09:35:04Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1f44ca
Parents:
8ebe212
Message:

More ccheck fixes, sometimes with manual intervention.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/uhci_batch.c

    r8ebe212 r18b6a88  
    5353
    5454/** Transfer batch setup table. */
    55 static void (*const batch_setup[])(uhci_transfer_batch_t*);
     55static void (*const batch_setup[])(uhci_transfer_batch_t *);
    5656
    5757/** Destroys uhci_transfer_batch_t structure.
     
    7272 * NULL otherwise.
    7373 */
    74 uhci_transfer_batch_t * uhci_transfer_batch_create(endpoint_t *ep)
     74uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *ep)
    7575{
    7676        uhci_transfer_batch_t *uhci_batch =
     
    9999        usb_transfer_batch_t *usb_batch = &uhci_batch->base;
    100100
    101         uhci_batch->td_count = (usb_batch->size + usb_batch->ep->max_packet_size - 1)
    102                 / usb_batch->ep->max_packet_size;
     101        uhci_batch->td_count = (usb_batch->size + usb_batch->ep->max_packet_size - 1) /
     102            usb_batch->ep->max_packet_size;
    103103
    104104        if (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) {
     
    106106        }
    107107
    108         const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL)
    109                 ? USB_SETUP_PACKET_SIZE
    110                 : 0;
    111 
    112         const size_t total_size = (sizeof(td_t) * uhci_batch->td_count)
    113             + sizeof(qh_t) + setup_size;
     108        const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) ?
     109            USB_SETUP_PACKET_SIZE :
     110            0;
     111
     112        const size_t total_size = (sizeof(td_t) * uhci_batch->td_count) +
     113            sizeof(qh_t) + setup_size;
    114114
    115115        if (dma_buffer_alloc(&uhci_batch->uhci_dma_buffer, total_size)) {
     
    162162        uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) batch->ep;
    163163
    164         for (size_t i = 0;i < uhci_batch->td_count; ++i) {
     164        for (size_t i = 0; i < uhci_batch->td_count; ++i) {
    165165                if (td_is_active(&uhci_batch->tds[i])) {
    166166                        return false;
     
    180180                }
    181181
    182                 batch->transferred_size
    183                     += td_act_size(&uhci_batch->tds[i]);
     182                batch->transferred_size +=
     183                    td_act_size(&uhci_batch->tds[i]);
    184184                if (td_is_short(&uhci_batch->tds[i]))
    185185                        goto substract_ret;
     
    235235                const size_t packet_size = min(remain_size, mps);
    236236
    237                 const td_t *next_td = (td + 1 < uhci_batch->td_count)
    238                     ? &uhci_batch->tds[td + 1] : NULL;
     237                const td_t *next_td = (td + 1 < uhci_batch->td_count) ?
     238                    &uhci_batch->tds[td + 1] : NULL;
    239239
    240240                assert(td < uhci_batch->td_count);
     
    328328}
    329329
    330 static void (*const batch_setup[])(uhci_transfer_batch_t*) =
    331 {
     330static void (*const batch_setup[])(uhci_transfer_batch_t *) =
     331    {
    332332        [USB_TRANSFER_CONTROL] = batch_control,
    333333        [USB_TRANSFER_BULK] = batch_data,
Note: See TracChangeset for help on using the changeset viewer.