diff options
Diffstat (limited to 'drivers/usb/gadget/printer.c')
-rw-r--r-- | drivers/usb/gadget/printer.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index cf241c371a71..271ef94668e7 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -126,36 +126,36 @@ static struct printer_dev usb_printer_gadget; | |||
126 | #define PRINTER_VENDOR_NUM 0x0525 /* NetChip */ | 126 | #define PRINTER_VENDOR_NUM 0x0525 /* NetChip */ |
127 | #define PRINTER_PRODUCT_NUM 0xa4a8 /* Linux-USB Printer Gadget */ | 127 | #define PRINTER_PRODUCT_NUM 0xa4a8 /* Linux-USB Printer Gadget */ |
128 | 128 | ||
129 | /* Some systems will want different product identifers published in the | 129 | /* Some systems will want different product identifiers published in the |
130 | * device descriptor, either numbers or strings or both. These string | 130 | * device descriptor, either numbers or strings or both. These string |
131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). | 131 | * parameters are in UTF-8 (superset of ASCII's 7 bit characters). |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static ushort __initdata idVendor; | 134 | static ushort idVendor; |
135 | module_param(idVendor, ushort, S_IRUGO); | 135 | module_param(idVendor, ushort, S_IRUGO); |
136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); | 136 | MODULE_PARM_DESC(idVendor, "USB Vendor ID"); |
137 | 137 | ||
138 | static ushort __initdata idProduct; | 138 | static ushort idProduct; |
139 | module_param(idProduct, ushort, S_IRUGO); | 139 | module_param(idProduct, ushort, S_IRUGO); |
140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); | 140 | MODULE_PARM_DESC(idProduct, "USB Product ID"); |
141 | 141 | ||
142 | static ushort __initdata bcdDevice; | 142 | static ushort bcdDevice; |
143 | module_param(bcdDevice, ushort, S_IRUGO); | 143 | module_param(bcdDevice, ushort, S_IRUGO); |
144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); | 144 | MODULE_PARM_DESC(bcdDevice, "USB Device version (BCD)"); |
145 | 145 | ||
146 | static char *__initdata iManufacturer; | 146 | static char *iManufacturer; |
147 | module_param(iManufacturer, charp, S_IRUGO); | 147 | module_param(iManufacturer, charp, S_IRUGO); |
148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); | 148 | MODULE_PARM_DESC(iManufacturer, "USB Manufacturer string"); |
149 | 149 | ||
150 | static char *__initdata iProduct; | 150 | static char *iProduct; |
151 | module_param(iProduct, charp, S_IRUGO); | 151 | module_param(iProduct, charp, S_IRUGO); |
152 | MODULE_PARM_DESC(iProduct, "USB Product string"); | 152 | MODULE_PARM_DESC(iProduct, "USB Product string"); |
153 | 153 | ||
154 | static char *__initdata iSerialNum; | 154 | static char *iSerialNum; |
155 | module_param(iSerialNum, charp, S_IRUGO); | 155 | module_param(iSerialNum, charp, S_IRUGO); |
156 | MODULE_PARM_DESC(iSerialNum, "1"); | 156 | MODULE_PARM_DESC(iSerialNum, "1"); |
157 | 157 | ||
158 | static char *__initdata iPNPstring; | 158 | static char *iPNPstring; |
159 | module_param(iPNPstring, charp, S_IRUGO); | 159 | module_param(iPNPstring, charp, S_IRUGO); |
160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); | 160 | MODULE_PARM_DESC(iPNPstring, "MFG:linux;MDL:g_printer;CLS:PRINTER;SN:1;"); |
161 | 161 | ||
@@ -884,7 +884,8 @@ static const struct file_operations printer_io_operations = { | |||
884 | .fsync = printer_fsync, | 884 | .fsync = printer_fsync, |
885 | .poll = printer_poll, | 885 | .poll = printer_poll, |
886 | .unlocked_ioctl = printer_ioctl, | 886 | .unlocked_ioctl = printer_ioctl, |
887 | .release = printer_close | 887 | .release = printer_close, |
888 | .llseek = noop_llseek, | ||
888 | }; | 889 | }; |
889 | 890 | ||
890 | /*-------------------------------------------------------------------------*/ | 891 | /*-------------------------------------------------------------------------*/ |
@@ -1188,6 +1189,8 @@ printer_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) | |||
1188 | else if (gadget->a_alt_hnp_support) | 1189 | else if (gadget->a_alt_hnp_support) |
1189 | DBG(dev, "HNP needs a different root port\n"); | 1190 | DBG(dev, "HNP needs a different root port\n"); |
1190 | value = printer_set_config(dev, wValue); | 1191 | value = printer_set_config(dev, wValue); |
1192 | if (!value) | ||
1193 | value = set_interface(dev, PRINTER_INTERFACE); | ||
1191 | break; | 1194 | break; |
1192 | case USB_REQ_GET_CONFIGURATION: | 1195 | case USB_REQ_GET_CONFIGURATION: |
1193 | if (ctrl->bRequestType != USB_DIR_IN) | 1196 | if (ctrl->bRequestType != USB_DIR_IN) |
@@ -1347,7 +1350,7 @@ printer_unbind(struct usb_gadget *gadget) | |||
1347 | set_gadget_data(gadget, NULL); | 1350 | set_gadget_data(gadget, NULL); |
1348 | } | 1351 | } |
1349 | 1352 | ||
1350 | static int __ref | 1353 | static int __init |
1351 | printer_bind(struct usb_gadget *gadget) | 1354 | printer_bind(struct usb_gadget *gadget) |
1352 | { | 1355 | { |
1353 | struct printer_dev *dev; | 1356 | struct printer_dev *dev; |
@@ -1543,7 +1546,6 @@ static struct usb_gadget_driver printer_driver = { | |||
1543 | .speed = DEVSPEED, | 1546 | .speed = DEVSPEED, |
1544 | 1547 | ||
1545 | .function = (char *) driver_desc, | 1548 | .function = (char *) driver_desc, |
1546 | .bind = printer_bind, | ||
1547 | .unbind = printer_unbind, | 1549 | .unbind = printer_unbind, |
1548 | 1550 | ||
1549 | .setup = printer_setup, | 1551 | .setup = printer_setup, |
@@ -1579,11 +1581,11 @@ init(void) | |||
1579 | return status; | 1581 | return status; |
1580 | } | 1582 | } |
1581 | 1583 | ||
1582 | status = usb_gadget_register_driver(&printer_driver); | 1584 | status = usb_gadget_probe_driver(&printer_driver, printer_bind); |
1583 | if (status) { | 1585 | if (status) { |
1584 | class_destroy(usb_gadget_class); | 1586 | class_destroy(usb_gadget_class); |
1585 | unregister_chrdev_region(g_printer_devno, 1); | 1587 | unregister_chrdev_region(g_printer_devno, 1); |
1586 | DBG(dev, "usb_gadget_register_driver %x\n", status); | 1588 | DBG(dev, "usb_gadget_probe_driver %x\n", status); |
1587 | } | 1589 | } |
1588 | 1590 | ||
1589 | return status; | 1591 | return status; |
@@ -1596,13 +1598,12 @@ cleanup(void) | |||
1596 | int status; | 1598 | int status; |
1597 | 1599 | ||
1598 | mutex_lock(&usb_printer_gadget.lock_printer_io); | 1600 | mutex_lock(&usb_printer_gadget.lock_printer_io); |
1599 | class_destroy(usb_gadget_class); | ||
1600 | unregister_chrdev_region(g_printer_devno, 2); | ||
1601 | |||
1602 | status = usb_gadget_unregister_driver(&printer_driver); | 1601 | status = usb_gadget_unregister_driver(&printer_driver); |
1603 | if (status) | 1602 | if (status) |
1604 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); | 1603 | ERROR(dev, "usb_gadget_unregister_driver %x\n", status); |
1605 | 1604 | ||
1605 | unregister_chrdev_region(g_printer_devno, 2); | ||
1606 | class_destroy(usb_gadget_class); | ||
1606 | mutex_unlock(&usb_printer_gadget.lock_printer_io); | 1607 | mutex_unlock(&usb_printer_gadget.lock_printer_io); |
1607 | } | 1608 | } |
1608 | module_exit(cleanup); | 1609 | module_exit(cleanup); |