aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg
diff options
context:
space:
mode:
authorShinya Kuribayashi <shinya.kuribayashi.px@renesas.com>2012-05-17 07:10:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-17 14:20:34 -0400
commitc8240c1b810ac4adc13e04244781db6d2ff272be (patch)
tree8057659c4d4221ceb705255b5f05a1b18bd4d484 /drivers/usb/otg
parentda020b49fa6ee7eaf9fe359bc6089dd1848bb7d0 (diff)
USB: gpio_vbus: handle IRQ flags properly
Currently, 'res->flags' handlings are wrong in three respects: * the driver _modifies_ the contents of platform data * res->flags is set up, but not used anywhere in the driver * request_irq() always takes VBUS_IRQ_FLAGS, regardless of refs->flags This patch tries to fix this with a policy: If a platform IRQ resource is available, give preference to its IRQ flag(s) over a default one (VBUS_IRQ_FLAGS). Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/otg')
-rw-r--r--drivers/usb/otg/gpio_vbus.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 4e393ef2f25..00e763ecb55 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -242,6 +242,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
242 struct gpio_vbus_data *gpio_vbus; 242 struct gpio_vbus_data *gpio_vbus;
243 struct resource *res; 243 struct resource *res;
244 int err, gpio, irq; 244 int err, gpio, irq;
245 unsigned long irqflags;
245 246
246 if (!pdata || !gpio_is_valid(pdata->gpio_vbus)) 247 if (!pdata || !gpio_is_valid(pdata->gpio_vbus))
247 return -EINVAL; 248 return -EINVAL;
@@ -278,10 +279,11 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
278 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 279 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
279 if (res) { 280 if (res) {
280 irq = res->start; 281 irq = res->start;
281 res->flags &= IRQF_TRIGGER_MASK; 282 irqflags = (res->flags & IRQF_TRIGGER_MASK) | IRQF_SHARED;
282 res->flags |= IRQF_SHARED; 283 } else {
283 } else
284 irq = gpio_to_irq(gpio); 284 irq = gpio_to_irq(gpio);
285 irqflags = VBUS_IRQ_FLAGS;
286 }
285 287
286 gpio_vbus->irq = irq; 288 gpio_vbus->irq = irq;
287 289
@@ -299,8 +301,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
299 gpio_direction_output(gpio, pdata->gpio_pullup_inverted); 301 gpio_direction_output(gpio, pdata->gpio_pullup_inverted);
300 } 302 }
301 303
302 err = request_irq(irq, gpio_vbus_irq, VBUS_IRQ_FLAGS, 304 err = request_irq(irq, gpio_vbus_irq, irqflags, "vbus_detect", pdev);
303 "vbus_detect", pdev);
304 if (err) { 305 if (err) {
305 dev_err(&pdev->dev, "can't request irq %i, err: %d\n", 306 dev_err(&pdev->dev, "can't request irq %i, err: %d\n",
306 irq, err); 307 irq, err);