Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/hcdhubd.c

    r1f43c8f rfe5e00d6  
    4040#include <bool.h>
    4141#include <errno.h>
    42 #include <str_error.h>
    4342#include <usb/classes/hub.h>
    4443
     
    113112        }
    114113
    115         rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id, true);
     114        rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id);
    116115        if (rc != EOK) {
    117116                free(id);
     
    151150        match_id->id = child_info->match_id;
    152151        match_id->score = 10;
     152        printf("adding child device with match \"%s\"\n", match_id->id);
    153153        add_match_id(&child->match_ids, match_id);
    154154
    155         printf("%s: adding child device `%s' with match \"%s\"\n",
    156             hc_driver->name, child->name, match_id->id);
    157155        rc = child_device_register(child, child_info->parent);
    158         printf("%s: child device `%s' registration: %s\n",
    159             hc_driver->name, child->name, str_error(rc));
    160 
    161156        if (rc != EOK) {
    162157                goto failure;
     
    178173leave:
    179174        free(arg);
    180         return EOK;
     175        return rc;
    181176}
    182177
     
    185180 * driven by the same task, the child adding is done in separate fibril.
    186181 * Not optimal, but it works.
    187  * Update: not under all circumstances the new fibril is successful either.
    188  * Thus the last parameter to let the caller choose.
    189182 *
    190183 * @param parent Parent device.
    191184 * @param name Device name.
    192185 * @param match_id Match id.
    193  * @param create_fibril Whether to run the addition in new fibril.
    194186 * @return Error code.
    195187 */
    196188int usb_hc_add_child_device(device_t *parent, const char *name,
    197     const char *match_id, bool create_fibril)
    198 {
    199         printf("%s: about to add child device `%s' (%s)\n", hc_driver->name,
    200             name, match_id);
    201 
     189    const char *match_id)
     190{
    202191        struct child_device_info *child_info
    203192            = malloc(sizeof(struct child_device_info));
     
    207196        child_info->match_id = match_id;
    208197
    209         if (create_fibril) {
    210                 fid_t fibril = fibril_create(fibril_add_child_device, child_info);
    211                 if (!fibril) {
    212                         return ENOMEM;
    213                 }
    214                 fibril_add_ready(fibril);
    215         } else {
    216                 fibril_add_child_device(child_info);
    217         }
     198        fid_t fibril = fibril_create(fibril_add_child_device, child_info);
     199        if (!fibril) {
     200                return ENOMEM;
     201        }
     202        fibril_add_ready(fibril);
    218203
    219204        return EOK;
Note: See TracChangeset for help on using the changeset viewer.