aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hcd-pci.c2
-rw-r--r--drivers/usb/core/hcd.h2
-rw-r--r--drivers/usb/core/usb.c25
-rw-r--r--drivers/usb/host/ehci-au1xxx.c2
-rw-r--r--drivers/usb/host/ohci-au1xxx.c2
-rw-r--r--drivers/usb/host/ohci-pxa27x.c2
-rw-r--r--drivers/usb/host/r8a66597-hcd.c2
-rw-r--r--drivers/usb/musb/musb_core.c2
-rw-r--r--drivers/usb/otg/twl4030-usb.c38
9 files changed, 43 insertions, 34 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 91f2885b6ee1..2dcf906df569 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -363,7 +363,7 @@ static int hcd_pci_restore(struct device *dev)
363 return resume_common(dev, true); 363 return resume_common(dev, true);
364} 364}
365 365
366struct dev_pm_ops usb_hcd_pci_pm_ops = { 366const struct dev_pm_ops usb_hcd_pci_pm_ops = {
367 .suspend = hcd_pci_suspend, 367 .suspend = hcd_pci_suspend,
368 .suspend_noirq = hcd_pci_suspend_noirq, 368 .suspend_noirq = hcd_pci_suspend_noirq,
369 .resume_noirq = hcd_pci_resume_noirq, 369 .resume_noirq = hcd_pci_resume_noirq,
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
index d8b43aee581e..bbe2b924aae8 100644
--- a/drivers/usb/core/hcd.h
+++ b/drivers/usb/core/hcd.h
@@ -330,7 +330,7 @@ extern void usb_hcd_pci_remove(struct pci_dev *dev);
330extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 330extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
331 331
332#ifdef CONFIG_PM_SLEEP 332#ifdef CONFIG_PM_SLEEP
333extern struct dev_pm_ops usb_hcd_pci_pm_ops; 333extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
334#endif 334#endif
335#endif /* CONFIG_PCI */ 335#endif /* CONFIG_PCI */
336 336
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 4e2c6df8d3cc..2fb42043b305 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -167,18 +167,23 @@ struct usb_host_interface *usb_altnum_to_altsetting(
167} 167}
168EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting); 168EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting);
169 169
170struct find_interface_arg {
171 int minor;
172 struct device_driver *drv;
173};
174
170static int __find_interface(struct device *dev, void *data) 175static int __find_interface(struct device *dev, void *data)
171{ 176{
172 int *minor = data; 177 struct find_interface_arg *arg = data;
173 struct usb_interface *intf; 178 struct usb_interface *intf;
174 179
175 if (!is_usb_interface(dev)) 180 if (!is_usb_interface(dev))
176 return 0; 181 return 0;
177 182
183 if (dev->driver != arg->drv)
184 return 0;
178 intf = to_usb_interface(dev); 185 intf = to_usb_interface(dev);
179 if (intf->minor != -1 && intf->minor == *minor) 186 return intf->minor == arg->minor;
180 return 1;
181 return 0;
182} 187}
183 188
184/** 189/**
@@ -187,14 +192,18 @@ static int __find_interface(struct device *dev, void *data)
187 * @minor: the minor number of the desired device 192 * @minor: the minor number of the desired device
188 * 193 *
189 * This walks the bus device list and returns a pointer to the interface 194 * This walks the bus device list and returns a pointer to the interface
190 * with the matching minor. Note, this only works for devices that share the 195 * with the matching minor and driver. Note, this only works for devices
191 * USB major number. 196 * that share the USB major number.
192 */ 197 */
193struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) 198struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
194{ 199{
200 struct find_interface_arg argb;
195 struct device *dev; 201 struct device *dev;
196 202
197 dev = bus_find_device(&usb_bus_type, NULL, &minor, __find_interface); 203 argb.minor = minor;
204 argb.drv = &drv->drvwrap.driver;
205
206 dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);
198 207
199 /* Drop reference count from bus_find_device */ 208 /* Drop reference count from bus_find_device */
200 put_device(dev); 209 put_device(dev);
@@ -320,7 +329,7 @@ static int usb_dev_restore(struct device *dev)
320 return usb_resume(dev, PMSG_RESTORE); 329 return usb_resume(dev, PMSG_RESTORE);
321} 330}
322 331
323static struct dev_pm_ops usb_device_pm_ops = { 332static const struct dev_pm_ops usb_device_pm_ops = {
324 .prepare = usb_dev_prepare, 333 .prepare = usb_dev_prepare,
325 .complete = usb_dev_complete, 334 .complete = usb_dev_complete,
326 .suspend = usb_dev_suspend, 335 .suspend = usb_dev_suspend,
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index ed77be76d6bb..dbfb482a94e3 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -297,7 +297,7 @@ static int ehci_hcd_au1xxx_drv_resume(struct device *dev)
297 return 0; 297 return 0;
298} 298}
299 299
300static struct dev_pm_ops au1xxx_ehci_pmops = { 300static const struct dev_pm_ops au1xxx_ehci_pmops = {
301 .suspend = ehci_hcd_au1xxx_drv_suspend, 301 .suspend = ehci_hcd_au1xxx_drv_suspend,
302 .resume = ehci_hcd_au1xxx_drv_resume, 302 .resume = ehci_hcd_au1xxx_drv_resume,
303}; 303};
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index e4380082ebb1..17a6043c1fa0 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -294,7 +294,7 @@ static int ohci_hcd_au1xxx_drv_resume(struct device *dev)
294 return 0; 294 return 0;
295} 295}
296 296
297static struct dev_pm_ops au1xxx_ohci_pmops = { 297static const struct dev_pm_ops au1xxx_ohci_pmops = {
298 .suspend = ohci_hcd_au1xxx_drv_suspend, 298 .suspend = ohci_hcd_au1xxx_drv_suspend,
299 .resume = ohci_hcd_au1xxx_drv_resume, 299 .resume = ohci_hcd_au1xxx_drv_resume,
300}; 300};
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index f1c06202fdf2..a18debdd79b8 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -518,7 +518,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
518 return 0; 518 return 0;
519} 519}
520 520
521static struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = { 521static const struct dev_pm_ops ohci_hcd_pxa27x_pm_ops = {
522 .suspend = ohci_hcd_pxa27x_drv_suspend, 522 .suspend = ohci_hcd_pxa27x_drv_suspend,
523 .resume = ohci_hcd_pxa27x_drv_resume, 523 .resume = ohci_hcd_pxa27x_drv_resume,
524}; 524};
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 41dbc70ae752..b7a661c02bcd 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -2353,7 +2353,7 @@ static int r8a66597_resume(struct device *dev)
2353 return 0; 2353 return 0;
2354} 2354}
2355 2355
2356static struct dev_pm_ops r8a66597_dev_pm_ops = { 2356static const struct dev_pm_ops r8a66597_dev_pm_ops = {
2357 .suspend = r8a66597_suspend, 2357 .suspend = r8a66597_suspend,
2358 .resume = r8a66597_resume, 2358 .resume = r8a66597_resume,
2359 .poweroff = r8a66597_suspend, 2359 .poweroff = r8a66597_suspend,
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 49f2346afad3..bfe08f4975a3 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2214,7 +2214,7 @@ static int musb_resume_noirq(struct device *dev)
2214 return 0; 2214 return 0;
2215} 2215}
2216 2216
2217static struct dev_pm_ops musb_dev_pm_ops = { 2217static const struct dev_pm_ops musb_dev_pm_ops = {
2218 .suspend = musb_suspend, 2218 .suspend = musb_suspend,
2219 .resume_noirq = musb_resume_noirq, 2219 .resume_noirq = musb_resume_noirq,
2220}; 2220};
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index bd9883f41e63..2be9f2fa41f9 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -33,7 +33,7 @@
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/usb/otg.h> 35#include <linux/usb/otg.h>
36#include <linux/i2c/twl4030.h> 36#include <linux/i2c/twl.h>
37#include <linux/regulator/consumer.h> 37#include <linux/regulator/consumer.h>
38#include <linux/err.h> 38#include <linux/err.h>
39 39
@@ -276,16 +276,16 @@ static int twl4030_i2c_write_u8_verify(struct twl4030_usb *twl,
276{ 276{
277 u8 check; 277 u8 check;
278 278
279 if ((twl4030_i2c_write_u8(module, data, address) >= 0) && 279 if ((twl_i2c_write_u8(module, data, address) >= 0) &&
280 (twl4030_i2c_read_u8(module, &check, address) >= 0) && 280 (twl_i2c_read_u8(module, &check, address) >= 0) &&
281 (check == data)) 281 (check == data))
282 return 0; 282 return 0;
283 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n", 283 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
284 1, module, address, check, data); 284 1, module, address, check, data);
285 285
286 /* Failed once: Try again */ 286 /* Failed once: Try again */
287 if ((twl4030_i2c_write_u8(module, data, address) >= 0) && 287 if ((twl_i2c_write_u8(module, data, address) >= 0) &&
288 (twl4030_i2c_read_u8(module, &check, address) >= 0) && 288 (twl_i2c_read_u8(module, &check, address) >= 0) &&
289 (check == data)) 289 (check == data))
290 return 0; 290 return 0;
291 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n", 291 dev_dbg(twl->dev, "Write%d[%d,0x%x] wrote %02x but read %02x\n",
@@ -303,7 +303,7 @@ static inline int twl4030_usb_write(struct twl4030_usb *twl,
303{ 303{
304 int ret = 0; 304 int ret = 0;
305 305
306 ret = twl4030_i2c_write_u8(TWL4030_MODULE_USB, data, address); 306 ret = twl_i2c_write_u8(TWL4030_MODULE_USB, data, address);
307 if (ret < 0) 307 if (ret < 0)
308 dev_dbg(twl->dev, 308 dev_dbg(twl->dev,
309 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret); 309 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
@@ -315,7 +315,7 @@ static inline int twl4030_readb(struct twl4030_usb *twl, u8 module, u8 address)
315 u8 data; 315 u8 data;
316 int ret = 0; 316 int ret = 0;
317 317
318 ret = twl4030_i2c_read_u8(module, &data, address); 318 ret = twl_i2c_read_u8(module, &data, address);
319 if (ret >= 0) 319 if (ret >= 0)
320 ret = data; 320 ret = data;
321 else 321 else
@@ -462,7 +462,7 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on)
462 * SLEEP. We work around this by clearing the bit after usv3v1 462 * SLEEP. We work around this by clearing the bit after usv3v1
463 * is re-activated. This ensures that VUSB3V1 is really active. 463 * is re-activated. This ensures that VUSB3V1 is really active.
464 */ 464 */
465 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, 465 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0,
466 VUSB_DEDICATED2); 466 VUSB_DEDICATED2);
467 regulator_enable(twl->usb1v5); 467 regulator_enable(twl->usb1v5);
468 pwr &= ~PHY_PWR_PHYPWD; 468 pwr &= ~PHY_PWR_PHYPWD;
@@ -505,44 +505,44 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
505static int twl4030_usb_ldo_init(struct twl4030_usb *twl) 505static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
506{ 506{
507 /* Enable writing to power configuration registers */ 507 /* Enable writing to power configuration registers */
508 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY); 508 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
509 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY); 509 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
510 510
511 /* put VUSB3V1 LDO in active state */ 511 /* put VUSB3V1 LDO in active state */
512 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2); 512 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
513 513
514 /* input to VUSB3V1 LDO is from VBAT, not VBUS */ 514 /* input to VUSB3V1 LDO is from VBAT, not VBUS */
515 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1); 515 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
516 516
517 /* Initialize 3.1V regulator */ 517 /* Initialize 3.1V regulator */
518 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP); 518 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);
519 519
520 twl->usb3v1 = regulator_get(twl->dev, "usb3v1"); 520 twl->usb3v1 = regulator_get(twl->dev, "usb3v1");
521 if (IS_ERR(twl->usb3v1)) 521 if (IS_ERR(twl->usb3v1))
522 return -ENODEV; 522 return -ENODEV;
523 523
524 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE); 524 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
525 525
526 /* Initialize 1.5V regulator */ 526 /* Initialize 1.5V regulator */
527 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP); 527 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);
528 528
529 twl->usb1v5 = regulator_get(twl->dev, "usb1v5"); 529 twl->usb1v5 = regulator_get(twl->dev, "usb1v5");
530 if (IS_ERR(twl->usb1v5)) 530 if (IS_ERR(twl->usb1v5))
531 goto fail1; 531 goto fail1;
532 532
533 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE); 533 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
534 534
535 /* Initialize 1.8V regulator */ 535 /* Initialize 1.8V regulator */
536 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP); 536 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP);
537 537
538 twl->usb1v8 = regulator_get(twl->dev, "usb1v8"); 538 twl->usb1v8 = regulator_get(twl->dev, "usb1v8");
539 if (IS_ERR(twl->usb1v8)) 539 if (IS_ERR(twl->usb1v8))
540 goto fail2; 540 goto fail2;
541 541
542 twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE); 542 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
543 543
544 /* disable access to power configuration registers */ 544 /* disable access to power configuration registers */
545 twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY); 545 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY);
546 546
547 return 0; 547 return 0;
548 548