diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-23 06:18:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-30 08:32:54 -0400 |
commit | 477527baf6a8d4c8652f979f0aa3546216635184 (patch) | |
tree | 338711652fbeed437fe8e41b1eeb24eb46025898 | |
parent | 70de8f3ef06e8e33826d052f9b4a92ff6678899f (diff) |
USB: host: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/host/ehci-grlib.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ehci-ppc-of.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ehci-xilinx-of.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-if.c | 10 | ||||
-rw-r--r-- | drivers/usb/host/ohci-ppc-of.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/uhci-grlib.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/uhci-platform.c | 2 | ||||
-rw-r--r-- | drivers/usb/host/xhci-plat.c | 2 |
8 files changed, 16 insertions, 26 deletions
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c index 5d75de9729b6..a77bd8dc33f4 100644 --- a/drivers/usb/host/ehci-grlib.c +++ b/drivers/usb/host/ehci-grlib.c | |||
@@ -153,9 +153,7 @@ err_irq: | |||
153 | 153 | ||
154 | static int ehci_hcd_grlib_remove(struct platform_device *op) | 154 | static int ehci_hcd_grlib_remove(struct platform_device *op) |
155 | { | 155 | { |
156 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 156 | struct usb_hcd *hcd = platform_get_drvdata(op); |
157 | |||
158 | dev_set_drvdata(&op->dev, NULL); | ||
159 | 157 | ||
160 | dev_dbg(&op->dev, "stopping GRLIB GRUSBHC EHCI USB Controller\n"); | 158 | dev_dbg(&op->dev, "stopping GRLIB GRUSBHC EHCI USB Controller\n"); |
161 | 159 | ||
@@ -171,7 +169,7 @@ static int ehci_hcd_grlib_remove(struct platform_device *op) | |||
171 | 169 | ||
172 | static void ehci_hcd_grlib_shutdown(struct platform_device *op) | 170 | static void ehci_hcd_grlib_shutdown(struct platform_device *op) |
173 | { | 171 | { |
174 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 172 | struct usb_hcd *hcd = platform_get_drvdata(op); |
175 | 173 | ||
176 | if (hcd->driver->shutdown) | 174 | if (hcd->driver->shutdown) |
177 | hcd->driver->shutdown(hcd); | 175 | hcd->driver->shutdown(hcd); |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 56dc732bf451..86da09c0f8d0 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -180,14 +180,12 @@ err_irq: | |||
180 | 180 | ||
181 | static int ehci_hcd_ppc_of_remove(struct platform_device *op) | 181 | static int ehci_hcd_ppc_of_remove(struct platform_device *op) |
182 | { | 182 | { |
183 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 183 | struct usb_hcd *hcd = platform_get_drvdata(op); |
184 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 184 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
185 | 185 | ||
186 | struct device_node *np; | 186 | struct device_node *np; |
187 | struct resource res; | 187 | struct resource res; |
188 | 188 | ||
189 | dev_set_drvdata(&op->dev, NULL); | ||
190 | |||
191 | dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n"); | 189 | dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n"); |
192 | 190 | ||
193 | usb_remove_hcd(hcd); | 191 | usb_remove_hcd(hcd); |
@@ -219,7 +217,7 @@ static int ehci_hcd_ppc_of_remove(struct platform_device *op) | |||
219 | 217 | ||
220 | static void ehci_hcd_ppc_of_shutdown(struct platform_device *op) | 218 | static void ehci_hcd_ppc_of_shutdown(struct platform_device *op) |
221 | { | 219 | { |
222 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 220 | struct usb_hcd *hcd = platform_get_drvdata(op); |
223 | 221 | ||
224 | if (hcd->driver->shutdown) | 222 | if (hcd->driver->shutdown) |
225 | hcd->driver->shutdown(hcd); | 223 | hcd->driver->shutdown(hcd); |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index d845e3bcfaff..35c7f90384a6 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
@@ -209,8 +209,7 @@ err_irq: | |||
209 | */ | 209 | */ |
210 | static int ehci_hcd_xilinx_of_remove(struct platform_device *op) | 210 | static int ehci_hcd_xilinx_of_remove(struct platform_device *op) |
211 | { | 211 | { |
212 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 212 | struct usb_hcd *hcd = platform_get_drvdata(op); |
213 | dev_set_drvdata(&op->dev, NULL); | ||
214 | 213 | ||
215 | dev_dbg(&op->dev, "stopping XILINX-OF USB Controller\n"); | 214 | dev_dbg(&op->dev, "stopping XILINX-OF USB Controller\n"); |
216 | 215 | ||
@@ -229,7 +228,7 @@ static int ehci_hcd_xilinx_of_remove(struct platform_device *op) | |||
229 | */ | 228 | */ |
230 | static void ehci_hcd_xilinx_of_shutdown(struct platform_device *op) | 229 | static void ehci_hcd_xilinx_of_shutdown(struct platform_device *op) |
231 | { | 230 | { |
232 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 231 | struct usb_hcd *hcd = platform_get_drvdata(op); |
233 | 232 | ||
234 | if (hcd->driver->shutdown) | 233 | if (hcd->driver->shutdown) |
235 | hcd->driver->shutdown(hcd); | 234 | hcd->driver->shutdown(hcd); |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index a13709ee4e5d..3df49b169b53 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -118,7 +118,7 @@ static int of_isp1760_probe(struct platform_device *dev) | |||
118 | goto free_gpio; | 118 | goto free_gpio; |
119 | } | 119 | } |
120 | 120 | ||
121 | dev_set_drvdata(&dev->dev, drvdata); | 121 | platform_set_drvdata(dev, drvdata); |
122 | return ret; | 122 | return ret; |
123 | 123 | ||
124 | free_gpio: | 124 | free_gpio: |
@@ -133,9 +133,7 @@ free_data: | |||
133 | 133 | ||
134 | static int of_isp1760_remove(struct platform_device *dev) | 134 | static int of_isp1760_remove(struct platform_device *dev) |
135 | { | 135 | { |
136 | struct isp1760 *drvdata = dev_get_drvdata(&dev->dev); | 136 | struct isp1760 *drvdata = platform_get_drvdata(dev); |
137 | |||
138 | dev_set_drvdata(&dev->dev, NULL); | ||
139 | 137 | ||
140 | usb_remove_hcd(drvdata->hcd); | 138 | usb_remove_hcd(drvdata->hcd); |
141 | iounmap(drvdata->hcd->regs); | 139 | iounmap(drvdata->hcd->regs); |
@@ -398,7 +396,7 @@ static int isp1760_plat_probe(struct platform_device *pdev) | |||
398 | irqflags, -ENOENT, | 396 | irqflags, -ENOENT, |
399 | &pdev->dev, dev_name(&pdev->dev), devflags); | 397 | &pdev->dev, dev_name(&pdev->dev), devflags); |
400 | 398 | ||
401 | dev_set_drvdata(&pdev->dev, hcd); | 399 | platform_set_drvdata(pdev, hcd); |
402 | 400 | ||
403 | if (IS_ERR(hcd)) { | 401 | if (IS_ERR(hcd)) { |
404 | pr_warning("isp1760: Failed to register the HCD device\n"); | 402 | pr_warning("isp1760: Failed to register the HCD device\n"); |
@@ -419,7 +417,7 @@ static int isp1760_plat_remove(struct platform_device *pdev) | |||
419 | { | 417 | { |
420 | struct resource *mem_res; | 418 | struct resource *mem_res; |
421 | resource_size_t mem_size; | 419 | resource_size_t mem_size; |
422 | struct usb_hcd *hcd = dev_get_drvdata(&pdev->dev); | 420 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
423 | 421 | ||
424 | usb_remove_hcd(hcd); | 422 | usb_remove_hcd(hcd); |
425 | 423 | ||
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c index 64c2ed9ff95e..8294e2fcc2f6 100644 --- a/drivers/usb/host/ohci-ppc-of.c +++ b/drivers/usb/host/ohci-ppc-of.c | |||
@@ -185,8 +185,7 @@ err_rmr: | |||
185 | 185 | ||
186 | static int ohci_hcd_ppc_of_remove(struct platform_device *op) | 186 | static int ohci_hcd_ppc_of_remove(struct platform_device *op) |
187 | { | 187 | { |
188 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 188 | struct usb_hcd *hcd = platform_get_drvdata(op); |
189 | dev_set_drvdata(&op->dev, NULL); | ||
190 | 189 | ||
191 | dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n"); | 190 | dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n"); |
192 | 191 | ||
@@ -203,7 +202,7 @@ static int ohci_hcd_ppc_of_remove(struct platform_device *op) | |||
203 | 202 | ||
204 | static void ohci_hcd_ppc_of_shutdown(struct platform_device *op) | 203 | static void ohci_hcd_ppc_of_shutdown(struct platform_device *op) |
205 | { | 204 | { |
206 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 205 | struct usb_hcd *hcd = platform_get_drvdata(op); |
207 | 206 | ||
208 | if (hcd->driver->shutdown) | 207 | if (hcd->driver->shutdown) |
209 | hcd->driver->shutdown(hcd); | 208 | hcd->driver->shutdown(hcd); |
diff --git a/drivers/usb/host/uhci-grlib.c b/drivers/usb/host/uhci-grlib.c index 511bfc46dd78..53c23ff7d685 100644 --- a/drivers/usb/host/uhci-grlib.c +++ b/drivers/usb/host/uhci-grlib.c | |||
@@ -157,9 +157,7 @@ err_rmr: | |||
157 | 157 | ||
158 | static int uhci_hcd_grlib_remove(struct platform_device *op) | 158 | static int uhci_hcd_grlib_remove(struct platform_device *op) |
159 | { | 159 | { |
160 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 160 | struct usb_hcd *hcd = platform_get_drvdata(op); |
161 | |||
162 | dev_set_drvdata(&op->dev, NULL); | ||
163 | 161 | ||
164 | dev_dbg(&op->dev, "stopping GRLIB GRUSBHC UHCI USB Controller\n"); | 162 | dev_dbg(&op->dev, "stopping GRLIB GRUSBHC UHCI USB Controller\n"); |
165 | 163 | ||
@@ -183,7 +181,7 @@ static int uhci_hcd_grlib_remove(struct platform_device *op) | |||
183 | */ | 181 | */ |
184 | static void uhci_hcd_grlib_shutdown(struct platform_device *op) | 182 | static void uhci_hcd_grlib_shutdown(struct platform_device *op) |
185 | { | 183 | { |
186 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 184 | struct usb_hcd *hcd = platform_get_drvdata(op); |
187 | 185 | ||
188 | uhci_hc_died(hcd_to_uhci(hcd)); | 186 | uhci_hc_died(hcd_to_uhci(hcd)); |
189 | } | 187 | } |
diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c index e11b70ae5f6f..d033a0ec7f0d 100644 --- a/drivers/usb/host/uhci-platform.c +++ b/drivers/usb/host/uhci-platform.c | |||
@@ -143,7 +143,7 @@ static int uhci_hcd_platform_remove(struct platform_device *pdev) | |||
143 | */ | 143 | */ |
144 | static void uhci_hcd_platform_shutdown(struct platform_device *op) | 144 | static void uhci_hcd_platform_shutdown(struct platform_device *op) |
145 | { | 145 | { |
146 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 146 | struct usb_hcd *hcd = platform_get_drvdata(op); |
147 | 147 | ||
148 | uhci_hc_died(hcd_to_uhci(hcd)); | 148 | uhci_hc_died(hcd_to_uhci(hcd)); |
149 | } | 149 | } |
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index df90fe51b4aa..a3a4aa306f33 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c | |||
@@ -130,7 +130,7 @@ static int xhci_plat_probe(struct platform_device *pdev) | |||
130 | goto unmap_registers; | 130 | goto unmap_registers; |
131 | 131 | ||
132 | /* USB 2.0 roothub is stored in the platform_device now. */ | 132 | /* USB 2.0 roothub is stored in the platform_device now. */ |
133 | hcd = dev_get_drvdata(&pdev->dev); | 133 | hcd = platform_get_drvdata(pdev); |
134 | xhci = hcd_to_xhci(hcd); | 134 | xhci = hcd_to_xhci(hcd); |
135 | xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev, | 135 | xhci->shared_hcd = usb_create_shared_hcd(driver, &pdev->dev, |
136 | dev_name(&pdev->dev), hcd); | 136 | dev_name(&pdev->dev), hcd); |