X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/1e832aa31a16b4c9c36ceae8e34f1d7190e65e99..c3adf4f9af7ee68df8bb65fafa4dbcbdcc4895ba:/lincan/src/usbcan.c diff --git a/lincan/src/usbcan.c b/lincan/src/usbcan.c index 429167c..a5e938a 100644 --- a/lincan/src/usbcan.c +++ b/lincan/src/usbcan.c @@ -573,19 +573,20 @@ int usbcan_stop_chip(struct canchip_t *chip) * * File: src/usbcan.c */ -void usbcan_register_devs(struct canchip_t *chip,void *data){ +int usbcan_register_devs(struct canchip_t *chip,void *data){ struct usbcan_devs *usbdevs=(struct usbcan_devs *)data; if (!usbdevs){ CANMSG("Bad structure given\n"); - return; + return -1; } if (chip->chip_idx>=usbdevs->count) { CANMSG("Requested chip number is bigger than chip count\n"); - return; + return -1; } usbdevs->devs[chip->chip_idx]->chip=chip; chip->chip_data=(void *)usbdevs->devs[chip->chip_idx]; + return 0; } /** @@ -1459,7 +1460,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device /* save our data pointer in this interface device */ usb_set_intfdata(interface, usbdevs); - if (!(usbdevs->candev=register_usbdev("usbcan",(void *) usbdevs, usbcan_register_devs))) + if (!(usbdevs->candev=register_hotplug_dev("usbcan", usbcan_register_devs,(void *) usbdevs))) goto register_error; /* let the user know what node this device is now attached to */ @@ -1467,7 +1468,7 @@ static int usbcan_probe(struct usb_interface *interface, const struct usb_device return 0; register_error: - cleanup_usbdev(usbdevs->candev); + cleanup_hotplug_dev(usbdevs->candev); error: if (usbdevs){ if (usbdevs->devs){ @@ -1507,7 +1508,7 @@ static void usbcan_disconnect(struct usb_interface *interface) if (usbdevs->devs){ usb_put_dev((*usbdevs->devs)->udev); } - cleanup_usbdev(usbdevs->candev); + cleanup_hotplug_dev(usbdevs->candev); if (usbdevs->devs){ for (j=0;jcount;j++){ if (!usbdevs->devs[j]) continue;