This one needed some fixes ... see the appended fixup patchlet, which I'll merge with this. - Dave The "Context:" annotations are recognized by the kerneldoc tools, and should snug up against the rest of the function summaries. Don't just test if a GPIO number is nonzero; use gpio_is_valid(), so that GPIO-0 isn't inappropriately ruled out, and -EINVAL doesn't get mistaken for a real GPIO number. And gpio_request() isn't quite enough; use gpio_direction_{in,out}put() too. --- g26.orig/drivers/usb/gadget/pxa27x_udc.c 2009-01-24 22:30:20.000000000 -0800 +++ g26/drivers/usb/gadget/pxa27x_udc.c 2009-01-24 20:54:10.000000000 -0800 @@ -1476,7 +1476,6 @@ static struct usb_ep_ops pxa_ep_ops = { * dplus_pullup - Connect or disconnect pullup resistor to D+ pin * @udc: udc device * @on: 0 if disconnect pullup resistor, 1 otherwise - * * Context: any * * Handle D+ pullup resistor, make the device visible to the usb bus, and @@ -1485,13 +1484,13 @@ static struct usb_ep_ops pxa_ep_ops = { static void dplus_pullup(struct pxa_udc *udc, int on) { if (on) { - if (udc->mach->gpio_pullup) + if (gpio_is_valid(udc->mach->gpio_pullup)) gpio_set_value(udc->mach->gpio_pullup, !udc->mach->gpio_pullup_inverted); if (udc->mach->udc_command) udc->mach->udc_command(PXA2XX_UDC_CMD_CONNECT); } else { - if (udc->mach->gpio_pullup) + if (gpio_is_valid(udc->mach->gpio_pullup)) gpio_set_value(udc->mach->gpio_pullup, udc->mach->gpio_pullup_inverted); if (udc->mach->udc_command) @@ -1534,13 +1533,12 @@ static void udc_disable(struct pxa_udc * /** * should_enable_udc - Tells if UDC should be enabled * @udc: udc device + * Context: any * * The UDC should be enabled if : * - the pullup resistor is connected * - and a gadget driver is bound * - * Context: any - * * Returns 1 if UDC should be enabled, 0 otherwise */ static int should_enable_udc(struct pxa_udc *udc) @@ -1554,13 +1552,12 @@ static int should_enable_udc(struct pxa_ /** * should_disable_udc - Tells if UDC should be disabled * @udc: udc device + * Context: any * * The UDC should be disabled if : * - the pullup resistor is not connected * - or no gadget driver is bound * - * Context: any - * * Returns 1 if UDC should be disabled */ static int should_disable_udc(struct pxa_udc *udc) @@ -1575,7 +1572,6 @@ static int should_disable_udc(struct pxa * pxa_udc_pullup - Offer manual D+ pullup control * @_gadget: usb gadget using the control * @is_active: 0 if disconnect, else connect D+ pullup resistor - * * Context: !in_interrupt() * * Returns 0 if OK, -EOPNOTSUPP if udc driver doesn't handle D+ pullup @@ -1584,7 +1580,7 @@ static int pxa_udc_pullup(struct usb_gad { struct pxa_udc *udc = to_gadget_udc(_gadget); - if (!udc->mach->gpio_pullup && !udc->mach->udc_command) + if (!gpio_is_valid(udc->mach->gpio_pullup)) && !udc->mach->udc_command) return -EOPNOTSUPP; dplus_pullup(udc, is_active); @@ -1606,7 +1602,6 @@ static const struct usb_gadget_ops pxa_u /** * udc_disable - disable udc device controller * @udc: udc device - * * Context: any * * Disables the udc device : disables clocks, udc interrupts, control endpoint @@ -2334,8 +2329,12 @@ static int __init pxa_udc_probe(struct p udc->mach = pdev->dev.platform_data; gpio = udc->mach->gpio_pullup; - if (gpio) + if (gpio_is_valid(gpio)) { retval = gpio_request(gpio, "USB D+ pullup"); + if (retval == 0) + gpio_direction_output(gpio, + udc->mach->gpio_pullup_inverted); + } if (retval) { dev_err(&pdev->dev, "Couldn't request gpio %d : %d\n", gpio, retval); @@ -2396,7 +2395,7 @@ static int __exit pxa_udc_remove(struct usb_gadget_unregister_driver(udc->driver); free_irq(udc->irq, udc); pxa_cleanup_debugfs(udc); - if (gpio) + if (gpio_is_valid(gpio)) gpio_free(gpio); platform_set_drvdata(_dev, NULL); -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html