Ignore:
Timestamp:
2011-10-14T14:46:59Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
571ba2a
Parents:
cddd151
Message:

usbhid: kbd unbind and destroy ddf function during destruction.

Remove redundant argument form usb_kbd_create_function().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/kbd/kbddev.c

    rcddd151 r7b54b99  
    514514/*----------------------------------------------------------------------------*/
    515515
    516 static int usb_kbd_create_function(usb_hid_dev_t *hid_dev, usb_kbd_t *kbd_dev)
    517 {
    518         assert(hid_dev != NULL);
    519         assert(hid_dev->usb_dev != NULL);
     516static int usb_kbd_create_function(usb_kbd_t *kbd_dev)
     517{
    520518        assert(kbd_dev != NULL);
     519        assert(kbd_dev->hid_dev != NULL);
     520        assert(kbd_dev->hid_dev->usb_dev != NULL);
    521521
    522522        /* Create the exposed function. */
    523523        usb_log_debug("Creating DDF function %s...\n", HID_KBD_FUN_NAME);
    524         ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed,
    525             HID_KBD_FUN_NAME);
     524        ddf_fun_t *fun = ddf_fun_create(kbd_dev->hid_dev->usb_dev->ddf_dev,
     525            fun_exposed, HID_KBD_FUN_NAME);
    526526        if (fun == NULL) {
    527527                usb_log_error("Could not create DDF function node.\n");
     
    721721
    722722        usb_log_debug("Creating KBD function...\n");
    723         int rc = usb_kbd_create_function(hid_dev, kbd_dev);
     723        int rc = usb_kbd_create_function(kbd_dev);
    724724        if (rc != EOK) {
    725725                usb_kbd_destroy(kbd_dev);
     
    786786        free(kbd_dev->keys_old);
    787787        free(kbd_dev->led_data);
     788
    788789        if (kbd_dev->led_path != NULL) {
    789790                usb_hid_report_path_free(kbd_dev->led_path);
     
    791792        if (kbd_dev->output_buffer != NULL) {
    792793                usb_hid_report_output_free(kbd_dev->output_buffer);
     794        }
     795
     796        if (ddf_fun_unbind(kbd_dev->fun) != EOK) {
     797                usb_log_warning("Failed to unbind kbd function.\n");
     798        } else {
     799                kbd_dev->fun->driver_data = NULL;
     800                ddf_fun_destroy(kbd_dev->fun);
    793801        }
    794802}
Note: See TracChangeset for help on using the changeset viewer.