aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichal Nazarewicz <mina86@mina86.com>2011-11-19 12:27:37 -0500
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:45:11 -0500
commitd327ab5b6d660d6fe22b073b743fde1668e593bb (patch)
treef32166a8a1bf562f6e235a2ce1b6ec0a6fead6ae /drivers
parent7aac8d1537b1fd1a9e39bd16edcd6728c19f8dd5 (diff)
usb: gadget: replace usb_gadget::is_dualspeed with max_speed
This commit replaces usb_gadget's is_dualspeed field with a max_speed field. [ balbi@ti.com : Fixed DWC3 driver ] Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/gadget.c2
-rw-r--r--drivers/usb/gadget/amd5536udc.c2
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/ci13xxx_udc.c7
-rw-r--r--drivers/usb/gadget/dummy_hcd.c2
-rw-r--r--drivers/usb/gadget/epautoconf.c6
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c2
-rw-r--r--drivers/usb/gadget/fusb300_udc.c2
-rw-r--r--drivers/usb/gadget/goku_udc.c1
-rw-r--r--drivers/usb/gadget/langwell_udc.c2
-rw-r--r--drivers/usb/gadget/m66592-udc.c2
-rw-r--r--drivers/usb/gadget/mv_udc_core.c2
-rw-r--r--drivers/usb/gadget/net2272.c2
-rw-r--r--drivers/usb/gadget/net2280.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c1
-rw-r--r--drivers/usb/gadget/pch_udc.c2
-rw-r--r--drivers/usb/gadget/printer.c4
-rw-r--r--drivers/usb/gadget/r8a66597-udc.c2
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c2
-rw-r--r--drivers/usb/gadget/s3c-hsudc.c2
-rw-r--r--drivers/usb/gadget/udc-core.c26
-rw-r--r--drivers/usb/musb/musb_gadget.c2
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c2
23 files changed, 49 insertions, 30 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 25dbd8614e72..580272042a33 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1986,7 +1986,7 @@ int __devinit dwc3_gadget_init(struct dwc3 *dwc)
1986 dev_set_name(&dwc->gadget.dev, "gadget"); 1986 dev_set_name(&dwc->gadget.dev, "gadget");
1987 1987
1988 dwc->gadget.ops = &dwc3_gadget_ops; 1988 dwc->gadget.ops = &dwc3_gadget_ops;
1989 dwc->gadget.is_dualspeed = true; 1989 dwc->gadget.max_speed = USB_SPEED_SUPER;
1990 dwc->gadget.speed = USB_SPEED_UNKNOWN; 1990 dwc->gadget.speed = USB_SPEED_UNKNOWN;
1991 dwc->gadget.dev.parent = dwc->dev; 1991 dwc->gadget.dev.parent = dwc->dev;
1992 1992
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c
index 45f422ac103f..e69cdbca8017 100644
--- a/drivers/usb/gadget/amd5536udc.c
+++ b/drivers/usb/gadget/amd5536udc.c
@@ -3349,7 +3349,7 @@ static int udc_probe(struct udc *dev)
3349 dev_set_name(&dev->gadget.dev, "gadget"); 3349 dev_set_name(&dev->gadget.dev, "gadget");
3350 dev->gadget.dev.release = gadget_release; 3350 dev->gadget.dev.release = gadget_release;
3351 dev->gadget.name = name; 3351 dev->gadget.name = name;
3352 dev->gadget.is_dualspeed = 1; 3352 dev->gadget.max_speed = USB_SPEED_HIGH;
3353 3353
3354 /* init registers, interrupts, ... */ 3354 /* init registers, interrupts, ... */
3355 startup_registers(dev); 3355 startup_registers(dev);
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 271a9d873608..e2fb6d583bd9 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1038,7 +1038,7 @@ static struct usba_udc the_udc = {
1038 .gadget = { 1038 .gadget = {
1039 .ops = &usba_udc_ops, 1039 .ops = &usba_udc_ops,
1040 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list), 1040 .ep_list = LIST_HEAD_INIT(the_udc.gadget.ep_list),
1041 .is_dualspeed = 1, 1041 .max_speed = USB_SPEED_HIGH,
1042 .name = "atmel_usba_udc", 1042 .name = "atmel_usba_udc",
1043 .dev = { 1043 .dev = {
1044 .init_name = "gadget", 1044 .init_name = "gadget",
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 8956a2448b33..9767d9170fbd 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -766,8 +766,11 @@ static ssize_t show_device(struct device *dev, struct device_attribute *attr,
766 766
767 n += scnprintf(buf + n, PAGE_SIZE - n, "speed = %d\n", 767 n += scnprintf(buf + n, PAGE_SIZE - n, "speed = %d\n",
768 gadget->speed); 768 gadget->speed);
769 n += scnprintf(buf + n, PAGE_SIZE - n, "max_speed = %d\n",
770 gadget->max_speed);
771 /* TODO: Scheduled for removal in 3.8. */
769 n += scnprintf(buf + n, PAGE_SIZE - n, "is_dualspeed = %d\n", 772 n += scnprintf(buf + n, PAGE_SIZE - n, "is_dualspeed = %d\n",
770 gadget->is_dualspeed); 773 gadget_is_dualspeed(gadget));
771 n += scnprintf(buf + n, PAGE_SIZE - n, "is_otg = %d\n", 774 n += scnprintf(buf + n, PAGE_SIZE - n, "is_otg = %d\n",
772 gadget->is_otg); 775 gadget->is_otg);
773 n += scnprintf(buf + n, PAGE_SIZE - n, "is_a_peripheral = %d\n", 776 n += scnprintf(buf + n, PAGE_SIZE - n, "is_a_peripheral = %d\n",
@@ -2880,7 +2883,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev,
2880 2883
2881 udc->gadget.ops = &usb_gadget_ops; 2884 udc->gadget.ops = &usb_gadget_ops;
2882 udc->gadget.speed = USB_SPEED_UNKNOWN; 2885 udc->gadget.speed = USB_SPEED_UNKNOWN;
2883 udc->gadget.is_dualspeed = 1; 2886 udc->gadget.max_speed = USB_SPEED_HIGH;
2884 udc->gadget.is_otg = 0; 2887 udc->gadget.is_otg = 0;
2885 udc->gadget.name = driver->name; 2888 udc->gadget.name = driver->name;
2886 2889
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index ab8f1b488d54..cf235d84d8b7 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -977,7 +977,7 @@ static int dummy_udc_probe (struct platform_device *pdev)
977 977
978 dum->gadget.name = gadget_name; 978 dum->gadget.name = gadget_name;
979 dum->gadget.ops = &dummy_ops; 979 dum->gadget.ops = &dummy_ops;
980 dum->gadget.is_dualspeed = 1; 980 dum->gadget.max_speed = USB_SPEED_SUPER;
981 981
982 dev_set_name(&dum->gadget.dev, "gadget"); 982 dev_set_name(&dum->gadget.dev, "gadget");
983 dum->gadget.dev.parent = &pdev->dev; 983 dum->gadget.dev.parent = &pdev->dev;
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index 596a0b464e61..38bcbfb91f62 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -152,7 +152,7 @@ ep_matches (
152 switch (type) { 152 switch (type) {
153 case USB_ENDPOINT_XFER_INT: 153 case USB_ENDPOINT_XFER_INT:
154 /* INT: limit 64 bytes full speed, 1024 high/super speed */ 154 /* INT: limit 64 bytes full speed, 1024 high/super speed */
155 if (!gadget->is_dualspeed && max > 64) 155 if (!gadget_is_dualspeed(gadget) && max > 64)
156 return 0; 156 return 0;
157 /* FALLTHROUGH */ 157 /* FALLTHROUGH */
158 158
@@ -160,12 +160,12 @@ ep_matches (
160 /* ISO: limit 1023 bytes full speed, 1024 high/super speed */ 160 /* ISO: limit 1023 bytes full speed, 1024 high/super speed */
161 if (ep->maxpacket < max) 161 if (ep->maxpacket < max)
162 return 0; 162 return 0;
163 if (!gadget->is_dualspeed && max > 1023) 163 if (!gadget_is_dualspeed(gadget) && max > 1023)
164 return 0; 164 return 0;
165 165
166 /* BOTH: "high bandwidth" works only at high speed */ 166 /* BOTH: "high bandwidth" works only at high speed */
167 if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) { 167 if ((desc->wMaxPacketSize & cpu_to_le16(3<<11))) {
168 if (!gadget->is_dualspeed) 168 if (!gadget_is_dualspeed(gadget))
169 return 0; 169 return 0;
170 /* configure your hardware with enough buffering!! */ 170 /* configure your hardware with enough buffering!! */
171 } 171 }
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index dd28ef3def71..6de8ec753818 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2525,7 +2525,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2525 2525
2526 /* Setup gadget structure */ 2526 /* Setup gadget structure */
2527 udc_controller->gadget.ops = &fsl_gadget_ops; 2527 udc_controller->gadget.ops = &fsl_gadget_ops;
2528 udc_controller->gadget.is_dualspeed = 1; 2528 udc_controller->gadget.max_speed = USB_SPEED_HIGH;
2529 udc_controller->gadget.ep0 = &udc_controller->eps[0].ep; 2529 udc_controller->gadget.ep0 = &udc_controller->eps[0].ep;
2530 INIT_LIST_HEAD(&udc_controller->gadget.ep_list); 2530 INIT_LIST_HEAD(&udc_controller->gadget.ep_list);
2531 udc_controller->gadget.speed = USB_SPEED_UNKNOWN; 2531 udc_controller->gadget.speed = USB_SPEED_UNKNOWN;
diff --git a/drivers/usb/gadget/fusb300_udc.c b/drivers/usb/gadget/fusb300_udc.c
index 74da206c8406..6e32a60ab3b7 100644
--- a/drivers/usb/gadget/fusb300_udc.c
+++ b/drivers/usb/gadget/fusb300_udc.c
@@ -1463,7 +1463,7 @@ static int __init fusb300_probe(struct platform_device *pdev)
1463 1463
1464 dev_set_name(&fusb300->gadget.dev, "gadget"); 1464 dev_set_name(&fusb300->gadget.dev, "gadget");
1465 1465
1466 fusb300->gadget.is_dualspeed = 1; 1466 fusb300->gadget.max_speed = USB_SPEED_HIGH;
1467 fusb300->gadget.dev.parent = &pdev->dev; 1467 fusb300->gadget.dev.parent = &pdev->dev;
1468 fusb300->gadget.dev.dma_mask = pdev->dev.dma_mask; 1468 fusb300->gadget.dev.dma_mask = pdev->dev.dma_mask;
1469 fusb300->gadget.dev.release = pdev->dev.release; 1469 fusb300->gadget.dev.release = pdev->dev.release;
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
index 7f87805cddc4..ab9c924eee76 100644
--- a/drivers/usb/gadget/goku_udc.c
+++ b/drivers/usb/gadget/goku_udc.c
@@ -1796,6 +1796,7 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1796 spin_lock_init(&dev->lock); 1796 spin_lock_init(&dev->lock);
1797 dev->pdev = pdev; 1797 dev->pdev = pdev;
1798 dev->gadget.ops = &goku_ops; 1798 dev->gadget.ops = &goku_ops;
1799 dev->gadget.max_speed = USB_SPEED_FULL;
1799 1800
1800 /* the "gadget" abstracts/virtualizes the controller */ 1801 /* the "gadget" abstracts/virtualizes the controller */
1801 dev_set_name(&dev->gadget.dev, "gadget"); 1802 dev_set_name(&dev->gadget.dev, "gadget");
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
index c9fa3bf5b377..fa0fcc11263f 100644
--- a/drivers/usb/gadget/langwell_udc.c
+++ b/drivers/usb/gadget/langwell_udc.c
@@ -3267,7 +3267,7 @@ static int langwell_udc_probe(struct pci_dev *pdev,
3267 dev->gadget.ep0 = &dev->ep[0].ep; /* gadget ep0 */ 3267 dev->gadget.ep0 = &dev->ep[0].ep; /* gadget ep0 */
3268 INIT_LIST_HEAD(&dev->gadget.ep_list); /* ep_list */ 3268 INIT_LIST_HEAD(&dev->gadget.ep_list); /* ep_list */
3269 dev->gadget.speed = USB_SPEED_UNKNOWN; /* speed */ 3269 dev->gadget.speed = USB_SPEED_UNKNOWN; /* speed */
3270 dev->gadget.is_dualspeed = 1; /* support dual speed */ 3270 dev->gadget.max_speed = USB_SPEED_HIGH; /* support dual speed */
3271#ifdef OTG_TRANSCEIVER 3271#ifdef OTG_TRANSCEIVER
3272 dev->gadget.is_otg = 1; /* support otg mode */ 3272 dev->gadget.is_otg = 1; /* support otg mode */
3273#endif 3273#endif
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c
index 9aa1cbbee45b..a7692c208ea7 100644
--- a/drivers/usb/gadget/m66592-udc.c
+++ b/drivers/usb/gadget/m66592-udc.c
@@ -1653,7 +1653,7 @@ static int __init m66592_probe(struct platform_device *pdev)
1653 m66592->gadget.ops = &m66592_gadget_ops; 1653 m66592->gadget.ops = &m66592_gadget_ops;
1654 device_initialize(&m66592->gadget.dev); 1654 device_initialize(&m66592->gadget.dev);
1655 dev_set_name(&m66592->gadget.dev, "gadget"); 1655 dev_set_name(&m66592->gadget.dev, "gadget");
1656 m66592->gadget.is_dualspeed = 1; 1656 m66592->gadget.max_speed = USB_SPEED_HIGH;
1657 m66592->gadget.dev.parent = &pdev->dev; 1657 m66592->gadget.dev.parent = &pdev->dev;
1658 m66592->gadget.dev.dma_mask = pdev->dev.dma_mask; 1658 m66592->gadget.dev.dma_mask = pdev->dev.dma_mask;
1659 m66592->gadget.dev.release = pdev->dev.release; 1659 m66592->gadget.dev.release = pdev->dev.release;
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 892412103dd8..9376a7483c9b 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -2312,7 +2312,7 @@ static int __devinit mv_udc_probe(struct platform_device *dev)
2312 udc->gadget.ep0 = &udc->eps[0].ep; /* gadget ep0 */ 2312 udc->gadget.ep0 = &udc->eps[0].ep; /* gadget ep0 */
2313 INIT_LIST_HEAD(&udc->gadget.ep_list); /* ep_list */ 2313 INIT_LIST_HEAD(&udc->gadget.ep_list); /* ep_list */
2314 udc->gadget.speed = USB_SPEED_UNKNOWN; /* speed */ 2314 udc->gadget.speed = USB_SPEED_UNKNOWN; /* speed */
2315 udc->gadget.is_dualspeed = 1; /* support dual speed */ 2315 udc->gadget.max_speed = USB_SPEED_HIGH; /* support dual speed */
2316 2316
2317 /* the "gadget" abstracts/virtualizes the controller */ 2317 /* the "gadget" abstracts/virtualizes the controller */
2318 dev_set_name(&udc->gadget.dev, "gadget"); 2318 dev_set_name(&udc->gadget.dev, "gadget");
diff --git a/drivers/usb/gadget/net2272.c b/drivers/usb/gadget/net2272.c
index d1b76368472f..d5050f4e8449 100644
--- a/drivers/usb/gadget/net2272.c
+++ b/drivers/usb/gadget/net2272.c
@@ -2235,7 +2235,7 @@ net2272_probe_init(struct device *dev, unsigned int irq)
2235 ret->irq = irq; 2235 ret->irq = irq;
2236 ret->dev = dev; 2236 ret->dev = dev;
2237 ret->gadget.ops = &net2272_ops; 2237 ret->gadget.ops = &net2272_ops;
2238 ret->gadget.is_dualspeed = 1; 2238 ret->gadget.max_speed = USB_SPEED_HIGH;
2239 2239
2240 /* the "gadget" abstracts/virtualizes the controller */ 2240 /* the "gadget" abstracts/virtualizes the controller */
2241 dev_set_name(&ret->gadget.dev, "gadget"); 2241 dev_set_name(&ret->gadget.dev, "gadget");
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index da2b9d0be3ca..9ee36fd5adae 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -2698,7 +2698,7 @@ static int net2280_probe (struct pci_dev *pdev, const struct pci_device_id *id)
2698 spin_lock_init (&dev->lock); 2698 spin_lock_init (&dev->lock);
2699 dev->pdev = pdev; 2699 dev->pdev = pdev;
2700 dev->gadget.ops = &net2280_ops; 2700 dev->gadget.ops = &net2280_ops;
2701 dev->gadget.is_dualspeed = 1; 2701 dev->gadget.max_speed = USB_SPEED_HIGH;
2702 2702
2703 /* the "gadget" abstracts/virtualizes the controller */ 2703 /* the "gadget" abstracts/virtualizes the controller */
2704 dev_set_name(&dev->gadget.dev, "gadget"); 2704 dev_set_name(&dev->gadget.dev, "gadget");
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 788989a10223..ed01a0f5f119 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2676,6 +2676,7 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2676 INIT_LIST_HEAD(&udc->gadget.ep_list); 2676 INIT_LIST_HEAD(&udc->gadget.ep_list);
2677 INIT_LIST_HEAD(&udc->iso); 2677 INIT_LIST_HEAD(&udc->iso);
2678 udc->gadget.speed = USB_SPEED_UNKNOWN; 2678 udc->gadget.speed = USB_SPEED_UNKNOWN;
2679 udc->gadget.max_speed = USB_SPEED_FULL;
2679 udc->gadget.name = driver_name; 2680 udc->gadget.name = driver_name;
2680 2681
2681 device_initialize(&udc->gadget.dev); 2682 device_initialize(&udc->gadget.dev);
diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 5048a0c07640..7f97b4adba3e 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -2941,7 +2941,7 @@ static int pch_udc_probe(struct pci_dev *pdev,
2941 dev->gadget.dev.dma_mask = pdev->dev.dma_mask; 2941 dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
2942 dev->gadget.dev.release = gadget_release; 2942 dev->gadget.dev.release = gadget_release;
2943 dev->gadget.name = KBUILD_MODNAME; 2943 dev->gadget.name = KBUILD_MODNAME;
2944 dev->gadget.is_dualspeed = 1; 2944 dev->gadget.max_speed = USB_SPEED_HIGH;
2945 2945
2946 retval = device_register(&dev->gadget.dev); 2946 retval = device_register(&dev->gadget.dev);
2947 if (retval) 2947 if (retval)
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c
index 65a8834f274b..b74f49ac95e5 100644
--- a/drivers/usb/gadget/printer.c
+++ b/drivers/usb/gadget/printer.c
@@ -1141,7 +1141,7 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1141 break; 1141 break;
1142#ifdef CONFIG_USB_GADGET_DUALSPEED 1142#ifdef CONFIG_USB_GADGET_DUALSPEED
1143 case USB_DT_DEVICE_QUALIFIER: 1143 case USB_DT_DEVICE_QUALIFIER:
1144 if (!gadget->is_dualspeed) 1144 if (!gadget_is_dualspeed(gadget))
1145 break; 1145 break;
1146 /* 1146 /*
1147 * assumes ep0 uses the same value for both 1147 * assumes ep0 uses the same value for both
@@ -1155,7 +1155,7 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1155 break; 1155 break;
1156 1156
1157 case USB_DT_OTHER_SPEED_CONFIG: 1157 case USB_DT_OTHER_SPEED_CONFIG:
1158 if (!gadget->is_dualspeed) 1158 if (!gadget_is_dualspeed(gadget))
1159 break; 1159 break;
1160 /* FALLTHROUGH */ 1160 /* FALLTHROUGH */
1161#endif /* CONFIG_USB_GADGET_DUALSPEED */ 1161#endif /* CONFIG_USB_GADGET_DUALSPEED */
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index fc719a3f8557..3666d7c54e24 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1911,7 +1911,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
1911 1911
1912 r8a66597->gadget.ops = &r8a66597_gadget_ops; 1912 r8a66597->gadget.ops = &r8a66597_gadget_ops;
1913 dev_set_name(&r8a66597->gadget.dev, "gadget"); 1913 dev_set_name(&r8a66597->gadget.dev, "gadget");
1914 r8a66597->gadget.is_dualspeed = 1; 1914 r8a66597->gadget.max_speed = USB_SPEED_HIGH;
1915 r8a66597->gadget.dev.parent = &pdev->dev; 1915 r8a66597->gadget.dev.parent = &pdev->dev;
1916 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask; 1916 r8a66597->gadget.dev.dma_mask = pdev->dev.dma_mask;
1917 r8a66597->gadget.dev.release = pdev->dev.release; 1917 r8a66597->gadget.dev.release = pdev->dev.release;
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index b31448229f0b..6bc7ad87c306 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -3362,7 +3362,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
3362 3362
3363 dev_set_name(&hsotg->gadget.dev, "gadget"); 3363 dev_set_name(&hsotg->gadget.dev, "gadget");
3364 3364
3365 hsotg->gadget.is_dualspeed = 1; 3365 hsotg->gadget.max_speed = USB_SPEED_HIGH;
3366 hsotg->gadget.ops = &s3c_hsotg_gadget_ops; 3366 hsotg->gadget.ops = &s3c_hsotg_gadget_ops;
3367 hsotg->gadget.name = dev_name(dev); 3367 hsotg->gadget.name = dev_name(dev);
3368 3368
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index 20a553b46aed..09ea96558b91 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -1310,7 +1310,7 @@ static int s3c_hsudc_probe(struct platform_device *pdev)
1310 device_initialize(&hsudc->gadget.dev); 1310 device_initialize(&hsudc->gadget.dev);
1311 dev_set_name(&hsudc->gadget.dev, "gadget"); 1311 dev_set_name(&hsudc->gadget.dev, "gadget");
1312 1312
1313 hsudc->gadget.is_dualspeed = 1; 1313 hsudc->gadget.max_speed = USB_SPEED_HIGH;
1314 hsudc->gadget.ops = &s3c_hsudc_gadget_ops; 1314 hsudc->gadget.ops = &s3c_hsudc_gadget_ops;
1315 hsudc->gadget.name = dev_name(dev); 1315 hsudc->gadget.name = dev_name(dev);
1316 hsudc->gadget.dev.parent = dev; 1316 hsudc->gadget.dev.parent = dev;
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
index 6939e17f4580..0b0d12ccc487 100644
--- a/drivers/usb/gadget/udc-core.c
+++ b/drivers/usb/gadget/udc-core.c
@@ -371,14 +371,28 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
371} 371}
372static DEVICE_ATTR(soft_connect, S_IWUSR, NULL, usb_udc_softconn_store); 372static DEVICE_ATTR(soft_connect, S_IWUSR, NULL, usb_udc_softconn_store);
373 373
374static ssize_t usb_udc_speed_show(struct device *dev, 374#define USB_UDC_SPEED_ATTR(name, param) \
375ssize_t usb_udc_##param##_show(struct device *dev, \
376 struct device_attribute *attr, char *buf) \
377{ \
378 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); \
379 return snprintf(buf, PAGE_SIZE, "%s\n", \
380 usb_speed_string(udc->gadget->param)); \
381} \
382static DEVICE_ATTR(name, S_IRUSR, usb_udc_##param##_show, NULL)
383
384static USB_UDC_SPEED_ATTR(current_speed, speed);
385static USB_UDC_SPEED_ATTR(maximum_speed, max_speed);
386
387/* TODO: Scheduled for removal in 3.8. */
388static ssize_t usb_udc_is_dualspeed_show(struct device *dev,
375 struct device_attribute *attr, char *buf) 389 struct device_attribute *attr, char *buf)
376{ 390{
377 struct usb_udc *udc = container_of(dev, struct usb_udc, dev); 391 struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
378 return snprintf(buf, PAGE_SIZE, "%s\n", 392 return snprintf(buf, PAGE_SIZE, "%d\n",
379 usb_speed_string(udc->gadget->speed)); 393 gadget_is_dualspeed(udc->gadget));
380} 394}
381static DEVICE_ATTR(speed, S_IRUGO, usb_udc_speed_show, NULL); 395static DEVICE_ATTR(is_dualspeed, S_IRUSR, usb_udc_is_dualspeed_show, NULL);
382 396
383#define USB_UDC_ATTR(name) \ 397#define USB_UDC_ATTR(name) \
384ssize_t usb_udc_##name##_show(struct device *dev, \ 398ssize_t usb_udc_##name##_show(struct device *dev, \
@@ -391,7 +405,6 @@ ssize_t usb_udc_##name##_show(struct device *dev, \
391} \ 405} \
392static DEVICE_ATTR(name, S_IRUGO, usb_udc_##name##_show, NULL) 406static DEVICE_ATTR(name, S_IRUGO, usb_udc_##name##_show, NULL)
393 407
394static USB_UDC_ATTR(is_dualspeed);
395static USB_UDC_ATTR(is_otg); 408static USB_UDC_ATTR(is_otg);
396static USB_UDC_ATTR(is_a_peripheral); 409static USB_UDC_ATTR(is_a_peripheral);
397static USB_UDC_ATTR(b_hnp_enable); 410static USB_UDC_ATTR(b_hnp_enable);
@@ -401,7 +414,8 @@ static USB_UDC_ATTR(a_alt_hnp_support);
401static struct attribute *usb_udc_attrs[] = { 414static struct attribute *usb_udc_attrs[] = {
402 &dev_attr_srp.attr, 415 &dev_attr_srp.attr,
403 &dev_attr_soft_connect.attr, 416 &dev_attr_soft_connect.attr,
404 &dev_attr_speed.attr, 417 &dev_attr_current_speed.attr,
418 &dev_attr_maximum_speed.attr,
405 419
406 &dev_attr_is_dualspeed.attr, 420 &dev_attr_is_dualspeed.attr,
407 &dev_attr_is_otg.attr, 421 &dev_attr_is_otg.attr,
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 922148ff8d29..47a3d1e5b28b 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1844,7 +1844,7 @@ int __init musb_gadget_setup(struct musb *musb)
1844 */ 1844 */
1845 1845
1846 musb->g.ops = &musb_gadget_operations; 1846 musb->g.ops = &musb_gadget_operations;
1847 musb->g.is_dualspeed = 1; 1847 musb->g.max_speed = USB_SPEED_HIGH;
1848 musb->g.speed = USB_SPEED_UNKNOWN; 1848 musb->g.speed = USB_SPEED_UNKNOWN;
1849 1849
1850 /* this "gadget" abstracts/virtualizes the controller */ 1850 /* this "gadget" abstracts/virtualizes the controller */
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 8fb9056ff48d..43c67e5cde26 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -862,7 +862,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
862 gpriv->gadget.dev.parent = dev; 862 gpriv->gadget.dev.parent = dev;
863 gpriv->gadget.name = "renesas_usbhs_udc"; 863 gpriv->gadget.name = "renesas_usbhs_udc";
864 gpriv->gadget.ops = &usbhsg_gadget_ops; 864 gpriv->gadget.ops = &usbhsg_gadget_ops;
865 gpriv->gadget.is_dualspeed = 1; 865 gpriv->gadget.max_speed = USB_SPEED_HIGH;
866 ret = device_register(&gpriv->gadget.dev); 866 ret = device_register(&gpriv->gadget.dev);
867 if (ret < 0) 867 if (ret < 0)
868 goto err_add_udc; 868 goto err_add_udc;