Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 7f7e6f5 in mainline


Ignore:
Timestamp:
2012-02-24T05:35:52Z (8 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
master
Children:
12e689f
Parents:
9f807c3
Message:

ohci: only consider transeferred size on packets that got through.

Fixes crash with stalled transfers on ppc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_batch.c

    r9f807c3 r7f7e6f5  
    199199                    ohci_batch->tds[i]->next, ohci_batch->tds[i]->be);
    200200
    201                 /* If the TD got all its data through, it will report 0 bytes
    202                  * remain, the sole exception is INPUT with data rounding flag
    203                  * (short), i.e. every INPUT. Nice thing is that short packets
    204                  * will correctly report remaining data, thus making
    205                  * this computation correct (short packets need to be produced
    206                  * by the last TD)
    207                  * NOTE: This also works for CONTROL transfer as
    208                  * the first TD will return 0 remain.
    209                  * NOTE: Short packets don't break the assumption that
    210                  * we leave the very last(unused) TD behind.
    211                  */
    212                 ohci_batch->usb_batch->transfered_size
    213                     -= td_remain_size(ohci_batch->tds[i]);
    214 
    215201                ohci_batch->usb_batch->error = td_error(ohci_batch->tds[i]);
    216                 if (ohci_batch->usb_batch->error != EOK) {
     202                if (ohci_batch->usb_batch->error == EOK) {
     203                        /* If the TD got all its data through, it will report
     204                         * 0 bytes remain, the sole exception is INPUT with
     205                         * data rounding flag (short), i.e. every INPUT.
     206                         * Nice thing is that short packets will correctly
     207                         * report remaining data, thus making this computation
     208                         * correct (short packets need to be produced by the
     209                         * last TD)
     210                         * NOTE: This also works for CONTROL transfer as
     211                         * the first TD will return 0 remain.
     212                         * NOTE: Short packets don't break the assumption that
     213                         * we leave the very last(unused) TD behind.
     214                         */
     215                        ohci_batch->usb_batch->transfered_size
     216                            -= td_remain_size(ohci_batch->tds[i]);
     217                } else {
    217218                        usb_log_debug("Batch %p found error TD(%zu):%08x.\n",
    218219                            ohci_batch->usb_batch, i,
Note: See TracChangeset for help on using the changeset viewer.