diff options
author | Heiko Stübner <heiko@sntech.de> | 2011-12-19 13:43:35 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-12-21 06:24:42 -0500 |
commit | 922be95a3f2669b4a9ef526ff3c7ba71c00cbf9e (patch) | |
tree | ad98209435c6a450fbf129fa57025d019ac2d2e6 /drivers/usb/gadget/s3c-hsudc.c | |
parent | dee19be7d8ed428e701331f9428d14d2701589f5 (diff) |
usb: gadget: s3c-hsudc: remove the_controller global
Instead use container_of to retrieve the s3c_hsudc from the
struct usb_gadget pointer.
[ balbi@ti.com : changed verbose container_of() into
an already provided helper 'to_hsudc()' ]
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsudc.c')
-rw-r--r-- | drivers/usb/gadget/s3c-hsudc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index f9de57e15a18..97661203a425 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
@@ -161,7 +161,6 @@ struct s3c_hsudc { | |||
161 | #define ep_index(_ep) ((_ep)->bEndpointAddress & \ | 161 | #define ep_index(_ep) ((_ep)->bEndpointAddress & \ |
162 | USB_ENDPOINT_NUMBER_MASK) | 162 | USB_ENDPOINT_NUMBER_MASK) |
163 | 163 | ||
164 | static struct s3c_hsudc *the_controller; | ||
165 | static const char driver_name[] = "s3c-udc"; | 164 | static const char driver_name[] = "s3c-udc"; |
166 | static const char ep0name[] = "ep0-control"; | 165 | static const char ep0name[] = "ep0-control"; |
167 | 166 | ||
@@ -1141,7 +1140,7 @@ static irqreturn_t s3c_hsudc_irq(int irq, void *_dev) | |||
1141 | static int s3c_hsudc_start(struct usb_gadget *gadget, | 1140 | static int s3c_hsudc_start(struct usb_gadget *gadget, |
1142 | struct usb_gadget_driver *driver) | 1141 | struct usb_gadget_driver *driver) |
1143 | { | 1142 | { |
1144 | struct s3c_hsudc *hsudc = the_controller; | 1143 | struct s3c_hsudc *hsudc = to_hsudc(gadget); |
1145 | int ret; | 1144 | int ret; |
1146 | 1145 | ||
1147 | if (!driver | 1146 | if (!driver |
@@ -1195,7 +1194,7 @@ err_supplies: | |||
1195 | static int s3c_hsudc_stop(struct usb_gadget *gadget, | 1194 | static int s3c_hsudc_stop(struct usb_gadget *gadget, |
1196 | struct usb_gadget_driver *driver) | 1195 | struct usb_gadget_driver *driver) |
1197 | { | 1196 | { |
1198 | struct s3c_hsudc *hsudc = the_controller; | 1197 | struct s3c_hsudc *hsudc = to_hsudc(gadget); |
1199 | unsigned long flags; | 1198 | unsigned long flags; |
1200 | 1199 | ||
1201 | if (!hsudc) | 1200 | if (!hsudc) |
@@ -1238,7 +1237,7 @@ static int s3c_hsudc_gadget_getframe(struct usb_gadget *gadget) | |||
1238 | 1237 | ||
1239 | static int s3c_hsudc_vbus_draw(struct usb_gadget *gadget, unsigned mA) | 1238 | static int s3c_hsudc_vbus_draw(struct usb_gadget *gadget, unsigned mA) |
1240 | { | 1239 | { |
1241 | struct s3c_hsudc *hsudc = the_controller; | 1240 | struct s3c_hsudc *hsudc = to_hsudc(gadget); |
1242 | 1241 | ||
1243 | if (!hsudc) | 1242 | if (!hsudc) |
1244 | return -ENODEV; | 1243 | return -ENODEV; |
@@ -1272,7 +1271,6 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev) | |||
1272 | return -ENOMEM; | 1271 | return -ENOMEM; |
1273 | } | 1272 | } |
1274 | 1273 | ||
1275 | the_controller = hsudc; | ||
1276 | platform_set_drvdata(pdev, dev); | 1274 | platform_set_drvdata(pdev, dev); |
1277 | hsudc->dev = dev; | 1275 | hsudc->dev = dev; |
1278 | hsudc->pd = pdev->dev.platform_data; | 1276 | hsudc->pd = pdev->dev.platform_data; |