Changeset 9e2132a in mainline


Ignore:
Timestamp:
2012-12-30T20:14:13Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17bbb28
Parents:
6df4adc4
Message:

usbmid: Don't use ddf_fun_data_implant.

Remove unused pointer to interface descriptor.

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

Legend:

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

    r6df4adc4 r9e2132a  
    111111                }
    112112
    113                 usbmid_interface_t *iface = malloc(sizeof(usbmid_interface_t));
    114                 if (iface == NULL) {
    115                         //TODO: Do something about that failure.
    116                         break;
    117                 }
    118 
    119                 link_initialize(&iface->link);
    120                 iface->fun = NULL;
    121                 iface->interface_no = interface->interface_number;
    122                 iface->interface = interface;
    123 
    124                 list_append(&iface->link, list);
    125113
    126114                usb_log_info("Creating child for interface %d (%s).\n",
     
    128116                    usb_str_class(interface->interface_class));
    129117
    130                 const int rc = usbmid_spawn_interface_child(usb_dev, iface,
     118                usbmid_interface_t *iface = NULL;
     119                const int rc = usbmid_spawn_interface_child(usb_dev, &iface,
    131120                    &usb_dev->descriptors.device, interface);
    132121                if (rc != EOK) {
     122                        //TODO: Do something about that failure.
    133123                        usb_log_error("Failed to create interface child for "
    134124                            "%d (%s): %s.\n", interface->interface_number,
    135125                            usb_str_class(interface->interface_class),
    136126                            str_error(rc));
     127                } else {
     128                        list_append(&iface->link, list);
    137129                }
    138130        }
  • uspace/drv/bus/usb/usbmid/usbmid.c

    r6df4adc4 r9e2132a  
    3030 * @{
    3131 */
    32 
    33 /* XXX Fix this */
    34 #define _DDF_DATA_IMPLANT
    3532
    3633/**
     
    8178                return ret;
    8279        }
    83         /* NOTE: usbmid->interface points somewhere, but we did not
    84          * allocate that space, so don't touch */
    8580        ddf_fun_destroy(mid_iface->fun);
    86         /* NOTE: mid_iface is invalid at this point, it was assigned to
    87          * mid_iface->fun->driver_data and freed in ddf_fun_destroy */
    8881        return EOK;
    8982}
     
    9891 */
    9992int usbmid_spawn_interface_child(usb_device_t *parent,
    100     usbmid_interface_t *iface,
     93    usbmid_interface_t **iface_ret,
    10194    const usb_standard_device_descriptor_t *device_descriptor,
    10295    const usb_standard_interface_descriptor_t *interface_descriptor)
     
    145138        }
    146139        clean_match_ids(&match_ids);
     140        ddf_fun_set_ops(child, &child_device_ops);
     141
     142        usbmid_interface_t *iface = ddf_fun_data_alloc(child, sizeof(*iface));
     143
     144        iface->fun = child;
     145        iface->interface_no = interface_descriptor->interface_number;
     146        link_initialize(&iface->link);
    147147
    148148        rc = ddf_fun_bind(child);
     
    152152                return rc;
    153153        }
    154 
    155         iface->fun = child;
    156         ddf_fun_data_implant(child, iface);
    157         ddf_fun_set_ops(child, &child_device_ops);
     154        *iface_ret = iface;
    158155
    159156        return EOK;
  • uspace/drv/bus/usb/usbmid/usbmid.h

    r6df4adc4 r9e2132a  
    5050        /** Function container. */
    5151        ddf_fun_t *fun;
    52         /** Interface descriptor. */
    53         const usb_standard_interface_descriptor_t *interface;
    5452        /** Interface number. */
    5553        int interface_no;
     
    6563
    6664int usbmid_explore_device(usb_device_t *);
    67 int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t *,
     65int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **,
    6866    const usb_standard_device_descriptor_t *,
    6967    const usb_standard_interface_descriptor_t *);
Note: See TracChangeset for help on using the changeset viewer.