Changeset 34289ea in mainline


Ignore:
Timestamp:
2012-12-30T19:04:34Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68e1023
Parents:
db8b7ca
Message:

usmid: return error code instead of weird bool rc conversions.

Location:
uspace/drv/bus/usb/usbmid
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmid/explore.c

    rdb8b7ca r34289ea  
    5757{
    5858        list_foreach(*list, l) {
    59                 usbmid_interface_t *iface = usbmid_interface_from_link(l);
     59                const usbmid_interface_t *iface = usbmid_interface_from_link(l);
    6060                if (iface->interface_no == interface_no) {
    6161                        return true;
     
    130130 * @return Whether to accept this device from devman.
    131131 */
    132 bool usbmid_explore_device(usb_device_t *dev)
     132int usbmid_explore_device(usb_device_t *dev)
    133133{
    134         int rc;
    135 
    136         unsigned dev_class = dev->descriptors.device.device_class;
     134        const unsigned dev_class = dev->descriptors.device.device_class;
    137135        if (dev_class != USB_CLASS_USE_INTERFACE) {
    138136                usb_log_warning(
     
    140138                    dev_class, usb_str_class(dev_class),
    141139                    USB_CLASS_USE_INTERFACE);
    142                 usb_log_error("Not multi interface device, refusing.\n");
    143                 return false;
     140                usb_log_error("Not a multi-interface device, refusing.\n");
     141                return ENOTSUP;
    144142        }
    145143
     
    151149
    152150        /* Select the first configuration */
    153         rc = usb_request_set_configuration(&dev->ctrl_pipe,
     151        int rc = usb_request_set_configuration(&dev->ctrl_pipe,
    154152            config_descriptor->configuration_number);
    155153        if (rc != EOK) {
    156154                usb_log_error("Failed to set device configuration: %s.\n",
    157155                    str_error(rc));
    158                 return false;
    159         }
     156                return rc;
     157        }
     158
     159       
    160160
    161161        /* Create driver soft-state. */
     
    163163        if (!usb_mid) {
    164164                usb_log_error("Failed to create USB MID structure.\n");
    165                 return false;
     165                return ENOMEM;
    166166        }
    167167
     
    170170        if (usb_mid->ctl_fun == NULL) {
    171171                usb_log_error("Failed to create control function.\n");
    172                 return false;
     172                return ENOMEM;
    173173        }
    174174        ddf_fun_set_ops(usb_mid->ctl_fun, &mid_device_ops);
     
    180180                    str_error(rc));
    181181                ddf_fun_destroy(usb_mid->ctl_fun);
    182                 return false;
     182                return rc;
    183183        }
    184184
     
    205205        }
    206206
    207         return true;
     207        return EOK;
    208208}
    209209
  • uspace/drv/bus/usb/usbmid/main.c

    rdb8b7ca r34289ea  
    5353        usb_log_info("Taking care of new MID `%s'.\n", ddf_dev_get_name(dev->ddf_dev));
    5454
    55         const bool accept = usbmid_explore_device(dev);
    56 
    57         if (!accept) {
    58                 return ENOTSUP;
    59         }
    60 
    61         return EOK;
     55        return usbmid_explore_device(dev);
    6256}
    6357
  • uspace/drv/bus/usb/usbmid/usbmid.h

    rdb8b7ca r34289ea  
    6464} usb_mid_t;
    6565
    66 bool usbmid_explore_device(usb_device_t *);
     66int usbmid_explore_device(usb_device_t *);
    6767int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t *,
    6868    const usb_standard_device_descriptor_t *,
Note: See TracChangeset for help on using the changeset viewer.