Changeset aa05b29 in mainline


Ignore:
Timestamp:
2011-10-30T13:10:24Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9871bca
Parents:
cf7561f
Message:

usbmid: Add device_remove incomplete implementation.

Add const qualifiers.

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

Legend:

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

    rcf7561f raa05b29  
    6565        return EOK;
    6666}
     67/*----------------------------------------------------------------------------*/
     68/** Callback when a MID device is about to be removed from the host.
     69 *
     70 * @param gen_dev Generic DDF device representing the removed device.
     71 * @return Error code.
     72 */
     73static int usbmid_device_remove(usb_device_t *dev)
     74{
     75        assert(dev);
     76        int ret = ENOTSUP;
     77        usb_mid_t *usb_mid = dev->driver_data;
     78        assert(usb_mid);
    6779
     80        /* Signal all interface functions */
     81        list_foreach(usb_mid->interface_list, item) {
     82                usbmid_interface_t *iface = usbmid_interface_from_link(item);
     83
     84                usb_log_info("Signaling remove to child for interface "
     85                    "%d (%s).\n", iface->interface_no,
     86                    usb_str_class(iface->interface->interface_class));
     87                // TODO cascade the call.
     88        }
     89        return ret;
     90}
     91/*----------------------------------------------------------------------------*/
     92/** Callback when a MID device was removed from the host.
     93 *
     94 * @param gen_dev Generic DDF device representing the removed device.
     95 * @return Error code.
     96 */
    6897static int usbmid_device_gone(usb_device_t *dev)
    6998{
     
    86115                list_remove(item);
    87116
    88                 usbmid_interface_t *iface = list_get_instance(item,
    89                     usbmid_interface_t, link);
     117                usbmid_interface_t *iface = usbmid_interface_from_link(item);
    90118
    91119                usb_log_info("Removing child for interface %d (%s).\n",
     
    107135
    108136/** USB MID driver ops. */
    109 static usb_driver_ops_t mid_driver_ops = {
     137static const usb_driver_ops_t mid_driver_ops = {
    110138        .device_add = usbmid_device_add,
     139        .device_rem = usbmid_device_remove,
    111140        .device_gone = usbmid_device_gone,
    112141};
    113142
    114143/** USB MID driver. */
    115 static usb_driver_t mid_driver = {
     144static const usb_driver_t mid_driver = {
    116145        .name = NAME,
    117146        .ops = &mid_driver_ops,
  • uspace/drv/bus/usb/usbmid/usbmid.h

    rcf7561f raa05b29  
    7171int usbmid_interface_destroy(usbmid_interface_t *mid_iface);
    7272
     73static inline usbmid_interface_t * usbmid_interface_from_link(link_t *item)
     74{
     75        return list_get_instance(item, usbmid_interface_t, link);
     76}
     77
    7378#endif
    7479/**
Note: See TracChangeset for help on using the changeset viewer.