Changeset c05642d in mainline for uspace/drv/bus/usb/usbhid/usbhid.c


Ignore:
Timestamp:
2011-09-07T00:03:26Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
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.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    rbb74dabe rc05642d  
    627627        }
    628628       
    629         usb_hid_free(&hid_dev);
     629        usb_hid_destroy(hid_dev);
    630630}
    631631
     
    646646/*----------------------------------------------------------------------------*/
    647647
    648 void usb_hid_free(usb_hid_dev_t **hid_dev)
     648void usb_hid_destroy(usb_hid_dev_t *hid_dev)
    649649{
    650650        int i;
    651651       
    652         if (hid_dev == NULL || *hid_dev == NULL) {
     652        if (hid_dev == NULL) {
    653653                return;
    654654        }
    655655       
    656656        usb_log_debug("Subdrivers: %p, subdriver count: %d\n",
    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);
     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);
    666666                }
    667667        }
    668668       
    669669        // 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);
    672672        }
    673673
    674674        // 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        }
    685682}
    686683
Note: See TracChangeset for help on using the changeset viewer.