Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/usbmid/usbmid.c

    rfcafa04 recb107b  
    7979};
    8080
    81 /** Create new interface for USB MID device.
    82  *
    83  * @param fun Backing generic DDF device function (representing interface).
    84  * @param iface_no Interface number.
    85  * @return New interface.
    86  * @retval NULL Error occured.
    87  */
    88 usbmid_interface_t *usbmid_interface_create(ddf_fun_t *fun, int iface_no)
    89 {
    90         usbmid_interface_t *iface = malloc(sizeof(usbmid_interface_t));
    91         if (iface == NULL) {
    92                 usb_log_error("Out of memory (wanted %zuB).\n",
    93                     sizeof(usbmid_interface_t));
    94                 return NULL;
    95         }
    96 
    97         iface->fun = fun;
    98         iface->interface_no = iface_no;
    99 
    100         return iface;
    101 }
    102 
    10381
    10482/** Spawn new child device from one interface.
    10583 *
    10684 * @param parent Parent MID device.
     85 * @param iface Interface information.
    10786 * @param device_descriptor Device descriptor.
    10887 * @param interface_descriptor Interface descriptor.
     
    11089 */
    11190int usbmid_spawn_interface_child(usb_device_t *parent,
     91    usbmid_interface_t *iface,
    11292    const usb_standard_device_descriptor_t *device_descriptor,
    11393    const usb_standard_interface_descriptor_t *interface_descriptor)
     
    11595        ddf_fun_t *child = NULL;
    11696        char *child_name = NULL;
    117         usbmid_interface_t *child_as_interface = NULL;
    11897        int rc;
    11998
     
    137116        }
    138117
     118        iface->fun = child;
    139119
    140 
    141         child_as_interface = usbmid_interface_create(child,
    142             (int) interface_descriptor->interface_number);
    143         if (child_as_interface == NULL) {
    144                 rc = ENOMEM;
    145                 goto error_leave;
    146         }
    147 
    148         child->driver_data = child_as_interface;
     120        child->driver_data = iface;
    149121        child->ops = &child_device_ops;
    150122
     
    172144                free(child_name);
    173145        }
    174         if (child_as_interface != NULL) {
    175                 free(child_as_interface);
    176         }
    177146
    178147        return rc;
Note: See TracChangeset for help on using the changeset viewer.