diff options
Diffstat (limited to 'drivers/usb/dwc3/dwc3-pci.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-pci.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 94f550e37f98..7d70f44567d2 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -58,7 +58,7 @@ struct dwc3_pci { | |||
58 | struct platform_device *usb3_phy; | 58 | struct platform_device *usb3_phy; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | static int __devinit dwc3_pci_register_phys(struct dwc3_pci *glue) | 61 | static int dwc3_pci_register_phys(struct dwc3_pci *glue) |
62 | { | 62 | { |
63 | struct nop_usb_xceiv_platform_data pdata; | 63 | struct nop_usb_xceiv_platform_data pdata; |
64 | struct platform_device *pdev; | 64 | struct platform_device *pdev; |
@@ -112,14 +112,13 @@ err1: | |||
112 | return ret; | 112 | return ret; |
113 | } | 113 | } |
114 | 114 | ||
115 | static int __devinit dwc3_pci_probe(struct pci_dev *pci, | 115 | static int dwc3_pci_probe(struct pci_dev *pci, |
116 | const struct pci_device_id *id) | 116 | const struct pci_device_id *id) |
117 | { | 117 | { |
118 | struct resource res[2]; | 118 | struct resource res[2]; |
119 | struct platform_device *dwc3; | 119 | struct platform_device *dwc3; |
120 | struct dwc3_pci *glue; | 120 | struct dwc3_pci *glue; |
121 | int ret = -ENOMEM; | 121 | int ret = -ENOMEM; |
122 | int devid; | ||
123 | struct device *dev = &pci->dev; | 122 | struct device *dev = &pci->dev; |
124 | 123 | ||
125 | glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); | 124 | glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL); |
@@ -145,13 +144,7 @@ static int __devinit dwc3_pci_probe(struct pci_dev *pci, | |||
145 | return ret; | 144 | return ret; |
146 | } | 145 | } |
147 | 146 | ||
148 | devid = dwc3_get_device_id(); | 147 | dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO); |
149 | if (devid < 0) { | ||
150 | ret = -ENOMEM; | ||
151 | goto err1; | ||
152 | } | ||
153 | |||
154 | dwc3 = platform_device_alloc("dwc3", devid); | ||
155 | if (!dwc3) { | 148 | if (!dwc3) { |
156 | dev_err(dev, "couldn't allocate dwc3 device\n"); | 149 | dev_err(dev, "couldn't allocate dwc3 device\n"); |
157 | ret = -ENOMEM; | 150 | ret = -ENOMEM; |
@@ -172,7 +165,7 @@ static int __devinit dwc3_pci_probe(struct pci_dev *pci, | |||
172 | ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res)); | 165 | ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res)); |
173 | if (ret) { | 166 | if (ret) { |
174 | dev_err(dev, "couldn't add resources to dwc3 device\n"); | 167 | dev_err(dev, "couldn't add resources to dwc3 device\n"); |
175 | goto err2; | 168 | goto err1; |
176 | } | 169 | } |
177 | 170 | ||
178 | pci_set_drvdata(pci, glue); | 171 | pci_set_drvdata(pci, glue); |
@@ -195,23 +188,18 @@ static int __devinit dwc3_pci_probe(struct pci_dev *pci, | |||
195 | err3: | 188 | err3: |
196 | pci_set_drvdata(pci, NULL); | 189 | pci_set_drvdata(pci, NULL); |
197 | platform_device_put(dwc3); | 190 | platform_device_put(dwc3); |
198 | |||
199 | err2: | ||
200 | dwc3_put_device_id(devid); | ||
201 | |||
202 | err1: | 191 | err1: |
203 | pci_disable_device(pci); | 192 | pci_disable_device(pci); |
204 | 193 | ||
205 | return ret; | 194 | return ret; |
206 | } | 195 | } |
207 | 196 | ||
208 | static void __devexit dwc3_pci_remove(struct pci_dev *pci) | 197 | static void dwc3_pci_remove(struct pci_dev *pci) |
209 | { | 198 | { |
210 | struct dwc3_pci *glue = pci_get_drvdata(pci); | 199 | struct dwc3_pci *glue = pci_get_drvdata(pci); |
211 | 200 | ||
212 | platform_device_unregister(glue->usb2_phy); | 201 | platform_device_unregister(glue->usb2_phy); |
213 | platform_device_unregister(glue->usb3_phy); | 202 | platform_device_unregister(glue->usb3_phy); |
214 | dwc3_put_device_id(glue->dwc3->id); | ||
215 | platform_device_unregister(glue->dwc3); | 203 | platform_device_unregister(glue->dwc3); |
216 | pci_set_drvdata(pci, NULL); | 204 | pci_set_drvdata(pci, NULL); |
217 | pci_disable_device(pci); | 205 | pci_disable_device(pci); |
@@ -230,7 +218,7 @@ static struct pci_driver dwc3_pci_driver = { | |||
230 | .name = "dwc3-pci", | 218 | .name = "dwc3-pci", |
231 | .id_table = dwc3_pci_id_table, | 219 | .id_table = dwc3_pci_id_table, |
232 | .probe = dwc3_pci_probe, | 220 | .probe = dwc3_pci_probe, |
233 | .remove = __devexit_p(dwc3_pci_remove), | 221 | .remove = dwc3_pci_remove, |
234 | }; | 222 | }; |
235 | 223 | ||
236 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); | 224 | MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>"); |