diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-06-15 18:44:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 19:34:36 -0400 |
commit | 52171b480865985c060a58fa3cbcd31ba6e13f75 (patch) | |
tree | aa9f691fcc5c91262c394832fb8094a5a0b18595 /drivers/usb/serial | |
parent | 17dd2215adee8c988b88308671cc20a69839a850 (diff) |
USB: serial: ti_usb_3410_5052: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.
Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 3d505fd0645b..f98626ae75fe 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -1112,22 +1112,24 @@ static void ti_interrupt_callback(struct urb *urb) | |||
1112 | int length = urb->actual_length; | 1112 | int length = urb->actual_length; |
1113 | int port_number; | 1113 | int port_number; |
1114 | int function; | 1114 | int function; |
1115 | int status; | 1115 | int status = urb->status; |
1116 | int retval; | ||
1116 | __u8 msr; | 1117 | __u8 msr; |
1117 | 1118 | ||
1118 | dbg("%s", __FUNCTION__); | 1119 | dbg("%s", __FUNCTION__); |
1119 | 1120 | ||
1120 | switch (urb->status) { | 1121 | switch (status) { |
1121 | case 0: | 1122 | case 0: |
1122 | break; | 1123 | break; |
1123 | case -ECONNRESET: | 1124 | case -ECONNRESET: |
1124 | case -ENOENT: | 1125 | case -ENOENT: |
1125 | case -ESHUTDOWN: | 1126 | case -ESHUTDOWN: |
1126 | dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); | 1127 | dbg("%s - urb shutting down, %d", __FUNCTION__, status); |
1127 | tdev->td_urb_error = 1; | 1128 | tdev->td_urb_error = 1; |
1128 | return; | 1129 | return; |
1129 | default: | 1130 | default: |
1130 | dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status); | 1131 | dev_err(dev, "%s - nonzero urb status, %d\n", |
1132 | __FUNCTION__, status); | ||
1131 | tdev->td_urb_error = 1; | 1133 | tdev->td_urb_error = 1; |
1132 | goto exit; | 1134 | goto exit; |
1133 | } | 1135 | } |
@@ -1175,9 +1177,10 @@ static void ti_interrupt_callback(struct urb *urb) | |||
1175 | } | 1177 | } |
1176 | 1178 | ||
1177 | exit: | 1179 | exit: |
1178 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1180 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1179 | if (status) | 1181 | if (retval) |
1180 | dev_err(dev, "%s - resubmit interrupt urb failed, %d\n", __FUNCTION__, status); | 1182 | dev_err(dev, "%s - resubmit interrupt urb failed, %d\n", |
1183 | __FUNCTION__, retval); | ||
1181 | } | 1184 | } |
1182 | 1185 | ||
1183 | 1186 | ||
@@ -1186,30 +1189,32 @@ static void ti_bulk_in_callback(struct urb *urb) | |||
1186 | struct ti_port *tport = (struct ti_port *)urb->context; | 1189 | struct ti_port *tport = (struct ti_port *)urb->context; |
1187 | struct usb_serial_port *port = tport->tp_port; | 1190 | struct usb_serial_port *port = tport->tp_port; |
1188 | struct device *dev = &urb->dev->dev; | 1191 | struct device *dev = &urb->dev->dev; |
1189 | int status = 0; | 1192 | int status = urb->status; |
1193 | int retval = 0; | ||
1190 | 1194 | ||
1191 | dbg("%s", __FUNCTION__); | 1195 | dbg("%s", __FUNCTION__); |
1192 | 1196 | ||
1193 | switch (urb->status) { | 1197 | switch (status) { |
1194 | case 0: | 1198 | case 0: |
1195 | break; | 1199 | break; |
1196 | case -ECONNRESET: | 1200 | case -ECONNRESET: |
1197 | case -ENOENT: | 1201 | case -ENOENT: |
1198 | case -ESHUTDOWN: | 1202 | case -ESHUTDOWN: |
1199 | dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); | 1203 | dbg("%s - urb shutting down, %d", __FUNCTION__, status); |
1200 | tport->tp_tdev->td_urb_error = 1; | 1204 | tport->tp_tdev->td_urb_error = 1; |
1201 | wake_up_interruptible(&tport->tp_write_wait); | 1205 | wake_up_interruptible(&tport->tp_write_wait); |
1202 | return; | 1206 | return; |
1203 | default: | 1207 | default: |
1204 | dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status ); | 1208 | dev_err(dev, "%s - nonzero urb status, %d\n", |
1209 | __FUNCTION__, status ); | ||
1205 | tport->tp_tdev->td_urb_error = 1; | 1210 | tport->tp_tdev->td_urb_error = 1; |
1206 | wake_up_interruptible(&tport->tp_write_wait); | 1211 | wake_up_interruptible(&tport->tp_write_wait); |
1207 | } | 1212 | } |
1208 | 1213 | ||
1209 | if (urb->status == -EPIPE) | 1214 | if (status == -EPIPE) |
1210 | goto exit; | 1215 | goto exit; |
1211 | 1216 | ||
1212 | if (urb->status) { | 1217 | if (status) { |
1213 | dev_err(dev, "%s - stopping read!\n", __FUNCTION__); | 1218 | dev_err(dev, "%s - stopping read!\n", __FUNCTION__); |
1214 | return; | 1219 | return; |
1215 | } | 1220 | } |
@@ -1234,13 +1239,14 @@ exit: | |||
1234 | spin_lock(&tport->tp_lock); | 1239 | spin_lock(&tport->tp_lock); |
1235 | if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) { | 1240 | if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) { |
1236 | urb->dev = port->serial->dev; | 1241 | urb->dev = port->serial->dev; |
1237 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1242 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
1238 | } else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) { | 1243 | } else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) { |
1239 | tport->tp_read_urb_state = TI_READ_URB_STOPPED; | 1244 | tport->tp_read_urb_state = TI_READ_URB_STOPPED; |
1240 | } | 1245 | } |
1241 | spin_unlock(&tport->tp_lock); | 1246 | spin_unlock(&tport->tp_lock); |
1242 | if (status) | 1247 | if (retval) |
1243 | dev_err(dev, "%s - resubmit read urb failed, %d\n", __FUNCTION__, status); | 1248 | dev_err(dev, "%s - resubmit read urb failed, %d\n", |
1249 | __FUNCTION__, retval); | ||
1244 | } | 1250 | } |
1245 | 1251 | ||
1246 | 1252 | ||
@@ -1249,23 +1255,25 @@ static void ti_bulk_out_callback(struct urb *urb) | |||
1249 | struct ti_port *tport = (struct ti_port *)urb->context; | 1255 | struct ti_port *tport = (struct ti_port *)urb->context; |
1250 | struct usb_serial_port *port = tport->tp_port; | 1256 | struct usb_serial_port *port = tport->tp_port; |
1251 | struct device *dev = &urb->dev->dev; | 1257 | struct device *dev = &urb->dev->dev; |
1258 | int status = urb->status; | ||
1252 | 1259 | ||
1253 | dbg("%s - port %d", __FUNCTION__, port->number); | 1260 | dbg("%s - port %d", __FUNCTION__, port->number); |
1254 | 1261 | ||
1255 | tport->tp_write_urb_in_use = 0; | 1262 | tport->tp_write_urb_in_use = 0; |
1256 | 1263 | ||
1257 | switch (urb->status) { | 1264 | switch (status) { |
1258 | case 0: | 1265 | case 0: |
1259 | break; | 1266 | break; |
1260 | case -ECONNRESET: | 1267 | case -ECONNRESET: |
1261 | case -ENOENT: | 1268 | case -ENOENT: |
1262 | case -ESHUTDOWN: | 1269 | case -ESHUTDOWN: |
1263 | dbg("%s - urb shutting down, %d", __FUNCTION__, urb->status); | 1270 | dbg("%s - urb shutting down, %d", __FUNCTION__, status); |
1264 | tport->tp_tdev->td_urb_error = 1; | 1271 | tport->tp_tdev->td_urb_error = 1; |
1265 | wake_up_interruptible(&tport->tp_write_wait); | 1272 | wake_up_interruptible(&tport->tp_write_wait); |
1266 | return; | 1273 | return; |
1267 | default: | 1274 | default: |
1268 | dev_err(dev, "%s - nonzero urb status, %d\n", __FUNCTION__, urb->status); | 1275 | dev_err(dev, "%s - nonzero urb status, %d\n", |
1276 | __FUNCTION__, status); | ||
1269 | tport->tp_tdev->td_urb_error = 1; | 1277 | tport->tp_tdev->td_urb_error = 1; |
1270 | wake_up_interruptible(&tport->tp_write_wait); | 1278 | wake_up_interruptible(&tport->tp_write_wait); |
1271 | } | 1279 | } |