diff options
Diffstat (limited to 'drivers/usb/host/ohci-platform.c')
-rw-r--r-- | drivers/usb/host/ohci-platform.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index e24ec9f79164..084503b03fcf 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c | |||
@@ -31,6 +31,10 @@ static int ohci_platform_reset(struct usb_hcd *hcd) | |||
31 | ohci->flags |= OHCI_QUIRK_FRAME_NO; | 31 | ohci->flags |= OHCI_QUIRK_FRAME_NO; |
32 | 32 | ||
33 | ohci_hcd_init(ohci); | 33 | ohci_hcd_init(ohci); |
34 | |||
35 | if (pdata->num_ports) | ||
36 | ohci->num_ports = pdata->num_ports; | ||
37 | |||
34 | err = ohci_init(ohci); | 38 | err = ohci_init(ohci); |
35 | 39 | ||
36 | return err; | 40 | return err; |
@@ -79,7 +83,7 @@ static const struct hc_driver ohci_platform_hc_driver = { | |||
79 | .start_port_reset = ohci_start_port_reset, | 83 | .start_port_reset = ohci_start_port_reset, |
80 | }; | 84 | }; |
81 | 85 | ||
82 | static int __devinit ohci_platform_probe(struct platform_device *dev) | 86 | static int ohci_platform_probe(struct platform_device *dev) |
83 | { | 87 | { |
84 | struct usb_hcd *hcd; | 88 | struct usb_hcd *hcd; |
85 | struct resource *res_mem; | 89 | struct resource *res_mem; |
@@ -97,13 +101,13 @@ static int __devinit ohci_platform_probe(struct platform_device *dev) | |||
97 | 101 | ||
98 | irq = platform_get_irq(dev, 0); | 102 | irq = platform_get_irq(dev, 0); |
99 | if (irq < 0) { | 103 | if (irq < 0) { |
100 | pr_err("no irq provided"); | 104 | dev_err(&dev->dev, "no irq provided"); |
101 | return irq; | 105 | return irq; |
102 | } | 106 | } |
103 | 107 | ||
104 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); | 108 | res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0); |
105 | if (!res_mem) { | 109 | if (!res_mem) { |
106 | pr_err("no memory recourse provided"); | 110 | dev_err(&dev->dev, "no memory resource provided"); |
107 | return -ENXIO; | 111 | return -ENXIO; |
108 | } | 112 | } |
109 | 113 | ||
@@ -123,29 +127,19 @@ static int __devinit ohci_platform_probe(struct platform_device *dev) | |||
123 | hcd->rsrc_start = res_mem->start; | 127 | hcd->rsrc_start = res_mem->start; |
124 | hcd->rsrc_len = resource_size(res_mem); | 128 | hcd->rsrc_len = resource_size(res_mem); |
125 | 129 | ||
126 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 130 | hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem); |
127 | pr_err("controller already in use"); | ||
128 | err = -EBUSY; | ||
129 | goto err_put_hcd; | ||
130 | } | ||
131 | |||
132 | hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len); | ||
133 | if (!hcd->regs) { | 131 | if (!hcd->regs) { |
134 | err = -ENOMEM; | 132 | err = -ENOMEM; |
135 | goto err_release_region; | 133 | goto err_put_hcd; |
136 | } | 134 | } |
137 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); | 135 | err = usb_add_hcd(hcd, irq, IRQF_SHARED); |
138 | if (err) | 136 | if (err) |
139 | goto err_iounmap; | 137 | goto err_put_hcd; |
140 | 138 | ||
141 | platform_set_drvdata(dev, hcd); | 139 | platform_set_drvdata(dev, hcd); |
142 | 140 | ||
143 | return err; | 141 | return err; |
144 | 142 | ||
145 | err_iounmap: | ||
146 | iounmap(hcd->regs); | ||
147 | err_release_region: | ||
148 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
149 | err_put_hcd: | 143 | err_put_hcd: |
150 | usb_put_hcd(hcd); | 144 | usb_put_hcd(hcd); |
151 | err_power: | 145 | err_power: |
@@ -155,14 +149,12 @@ err_power: | |||
155 | return err; | 149 | return err; |
156 | } | 150 | } |
157 | 151 | ||
158 | static int __devexit ohci_platform_remove(struct platform_device *dev) | 152 | static int ohci_platform_remove(struct platform_device *dev) |
159 | { | 153 | { |
160 | struct usb_hcd *hcd = platform_get_drvdata(dev); | 154 | struct usb_hcd *hcd = platform_get_drvdata(dev); |
161 | struct usb_ohci_pdata *pdata = dev->dev.platform_data; | 155 | struct usb_ohci_pdata *pdata = dev->dev.platform_data; |
162 | 156 | ||
163 | usb_remove_hcd(hcd); | 157 | usb_remove_hcd(hcd); |
164 | iounmap(hcd->regs); | ||
165 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
166 | usb_put_hcd(hcd); | 158 | usb_put_hcd(hcd); |
167 | platform_set_drvdata(dev, NULL); | 159 | platform_set_drvdata(dev, NULL); |
168 | 160 | ||
@@ -199,7 +191,7 @@ static int ohci_platform_resume(struct device *dev) | |||
199 | return err; | 191 | return err; |
200 | } | 192 | } |
201 | 193 | ||
202 | ohci_finish_controller_resume(hcd); | 194 | ohci_resume(hcd, false); |
203 | return 0; | 195 | return 0; |
204 | } | 196 | } |
205 | 197 | ||
@@ -222,7 +214,7 @@ static const struct dev_pm_ops ohci_platform_pm_ops = { | |||
222 | static struct platform_driver ohci_platform_driver = { | 214 | static struct platform_driver ohci_platform_driver = { |
223 | .id_table = ohci_platform_table, | 215 | .id_table = ohci_platform_table, |
224 | .probe = ohci_platform_probe, | 216 | .probe = ohci_platform_probe, |
225 | .remove = __devexit_p(ohci_platform_remove), | 217 | .remove = ohci_platform_remove, |
226 | .shutdown = usb_hcd_platform_shutdown, | 218 | .shutdown = usb_hcd_platform_shutdown, |
227 | .driver = { | 219 | .driver = { |
228 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |