aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTilman Schmidt <tilman@imap.cc>2010-09-30 09:35:11 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-01 03:33:34 -0400
commit1d5a9edcd5f1fe6483afca33294ed0ebab793ebf (patch)
treebfdcb39a7590ca2bcd2f350d5f8eaec816c1c285
parentbefba36ab942c44ba1d3761a7439324fff83638f (diff)
isdn/gigaset: bas_gigaset timer cleanup
Use setup_timer() and mod_timer() instead of direct assignment to timer structure members, simplify the argument of one timer routine, and make extra sure all timers are stopped during suspend. Signed-off-by: Tilman Schmidt <tilman@imap.cc> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/gigaset/bas-gigaset.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c
index 131976d880d..e865c5dc028 100644
--- a/drivers/isdn/gigaset/bas-gigaset.c
+++ b/drivers/isdn/gigaset/bas-gigaset.c
@@ -588,10 +588,7 @@ static int atread_submit(struct cardstate *cs, int timeout)
588 588
589 if (timeout > 0) { 589 if (timeout > 0) {
590 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 590 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
591 ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10; 591 mod_timer(&ucs->timer_cmd_in, jiffies + timeout * HZ / 10);
592 ucs->timer_cmd_in.data = (unsigned long) cs;
593 ucs->timer_cmd_in.function = cmd_in_timeout;
594 add_timer(&ucs->timer_cmd_in);
595 } 592 }
596 return 0; 593 return 0;
597} 594}
@@ -1356,12 +1353,12 @@ error:
1356/* req_timeout 1353/* req_timeout
1357 * timeout routine for control output request 1354 * timeout routine for control output request
1358 * argument: 1355 * argument:
1359 * B channel control structure 1356 * controller state structure
1360 */ 1357 */
1361static void req_timeout(unsigned long data) 1358static void req_timeout(unsigned long data)
1362{ 1359{
1363 struct bc_state *bcs = (struct bc_state *) data; 1360 struct cardstate *cs = (struct cardstate *) data;
1364 struct bas_cardstate *ucs = bcs->cs->hw.bas; 1361 struct bas_cardstate *ucs = cs->hw.bas;
1365 int pending; 1362 int pending;
1366 unsigned long flags; 1363 unsigned long flags;
1367 1364
@@ -1378,38 +1375,44 @@ static void req_timeout(unsigned long data)
1378 break; 1375 break;
1379 1376
1380 case HD_OPEN_ATCHANNEL: 1377 case HD_OPEN_ATCHANNEL:
1381 dev_err(bcs->cs->dev, "timeout opening AT channel\n"); 1378 dev_err(cs->dev, "timeout opening AT channel\n");
1382 error_reset(bcs->cs); 1379 error_reset(cs);
1383 break; 1380 break;
1384 1381
1385 case HD_OPEN_B2CHANNEL:
1386 case HD_OPEN_B1CHANNEL: 1382 case HD_OPEN_B1CHANNEL:
1387 dev_err(bcs->cs->dev, "timeout opening channel %d\n", 1383 dev_err(cs->dev, "timeout opening channel 1\n");
1388 bcs->channel + 1); 1384 error_hangup(&cs->bcs[0]);
1389 error_hangup(bcs); 1385 break;
1386
1387 case HD_OPEN_B2CHANNEL:
1388 dev_err(cs->dev, "timeout opening channel 2\n");
1389 error_hangup(&cs->bcs[1]);
1390 break; 1390 break;
1391 1391
1392 case HD_CLOSE_ATCHANNEL: 1392 case HD_CLOSE_ATCHANNEL:
1393 dev_err(bcs->cs->dev, "timeout closing AT channel\n"); 1393 dev_err(cs->dev, "timeout closing AT channel\n");
1394 error_reset(bcs->cs); 1394 error_reset(cs);
1395 break; 1395 break;
1396 1396
1397 case HD_CLOSE_B2CHANNEL:
1398 case HD_CLOSE_B1CHANNEL: 1397 case HD_CLOSE_B1CHANNEL:
1399 dev_err(bcs->cs->dev, "timeout closing channel %d\n", 1398 dev_err(cs->dev, "timeout closing channel 1\n");
1400 bcs->channel + 1); 1399 error_reset(cs);
1401 error_reset(bcs->cs); 1400 break;
1401
1402 case HD_CLOSE_B2CHANNEL:
1403 dev_err(cs->dev, "timeout closing channel 2\n");
1404 error_reset(cs);
1402 break; 1405 break;
1403 1406
1404 case HD_RESET_INTERRUPT_PIPE: 1407 case HD_RESET_INTERRUPT_PIPE:
1405 /* error recovery escalation */ 1408 /* error recovery escalation */
1406 dev_err(bcs->cs->dev, 1409 dev_err(cs->dev,
1407 "reset interrupt pipe timeout, attempting USB reset\n"); 1410 "reset interrupt pipe timeout, attempting USB reset\n");
1408 usb_queue_reset_device(bcs->cs->hw.bas->interface); 1411 usb_queue_reset_device(ucs->interface);
1409 break; 1412 break;
1410 1413
1411 default: 1414 default:
1412 dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n", 1415 dev_warn(cs->dev, "request 0x%02x timed out, clearing\n",
1413 pending); 1416 pending);
1414 } 1417 }
1415 1418
@@ -1540,10 +1543,7 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout)
1540 1543
1541 if (timeout > 0) { 1544 if (timeout > 0) {
1542 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); 1545 gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout);
1543 ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10; 1546 mod_timer(&ucs->timer_ctrl, jiffies + timeout * HZ / 10);
1544 ucs->timer_ctrl.data = (unsigned long) bcs;
1545 ucs->timer_ctrl.function = req_timeout;
1546 add_timer(&ucs->timer_ctrl);
1547 } 1547 }
1548 1548
1549 spin_unlock_irqrestore(&ucs->lock, flags); 1549 spin_unlock_irqrestore(&ucs->lock, flags);
@@ -1809,10 +1809,7 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len)
1809 if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) { 1809 if (!(update_basstate(ucs, BS_ATTIMER, BS_ATREADY) & BS_ATTIMER)) {
1810 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", 1810 gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs",
1811 ATRDY_TIMEOUT); 1811 ATRDY_TIMEOUT);
1812 ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; 1812 mod_timer(&ucs->timer_atrdy, jiffies + ATRDY_TIMEOUT * HZ / 10);
1813 ucs->timer_atrdy.data = (unsigned long) cs;
1814 ucs->timer_atrdy.function = atrdy_timeout;
1815 add_timer(&ucs->timer_atrdy);
1816 } 1813 }
1817 return 0; 1814 return 0;
1818} 1815}
@@ -2114,9 +2111,9 @@ static int gigaset_initcshw(struct cardstate *cs)
2114 ucs->pending = 0; 2111 ucs->pending = 0;
2115 2112
2116 ucs->basstate = 0; 2113 ucs->basstate = 0;
2117 init_timer(&ucs->timer_ctrl); 2114 setup_timer(&ucs->timer_ctrl, req_timeout, (unsigned long) cs);
2118 init_timer(&ucs->timer_atrdy); 2115 setup_timer(&ucs->timer_atrdy, atrdy_timeout, (unsigned long) cs);
2119 init_timer(&ucs->timer_cmd_in); 2116 setup_timer(&ucs->timer_cmd_in, cmd_in_timeout, (unsigned long) cs);
2120 init_waitqueue_head(&ucs->waitqueue); 2117 init_waitqueue_head(&ucs->waitqueue);
2121 2118
2122 return 1; 2119 return 1;
@@ -2387,6 +2384,8 @@ static int gigaset_suspend(struct usb_interface *intf, pm_message_t message)
2387 usb_kill_urb(ucs->urb_ctrl); 2384 usb_kill_urb(ucs->urb_ctrl);
2388 usb_kill_urb(ucs->urb_int_in); 2385 usb_kill_urb(ucs->urb_int_in);
2389 del_timer_sync(&ucs->timer_ctrl); 2386 del_timer_sync(&ucs->timer_ctrl);
2387 del_timer_sync(&ucs->timer_atrdy);
2388 del_timer_sync(&ucs->timer_cmd_in);
2390 2389
2391 gig_dbg(DEBUG_SUSPEND, "suspend complete"); 2390 gig_dbg(DEBUG_SUSPEND, "suspend complete");
2392 return 0; 2391 return 0;