116 lines
3.2 KiB
Diff
116 lines
3.2 KiB
Diff
|
Index: linux-3.10/drivers/staging/octeon-usb/octeon-hcd.c
|
||
|
===================================================================
|
||
|
--- linux-3.10.orig/drivers/staging/octeon-usb/octeon-hcd.c 2013-08-03 16:11:44.269610286 +0200
|
||
|
+++ linux-3.10/drivers/staging/octeon-usb/octeon-hcd.c 2013-08-04 13:18:54.011421971 +0200
|
||
|
@@ -673,8 +673,9 @@
|
||
|
};
|
||
|
|
||
|
|
||
|
-static int octeon_usb_driver_probe(struct device *dev)
|
||
|
+static int octeon_usb_driver_probe(struct platform_device *pdev)
|
||
|
{
|
||
|
+ struct device *dev = &pdev->dev;
|
||
|
int status;
|
||
|
int usb_num = to_platform_device(dev)->id;
|
||
|
int irq = platform_get_irq(to_platform_device(dev), 0);
|
||
|
@@ -728,8 +729,9 @@
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-static int octeon_usb_driver_remove(struct device *dev)
|
||
|
+static int octeon_usb_driver_remove(struct platform_device *pdev)
|
||
|
{
|
||
|
+ struct device *dev = &pdev->dev;
|
||
|
int status;
|
||
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
||
|
struct octeon_hcd *priv = hcd_to_octeon(hcd);
|
||
|
@@ -748,30 +750,35 @@
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
-static struct device_driver octeon_usb_driver = {
|
||
|
- .name = "OcteonUSB",
|
||
|
- .bus = &platform_bus_type,
|
||
|
+static struct platform_driver octeon_usb_driver = {
|
||
|
+ .driver = {
|
||
|
+ .name = "OcteonUSB",
|
||
|
+ .owner = THIS_MODULE,
|
||
|
+ },
|
||
|
.probe = octeon_usb_driver_probe,
|
||
|
.remove = octeon_usb_driver_remove,
|
||
|
};
|
||
|
|
||
|
+static struct resource octeon_usb_resources = {
|
||
|
+ .start = OCTEON_IRQ_USB0,
|
||
|
+ .end = OCTEON_IRQ_USB0,
|
||
|
+ .flags = IORESOURCE_IRQ,
|
||
|
+};
|
||
|
+
|
||
|
+static struct platform_device octeon_usb_device = {
|
||
|
+ .name = "OcteonUSB",
|
||
|
+ .id = 0,
|
||
|
+ .resource = &octeon_usb_resources,
|
||
|
+ .num_resources = 1,
|
||
|
+};
|
||
|
|
||
|
-#define MAX_USB_PORTS 10
|
||
|
-static struct platform_device *pdev_glob[MAX_USB_PORTS];
|
||
|
-static int octeon_usb_registered;
|
||
|
static int __init octeon_usb_module_init(void)
|
||
|
{
|
||
|
int num_devices = cvmx_usb_get_num_ports();
|
||
|
- int device;
|
||
|
|
||
|
if (usb_disabled() || num_devices == 0)
|
||
|
return -ENODEV;
|
||
|
|
||
|
- if (driver_register(&octeon_usb_driver))
|
||
|
- return -ENOMEM;
|
||
|
-
|
||
|
- octeon_usb_registered = 1;
|
||
|
-
|
||
|
/*
|
||
|
* Only cn52XX and cn56XX have DWC_OTG USB hardware and the
|
||
|
* IOB priority registers. Under heavy network load USB
|
||
|
@@ -792,37 +799,14 @@
|
||
|
cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
|
||
|
}
|
||
|
|
||
|
- for (device = 0; device < num_devices; device++) {
|
||
|
- struct resource irq_resource;
|
||
|
- struct platform_device *pdev;
|
||
|
- memset(&irq_resource, 0, sizeof(irq_resource));
|
||
|
- irq_resource.start = (device == 0) ? OCTEON_IRQ_USB0 : OCTEON_IRQ_USB1;
|
||
|
- irq_resource.end = irq_resource.start;
|
||
|
- irq_resource.flags = IORESOURCE_IRQ;
|
||
|
- pdev = platform_device_register_simple((char *)octeon_usb_driver. name, device, &irq_resource, 1);
|
||
|
- if (IS_ERR(pdev)) {
|
||
|
- driver_unregister(&octeon_usb_driver);
|
||
|
- octeon_usb_registered = 0;
|
||
|
- return PTR_ERR(pdev);
|
||
|
- }
|
||
|
- if (device < MAX_USB_PORTS)
|
||
|
- pdev_glob[device] = pdev;
|
||
|
+ platform_device_register(&octeon_usb_device);
|
||
|
|
||
|
- }
|
||
|
- return 0;
|
||
|
+ return platform_driver_register(&octeon_usb_driver);
|
||
|
}
|
||
|
|
||
|
static void __exit octeon_usb_module_cleanup(void)
|
||
|
{
|
||
|
- int i;
|
||
|
-
|
||
|
- for (i = 0; i < MAX_USB_PORTS; i++)
|
||
|
- if (pdev_glob[i]) {
|
||
|
- platform_device_unregister(pdev_glob[i]);
|
||
|
- pdev_glob[i] = NULL;
|
||
|
- }
|
||
|
- if (octeon_usb_registered)
|
||
|
- driver_unregister(&octeon_usb_driver);
|
||
|
+ platform_driver_unregister(&octeon_usb_driver);
|
||
|
}
|
||
|
|
||
|
MODULE_LICENSE("GPL");
|