Changeset 56fd7cf in mainline for uspace/drv/bus/usb/usbhid/kbd/kbddev.c
- Timestamp:
- 2012-08-17T11:37:03Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d5a540
- Parents:
- be2a38ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/kbd/kbddev.c
rbe2a38ad r56fd7cf 34 34 * USB HID keyboard device structure and API. 35 35 */ 36 37 /* XXX Fix this */ 38 #define _DDF_DATA_IMPLANT 36 39 37 40 #include <errno.h> … … 162 165 ipc_callid_t icallid, ipc_call_t *icall) 163 166 { 164 if (fun == NULL || fun->driver_data == NULL) {165 usb_log_error("%s: Missing parameter.\n", __FUNCTION__);166 async_answer_0(icallid, EINVAL);167 return;168 }169 170 167 const sysarg_t method = IPC_GET_IMETHOD(*icall); 171 usb_kbd_t *kbd_dev = fun->driver_data;168 usb_kbd_t *kbd_dev = ddf_fun_data_get(fun); 172 169 173 170 switch (method) { … … 501 498 /* Store the initialized HID device and HID ops 502 499 * to the DDF function. */ 503 fun->ops = &kbdops;504 fun->driver_data = kbd_dev;500 ddf_fun_set_ops(fun, &kbdops); 501 ddf_fun_data_implant(fun, kbd_dev); 505 502 506 503 int rc = ddf_fun_bind(fun); … … 508 505 usb_log_error("Could not bind DDF function: %s.\n", 509 506 str_error(rc)); 510 fun->driver_data = NULL; /* We did not allocate this. */511 507 ddf_fun_destroy(fun); 512 508 return rc; … … 514 510 515 511 usb_log_debug("%s function created. Handle: %" PRIun "\n", 516 HID_KBD_FUN_NAME, fun->handle);512 HID_KBD_FUN_NAME, ddf_fun_get_handle(fun)); 517 513 518 514 usb_log_debug("Adding DDF function to category %s...\n", … … 524 520 HID_KBD_CLASS_NAME, str_error(rc)); 525 521 if (ddf_fun_unbind(fun) == EOK) { 526 fun->driver_data = NULL; /* We did not allocate this. */527 522 ddf_fun_destroy(fun); 528 523 } else { 529 524 usb_log_error( 530 525 "Failed to unbind `%s', will not destroy.\n", 531 fun->name);526 ddf_fun_get_name(fun)); 532 527 } 533 528 return rc; … … 757 752 if (ddf_fun_unbind(kbd_dev->fun) != EOK) { 758 753 usb_log_warning("Failed to unbind %s.\n", 759 kbd_dev->fun->name);754 ddf_fun_get_name(kbd_dev->fun)); 760 755 } else { 761 usb_log_debug2("%s unbound.\n", kbd_dev->fun->name);762 kbd_dev->fun->driver_data = NULL;756 usb_log_debug2("%s unbound.\n", 757 ddf_fun_get_name(kbd_dev->fun)); 763 758 ddf_fun_destroy(kbd_dev->fun); 764 759 } 765 760 } 766 free(kbd_dev);767 761 } 768 762
Note:
See TracChangeset
for help on using the changeset viewer.