diff options
Diffstat (limited to 'drivers/usb/gadget/printer.c')
-rw-r--r-- | drivers/usb/gadget/printer.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index e0090085b78e..5a3034fdfe47 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c @@ -53,6 +53,20 @@ #include "gadget_chips.h" + +/* + * Kbuild is not very cooperative with respect to linking separately + * compiled library objects into one module. So for now we won't use + * separate compilation ... ensuring init/exit sections work to shrink + * the runtime footprint, and giving us at least some parts of what + * a "gcc --combine ... part1.c part2.c part3.c ... " build would. + */ +#include "usbstring.c" +#include "config.c" +#include "epautoconf.c" + +/*-------------------------------------------------------------------------*/ + #define DRIVER_DESC "Printer Gadget" #define DRIVER_VERSION "2007 OCT 06" @@ -238,7 +252,7 @@ static struct usb_config_descriptor config_desc = { .bConfigurationValue = DEV_CONFIG_VALUE, .iConfiguration = 0, .bmAttributes = USB_CONFIG_ATT_ONE | USB_CONFIG_ATT_SELFPOWER, - .bMaxPower = 1 /* Self-Powered */ + .bMaxPower = CONFIG_USB_GADGET_VBUS_DRAW / 2, }; static struct usb_interface_descriptor intf_desc = { @@ -1264,8 +1278,7 @@ unknown: /* respond with data transfer before status phase? */ if (value >= 0) { req->length = value; - req->zero = value < wLength - && (value % gadget->ep0->maxpacket) == 0; + req->zero = value < wLength; value = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); if (value < 0) { DBG(dev, "ep_queue --> %d\n", value); @@ -1360,8 +1373,8 @@ printer_bind(struct usb_gadget *gadget) /* Setup the sysfs files for the printer gadget. */ - dev->pdev = device_create_drvdata(usb_gadget_class, NULL, - g_printer_devno, NULL, "g_printer"); + dev->pdev = device_create(usb_gadget_class, NULL, g_printer_devno, + NULL, "g_printer"); if (IS_ERR(dev->pdev)) { ERROR(dev, "Failed to create device: g_printer\n"); goto fail; @@ -1463,7 +1476,6 @@ autoconf_fail: if (gadget->is_otg) { otg_desc.bmAttributes |= USB_OTG_HNP, config_desc.bmAttributes |= USB_CONFIG_ATT_WAKEUP; - config_desc.bMaxPower = 4; } spin_lock_init(&dev->lock); |