Changeset c05642d in mainline for uspace/drv/bus/usb/usbhid/usbhid.c
- Timestamp:
- 2011-09-07T00:03:26Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5081276
- Parents:
- bb74dabe (diff), 038b289 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/usbhid.c
rbb74dabe rc05642d 627 627 } 628 628 629 usb_hid_ free(&hid_dev);629 usb_hid_destroy(hid_dev); 630 630 } 631 631 … … 646 646 /*----------------------------------------------------------------------------*/ 647 647 648 void usb_hid_ free(usb_hid_dev_t **hid_dev)648 void usb_hid_destroy(usb_hid_dev_t *hid_dev) 649 649 { 650 650 int i; 651 651 652 if (hid_dev == NULL || *hid_dev == NULL) {652 if (hid_dev == NULL) { 653 653 return; 654 654 } 655 655 656 656 usb_log_debug("Subdrivers: %p, subdriver count: %d\n", 657 (*hid_dev)->subdrivers, (*hid_dev)->subdriver_count);658 659 assert( (*hid_dev)->subdrivers != NULL660 || (*hid_dev)->subdriver_count == 0);661 662 for (i = 0; i < (*hid_dev)->subdriver_count; ++i) {663 if ( (*hid_dev)->subdrivers[i].deinit != NULL) {664 (*hid_dev)->subdrivers[i].deinit(*hid_dev,665 (*hid_dev)->subdrivers[i].data);657 hid_dev->subdrivers, hid_dev->subdriver_count); 658 659 assert(hid_dev->subdrivers != NULL 660 || hid_dev->subdriver_count == 0); 661 662 for (i = 0; i < hid_dev->subdriver_count; ++i) { 663 if (hid_dev->subdrivers[i].deinit != NULL) { 664 hid_dev->subdrivers[i].deinit(hid_dev, 665 hid_dev->subdrivers[i].data); 666 666 } 667 667 } 668 668 669 669 // free the subdrivers info 670 if ( (*hid_dev)->subdrivers != NULL) {671 free( (*hid_dev)->subdrivers);670 if (hid_dev->subdrivers != NULL) { 671 free(hid_dev->subdrivers); 672 672 } 673 673 674 674 // destroy the parser 675 if ((*hid_dev)->report != NULL) { 676 usb_hid_free_report((*hid_dev)->report); 677 } 678 679 if ((*hid_dev)->report_desc != NULL) { 680 free((*hid_dev)->report_desc); 681 } 682 683 free(*hid_dev); 684 *hid_dev = NULL; 675 if (hid_dev->report != NULL) { 676 usb_hid_free_report(hid_dev->report); 677 } 678 679 if (hid_dev->report_desc != NULL) { 680 free(hid_dev->report_desc); 681 } 685 682 } 686 683
Note:
See TracChangeset
for help on using the changeset viewer.