diff options
author | Jaya Kumar <jayakumar.lkml@gmail.com> | 2008-11-17 20:32:36 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-11-23 10:49:59 -0500 |
commit | 47fd6f7c94e15eb5f97dd1cbb0427a46b03c8185 (patch) | |
tree | dc9842ab5729f971c21947232c86fb928d45125a /drivers/usb | |
parent | 844c6f6a36984c5fe1bcc2d68a88f2ed212d1eef (diff) |
[ARM] 5335/1: pxa25x_udc: Fix is_vbus_present to return 1 or 0
the use of is_blah() suggests a 1 or 0 return. This assumption is made in
pxa25x_udc code such as:
dev->vbus = is_vbus_present();
where dev->vbus is a bitfield. This fix allows pxa25x_udc_probe to correctly
detect vbus. Other changes were to make its use consistent in the rest of
the code.
Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/pxa25x_udc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index da6e93c201d2..2dbc0db0b46c 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -141,7 +141,11 @@ static int is_vbus_present(void) | |||
141 | 141 | ||
142 | if (mach->gpio_vbus) { | 142 | if (mach->gpio_vbus) { |
143 | int value = gpio_get_value(mach->gpio_vbus); | 143 | int value = gpio_get_value(mach->gpio_vbus); |
144 | return mach->gpio_vbus_inverted ? !value : value; | 144 | |
145 | if (mach->gpio_vbus_inverted) | ||
146 | return !value; | ||
147 | else | ||
148 | return !!value; | ||
145 | } | 149 | } |
146 | if (mach->udc_is_connected) | 150 | if (mach->udc_is_connected) |
147 | return mach->udc_is_connected(); | 151 | return mach->udc_is_connected(); |
@@ -982,7 +986,7 @@ static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
982 | struct pxa25x_udc *udc; | 986 | struct pxa25x_udc *udc; |
983 | 987 | ||
984 | udc = container_of(_gadget, struct pxa25x_udc, gadget); | 988 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
985 | udc->vbus = (is_active != 0); | 989 | udc->vbus = is_active; |
986 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); | 990 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); |
987 | pullup(udc); | 991 | pullup(udc); |
988 | return 0; | 992 | return 0; |
@@ -1399,12 +1403,8 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1399 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) | 1403 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) |
1400 | { | 1404 | { |
1401 | struct pxa25x_udc *dev = _dev; | 1405 | struct pxa25x_udc *dev = _dev; |
1402 | int vbus = gpio_get_value(dev->mach->gpio_vbus); | ||
1403 | 1406 | ||
1404 | if (dev->mach->gpio_vbus_inverted) | 1407 | pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present()); |
1405 | vbus = !vbus; | ||
1406 | |||
1407 | pxa25x_udc_vbus_session(&dev->gadget, vbus); | ||
1408 | return IRQ_HANDLED; | 1408 | return IRQ_HANDLED; |
1409 | } | 1409 | } |
1410 | 1410 | ||