aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-06-15 18:44:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-12 19:34:32 -0400
commitf9feb517faf03ee85de6e2467f7fcb87c1af2258 (patch)
treea9bee43e99c392109279eb5743ddb84af25d3248
parent0fb0aa188d0e61d58485288071e73d3766513f2a (diff)
USB: serial: garmin_gps: 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: Hermann Kneissel <herkne@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/serial/garmin_gps.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index 74660a3aa670..04bd3b7a2985 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1036,15 +1036,16 @@ static void garmin_write_bulk_callback (struct urb *urb)
1036 unsigned long flags; 1036 unsigned long flags;
1037 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 1037 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
1038 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); 1038 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1039 int status = urb->status;
1039 1040
1040 /* free up the transfer buffer, as usb_free_urb() does not do this */ 1041 /* free up the transfer buffer, as usb_free_urb() does not do this */
1041 kfree (urb->transfer_buffer); 1042 kfree (urb->transfer_buffer);
1042 1043
1043 dbg("%s - port %d", __FUNCTION__, port->number); 1044 dbg("%s - port %d", __FUNCTION__, port->number);
1044 1045
1045 if (urb->status) { 1046 if (status) {
1046 dbg("%s - nonzero write bulk status received: %d", 1047 dbg("%s - nonzero write bulk status received: %d",
1047 __FUNCTION__, urb->status); 1048 __FUNCTION__, status);
1048 spin_lock_irqsave(&garmin_data_p->lock, flags); 1049 spin_lock_irqsave(&garmin_data_p->lock, flags);
1049 garmin_data_p->flags |= CLEAR_HALT_REQUIRED; 1050 garmin_data_p->flags |= CLEAR_HALT_REQUIRED;
1050 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1051 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
@@ -1281,7 +1282,8 @@ static void garmin_read_bulk_callback (struct urb *urb)
1281 struct usb_serial *serial = port->serial; 1282 struct usb_serial *serial = port->serial;
1282 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); 1283 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1283 unsigned char *data = urb->transfer_buffer; 1284 unsigned char *data = urb->transfer_buffer;
1284 int status; 1285 int status = urb->status;
1286 int retval;
1285 1287
1286 dbg("%s - port %d", __FUNCTION__, port->number); 1288 dbg("%s - port %d", __FUNCTION__, port->number);
1287 1289
@@ -1290,9 +1292,9 @@ static void garmin_read_bulk_callback (struct urb *urb)
1290 return; 1292 return;
1291 } 1293 }
1292 1294
1293 if (urb->status) { 1295 if (status) {
1294 dbg("%s - nonzero read bulk status received: %d", 1296 dbg("%s - nonzero read bulk status received: %d",
1295 __FUNCTION__, urb->status); 1297 __FUNCTION__, status);
1296 return; 1298 return;
1297 } 1299 }
1298 1300
@@ -1306,19 +1308,19 @@ static void garmin_read_bulk_callback (struct urb *urb)
1306 spin_lock_irqsave(&garmin_data_p->lock, flags); 1308 spin_lock_irqsave(&garmin_data_p->lock, flags);
1307 garmin_data_p->flags &= ~FLAGS_BULK_IN_RESTART; 1309 garmin_data_p->flags &= ~FLAGS_BULK_IN_RESTART;
1308 spin_unlock_irqrestore(&garmin_data_p->lock, flags); 1310 spin_unlock_irqrestore(&garmin_data_p->lock, flags);
1309 status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1311 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1310 if (status) 1312 if (retval)
1311 dev_err(&port->dev, 1313 dev_err(&port->dev,
1312 "%s - failed resubmitting read urb, error %d\n", 1314 "%s - failed resubmitting read urb, error %d\n",
1313 __FUNCTION__, status); 1315 __FUNCTION__, retval);
1314 } else if (urb->actual_length > 0) { 1316 } else if (urb->actual_length > 0) {
1315 /* Continue trying to read until nothing more is received */ 1317 /* Continue trying to read until nothing more is received */
1316 if (0 == (garmin_data_p->flags & FLAGS_THROTTLED)) { 1318 if (0 == (garmin_data_p->flags & FLAGS_THROTTLED)) {
1317 status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1319 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1318 if (status) 1320 if (retval)
1319 dev_err(&port->dev, 1321 dev_err(&port->dev,
1320 "%s - failed resubmitting read urb, error %d\n", 1322 "%s - failed resubmitting read urb, "
1321 __FUNCTION__, status); 1323 "error %d\n", __FUNCTION__, retval);
1322 } 1324 }
1323 } else { 1325 } else {
1324 dbg("%s - end of bulk data", __FUNCTION__); 1326 dbg("%s - end of bulk data", __FUNCTION__);
@@ -1333,13 +1335,14 @@ static void garmin_read_bulk_callback (struct urb *urb)
1333static void garmin_read_int_callback (struct urb *urb) 1335static void garmin_read_int_callback (struct urb *urb)
1334{ 1336{
1335 unsigned long flags; 1337 unsigned long flags;
1336 int status; 1338 int retval;
1337 struct usb_serial_port *port = (struct usb_serial_port *)urb->context; 1339 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
1338 struct usb_serial *serial = port->serial; 1340 struct usb_serial *serial = port->serial;
1339 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port); 1341 struct garmin_data * garmin_data_p = usb_get_serial_port_data(port);
1340 unsigned char *data = urb->transfer_buffer; 1342 unsigned char *data = urb->transfer_buffer;
1343 int status = urb->status;
1341 1344
1342 switch (urb->status) { 1345 switch (status) {
1343 case 0: 1346 case 0:
1344 /* success */ 1347 /* success */
1345 break; 1348 break;
@@ -1348,11 +1351,11 @@ static void garmin_read_int_callback (struct urb *urb)
1348 case -ESHUTDOWN: 1351 case -ESHUTDOWN:
1349 /* this urb is terminated, clean up */ 1352 /* this urb is terminated, clean up */
1350 dbg("%s - urb shutting down with status: %d", 1353 dbg("%s - urb shutting down with status: %d",
1351 __FUNCTION__, urb->status); 1354 __FUNCTION__, status);
1352 return; 1355 return;
1353 default: 1356 default:
1354 dbg("%s - nonzero urb status received: %d", 1357 dbg("%s - nonzero urb status received: %d",
1355 __FUNCTION__, urb->status); 1358 __FUNCTION__, status);
1356 return; 1359 return;
1357 } 1360 }
1358 1361
@@ -1374,11 +1377,11 @@ static void garmin_read_int_callback (struct urb *urb)
1374 port->read_urb->transfer_buffer, 1377 port->read_urb->transfer_buffer,
1375 port->read_urb->transfer_buffer_length, 1378 port->read_urb->transfer_buffer_length,
1376 garmin_read_bulk_callback, port); 1379 garmin_read_bulk_callback, port);
1377 status = usb_submit_urb(port->read_urb, GFP_ATOMIC); 1380 retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
1378 if (status) { 1381 if (retval) {
1379 dev_err(&port->dev, 1382 dev_err(&port->dev,
1380 "%s - failed submitting read urb, error %d\n", 1383 "%s - failed submitting read urb, error %d\n",
1381 __FUNCTION__, status); 1384 __FUNCTION__, retval);
1382 } else { 1385 } else {
1383 spin_lock_irqsave(&garmin_data_p->lock, flags); 1386 spin_lock_irqsave(&garmin_data_p->lock, flags);
1384 garmin_data_p->flags |= FLAGS_BULK_IN_ACTIVE; 1387 garmin_data_p->flags |= FLAGS_BULK_IN_ACTIVE;
@@ -1422,11 +1425,11 @@ static void garmin_read_int_callback (struct urb *urb)
1422 } 1425 }
1423 1426
1424 port->interrupt_in_urb->dev = port->serial->dev; 1427 port->interrupt_in_urb->dev = port->serial->dev;
1425 status = usb_submit_urb (urb, GFP_ATOMIC); 1428 retval = usb_submit_urb (urb, GFP_ATOMIC);
1426 if (status) 1429 if (retval)
1427 dev_err(&urb->dev->dev, 1430 dev_err(&urb->dev->dev,
1428 "%s - Error %d submitting interrupt urb\n", 1431 "%s - Error %d submitting interrupt urb\n",
1429 __FUNCTION__, status); 1432 __FUNCTION__, retval);
1430} 1433}
1431 1434
1432 1435