Changeset 78f01ff9 in mainline for uspace/lib/usb/src/hcdhubd.c


Ignore:
Timestamp:
2010-11-28T22:25:01Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4570779, c39544a
Parents:
36bcf84f (diff), 1f43c8f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge with vojtechhorky/

File:
1 edited

Legend:

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

    r36bcf84f r78f01ff9  
    4040#include <bool.h>
    4141#include <errno.h>
     42#include <str_error.h>
    4243#include <usb/classes/hub.h>
    4344
     
    112113        }
    113114
    114         rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id);
     115        rc = usb_hc_add_child_device(dev->generic, USB_HUB_DEVICE_NAME, id, true);
    115116        if (rc != EOK) {
    116117                free(id);
     
    150151        match_id->id = child_info->match_id;
    151152        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);
    155157        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
    156161        if (rc != EOK) {
    157162                goto failure;
     
    173178leave:
    174179        free(arg);
    175         return rc;
     180        return EOK;
    176181}
    177182
     
    180185 * driven by the same task, the child adding is done in separate fibril.
    181186 * 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.
    182189 *
    183190 * @param parent Parent device.
    184191 * @param name Device name.
    185192 * @param match_id Match id.
     193 * @param create_fibril Whether to run the addition in new fibril.
    186194 * @return Error code.
    187195 */
    188196int usb_hc_add_child_device(device_t *parent, const char *name,
    189     const char *match_id)
    190 {
     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
    191202        struct child_device_info *child_info
    192203            = malloc(sizeof(struct child_device_info));
     
    196207        child_info->match_id = match_id;
    197208
    198         fid_t fibril = fibril_create(fibril_add_child_device, child_info);
    199         if (!fibril) {
    200                 return ENOMEM;
    201         }
    202         fibril_add_ready(fibril);
     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        }
    203218
    204219        return EOK;
Note: See TracChangeset for help on using the changeset viewer.