diff options
Diffstat (limited to 'drivers/usb/otg/gpio_vbus.c')
-rw-r--r-- | drivers/usb/otg/gpio_vbus.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index bd6e755dd3d8..8853cb1fd9d7 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -39,6 +39,7 @@ struct gpio_vbus_data { | |||
39 | unsigned mA; | 39 | unsigned mA; |
40 | struct delayed_work work; | 40 | struct delayed_work work; |
41 | int vbus; | 41 | int vbus; |
42 | int irq; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | 45 | ||
@@ -173,12 +174,11 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, | |||
173 | struct gpio_vbus_data *gpio_vbus; | 174 | struct gpio_vbus_data *gpio_vbus; |
174 | struct gpio_vbus_mach_info *pdata; | 175 | struct gpio_vbus_mach_info *pdata; |
175 | struct platform_device *pdev; | 176 | struct platform_device *pdev; |
176 | int gpio, irq; | 177 | int gpio; |
177 | 178 | ||
178 | gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); | 179 | gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); |
179 | pdev = to_platform_device(gpio_vbus->dev); | 180 | pdev = to_platform_device(gpio_vbus->dev); |
180 | pdata = gpio_vbus->dev->platform_data; | 181 | pdata = gpio_vbus->dev->platform_data; |
181 | irq = gpio_to_irq(pdata->gpio_vbus); | ||
182 | gpio = pdata->gpio_pullup; | 182 | gpio = pdata->gpio_pullup; |
183 | 183 | ||
184 | if (!gadget) { | 184 | if (!gadget) { |
@@ -203,7 +203,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, | |||
203 | 203 | ||
204 | /* initialize connection state */ | 204 | /* initialize connection state */ |
205 | gpio_vbus->vbus = 0; /* start with disconnected */ | 205 | gpio_vbus->vbus = 0; /* start with disconnected */ |
206 | gpio_vbus_irq(irq, pdev); | 206 | gpio_vbus_irq(gpio_vbus->irq, pdev); |
207 | return 0; | 207 | return 0; |
208 | } | 208 | } |
209 | 209 | ||
@@ -284,6 +284,8 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
284 | } else | 284 | } else |
285 | irq = gpio_to_irq(gpio); | 285 | irq = gpio_to_irq(gpio); |
286 | 286 | ||
287 | gpio_vbus->irq = irq; | ||
288 | |||
287 | /* if data line pullup is in use, initialize it to "not pulling up" */ | 289 | /* if data line pullup is in use, initialize it to "not pulling up" */ |
288 | gpio = pdata->gpio_pullup; | 290 | gpio = pdata->gpio_pullup; |
289 | if (gpio_is_valid(gpio)) { | 291 | if (gpio_is_valid(gpio)) { |
@@ -350,7 +352,7 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev) | |||
350 | 352 | ||
351 | usb_set_transceiver(NULL); | 353 | usb_set_transceiver(NULL); |
352 | 354 | ||
353 | free_irq(gpio_to_irq(gpio), pdev); | 355 | free_irq(gpio_vbus->irq, pdev); |
354 | if (gpio_is_valid(pdata->gpio_pullup)) | 356 | if (gpio_is_valid(pdata->gpio_pullup)) |
355 | gpio_free(pdata->gpio_pullup); | 357 | gpio_free(pdata->gpio_pullup); |
356 | gpio_free(gpio); | 358 | gpio_free(gpio); |