aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-14 18:08:33 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-14 18:08:33 -0400
commit9eecf8085473c9bbe77d35ee84928696185cceed (patch)
treed7f618160d4630af9319bc80ade45c2cab4d7c8e /drivers/usb/serial
parent4a770ccaae1fd2ecad9dcc3f7942d3b163ecf362 (diff)
USB: serial: mos7720.c: remove dbg() usage
dbg() was a very old USB-serial-specific macro. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Johan Hovold <jhovold@gmail.com> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Alan Stern <stern@rowland.harvard.edu> CC: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/mos7720.c220
1 files changed, 79 insertions, 141 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 9817d9d654c1..192191ca1d37 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -283,14 +283,17 @@ static void send_deferred_urbs(unsigned long _mos_parport)
283 struct mos7715_parport *mos_parport = (void *)_mos_parport; 283 struct mos7715_parport *mos_parport = (void *)_mos_parport;
284 struct urbtracker *urbtrack, *tmp; 284 struct urbtracker *urbtrack, *tmp;
285 struct list_head *cursor, *next; 285 struct list_head *cursor, *next;
286 struct device *dev;
286 287
287 /* if release function ran, game over */ 288 /* if release function ran, game over */
288 if (unlikely(mos_parport->serial == NULL)) 289 if (unlikely(mos_parport->serial == NULL))
289 return; 290 return;
290 291
292 dev = &mos_parport->serial->dev->dev;
293
291 /* try again to get the mutex */ 294 /* try again to get the mutex */
292 if (!mutex_trylock(&mos_parport->serial->disc_mutex)) { 295 if (!mutex_trylock(&mos_parport->serial->disc_mutex)) {
293 dbg("%s: rescheduling tasklet", __func__); 296 dev_dbg(dev, "%s: rescheduling tasklet\n", __func__);
294 tasklet_schedule(&mos_parport->urb_tasklet); 297 tasklet_schedule(&mos_parport->urb_tasklet);
295 return; 298 return;
296 } 299 }
@@ -305,7 +308,7 @@ static void send_deferred_urbs(unsigned long _mos_parport)
305 if (list_empty(&mos_parport->deferred_urbs)) { 308 if (list_empty(&mos_parport->deferred_urbs)) {
306 spin_unlock_irqrestore(&mos_parport->listlock, flags); 309 spin_unlock_irqrestore(&mos_parport->listlock, flags);
307 mutex_unlock(&mos_parport->serial->disc_mutex); 310 mutex_unlock(&mos_parport->serial->disc_mutex);
308 dbg("%s: deferred_urbs list empty", __func__); 311 dev_dbg(dev, "%s: deferred_urbs list empty\n", __func__);
309 return; 312 return;
310 } 313 }
311 314
@@ -315,10 +318,9 @@ static void send_deferred_urbs(unsigned long _mos_parport)
315 list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs, 318 list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs,
316 urblist_entry) { 319 urblist_entry) {
317 ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC); 320 ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC);
318 dbg("%s: urb submitted", __func__); 321 dev_dbg(dev, "%s: urb submitted\n", __func__);
319 if (ret_val) { 322 if (ret_val) {
320 dev_err(&mos_parport->serial->dev->dev, 323 dev_err(dev, "usb_submit_urb() failed: %d\n", ret_val);
321 "usb_submit_urb() failed: %d", ret_val);
322 list_del(&urbtrack->urblist_entry); 324 list_del(&urbtrack->urblist_entry);
323 kref_put(&urbtrack->ref_count, destroy_urbtracker); 325 kref_put(&urbtrack->ref_count, destroy_urbtracker);
324 } 326 }
@@ -334,7 +336,7 @@ static void async_complete(struct urb *urb)
334 int status = urb->status; 336 int status = urb->status;
335 337
336 if (unlikely(status)) 338 if (unlikely(status))
337 dbg("%s - nonzero urb status received: %d", __func__, status); 339 dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
338 340
339 /* remove the urbtracker from the active_urbs list */ 341 /* remove the urbtracker from the active_urbs list */
340 spin_lock(&urbtrack->mos_parport->listlock); 342 spin_lock(&urbtrack->mos_parport->listlock);
@@ -389,7 +391,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
389 &mos_parport->deferred_urbs); 391 &mos_parport->deferred_urbs);
390 spin_unlock_irqrestore(&mos_parport->listlock, flags); 392 spin_unlock_irqrestore(&mos_parport->listlock, flags);
391 tasklet_schedule(&mos_parport->urb_tasklet); 393 tasklet_schedule(&mos_parport->urb_tasklet);
392 dbg("tasklet scheduled"); 394 dev_dbg(&usbdev->dev, "tasklet scheduled");
393 return 0; 395 return 0;
394 } 396 }
395 397
@@ -690,7 +692,7 @@ static int mos7715_parport_init(struct usb_serial *serial)
690 /* allocate and initialize parallel port control struct */ 692 /* allocate and initialize parallel port control struct */
691 mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL); 693 mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
692 if (mos_parport == NULL) { 694 if (mos_parport == NULL) {
693 dbg("mos7715_parport_init: kzalloc failed"); 695 dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
694 return -ENOMEM; 696 return -ENOMEM;
695 } 697 }
696 mos_parport->msg_pending = false; 698 mos_parport->msg_pending = false;
@@ -743,6 +745,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
743 int result; 745 int result;
744 int length; 746 int length;
745 int status = urb->status; 747 int status = urb->status;
748 struct device *dev = &urb->dev->dev;
746 __u8 *data; 749 __u8 *data;
747 __u8 sp1; 750 __u8 sp1;
748 __u8 sp2; 751 __u8 sp2;
@@ -755,12 +758,10 @@ static void mos7720_interrupt_callback(struct urb *urb)
755 case -ENOENT: 758 case -ENOENT:
756 case -ESHUTDOWN: 759 case -ESHUTDOWN:
757 /* this urb is terminated, clean up */ 760 /* this urb is terminated, clean up */
758 dbg("%s - urb shutting down with status: %d", __func__, 761 dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
759 status);
760 return; 762 return;
761 default: 763 default:
762 dbg("%s - nonzero urb status received: %d", __func__, 764 dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
763 status);
764 goto exit; 765 goto exit;
765 } 766 }
766 767
@@ -777,7 +778,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
777 * oneukum 2007-03-14 */ 778 * oneukum 2007-03-14 */
778 779
779 if (unlikely(length != 4)) { 780 if (unlikely(length != 4)) {
780 dbg("Wrong data !!!"); 781 dev_dbg(dev, "Wrong data !!!\n");
781 return; 782 return;
782 } 783 }
783 784
@@ -786,31 +787,29 @@ static void mos7720_interrupt_callback(struct urb *urb)
786 787
787 if ((sp1 | sp2) & 0x01) { 788 if ((sp1 | sp2) & 0x01) {
788 /* No Interrupt Pending in both the ports */ 789 /* No Interrupt Pending in both the ports */
789 dbg("No Interrupt !!!"); 790 dev_dbg(dev, "No Interrupt !!!\n");
790 } else { 791 } else {
791 switch (sp1 & 0x0f) { 792 switch (sp1 & 0x0f) {
792 case SERIAL_IIR_RLS: 793 case SERIAL_IIR_RLS:
793 dbg("Serial Port 1: Receiver status error or address " 794 dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n");
794 "bit detected in 9-bit mode\n");
795 break; 795 break;
796 case SERIAL_IIR_CTI: 796 case SERIAL_IIR_CTI:
797 dbg("Serial Port 1: Receiver time out"); 797 dev_dbg(dev, "Serial Port 1: Receiver time out\n");
798 break; 798 break;
799 case SERIAL_IIR_MS: 799 case SERIAL_IIR_MS:
800 /* dbg("Serial Port 1: Modem status change"); */ 800 /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */
801 break; 801 break;
802 } 802 }
803 803
804 switch (sp2 & 0x0f) { 804 switch (sp2 & 0x0f) {
805 case SERIAL_IIR_RLS: 805 case SERIAL_IIR_RLS:
806 dbg("Serial Port 2: Receiver status error or address " 806 dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n");
807 "bit detected in 9-bit mode");
808 break; 807 break;
809 case SERIAL_IIR_CTI: 808 case SERIAL_IIR_CTI:
810 dbg("Serial Port 2: Receiver time out"); 809 dev_dbg(dev, "Serial Port 2: Receiver time out\n");
811 break; 810 break;
812 case SERIAL_IIR_MS: 811 case SERIAL_IIR_MS:
813 /* dbg("Serial Port 2: Modem status change"); */ 812 /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */
814 break; 813 break;
815 } 814 }
816 } 815 }
@@ -818,9 +817,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
818exit: 817exit:
819 result = usb_submit_urb(urb, GFP_ATOMIC); 818 result = usb_submit_urb(urb, GFP_ATOMIC);
820 if (result) 819 if (result)
821 dev_err(&urb->dev->dev, 820 dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
822 "%s - Error %d submitting control urb\n",
823 __func__, result);
824} 821}
825 822
826/* 823/*
@@ -833,6 +830,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
833 int result; 830 int result;
834 int length; 831 int length;
835 int status = urb->status; 832 int status = urb->status;
833 struct device *dev = &urb->dev->dev;
836 __u8 *data; 834 __u8 *data;
837 __u8 iir; 835 __u8 iir;
838 836
@@ -845,12 +843,10 @@ static void mos7715_interrupt_callback(struct urb *urb)
845 case -ESHUTDOWN: 843 case -ESHUTDOWN:
846 case -ENODEV: 844 case -ENODEV:
847 /* this urb is terminated, clean up */ 845 /* this urb is terminated, clean up */
848 dbg("%s - urb shutting down with status: %d", __func__, 846 dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
849 status);
850 return; 847 return;
851 default: 848 default:
852 dbg("%s - nonzero urb status received: %d", __func__, 849 dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
853 status);
854 goto exit; 850 goto exit;
855 } 851 }
856 852
@@ -864,7 +860,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
864 * Byte 4: FIFO status for both */ 860 * Byte 4: FIFO status for both */
865 861
866 if (unlikely(length != 4)) { 862 if (unlikely(length != 4)) {
867 dbg("Wrong data !!!"); 863 dev_dbg(dev, "Wrong data !!!\n");
868 return; 864 return;
869 } 865 }
870 866
@@ -872,14 +868,13 @@ static void mos7715_interrupt_callback(struct urb *urb)
872 if (!(iir & 0x01)) { /* serial port interrupt pending */ 868 if (!(iir & 0x01)) { /* serial port interrupt pending */
873 switch (iir & 0x0f) { 869 switch (iir & 0x0f) {
874 case SERIAL_IIR_RLS: 870 case SERIAL_IIR_RLS:
875 dbg("Serial Port: Receiver status error or address " 871 dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n\n");
876 "bit detected in 9-bit mode\n");
877 break; 872 break;
878 case SERIAL_IIR_CTI: 873 case SERIAL_IIR_CTI:
879 dbg("Serial Port: Receiver time out"); 874 dev_dbg(dev, "Serial Port: Receiver time out\n");
880 break; 875 break;
881 case SERIAL_IIR_MS: 876 case SERIAL_IIR_MS:
882 /* dbg("Serial Port: Modem status change"); */ 877 /* dev_dbg(dev, "Serial Port: Modem status change\n"); */
883 break; 878 break;
884 } 879 }
885 } 880 }
@@ -897,9 +892,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
897exit: 892exit:
898 result = usb_submit_urb(urb, GFP_ATOMIC); 893 result = usb_submit_urb(urb, GFP_ATOMIC);
899 if (result) 894 if (result)
900 dev_err(&urb->dev->dev, 895 dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
901 "%s - Error %d submitting control urb\n",
902 __func__, result);
903} 896}
904 897
905/* 898/*
@@ -916,13 +909,13 @@ static void mos7720_bulk_in_callback(struct urb *urb)
916 int status = urb->status; 909 int status = urb->status;
917 910
918 if (status) { 911 if (status) {
919 dbg("nonzero read bulk status received: %d", status); 912 dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status);
920 return; 913 return;
921 } 914 }
922 915
923 port = urb->context; 916 port = urb->context;
924 917
925 dbg("Entering...%s", __func__); 918 dev_dbg(&port->dev, "Entering...%s\n", __func__);
926 919
927 data = urb->transfer_buffer; 920 data = urb->transfer_buffer;
928 921
@@ -936,8 +929,7 @@ static void mos7720_bulk_in_callback(struct urb *urb)
936 if (port->read_urb->status != -EINPROGRESS) { 929 if (port->read_urb->status != -EINPROGRESS) {
937 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); 930 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
938 if (retval) 931 if (retval)
939 dbg("usb_submit_urb(read bulk) failed, retval = %d", 932 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval);
940 retval);
941 } 933 }
942} 934}
943 935
@@ -953,13 +945,13 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
953 int status = urb->status; 945 int status = urb->status;
954 946
955 if (status) { 947 if (status) {
956 dbg("nonzero write bulk status received:%d", status); 948 dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status);
957 return; 949 return;
958 } 950 }
959 951
960 mos7720_port = urb->context; 952 mos7720_port = urb->context;
961 if (!mos7720_port) { 953 if (!mos7720_port) {
962 dbg("NULL mos7720_port pointer"); 954 dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n");
963 return ; 955 return ;
964 } 956 }
965 957
@@ -1061,9 +1053,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
1061 port_number = port->number - port->serial->minor; 1053 port_number = port->number - port->serial->minor;
1062 read_mos_reg(serial, port_number, LSR, &data); 1054 read_mos_reg(serial, port_number, LSR, &data);
1063 1055
1064 dbg("SS::%p LSR:%x", mos7720_port, data); 1056 dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
1065
1066 dbg("Check:Sending Command ..........");
1067 1057
1068 write_mos_reg(serial, dummy, SP1_REG, 0x02); 1058 write_mos_reg(serial, dummy, SP1_REG, 0x02);
1069 write_mos_reg(serial, dummy, SP2_REG, 0x02); 1059 write_mos_reg(serial, dummy, SP2_REG, 0x02);
@@ -1122,20 +1112,16 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty)
1122 int chars = 0; 1112 int chars = 0;
1123 struct moschip_port *mos7720_port; 1113 struct moschip_port *mos7720_port;
1124 1114
1125 dbg("%s:entering ...........", __func__);
1126
1127 mos7720_port = usb_get_serial_port_data(port); 1115 mos7720_port = usb_get_serial_port_data(port);
1128 if (mos7720_port == NULL) { 1116 if (mos7720_port == NULL)
1129 dbg("%s:leaving ...........", __func__);
1130 return 0; 1117 return 0;
1131 }
1132 1118
1133 for (i = 0; i < NUM_URBS; ++i) { 1119 for (i = 0; i < NUM_URBS; ++i) {
1134 if (mos7720_port->write_urb_pool[i] && 1120 if (mos7720_port->write_urb_pool[i] &&
1135 mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) 1121 mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
1136 chars += URB_TRANSFER_BUFFER_SIZE; 1122 chars += URB_TRANSFER_BUFFER_SIZE;
1137 } 1123 }
1138 dbg("%s - returns %d", __func__, chars); 1124 dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
1139 return chars; 1125 return chars;
1140} 1126}
1141 1127
@@ -1145,8 +1131,6 @@ static void mos7720_close(struct usb_serial_port *port)
1145 struct moschip_port *mos7720_port; 1131 struct moschip_port *mos7720_port;
1146 int j; 1132 int j;
1147 1133
1148 dbg("mos7720_close:entering...");
1149
1150 serial = port->serial; 1134 serial = port->serial;
1151 1135
1152 mos7720_port = usb_get_serial_port_data(port); 1136 mos7720_port = usb_get_serial_port_data(port);
@@ -1166,9 +1150,7 @@ static void mos7720_close(struct usb_serial_port *port)
1166 1150
1167 /* While closing port, shutdown all bulk read, write * 1151 /* While closing port, shutdown all bulk read, write *
1168 * and interrupt read if they exists, otherwise nop */ 1152 * and interrupt read if they exists, otherwise nop */
1169 dbg("Shutdown bulk write");
1170 usb_kill_urb(port->write_urb); 1153 usb_kill_urb(port->write_urb);
1171 dbg("Shutdown bulk read");
1172 usb_kill_urb(port->read_urb); 1154 usb_kill_urb(port->read_urb);
1173 1155
1174 mutex_lock(&serial->disc_mutex); 1156 mutex_lock(&serial->disc_mutex);
@@ -1182,8 +1164,6 @@ static void mos7720_close(struct usb_serial_port *port)
1182 } 1164 }
1183 mutex_unlock(&serial->disc_mutex); 1165 mutex_unlock(&serial->disc_mutex);
1184 mos7720_port->open = 0; 1166 mos7720_port->open = 0;
1185
1186 dbg("Leaving %s", __func__);
1187} 1167}
1188 1168
1189static void mos7720_break(struct tty_struct *tty, int break_state) 1169static void mos7720_break(struct tty_struct *tty, int break_state)
@@ -1193,8 +1173,6 @@ static void mos7720_break(struct tty_struct *tty, int break_state)
1193 struct usb_serial *serial; 1173 struct usb_serial *serial;
1194 struct moschip_port *mos7720_port; 1174 struct moschip_port *mos7720_port;
1195 1175
1196 dbg("Entering %s", __func__);
1197
1198 serial = port->serial; 1176 serial = port->serial;
1199 1177
1200 mos7720_port = usb_get_serial_port_data(port); 1178 mos7720_port = usb_get_serial_port_data(port);
@@ -1225,13 +1203,9 @@ static int mos7720_write_room(struct tty_struct *tty)
1225 int room = 0; 1203 int room = 0;
1226 int i; 1204 int i;
1227 1205
1228 dbg("%s:entering ...........", __func__);
1229
1230 mos7720_port = usb_get_serial_port_data(port); 1206 mos7720_port = usb_get_serial_port_data(port);
1231 if (mos7720_port == NULL) { 1207 if (mos7720_port == NULL)
1232 dbg("%s:leaving ...........", __func__);
1233 return -ENODEV; 1208 return -ENODEV;
1234 }
1235 1209
1236 /* FIXME: Locking */ 1210 /* FIXME: Locking */
1237 for (i = 0; i < NUM_URBS; ++i) { 1211 for (i = 0; i < NUM_URBS; ++i) {
@@ -1240,7 +1214,7 @@ static int mos7720_write_room(struct tty_struct *tty)
1240 room += URB_TRANSFER_BUFFER_SIZE; 1214 room += URB_TRANSFER_BUFFER_SIZE;
1241 } 1215 }
1242 1216
1243 dbg("%s - returns %d", __func__, room); 1217 dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
1244 return room; 1218 return room;
1245} 1219}
1246 1220
@@ -1257,15 +1231,11 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
1257 struct urb *urb; 1231 struct urb *urb;
1258 const unsigned char *current_position = data; 1232 const unsigned char *current_position = data;
1259 1233
1260 dbg("%s:entering ...........", __func__);
1261
1262 serial = port->serial; 1234 serial = port->serial;
1263 1235
1264 mos7720_port = usb_get_serial_port_data(port); 1236 mos7720_port = usb_get_serial_port_data(port);
1265 if (mos7720_port == NULL) { 1237 if (mos7720_port == NULL)
1266 dbg("mos7720_port is NULL");
1267 return -ENODEV; 1238 return -ENODEV;
1268 }
1269 1239
1270 /* try to find a free urb in the list */ 1240 /* try to find a free urb in the list */
1271 urb = NULL; 1241 urb = NULL;
@@ -1274,13 +1244,13 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
1274 if (mos7720_port->write_urb_pool[i] && 1244 if (mos7720_port->write_urb_pool[i] &&
1275 mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) { 1245 mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) {
1276 urb = mos7720_port->write_urb_pool[i]; 1246 urb = mos7720_port->write_urb_pool[i];
1277 dbg("URB:%d", i); 1247 dev_dbg(&port->dev, "URB:%d\n", i);
1278 break; 1248 break;
1279 } 1249 }
1280 } 1250 }
1281 1251
1282 if (urb == NULL) { 1252 if (urb == NULL) {
1283 dbg("%s - no more free urbs", __func__); 1253 dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
1284 goto exit; 1254 goto exit;
1285 } 1255 }
1286 1256
@@ -1326,20 +1296,16 @@ static void mos7720_throttle(struct tty_struct *tty)
1326 struct moschip_port *mos7720_port; 1296 struct moschip_port *mos7720_port;
1327 int status; 1297 int status;
1328 1298
1329 dbg("%s- port %d", __func__, port->number);
1330
1331 mos7720_port = usb_get_serial_port_data(port); 1299 mos7720_port = usb_get_serial_port_data(port);
1332 1300
1333 if (mos7720_port == NULL) 1301 if (mos7720_port == NULL)
1334 return; 1302 return;
1335 1303
1336 if (!mos7720_port->open) { 1304 if (!mos7720_port->open) {
1337 dbg("port not opened"); 1305 dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1338 return; 1306 return;
1339 } 1307 }
1340 1308
1341 dbg("%s: Entering ..........", __func__);
1342
1343 /* if we are implementing XON/XOFF, send the stop character */ 1309 /* if we are implementing XON/XOFF, send the stop character */
1344 if (I_IXOFF(tty)) { 1310 if (I_IXOFF(tty)) {
1345 unsigned char stop_char = STOP_CHAR(tty); 1311 unsigned char stop_char = STOP_CHAR(tty);
@@ -1368,12 +1334,10 @@ static void mos7720_unthrottle(struct tty_struct *tty)
1368 return; 1334 return;
1369 1335
1370 if (!mos7720_port->open) { 1336 if (!mos7720_port->open) {
1371 dbg("%s - port not opened", __func__); 1337 dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1372 return; 1338 return;
1373 } 1339 }
1374 1340
1375 dbg("%s: Entering ..........", __func__);
1376
1377 /* if we are implementing XON/XOFF, send the start character */ 1341 /* if we are implementing XON/XOFF, send the start character */
1378 if (I_IXOFF(tty)) { 1342 if (I_IXOFF(tty)) {
1379 unsigned char start_char = START_CHAR(tty); 1343 unsigned char start_char = START_CHAR(tty);
@@ -1409,7 +1373,7 @@ static int set_higher_rates(struct moschip_port *mos7720_port,
1409 /*********************************************** 1373 /***********************************************
1410 * Init Sequence for higher rates 1374 * Init Sequence for higher rates
1411 ***********************************************/ 1375 ***********************************************/
1412 dbg("Sending Setting Commands .........."); 1376 dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
1413 port_number = port->number - port->serial->minor; 1377 port_number = port->number - port->serial->minor;
1414 1378
1415 write_mos_reg(serial, port_number, IER, 0x00); 1379 write_mos_reg(serial, port_number, IER, 0x00);
@@ -1478,7 +1442,7 @@ static struct divisor_table_entry divisor_table[] = {
1478 * this function calculates the proper baud rate divisor for the specified 1442 * this function calculates the proper baud rate divisor for the specified
1479 * baud rate. 1443 * baud rate.
1480 *****************************************************************************/ 1444 *****************************************************************************/
1481static int calc_baud_rate_divisor(int baudrate, int *divisor) 1445static int calc_baud_rate_divisor(struct usb_serial_port *port, int baudrate, int *divisor)
1482{ 1446{
1483 int i; 1447 int i;
1484 __u16 custom; 1448 __u16 custom;
@@ -1486,7 +1450,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor)
1486 __u16 round; 1450 __u16 round;
1487 1451
1488 1452
1489 dbg("%s - %d", __func__, baudrate); 1453 dev_dbg(&port->dev, "%s - %d\n", __func__, baudrate);
1490 1454
1491 for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { 1455 for (i = 0; i < ARRAY_SIZE(divisor_table); i++) {
1492 if (divisor_table[i].baudrate == baudrate) { 1456 if (divisor_table[i].baudrate == baudrate) {
@@ -1508,11 +1472,11 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor)
1508 custom++; 1472 custom++;
1509 *divisor = custom; 1473 *divisor = custom;
1510 1474
1511 dbg("Baud %d = %d", baudrate, custom); 1475 dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom);
1512 return 0; 1476 return 0;
1513 } 1477 }
1514 1478
1515 dbg("Baud calculation Failed..."); 1479 dev_dbg(&port->dev, "Baud calculation Failed...\n");
1516 return -EINVAL; 1480 return -EINVAL;
1517} 1481}
1518 1482
@@ -1536,13 +1500,11 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
1536 port = mos7720_port->port; 1500 port = mos7720_port->port;
1537 serial = port->serial; 1501 serial = port->serial;
1538 1502
1539 dbg("%s: Entering ..........", __func__);
1540
1541 number = port->number - port->serial->minor; 1503 number = port->number - port->serial->minor;
1542 dbg("%s - port = %d, baud = %d", __func__, port->number, baudrate); 1504 dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate);
1543 1505
1544 /* Calculate the Divisor */ 1506 /* Calculate the Divisor */
1545 status = calc_baud_rate_divisor(baudrate, &divisor); 1507 status = calc_baud_rate_divisor(port, baudrate, &divisor);
1546 if (status) { 1508 if (status) {
1547 dev_err(&port->dev, "%s - bad baud rate\n", __func__); 1509 dev_err(&port->dev, "%s - bad baud rate\n", __func__);
1548 return status; 1510 return status;
@@ -1591,15 +1553,11 @@ static void change_port_settings(struct tty_struct *tty,
1591 serial = port->serial; 1553 serial = port->serial;
1592 port_number = port->number - port->serial->minor; 1554 port_number = port->number - port->serial->minor;
1593 1555
1594 dbg("%s - port %d", __func__, port->number);
1595
1596 if (!mos7720_port->open) { 1556 if (!mos7720_port->open) {
1597 dbg("%s - port not opened", __func__); 1557 dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1598 return; 1558 return;
1599 } 1559 }
1600 1560
1601 dbg("%s: Entering ..........", __func__);
1602
1603 lData = UART_LCR_WLEN8; 1561 lData = UART_LCR_WLEN8;
1604 lStop = 0x00; /* 1 stop bit */ 1562 lStop = 0x00; /* 1 stop bit */
1605 lParity = 0x00; /* No parity */ 1563 lParity = 0x00; /* No parity */
@@ -1633,14 +1591,14 @@ static void change_port_settings(struct tty_struct *tty,
1633 if (cflag & PARENB) { 1591 if (cflag & PARENB) {
1634 if (cflag & PARODD) { 1592 if (cflag & PARODD) {
1635 lParity = UART_LCR_PARITY; 1593 lParity = UART_LCR_PARITY;
1636 dbg("%s - parity = odd", __func__); 1594 dev_dbg(&port->dev, "%s - parity = odd\n", __func__);
1637 } else { 1595 } else {
1638 lParity = (UART_LCR_EPAR | UART_LCR_PARITY); 1596 lParity = (UART_LCR_EPAR | UART_LCR_PARITY);
1639 dbg("%s - parity = even", __func__); 1597 dev_dbg(&port->dev, "%s - parity = even\n", __func__);
1640 } 1598 }
1641 1599
1642 } else { 1600 } else {
1643 dbg("%s - parity = none", __func__); 1601 dev_dbg(&port->dev, "%s - parity = none\n", __func__);
1644 } 1602 }
1645 1603
1646 if (cflag & CMSPAR) 1604 if (cflag & CMSPAR)
@@ -1649,10 +1607,10 @@ static void change_port_settings(struct tty_struct *tty,
1649 /* Change the Stop bit */ 1607 /* Change the Stop bit */
1650 if (cflag & CSTOPB) { 1608 if (cflag & CSTOPB) {
1651 lStop = UART_LCR_STOP; 1609 lStop = UART_LCR_STOP;
1652 dbg("%s - stop bits = 2", __func__); 1610 dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__);
1653 } else { 1611 } else {
1654 lStop = 0x00; 1612 lStop = 0x00;
1655 dbg("%s - stop bits = 1", __func__); 1613 dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__);
1656 } 1614 }
1657 1615
1658#define LCR_BITS_MASK 0x03 /* Mask for bits/char field */ 1616#define LCR_BITS_MASK 0x03 /* Mask for bits/char field */
@@ -1698,7 +1656,7 @@ static void change_port_settings(struct tty_struct *tty,
1698 baud = tty_get_baud_rate(tty); 1656 baud = tty_get_baud_rate(tty);
1699 if (!baud) { 1657 if (!baud) {
1700 /* pick a default, any default... */ 1658 /* pick a default, any default... */
1701 dbg("Picked default baud..."); 1659 dev_dbg(&port->dev, "Picked default baud...\n");
1702 baud = 9600; 1660 baud = 9600;
1703 } 1661 }
1704 1662
@@ -1709,7 +1667,7 @@ static void change_port_settings(struct tty_struct *tty,
1709 return; 1667 return;
1710 } 1668 }
1711 1669
1712 dbg("%s - baud rate = %d", __func__, baud); 1670 dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud);
1713 status = send_cmd_write_baud_rate(mos7720_port, baud); 1671 status = send_cmd_write_baud_rate(mos7720_port, baud);
1714 /* FIXME: needs to write actual resulting baud back not just 1672 /* FIXME: needs to write actual resulting baud back not just
1715 blindly do so */ 1673 blindly do so */
@@ -1721,8 +1679,7 @@ static void change_port_settings(struct tty_struct *tty,
1721 if (port->read_urb->status != -EINPROGRESS) { 1679 if (port->read_urb->status != -EINPROGRESS) {
1722 status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1680 status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1723 if (status) 1681 if (status)
1724 dbg("usb_submit_urb(read bulk) failed, status = %d", 1682 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
1725 status);
1726 } 1683 }
1727} 1684}
1728 1685
@@ -1747,23 +1704,19 @@ static void mos7720_set_termios(struct tty_struct *tty,
1747 return; 1704 return;
1748 1705
1749 if (!mos7720_port->open) { 1706 if (!mos7720_port->open) {
1750 dbg("%s - port not opened", __func__); 1707 dev_dbg(&port->dev, "%s - port not opened\n", __func__);
1751 return; 1708 return;
1752 } 1709 }
1753 1710
1754 dbg("%s\n", "setting termios - ASPIRE"); 1711 dev_dbg(&port->dev, "setting termios - ASPIRE\n");
1755 1712
1756 cflag = tty->termios->c_cflag; 1713 cflag = tty->termios->c_cflag;
1757 1714
1758 dbg("%s - cflag %08x iflag %08x", __func__, 1715 dev_dbg(&port->dev, "%s - cflag %08x iflag %08x\n", __func__,
1759 tty->termios->c_cflag, 1716 tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
1760 RELEVANT_IFLAG(tty->termios->c_iflag));
1761 1717
1762 dbg("%s - old cflag %08x old iflag %08x", __func__, 1718 dev_dbg(&port->dev, "%s - old cflag %08x old iflag %08x\n", __func__,
1763 old_termios->c_cflag, 1719 old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
1764 RELEVANT_IFLAG(old_termios->c_iflag));
1765
1766 dbg("%s - port %d", __func__, port->number);
1767 1720
1768 /* change the port settings to the new ones specified */ 1721 /* change the port settings to the new ones specified */
1769 change_port_settings(tty, mos7720_port, old_termios); 1722 change_port_settings(tty, mos7720_port, old_termios);
@@ -1771,8 +1724,7 @@ static void mos7720_set_termios(struct tty_struct *tty,
1771 if (port->read_urb->status != -EINPROGRESS) { 1724 if (port->read_urb->status != -EINPROGRESS) {
1772 status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1725 status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1773 if (status) 1726 if (status)
1774 dbg("usb_submit_urb(read bulk) failed, status = %d", 1727 dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
1775 status);
1776 } 1728 }
1777} 1729}
1778 1730
@@ -1800,7 +1752,7 @@ static int get_lsr_info(struct tty_struct *tty,
1800 read_mos_reg(port->serial, port_number, LSR, &data); 1752 read_mos_reg(port->serial, port_number, LSR, &data);
1801 if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) 1753 if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
1802 == (UART_LSR_TEMT | UART_LSR_THRE)) { 1754 == (UART_LSR_TEMT | UART_LSR_THRE)) {
1803 dbg("%s -- Empty", __func__); 1755 dev_dbg(&port->dev, "%s -- Empty\n", __func__);
1804 result = TIOCSER_TEMT; 1756 result = TIOCSER_TEMT;
1805 } 1757 }
1806 } 1758 }
@@ -1817,8 +1769,6 @@ static int mos7720_tiocmget(struct tty_struct *tty)
1817 unsigned int mcr ; 1769 unsigned int mcr ;
1818 unsigned int msr ; 1770 unsigned int msr ;
1819 1771
1820 dbg("%s - port %d", __func__, port->number);
1821
1822 mcr = mos7720_port->shadowMCR; 1772 mcr = mos7720_port->shadowMCR;
1823 msr = mos7720_port->shadowMSR; 1773 msr = mos7720_port->shadowMSR;
1824 1774
@@ -1829,8 +1779,6 @@ static int mos7720_tiocmget(struct tty_struct *tty)
1829 | ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */ 1779 | ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
1830 | ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */ 1780 | ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
1831 1781
1832 dbg("%s -- %x", __func__, result);
1833
1834 return result; 1782 return result;
1835} 1783}
1836 1784
@@ -1840,8 +1788,6 @@ static int mos7720_tiocmset(struct tty_struct *tty,
1840 struct usb_serial_port *port = tty->driver_data; 1788 struct usb_serial_port *port = tty->driver_data;
1841 struct moschip_port *mos7720_port = usb_get_serial_port_data(port); 1789 struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
1842 unsigned int mcr ; 1790 unsigned int mcr ;
1843 dbg("%s - port %d", __func__, port->number);
1844 dbg("he was at tiocmset");
1845 1791
1846 mcr = mos7720_port->shadowMCR; 1792 mcr = mos7720_port->shadowMCR;
1847 1793
@@ -1888,8 +1834,8 @@ static int mos7720_get_icount(struct tty_struct *tty,
1888 icount->brk = cnow.brk; 1834 icount->brk = cnow.brk;
1889 icount->buf_overrun = cnow.buf_overrun; 1835 icount->buf_overrun = cnow.buf_overrun;
1890 1836
1891 dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, 1837 dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
1892 port->number, icount->rx, icount->tx); 1838 icount->rx, icount->tx);
1893 return 0; 1839 return 0;
1894} 1840}
1895 1841
@@ -1975,29 +1921,28 @@ static int mos7720_ioctl(struct tty_struct *tty,
1975 if (mos7720_port == NULL) 1921 if (mos7720_port == NULL)
1976 return -ENODEV; 1922 return -ENODEV;
1977 1923
1978 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); 1924 dev_dbg(&port->dev, "%s - cmd = 0x%x", __func__, cmd);
1979 1925
1980 switch (cmd) { 1926 switch (cmd) {
1981 case TIOCSERGETLSR: 1927 case TIOCSERGETLSR:
1982 dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); 1928 dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__);
1983 return get_lsr_info(tty, mos7720_port, 1929 return get_lsr_info(tty, mos7720_port,
1984 (unsigned int __user *)arg); 1930 (unsigned int __user *)arg);
1985 1931
1986 /* FIXME: These should be using the mode methods */ 1932 /* FIXME: These should be using the mode methods */
1987 case TIOCMBIS: 1933 case TIOCMBIS:
1988 case TIOCMBIC: 1934 case TIOCMBIC:
1989 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", 1935 dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__);
1990 __func__, port->number);
1991 return set_modem_info(mos7720_port, cmd, 1936 return set_modem_info(mos7720_port, cmd,
1992 (unsigned int __user *)arg); 1937 (unsigned int __user *)arg);
1993 1938
1994 case TIOCGSERIAL: 1939 case TIOCGSERIAL:
1995 dbg("%s (%d) TIOCGSERIAL", __func__, port->number); 1940 dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
1996 return get_serial_info(mos7720_port, 1941 return get_serial_info(mos7720_port,
1997 (struct serial_struct __user *)arg); 1942 (struct serial_struct __user *)arg);
1998 1943
1999 case TIOCMIWAIT: 1944 case TIOCMIWAIT:
2000 dbg("%s (%d) TIOCMIWAIT", __func__, port->number); 1945 dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
2001 cprev = mos7720_port->icount; 1946 cprev = mos7720_port->icount;
2002 while (1) { 1947 while (1) {
2003 if (signal_pending(current)) 1948 if (signal_pending(current))
@@ -2030,13 +1975,6 @@ static int mos7720_startup(struct usb_serial *serial)
2030 u16 product; 1975 u16 product;
2031 int ret_val; 1976 int ret_val;
2032 1977
2033 dbg("%s: Entering ..........", __func__);
2034
2035 if (!serial) {
2036 dbg("Invalid Handler");
2037 return -ENODEV;
2038 }
2039
2040 product = le16_to_cpu(serial->dev->descriptor.idProduct); 1978 product = le16_to_cpu(serial->dev->descriptor.idProduct);
2041 dev = serial->dev; 1979 dev = serial->dev;
2042 1980
@@ -2081,8 +2019,8 @@ static int mos7720_startup(struct usb_serial *serial)
2081 mos7720_port->port = serial->port[i]; 2019 mos7720_port->port = serial->port[i];
2082 usb_set_serial_port_data(serial->port[i], mos7720_port); 2020 usb_set_serial_port_data(serial->port[i], mos7720_port);
2083 2021
2084 dbg("port number is %d", serial->port[i]->number); 2022 dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number);
2085 dbg("serial number is %d", serial->minor); 2023 dev_dbg(&dev->dev, "serial number is %d\n", serial->minor);
2086 } 2024 }
2087 2025
2088 2026
@@ -2106,7 +2044,7 @@ static int mos7720_startup(struct usb_serial *serial)
2106#endif 2044#endif
2107 /* LSR For Port 1 */ 2045 /* LSR For Port 1 */
2108 read_mos_reg(serial, 0, LSR, &data); 2046 read_mos_reg(serial, 0, LSR, &data);
2109 dbg("LSR:%x", data); 2047 dev_dbg(&dev->dev, "LSR:%x\n", data);
2110 2048
2111 return 0; 2049 return 0;
2112} 2050}