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

Changeset f167f55 in mainline


Ignore:
Timestamp:
2011-12-06T12:06:41Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
2582d8f
Parents:
3f162ab
Message:

lilbusbhost: Do not use usb_transfer_batch_t.error field in finish_error variant

Location:
uspace/lib/usbhost
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h

    r3f162ab rf167f55  
    106106void usb_transfer_batch_destroy(const usb_transfer_batch_t *instance);
    107107
    108 void usb_transfer_batch_finish(const usb_transfer_batch_t *instance,
    109     const void* data, size_t size);
     108void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance,
     109    const void* data, size_t size, int error);
    110110/*----------------------------------------------------------------------------*/
    111 /** Override error value and finishes transfer.
     111/** Finish batch using stored error value.
    112112 *
    113113 * @param[in] instance Batch structure to use.
    114114 * @param[in] data Data to copy to the output buffer.
    115115 * @param[in] size Size of @p data.
    116  * @param[in] error Set batch status to this error value.
    117116 */
    118 static inline void usb_transfer_batch_finish_error(
    119     usb_transfer_batch_t *instance, const void* data, size_t size, int error)
     117static inline void usb_transfer_batch_finish(
     118    const usb_transfer_batch_t *instance, const void* data, size_t size)
    120119{
    121120        assert(instance);
    122         instance->error = error;
    123         usb_transfer_batch_finish(instance, data, size);
     121        usb_transfer_batch_finish_error(instance, data, size, instance->error);
    124122}
    125123/*----------------------------------------------------------------------------*/
  • uspace/lib/usbhost/src/usb_transfer_batch.c

    r3f162ab rf167f55  
    3333 */
    3434#include <errno.h>
    35 #include <str_error.h>
    3635#include <macros.h>
    3736
     
    122121 * @param[in] data Data to copy to the output buffer.
    123122 * @param[in] size Size of @p data.
     123 * @param[in] error Error value to use.
    124124 */
    125 void usb_transfer_batch_finish(
    126     const usb_transfer_batch_t *instance, const void *data, size_t size)
     125void usb_transfer_batch_finish_error(const usb_transfer_batch_t *instance,
     126    const void *data, size_t size, int error)
    127127{
    128128        assert(instance);
     
    134134                /* Check for commands that reset toggle bit */
    135135                if (instance->ep->transfer_type == USB_TRANSFER_CONTROL
    136                     && instance->error == EOK) {
     136                    && error == EOK) {
    137137                        const usb_target_t target =
    138138                            {{ instance->ep->address, instance->ep->endpoint }};
     
    140140                            instance->setup_buffer);
    141141                }
    142                 instance->callback_out(instance->fun,
    143                     instance->error, instance->arg);
     142                instance->callback_out(instance->fun, error, instance->arg);
    144143        }
    145144
     
    150149                        memcpy(instance->buffer, data, minsize);
    151150                }
    152                 instance->callback_in(instance->fun, instance->error,
     151                instance->callback_in(instance->fun, error,
    153152                    instance->transfered_size, instance->arg);
    154153        }
Note: See TracChangeset for help on using the changeset viewer.