提交 47fd6f7c 编写于 作者: J Jaya Kumar 提交者: Russell King

[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: NJaya Kumar <jayakumar.lkml@gmail.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 844c6f6a
...@@ -141,7 +141,11 @@ static int is_vbus_present(void) ...@@ -141,7 +141,11 @@ static int is_vbus_present(void)
if (mach->gpio_vbus) { if (mach->gpio_vbus) {
int value = gpio_get_value(mach->gpio_vbus); int value = gpio_get_value(mach->gpio_vbus);
return mach->gpio_vbus_inverted ? !value : value;
if (mach->gpio_vbus_inverted)
return !value;
else
return !!value;
} }
if (mach->udc_is_connected) if (mach->udc_is_connected)
return mach->udc_is_connected(); return mach->udc_is_connected();
...@@ -982,7 +986,7 @@ static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active) ...@@ -982,7 +986,7 @@ static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
struct pxa25x_udc *udc; struct pxa25x_udc *udc;
udc = container_of(_gadget, struct pxa25x_udc, gadget); udc = container_of(_gadget, struct pxa25x_udc, gadget);
udc->vbus = (is_active != 0); udc->vbus = is_active;
DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); DMSG("vbus %s\n", is_active ? "supplied" : "inactive");
pullup(udc); pullup(udc);
return 0; return 0;
...@@ -1399,12 +1403,8 @@ lubbock_vbus_irq(int irq, void *_dev) ...@@ -1399,12 +1403,8 @@ lubbock_vbus_irq(int irq, void *_dev)
static irqreturn_t udc_vbus_irq(int irq, void *_dev) static irqreturn_t udc_vbus_irq(int irq, void *_dev)
{ {
struct pxa25x_udc *dev = _dev; struct pxa25x_udc *dev = _dev;
int vbus = gpio_get_value(dev->mach->gpio_vbus);
if (dev->mach->gpio_vbus_inverted) pxa25x_udc_vbus_session(&dev->gadget, is_vbus_present());
vbus = !vbus;
pxa25x_udc_vbus_session(&dev->gadget, vbus);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册