diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/usb/usbip/usbip_common.h | 6 | ||||
-rw-r--r-- | drivers/usb/usbip/vhci_hcd.c | 44 |
2 files changed, 15 insertions, 35 deletions
diff --git a/drivers/usb/usbip/usbip_common.h b/drivers/usb/usbip/usbip_common.h index d8cbd2dfc2..282efca64a 100644 --- a/drivers/usb/usbip/usbip_common.h +++ b/drivers/usb/usbip/usbip_common.h @@ -298,12 +298,6 @@ struct usbip_device { __k; \ }) -#define kthread_stop_put(k) \ - do { \ - kthread_stop(k); \ - put_task_struct(k); \ - } while (0) - /* usbip_common.c */ void usbip_dump_urb(struct urb *purb); void usbip_dump_header(struct usbip_header *pdu); diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 37d1fc34e8..82650c11e4 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -1140,6 +1140,7 @@ static int hcd_name_to_id(const char *name) static int vhci_setup(struct usb_hcd *hcd) { struct vhci *vhci = *((void **)dev_get_platdata(hcd->self.controller)); + if (usb_hcd_is_primary_hcd(hcd)) { vhci->vhci_hcd_hs = hcd_to_vhci_hcd(hcd); vhci->vhci_hcd_hs->vhci = vhci; @@ -1493,13 +1494,10 @@ static struct platform_driver vhci_driver = { static void del_platform_devices(void) { - struct platform_device *pdev; int i; for (i = 0; i < vhci_num_controllers; i++) { - pdev = vhcis[i].pdev; - if (pdev != NULL) - platform_device_unregister(pdev); + platform_device_unregister(vhcis[i].pdev); vhcis[i].pdev = NULL; } sysfs_remove_link(&platform_bus.kobj, driver_name); @@ -1519,45 +1517,33 @@ static int __init vhci_hcd_init(void) if (vhcis == NULL) return -ENOMEM; - for (i = 0; i < vhci_num_controllers; i++) { - vhcis[i].pdev = platform_device_alloc(driver_name, i); - if (!vhcis[i].pdev) { - i--; - while (i >= 0) - platform_device_put(vhcis[i--].pdev); - ret = -ENOMEM; - goto err_device_alloc; - } - } - for (i = 0; i < vhci_num_controllers; i++) { - void *vhci = &vhcis[i]; - ret = platform_device_add_data(vhcis[i].pdev, &vhci, sizeof(void *)); - if (ret) - goto err_driver_register; - } - ret = platform_driver_register(&vhci_driver); if (ret) goto err_driver_register; for (i = 0; i < vhci_num_controllers; i++) { - ret = platform_device_add(vhcis[i].pdev); + void *vhci = &vhcis[i]; + struct platform_device_info pdevinfo = { + .name = driver_name, + .id = i, + .data = &vhci, + .size_data = sizeof(void *), + }; + + vhcis[i].pdev = platform_device_register_full(&pdevinfo); + ret = PTR_ERR_OR_ZERO(vhcis[i].pdev); if (ret < 0) { - i--; - while (i >= 0) - platform_device_del(vhcis[i--].pdev); + while (i--) + platform_device_unregister(vhcis[i].pdev); goto err_add_hcd; } } - return ret; + return 0; err_add_hcd: platform_driver_unregister(&vhci_driver); err_driver_register: - for (i = 0; i < vhci_num_controllers; i++) - platform_device_put(vhcis[i].pdev); -err_device_alloc: kfree(vhcis); return ret; } |