Changeset a0487a2 in mainline


Ignore:
Timestamp:
2011-12-14T16:04:52Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5dd4294b
Parents:
6e3c005
Message:

libusbdev: Move arg callback argument from poling_data_t to usb_device_auto_polling_t.

That's where the callbacks are.

Location:
uspace/lib/usbdev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/include/usb/dev/poll.h

    r6e3c005 ra0487a2  
    8383         */
    8484        bool (*on_error)(usb_device_t *dev, int err_code, void *arg);
     85        /** Argument to pass to callbacks. */
     86        void *arg;
    8587} usb_device_auto_polling_t;
    8688
    8789int usb_device_auto_polling(usb_device_t *, size_t,
    88     const usb_device_auto_polling_t *, size_t, void *);
     90    const usb_device_auto_polling_t *, size_t);
    8991
    9092typedef bool (*usb_polling_callback_t)(usb_device_t *,
  • uspace/lib/usbdev/src/devpoll.c

    r6e3c005 ra0487a2  
    5757        /** Data buffer. */
    5858        uint8_t *buffer;
    59         /** Argument to pass to callbacks. */
    60         void *custom_arg;
    6159} polling_data_t;
    6260
     
    125123                        ++failed_attempts;
    126124                        const bool cont = (params->on_error == NULL) ? true :
    127                             params->on_error(data->dev, rc, data->custom_arg);
     125                            params->on_error(data->dev, rc, params->arg);
    128126                        if (!cont) {
    129127                                failed_attempts = params->max_failures;
     
    135133                assert(params->on_data);
    136134                const bool carry_on = params->on_data(
    137                     data->dev, data->buffer, actual_size, data->custom_arg);
     135                    data->dev, data->buffer, actual_size, params->arg);
    138136
    139137                if (!carry_on) {
     
    155153
    156154        if (params->on_polling_end != NULL) {
    157                 params->on_polling_end(data->dev, failed, data->custom_arg);
     155                params->on_polling_end(data->dev, failed, params->arg);
    158156        }
    159157
     
    205203                .on_polling_end = terminated_callback,
    206204                .on_error = NULL,
     205                .arg = arg,
    207206        };
    208207
    209208        return usb_device_auto_polling(dev, pipe_index, &auto_polling,
    210            request_size, arg);
     209           request_size);
    211210}
    212211
     
    230229int usb_device_auto_polling(usb_device_t *dev, size_t pipe_index,
    231230    const usb_device_auto_polling_t *polling,
    232     size_t request_size, void *arg)
     231    size_t request_size)
    233232{
    234233        if ((dev == NULL) || (polling == NULL) || (polling->on_data == NULL)) {
     
    258257        polling_data->dev = dev;
    259258        polling_data->pipe_index = pipe_index;
    260         polling_data->custom_arg = arg;
    261259
    262260        /* Copy provided settings. */
Note: See TracChangeset for help on using the changeset viewer.