aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r--drivers/usb/gadget/serial.c153
1 files changed, 79 insertions, 74 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index f5738eb8e765..f5c3896b1d95 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -89,9 +89,9 @@ static int debug = 1;
89#endif 89#endif
90 90
91#define gs_debug(format, arg...) \ 91#define gs_debug(format, arg...) \
92 do { if (debug) printk(KERN_DEBUG format, ## arg); } while(0) 92 do { if (debug) pr_debug(format, ## arg); } while (0)
93#define gs_debug_level(level, format, arg...) \ 93#define gs_debug_level(level, format, arg...) \
94 do { if (debug>=level) printk(KERN_DEBUG format, ## arg); } while(0) 94 do { if (debug >= level) pr_debug(format, ## arg); } while (0)
95 95
96 96
97/* Thanks to NetChip Technologies for donating this product ID. 97/* Thanks to NetChip Technologies for donating this product ID.
@@ -553,7 +553,8 @@ static int __init gs_module_init(void)
553 553
554 retval = usb_gadget_register_driver(&gs_gadget_driver); 554 retval = usb_gadget_register_driver(&gs_gadget_driver);
555 if (retval) { 555 if (retval) {
556 printk(KERN_ERR "gs_module_init: cannot register gadget driver, ret=%d\n", retval); 556 pr_err("gs_module_init: cannot register gadget driver, "
557 "ret=%d\n", retval);
557 return retval; 558 return retval;
558 } 559 }
559 560
@@ -579,11 +580,13 @@ static int __init gs_module_init(void)
579 if (retval) { 580 if (retval) {
580 usb_gadget_unregister_driver(&gs_gadget_driver); 581 usb_gadget_unregister_driver(&gs_gadget_driver);
581 put_tty_driver(gs_tty_driver); 582 put_tty_driver(gs_tty_driver);
582 printk(KERN_ERR "gs_module_init: cannot register tty driver, ret=%d\n", retval); 583 pr_err("gs_module_init: cannot register tty driver, "
584 "ret=%d\n", retval);
583 return retval; 585 return retval;
584 } 586 }
585 587
586 printk(KERN_INFO "gs_module_init: %s %s loaded\n", GS_LONG_NAME, GS_VERSION_STR); 588 pr_info("gs_module_init: %s %s loaded\n",
589 GS_LONG_NAME, GS_VERSION_STR);
587 return 0; 590 return 0;
588} 591}
589 592
@@ -598,7 +601,8 @@ static void __exit gs_module_exit(void)
598 put_tty_driver(gs_tty_driver); 601 put_tty_driver(gs_tty_driver);
599 usb_gadget_unregister_driver(&gs_gadget_driver); 602 usb_gadget_unregister_driver(&gs_gadget_driver);
600 603
601 printk(KERN_INFO "gs_module_exit: %s %s unloaded\n", GS_LONG_NAME, GS_VERSION_STR); 604 pr_info("gs_module_exit: %s %s unloaded\n",
605 GS_LONG_NAME, GS_VERSION_STR);
602} 606}
603 607
604/* TTY Driver */ 608/* TTY Driver */
@@ -621,7 +625,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
621 gs_debug("gs_open: (%d,%p,%p)\n", port_num, tty, file); 625 gs_debug("gs_open: (%d,%p,%p)\n", port_num, tty, file);
622 626
623 if (port_num < 0 || port_num >= GS_NUM_PORTS) { 627 if (port_num < 0 || port_num >= GS_NUM_PORTS) {
624 printk(KERN_ERR "gs_open: (%d,%p,%p) invalid port number\n", 628 pr_err("gs_open: (%d,%p,%p) invalid port number\n",
625 port_num, tty, file); 629 port_num, tty, file);
626 return -ENODEV; 630 return -ENODEV;
627 } 631 }
@@ -629,15 +633,14 @@ static int gs_open(struct tty_struct *tty, struct file *file)
629 dev = gs_device; 633 dev = gs_device;
630 634
631 if (dev == NULL) { 635 if (dev == NULL) {
632 printk(KERN_ERR "gs_open: (%d,%p,%p) NULL device pointer\n", 636 pr_err("gs_open: (%d,%p,%p) NULL device pointer\n",
633 port_num, tty, file); 637 port_num, tty, file);
634 return -ENODEV; 638 return -ENODEV;
635 } 639 }
636 640
637 mtx = &gs_open_close_lock[port_num]; 641 mtx = &gs_open_close_lock[port_num];
638 if (mutex_lock_interruptible(mtx)) { 642 if (mutex_lock_interruptible(mtx)) {
639 printk(KERN_ERR 643 pr_err("gs_open: (%d,%p,%p) interrupted waiting for mutex\n",
640 "gs_open: (%d,%p,%p) interrupted waiting for mutex\n",
641 port_num, tty, file); 644 port_num, tty, file);
642 return -ERESTARTSYS; 645 return -ERESTARTSYS;
643 } 646 }
@@ -645,8 +648,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
645 spin_lock_irqsave(&dev->dev_lock, flags); 648 spin_lock_irqsave(&dev->dev_lock, flags);
646 649
647 if (dev->dev_config == GS_NO_CONFIG_ID) { 650 if (dev->dev_config == GS_NO_CONFIG_ID) {
648 printk(KERN_ERR 651 pr_err("gs_open: (%d,%p,%p) device is not connected\n",
649 "gs_open: (%d,%p,%p) device is not connected\n",
650 port_num, tty, file); 652 port_num, tty, file);
651 ret = -ENODEV; 653 ret = -ENODEV;
652 goto exit_unlock_dev; 654 goto exit_unlock_dev;
@@ -655,7 +657,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
655 port = dev->dev_port[port_num]; 657 port = dev->dev_port[port_num];
656 658
657 if (port == NULL) { 659 if (port == NULL) {
658 printk(KERN_ERR "gs_open: (%d,%p,%p) NULL port pointer\n", 660 pr_err("gs_open: (%d,%p,%p) NULL port pointer\n",
659 port_num, tty, file); 661 port_num, tty, file);
660 ret = -ENODEV; 662 ret = -ENODEV;
661 goto exit_unlock_dev; 663 goto exit_unlock_dev;
@@ -665,7 +667,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
665 spin_unlock(&dev->dev_lock); 667 spin_unlock(&dev->dev_lock);
666 668
667 if (port->port_dev == NULL) { 669 if (port->port_dev == NULL) {
668 printk(KERN_ERR "gs_open: (%d,%p,%p) port disconnected (1)\n", 670 pr_err("gs_open: (%d,%p,%p) port disconnected (1)\n",
669 port_num, tty, file); 671 port_num, tty, file);
670 ret = -EIO; 672 ret = -EIO;
671 goto exit_unlock_port; 673 goto exit_unlock_port;
@@ -692,8 +694,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
692 694
693 /* might have been disconnected while asleep, check */ 695 /* might have been disconnected while asleep, check */
694 if (port->port_dev == NULL) { 696 if (port->port_dev == NULL) {
695 printk(KERN_ERR 697 pr_err("gs_open: (%d,%p,%p) port disconnected (2)\n",
696 "gs_open: (%d,%p,%p) port disconnected (2)\n",
697 port_num, tty, file); 698 port_num, tty, file);
698 port->port_in_use = 0; 699 port->port_in_use = 0;
699 ret = -EIO; 700 ret = -EIO;
@@ -701,7 +702,8 @@ static int gs_open(struct tty_struct *tty, struct file *file)
701 } 702 }
702 703
703 if ((port->port_write_buf=buf) == NULL) { 704 if ((port->port_write_buf=buf) == NULL) {
704 printk(KERN_ERR "gs_open: (%d,%p,%p) cannot allocate port write buffer\n", 705 pr_err("gs_open: (%d,%p,%p) cannot allocate "
706 "port write buffer\n",
705 port_num, tty, file); 707 port_num, tty, file);
706 port->port_in_use = 0; 708 port->port_in_use = 0;
707 ret = -ENOMEM; 709 ret = -ENOMEM;
@@ -714,7 +716,7 @@ static int gs_open(struct tty_struct *tty, struct file *file)
714 716
715 /* might have been disconnected while asleep, check */ 717 /* might have been disconnected while asleep, check */
716 if (port->port_dev == NULL) { 718 if (port->port_dev == NULL) {
717 printk(KERN_ERR "gs_open: (%d,%p,%p) port disconnected (3)\n", 719 pr_err("gs_open: (%d,%p,%p) port disconnected (3)\n",
718 port_num, tty, file); 720 port_num, tty, file);
719 port->port_in_use = 0; 721 port->port_in_use = 0;
720 ret = -EIO; 722 ret = -EIO;
@@ -762,7 +764,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
762 struct mutex *mtx; 764 struct mutex *mtx;
763 765
764 if (port == NULL) { 766 if (port == NULL) {
765 printk(KERN_ERR "gs_close: NULL port pointer\n"); 767 pr_err("gs_close: NULL port pointer\n");
766 return; 768 return;
767 } 769 }
768 770
@@ -774,8 +776,7 @@ static void gs_close(struct tty_struct *tty, struct file *file)
774 spin_lock_irq(&port->port_lock); 776 spin_lock_irq(&port->port_lock);
775 777
776 if (port->port_open_count == 0) { 778 if (port->port_open_count == 0) {
777 printk(KERN_ERR 779 pr_err("gs_close: (%d,%p,%p) port is already closed\n",
778 "gs_close: (%d,%p,%p) port is already closed\n",
779 port->port_num, tty, file); 780 port->port_num, tty, file);
780 goto exit; 781 goto exit;
781 } 782 }
@@ -837,7 +838,7 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
837 int ret; 838 int ret;
838 839
839 if (port == NULL) { 840 if (port == NULL) {
840 printk(KERN_ERR "gs_write: NULL port pointer\n"); 841 pr_err("gs_write: NULL port pointer\n");
841 return -EIO; 842 return -EIO;
842 } 843 }
843 844
@@ -850,14 +851,14 @@ static int gs_write(struct tty_struct *tty, const unsigned char *buf, int count)
850 spin_lock_irqsave(&port->port_lock, flags); 851 spin_lock_irqsave(&port->port_lock, flags);
851 852
852 if (port->port_dev == NULL) { 853 if (port->port_dev == NULL) {
853 printk(KERN_ERR "gs_write: (%d,%p) port is not connected\n", 854 pr_err("gs_write: (%d,%p) port is not connected\n",
854 port->port_num, tty); 855 port->port_num, tty);
855 ret = -EIO; 856 ret = -EIO;
856 goto exit; 857 goto exit;
857 } 858 }
858 859
859 if (port->port_open_count == 0) { 860 if (port->port_open_count == 0) {
860 printk(KERN_ERR "gs_write: (%d,%p) port is closed\n", 861 pr_err("gs_write: (%d,%p) port is closed\n",
861 port->port_num, tty); 862 port->port_num, tty);
862 ret = -EBADF; 863 ret = -EBADF;
863 goto exit; 864 goto exit;
@@ -888,7 +889,7 @@ static void gs_put_char(struct tty_struct *tty, unsigned char ch)
888 struct gs_port *port = tty->driver_data; 889 struct gs_port *port = tty->driver_data;
889 890
890 if (port == NULL) { 891 if (port == NULL) {
891 printk(KERN_ERR "gs_put_char: NULL port pointer\n"); 892 pr_err("gs_put_char: NULL port pointer\n");
892 return; 893 return;
893 } 894 }
894 895
@@ -898,13 +899,13 @@ static void gs_put_char(struct tty_struct *tty, unsigned char ch)
898 spin_lock_irqsave(&port->port_lock, flags); 899 spin_lock_irqsave(&port->port_lock, flags);
899 900
900 if (port->port_dev == NULL) { 901 if (port->port_dev == NULL) {
901 printk(KERN_ERR "gs_put_char: (%d,%p) port is not connected\n", 902 pr_err("gs_put_char: (%d,%p) port is not connected\n",
902 port->port_num, tty); 903 port->port_num, tty);
903 goto exit; 904 goto exit;
904 } 905 }
905 906
906 if (port->port_open_count == 0) { 907 if (port->port_open_count == 0) {
907 printk(KERN_ERR "gs_put_char: (%d,%p) port is closed\n", 908 pr_err("gs_put_char: (%d,%p) port is closed\n",
908 port->port_num, tty); 909 port->port_num, tty);
909 goto exit; 910 goto exit;
910 } 911 }
@@ -924,7 +925,7 @@ static void gs_flush_chars(struct tty_struct *tty)
924 struct gs_port *port = tty->driver_data; 925 struct gs_port *port = tty->driver_data;
925 926
926 if (port == NULL) { 927 if (port == NULL) {
927 printk(KERN_ERR "gs_flush_chars: NULL port pointer\n"); 928 pr_err("gs_flush_chars: NULL port pointer\n");
928 return; 929 return;
929 } 930 }
930 931
@@ -933,14 +934,13 @@ static void gs_flush_chars(struct tty_struct *tty)
933 spin_lock_irqsave(&port->port_lock, flags); 934 spin_lock_irqsave(&port->port_lock, flags);
934 935
935 if (port->port_dev == NULL) { 936 if (port->port_dev == NULL) {
936 printk(KERN_ERR 937 pr_err("gs_flush_chars: (%d,%p) port is not connected\n",
937 "gs_flush_chars: (%d,%p) port is not connected\n",
938 port->port_num, tty); 938 port->port_num, tty);
939 goto exit; 939 goto exit;
940 } 940 }
941 941
942 if (port->port_open_count == 0) { 942 if (port->port_open_count == 0) {
943 printk(KERN_ERR "gs_flush_chars: (%d,%p) port is closed\n", 943 pr_err("gs_flush_chars: (%d,%p) port is closed\n",
944 port->port_num, tty); 944 port->port_num, tty);
945 goto exit; 945 goto exit;
946 } 946 }
@@ -1038,7 +1038,7 @@ static int gs_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd,
1038 struct gs_port *port = tty->driver_data; 1038 struct gs_port *port = tty->driver_data;
1039 1039
1040 if (port == NULL) { 1040 if (port == NULL) {
1041 printk(KERN_ERR "gs_ioctl: NULL port pointer\n"); 1041 pr_err("gs_ioctl: NULL port pointer\n");
1042 return -EIO; 1042 return -EIO;
1043 } 1043 }
1044 1044
@@ -1076,7 +1076,7 @@ static int gs_send(struct gs_dev *dev)
1076 struct gs_req_entry *req_entry; 1076 struct gs_req_entry *req_entry;
1077 1077
1078 if (dev == NULL) { 1078 if (dev == NULL) {
1079 printk(KERN_ERR "gs_send: NULL device pointer\n"); 1079 pr_err("gs_send: NULL device pointer\n");
1080 return -ENODEV; 1080 return -ENODEV;
1081 } 1081 }
1082 1082
@@ -1103,7 +1103,7 @@ static int gs_send(struct gs_dev *dev)
1103 req->length = len; 1103 req->length = len;
1104 spin_unlock_irqrestore(&dev->dev_lock, flags); 1104 spin_unlock_irqrestore(&dev->dev_lock, flags);
1105 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) { 1105 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) {
1106 printk(KERN_ERR 1106 pr_err(
1107 "gs_send: cannot queue read request, ret=%d\n", 1107 "gs_send: cannot queue read request, ret=%d\n",
1108 ret); 1108 ret);
1109 spin_lock_irqsave(&dev->dev_lock, flags); 1109 spin_lock_irqsave(&dev->dev_lock, flags);
@@ -1144,9 +1144,7 @@ static int gs_send_packet(struct gs_dev *dev, char *packet, unsigned int size)
1144 port = dev->dev_port[0]; 1144 port = dev->dev_port[0];
1145 1145
1146 if (port == NULL) { 1146 if (port == NULL) {
1147 printk(KERN_ERR 1147 pr_err("gs_send_packet: port=%d, NULL port pointer\n", 0);
1148 "gs_send_packet: port=%d, NULL port pointer\n",
1149 0);
1150 return -EIO; 1148 return -EIO;
1151 } 1149 }
1152 1150
@@ -1193,7 +1191,7 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size)
1193 port = dev->dev_port[0]; 1191 port = dev->dev_port[0];
1194 1192
1195 if (port == NULL) { 1193 if (port == NULL) {
1196 printk(KERN_ERR "gs_recv_packet: port=%d, NULL port pointer\n", 1194 pr_err("gs_recv_packet: port=%d, NULL port pointer\n",
1197 port->port_num); 1195 port->port_num);
1198 return -EIO; 1196 return -EIO;
1199 } 1197 }
@@ -1201,7 +1199,7 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size)
1201 spin_lock(&port->port_lock); 1199 spin_lock(&port->port_lock);
1202 1200
1203 if (port->port_open_count == 0) { 1201 if (port->port_open_count == 0) {
1204 printk(KERN_ERR "gs_recv_packet: port=%d, port is closed\n", 1202 pr_err("gs_recv_packet: port=%d, port is closed\n",
1205 port->port_num); 1203 port->port_num);
1206 ret = -EIO; 1204 ret = -EIO;
1207 goto exit; 1205 goto exit;
@@ -1211,14 +1209,14 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size)
1211 tty = port->port_tty; 1209 tty = port->port_tty;
1212 1210
1213 if (tty == NULL) { 1211 if (tty == NULL) {
1214 printk(KERN_ERR "gs_recv_packet: port=%d, NULL tty pointer\n", 1212 pr_err("gs_recv_packet: port=%d, NULL tty pointer\n",
1215 port->port_num); 1213 port->port_num);
1216 ret = -EIO; 1214 ret = -EIO;
1217 goto exit; 1215 goto exit;
1218 } 1216 }
1219 1217
1220 if (port->port_tty->magic != TTY_MAGIC) { 1218 if (port->port_tty->magic != TTY_MAGIC) {
1221 printk(KERN_ERR "gs_recv_packet: port=%d, bad tty magic\n", 1219 pr_err("gs_recv_packet: port=%d, bad tty magic\n",
1222 port->port_num); 1220 port->port_num);
1223 ret = -EIO; 1221 ret = -EIO;
1224 goto exit; 1222 goto exit;
@@ -1245,7 +1243,7 @@ static void gs_read_complete(struct usb_ep *ep, struct usb_request *req)
1245 struct gs_dev *dev = ep->driver_data; 1243 struct gs_dev *dev = ep->driver_data;
1246 1244
1247 if (dev == NULL) { 1245 if (dev == NULL) {
1248 printk(KERN_ERR "gs_read_complete: NULL device pointer\n"); 1246 pr_err("gs_read_complete: NULL device pointer\n");
1249 return; 1247 return;
1250 } 1248 }
1251 1249
@@ -1256,7 +1254,7 @@ static void gs_read_complete(struct usb_ep *ep, struct usb_request *req)
1256requeue: 1254requeue:
1257 req->length = ep->maxpacket; 1255 req->length = ep->maxpacket;
1258 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) { 1256 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) {
1259 printk(KERN_ERR 1257 pr_err(
1260 "gs_read_complete: cannot queue read request, ret=%d\n", 1258 "gs_read_complete: cannot queue read request, ret=%d\n",
1261 ret); 1259 ret);
1262 } 1260 }
@@ -1270,7 +1268,7 @@ requeue:
1270 1268
1271 default: 1269 default:
1272 /* unexpected */ 1270 /* unexpected */
1273 printk(KERN_ERR 1271 pr_err(
1274 "gs_read_complete: unexpected status error, status=%d\n", 1272 "gs_read_complete: unexpected status error, status=%d\n",
1275 req->status); 1273 req->status);
1276 goto requeue; 1274 goto requeue;
@@ -1287,7 +1285,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
1287 struct gs_req_entry *gs_req = req->context; 1285 struct gs_req_entry *gs_req = req->context;
1288 1286
1289 if (dev == NULL) { 1287 if (dev == NULL) {
1290 printk(KERN_ERR "gs_write_complete: NULL device pointer\n"); 1288 pr_err("gs_write_complete: NULL device pointer\n");
1291 return; 1289 return;
1292 } 1290 }
1293 1291
@@ -1296,8 +1294,7 @@ static void gs_write_complete(struct usb_ep *ep, struct usb_request *req)
1296 /* normal completion */ 1294 /* normal completion */
1297requeue: 1295requeue:
1298 if (gs_req == NULL) { 1296 if (gs_req == NULL) {
1299 printk(KERN_ERR 1297 pr_err("gs_write_complete: NULL request pointer\n");
1300 "gs_write_complete: NULL request pointer\n");
1301 return; 1298 return;
1302 } 1299 }
1303 1300
@@ -1316,7 +1313,7 @@ requeue:
1316 break; 1313 break;
1317 1314
1318 default: 1315 default:
1319 printk(KERN_ERR 1316 pr_err(
1320 "gs_write_complete: unexpected status error, status=%d\n", 1317 "gs_write_complete: unexpected status error, status=%d\n",
1321 req->status); 1318 req->status);
1322 goto requeue; 1319 goto requeue;
@@ -1351,7 +1348,7 @@ static int __init gs_bind(struct usb_gadget *gadget)
1351 gs_device_desc.bcdDevice = 1348 gs_device_desc.bcdDevice =
1352 cpu_to_le16(GS_VERSION_NUM | gcnum); 1349 cpu_to_le16(GS_VERSION_NUM | gcnum);
1353 else { 1350 else {
1354 printk(KERN_WARNING "gs_bind: controller '%s' not recognized\n", 1351 pr_warning("gs_bind: controller '%s' not recognized\n",
1355 gadget->name); 1352 gadget->name);
1356 /* unrecognized, but safe unless bulk is REALLY quirky */ 1353 /* unrecognized, but safe unless bulk is REALLY quirky */
1357 gs_device_desc.bcdDevice = 1354 gs_device_desc.bcdDevice =
@@ -1375,7 +1372,7 @@ static int __init gs_bind(struct usb_gadget *gadget)
1375 if (use_acm) { 1372 if (use_acm) {
1376 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc); 1373 ep = usb_ep_autoconfig(gadget, &gs_fullspeed_notify_desc);
1377 if (!ep) { 1374 if (!ep) {
1378 printk(KERN_ERR "gs_bind: cannot run ACM on %s\n", gadget->name); 1375 pr_err("gs_bind: cannot run ACM on %s\n", gadget->name);
1379 goto autoconf_fail; 1376 goto autoconf_fail;
1380 } 1377 }
1381 gs_device_desc.idProduct = __constant_cpu_to_le16( 1378 gs_device_desc.idProduct = __constant_cpu_to_le16(
@@ -1425,7 +1422,7 @@ static int __init gs_bind(struct usb_gadget *gadget)
1425 set_gadget_data(gadget, dev); 1422 set_gadget_data(gadget, dev);
1426 1423
1427 if ((ret=gs_alloc_ports(dev, GFP_KERNEL)) != 0) { 1424 if ((ret=gs_alloc_ports(dev, GFP_KERNEL)) != 0) {
1428 printk(KERN_ERR "gs_bind: cannot allocate ports\n"); 1425 pr_err("gs_bind: cannot allocate ports\n");
1429 gs_unbind(gadget); 1426 gs_unbind(gadget);
1430 return ret; 1427 return ret;
1431 } 1428 }
@@ -1441,13 +1438,13 @@ static int __init gs_bind(struct usb_gadget *gadget)
1441 1438
1442 gadget->ep0->driver_data = dev; 1439 gadget->ep0->driver_data = dev;
1443 1440
1444 printk(KERN_INFO "gs_bind: %s %s bound\n", 1441 pr_info("gs_bind: %s %s bound\n",
1445 GS_LONG_NAME, GS_VERSION_STR); 1442 GS_LONG_NAME, GS_VERSION_STR);
1446 1443
1447 return 0; 1444 return 0;
1448 1445
1449autoconf_fail: 1446autoconf_fail:
1450 printk(KERN_ERR "gs_bind: cannot autoconfigure on %s\n", gadget->name); 1447 pr_err("gs_bind: cannot autoconfigure on %s\n", gadget->name);
1451 return -ENODEV; 1448 return -ENODEV;
1452} 1449}
1453 1450
@@ -1480,7 +1477,7 @@ static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget)
1480 set_gadget_data(gadget, NULL); 1477 set_gadget_data(gadget, NULL);
1481 } 1478 }
1482 1479
1483 printk(KERN_INFO "gs_unbind: %s %s unbound\n", GS_LONG_NAME, 1480 pr_info("gs_unbind: %s %s unbound\n", GS_LONG_NAME,
1484 GS_VERSION_STR); 1481 GS_VERSION_STR);
1485} 1482}
1486 1483
@@ -1513,7 +1510,8 @@ static int gs_setup(struct usb_gadget *gadget,
1513 break; 1510 break;
1514 1511
1515 default: 1512 default:
1516 printk(KERN_ERR "gs_setup: unknown request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n", 1513 pr_err("gs_setup: unknown request, type=%02x, request=%02x, "
1514 "value=%04x, index=%04x, length=%d\n",
1517 ctrl->bRequestType, ctrl->bRequest, 1515 ctrl->bRequestType, ctrl->bRequest,
1518 wValue, wIndex, wLength); 1516 wValue, wIndex, wLength);
1519 break; 1517 break;
@@ -1526,7 +1524,7 @@ static int gs_setup(struct usb_gadget *gadget,
1526 && (ret % gadget->ep0->maxpacket) == 0; 1524 && (ret % gadget->ep0->maxpacket) == 0;
1527 ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC); 1525 ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
1528 if (ret < 0) { 1526 if (ret < 0) {
1529 printk(KERN_ERR "gs_setup: cannot queue response, ret=%d\n", 1527 pr_err("gs_setup: cannot queue response, ret=%d\n",
1530 ret); 1528 ret);
1531 req->status = 0; 1529 req->status = 0;
1532 gs_setup_complete(gadget->ep0, req); 1530 gs_setup_complete(gadget->ep0, req);
@@ -1656,7 +1654,8 @@ set_interface_done:
1656 break; 1654 break;
1657 1655
1658 default: 1656 default:
1659 printk(KERN_ERR "gs_setup: unknown standard request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n", 1657 pr_err("gs_setup: unknown standard request, type=%02x, "
1658 "request=%02x, value=%04x, index=%04x, length=%d\n",
1660 ctrl->bRequestType, ctrl->bRequest, 1659 ctrl->bRequestType, ctrl->bRequest,
1661 wValue, wIndex, wLength); 1660 wValue, wIndex, wLength);
1662 break; 1661 break;
@@ -1682,7 +1681,7 @@ static int gs_setup_class(struct usb_gadget *gadget,
1682 * handler copy that data to port->port_line_coding (iff 1681 * handler copy that data to port->port_line_coding (iff
1683 * it's valid) and maybe pass it on. Until then, fail. 1682 * it's valid) and maybe pass it on. Until then, fail.
1684 */ 1683 */
1685 printk(KERN_WARNING "gs_setup: set_line_coding " 1684 pr_warning("gs_setup: set_line_coding "
1686 "unuspported\n"); 1685 "unuspported\n");
1687 break; 1686 break;
1688 1687
@@ -1702,12 +1701,12 @@ static int gs_setup_class(struct usb_gadget *gadget,
1702 * handler use that to set the state (iff it's valid) and 1701 * handler use that to set the state (iff it's valid) and
1703 * maybe pass it on. Until then, fail. 1702 * maybe pass it on. Until then, fail.
1704 */ 1703 */
1705 printk(KERN_WARNING "gs_setup: set_control_line_state " 1704 pr_warning("gs_setup: set_control_line_state "
1706 "unuspported\n"); 1705 "unuspported\n");
1707 break; 1706 break;
1708 1707
1709 default: 1708 default:
1710 printk(KERN_ERR "gs_setup: unknown class request, " 1709 pr_err("gs_setup: unknown class request, "
1711 "type=%02x, request=%02x, value=%04x, " 1710 "type=%02x, request=%02x, value=%04x, "
1712 "index=%04x, length=%d\n", 1711 "index=%04x, length=%d\n",
1713 ctrl->bRequestType, ctrl->bRequest, 1712 ctrl->bRequestType, ctrl->bRequest,
@@ -1724,7 +1723,8 @@ static int gs_setup_class(struct usb_gadget *gadget,
1724static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req) 1723static void gs_setup_complete(struct usb_ep *ep, struct usb_request *req)
1725{ 1724{
1726 if (req->status || req->actual != req->length) { 1725 if (req->status || req->actual != req->length) {
1727 printk(KERN_ERR "gs_setup_complete: status error, status=%d, actual=%d, length=%d\n", 1726 pr_err("gs_setup_complete: status error, status=%d, "
1727 "actual=%d, length=%d\n",
1728 req->status, req->actual, req->length); 1728 req->status, req->actual, req->length);
1729 } 1729 }
1730} 1730}
@@ -1751,11 +1751,11 @@ static void gs_disconnect(struct usb_gadget *gadget)
1751 1751
1752 /* re-allocate ports for the next connection */ 1752 /* re-allocate ports for the next connection */
1753 if (gs_alloc_ports(dev, GFP_ATOMIC) != 0) 1753 if (gs_alloc_ports(dev, GFP_ATOMIC) != 0)
1754 printk(KERN_ERR "gs_disconnect: cannot re-allocate ports\n"); 1754 pr_err("gs_disconnect: cannot re-allocate ports\n");
1755 1755
1756 spin_unlock_irqrestore(&dev->dev_lock, flags); 1756 spin_unlock_irqrestore(&dev->dev_lock, flags);
1757 1757
1758 printk(KERN_INFO "gs_disconnect: %s disconnected\n", GS_LONG_NAME); 1758 pr_info("gs_disconnect: %s disconnected\n", GS_LONG_NAME);
1759} 1759}
1760 1760
1761/* 1761/*
@@ -1778,7 +1778,7 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1778 struct gs_req_entry *req_entry; 1778 struct gs_req_entry *req_entry;
1779 1779
1780 if (dev == NULL) { 1780 if (dev == NULL) {
1781 printk(KERN_ERR "gs_set_config: NULL device pointer\n"); 1781 pr_err("gs_set_config: NULL device pointer\n");
1782 return 0; 1782 return 0;
1783 } 1783 }
1784 1784
@@ -1823,7 +1823,8 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1823 dev->dev_notify_ep = ep; 1823 dev->dev_notify_ep = ep;
1824 dev->dev_notify_ep_desc = ep_desc; 1824 dev->dev_notify_ep_desc = ep_desc;
1825 } else { 1825 } else {
1826 printk(KERN_ERR "gs_set_config: cannot enable notify endpoint %s, ret=%d\n", 1826 pr_err("gs_set_config: cannot enable NOTIFY "
1827 "endpoint %s, ret=%d\n",
1827 ep->name, ret); 1828 ep->name, ret);
1828 goto exit_reset_config; 1829 goto exit_reset_config;
1829 } 1830 }
@@ -1839,7 +1840,8 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1839 dev->dev_in_ep = ep; 1840 dev->dev_in_ep = ep;
1840 dev->dev_in_ep_desc = ep_desc; 1841 dev->dev_in_ep_desc = ep_desc;
1841 } else { 1842 } else {
1842 printk(KERN_ERR "gs_set_config: cannot enable in endpoint %s, ret=%d\n", 1843 pr_err("gs_set_config: cannot enable IN "
1844 "endpoint %s, ret=%d\n",
1843 ep->name, ret); 1845 ep->name, ret);
1844 goto exit_reset_config; 1846 goto exit_reset_config;
1845 } 1847 }
@@ -1855,7 +1857,8 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1855 dev->dev_out_ep = ep; 1857 dev->dev_out_ep = ep;
1856 dev->dev_out_ep_desc = ep_desc; 1858 dev->dev_out_ep_desc = ep_desc;
1857 } else { 1859 } else {
1858 printk(KERN_ERR "gs_set_config: cannot enable out endpoint %s, ret=%d\n", 1860 pr_err("gs_set_config: cannot enable OUT "
1861 "endpoint %s, ret=%d\n",
1859 ep->name, ret); 1862 ep->name, ret);
1860 goto exit_reset_config; 1863 goto exit_reset_config;
1861 } 1864 }
@@ -1865,7 +1868,7 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1865 1868
1866 if (dev->dev_in_ep == NULL || dev->dev_out_ep == NULL 1869 if (dev->dev_in_ep == NULL || dev->dev_out_ep == NULL
1867 || (config != GS_BULK_CONFIG_ID && dev->dev_notify_ep == NULL)) { 1870 || (config != GS_BULK_CONFIG_ID && dev->dev_notify_ep == NULL)) {
1868 printk(KERN_ERR "gs_set_config: cannot find endpoints\n"); 1871 pr_err("gs_set_config: cannot find endpoints\n");
1869 ret = -ENODEV; 1872 ret = -ENODEV;
1870 goto exit_reset_config; 1873 goto exit_reset_config;
1871 } 1874 }
@@ -1876,11 +1879,12 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1876 if ((req=gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC))) { 1879 if ((req=gs_alloc_req(ep, ep->maxpacket, GFP_ATOMIC))) {
1877 req->complete = gs_read_complete; 1880 req->complete = gs_read_complete;
1878 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) { 1881 if ((ret=usb_ep_queue(ep, req, GFP_ATOMIC))) {
1879 printk(KERN_ERR "gs_set_config: cannot queue read request, ret=%d\n", 1882 pr_err("gs_set_config: cannot queue read "
1880 ret); 1883 "request, ret=%d\n", ret);
1881 } 1884 }
1882 } else { 1885 } else {
1883 printk(KERN_ERR "gs_set_config: cannot allocate read requests\n"); 1886 pr_err("gs_set_config: cannot allocate "
1887 "read requests\n");
1884 ret = -ENOMEM; 1888 ret = -ENOMEM;
1885 goto exit_reset_config; 1889 goto exit_reset_config;
1886 } 1890 }
@@ -1893,13 +1897,14 @@ static int gs_set_config(struct gs_dev *dev, unsigned config)
1893 req_entry->re_req->complete = gs_write_complete; 1897 req_entry->re_req->complete = gs_write_complete;
1894 list_add(&req_entry->re_entry, &dev->dev_req_list); 1898 list_add(&req_entry->re_entry, &dev->dev_req_list);
1895 } else { 1899 } else {
1896 printk(KERN_ERR "gs_set_config: cannot allocate write requests\n"); 1900 pr_err("gs_set_config: cannot allocate "
1901 "write requests\n");
1897 ret = -ENOMEM; 1902 ret = -ENOMEM;
1898 goto exit_reset_config; 1903 goto exit_reset_config;
1899 } 1904 }
1900 } 1905 }
1901 1906
1902 printk(KERN_INFO "gs_set_config: %s configured, %s speed %s config\n", 1907 pr_info("gs_set_config: %s configured, %s speed %s config\n",
1903 GS_LONG_NAME, 1908 GS_LONG_NAME,
1904 gadget->speed == USB_SPEED_HIGH ? "high" : "full", 1909 gadget->speed == USB_SPEED_HIGH ? "high" : "full",
1905 config == GS_BULK_CONFIG_ID ? "BULK" : "CDC-ACM"); 1910 config == GS_BULK_CONFIG_ID ? "BULK" : "CDC-ACM");
@@ -1926,7 +1931,7 @@ static void gs_reset_config(struct gs_dev *dev)
1926 struct gs_req_entry *req_entry; 1931 struct gs_req_entry *req_entry;
1927 1932
1928 if (dev == NULL) { 1933 if (dev == NULL) {
1929 printk(KERN_ERR "gs_reset_config: NULL device pointer\n"); 1934 pr_err("gs_reset_config: NULL device pointer\n");
1930 return; 1935 return;
1931 } 1936 }
1932 1937