diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-02-12 03:52:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:30 -0500 |
commit | 40565f1962c5be9b9e285e05af01ab7771534868 (patch) | |
tree | ae84097778a8adfc5a9aad8a5428fe803d54346a /drivers/char/ip2/i2lib.c | |
parent | d096f3e9898d469493fc0afe88d7285c4bdc3ce2 (diff) |
[PATCH] Char: timers cleanup
- Use timer macros to set function and data members and to modify
expiration time.
- Use DEFINE_TIMER for global timers and do not init them at run-time in
these cases.
- del_timer_sync is common in most cases -- we want to wait for timer
function if it's still running.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Dmitry Torokhov <dtor@mail.ru> (Input bits)
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ip2/i2lib.c')
-rw-r--r-- | drivers/char/ip2/i2lib.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index 88b9d338da53..f86fa0c55d36 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c | |||
@@ -80,7 +80,7 @@ static int i2RetryFlushOutput(i2ChanStrPtr); | |||
80 | // Not a documented part of the library routines (careful...) but the Diagnostic | 80 | // Not a documented part of the library routines (careful...) but the Diagnostic |
81 | // i2diag.c finds them useful to help the throughput in certain limited | 81 | // i2diag.c finds them useful to help the throughput in certain limited |
82 | // single-threaded operations. | 82 | // single-threaded operations. |
83 | static void iiSendPendingMail(i2eBordStrPtr); | 83 | static inline void iiSendPendingMail(i2eBordStrPtr); |
84 | static void serviceOutgoingFifo(i2eBordStrPtr); | 84 | static void serviceOutgoingFifo(i2eBordStrPtr); |
85 | 85 | ||
86 | // Functions defined in ip2.c as part of interrupt handling | 86 | // Functions defined in ip2.c as part of interrupt handling |
@@ -150,6 +150,13 @@ i2Validate ( i2ChanStrPtr pCh ) | |||
150 | == (CHANNEL_MAGIC | CHANNEL_SUPPORT)); | 150 | == (CHANNEL_MAGIC | CHANNEL_SUPPORT)); |
151 | } | 151 | } |
152 | 152 | ||
153 | static void iiSendPendingMail_t(unsigned long data) | ||
154 | { | ||
155 | i2eBordStrPtr pB = (i2eBordStrPtr)data; | ||
156 | |||
157 | iiSendPendingMail(pB); | ||
158 | } | ||
159 | |||
153 | //****************************************************************************** | 160 | //****************************************************************************** |
154 | // Function: iiSendPendingMail(pB) | 161 | // Function: iiSendPendingMail(pB) |
155 | // Parameters: Pointer to a board structure | 162 | // Parameters: Pointer to a board structure |
@@ -184,12 +191,9 @@ iiSendPendingMail(i2eBordStrPtr pB) | |||
184 | /\/\|=mhw=|\/\/ */ | 191 | /\/\|=mhw=|\/\/ */ |
185 | 192 | ||
186 | if( ++pB->SendPendingRetry < 16 ) { | 193 | if( ++pB->SendPendingRetry < 16 ) { |
187 | 194 | setup_timer(&pB->SendPendingTimer, | |
188 | init_timer( &(pB->SendPendingTimer) ); | 195 | iiSendPendingMail_t, (unsigned long)pB); |
189 | pB->SendPendingTimer.expires = jiffies + 1; | 196 | mod_timer(&pB->SendPendingTimer, jiffies + 1); |
190 | pB->SendPendingTimer.function = (void*)(unsigned long)iiSendPendingMail; | ||
191 | pB->SendPendingTimer.data = (unsigned long)pB; | ||
192 | add_timer( &(pB->SendPendingTimer) ); | ||
193 | } else { | 197 | } else { |
194 | printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" ); | 198 | printk( KERN_ERR "IP2: iiSendPendingMail unable to queue outbound mail\n" ); |
195 | } | 199 | } |
@@ -1265,8 +1269,10 @@ i2RetryFlushOutput(i2ChanStrPtr pCh) | |||
1265 | // soon as all the data is completely sent. | 1269 | // soon as all the data is completely sent. |
1266 | //****************************************************************************** | 1270 | //****************************************************************************** |
1267 | static void | 1271 | static void |
1268 | i2DrainWakeup(i2ChanStrPtr pCh) | 1272 | i2DrainWakeup(unsigned long d) |
1269 | { | 1273 | { |
1274 | i2ChanStrPtr pCh = (i2ChanStrPtr)d; | ||
1275 | |||
1270 | ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires ); | 1276 | ip2trace (CHANN, ITRC_DRAIN, 10, 1, pCh->BookmarkTimer.expires ); |
1271 | 1277 | ||
1272 | pCh->BookmarkTimer.expires = 0; | 1278 | pCh->BookmarkTimer.expires = 0; |
@@ -1292,14 +1298,12 @@ i2DrainOutput(i2ChanStrPtr pCh, int timeout) | |||
1292 | } | 1298 | } |
1293 | if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) { | 1299 | if ((timeout > 0) && (pCh->BookmarkTimer.expires == 0 )) { |
1294 | // One per customer (channel) | 1300 | // One per customer (channel) |
1295 | init_timer( &(pCh->BookmarkTimer) ); | 1301 | setup_timer(&pCh->BookmarkTimer, i2DrainWakeup, |
1296 | pCh->BookmarkTimer.expires = jiffies + timeout; | 1302 | (unsigned long)pCh); |
1297 | pCh->BookmarkTimer.function = (void*)(unsigned long)i2DrainWakeup; | ||
1298 | pCh->BookmarkTimer.data = (unsigned long)pCh; | ||
1299 | 1303 | ||
1300 | ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires ); | 1304 | ip2trace (CHANN, ITRC_DRAIN, 1, 1, pCh->BookmarkTimer.expires ); |
1301 | 1305 | ||
1302 | add_timer( &(pCh->BookmarkTimer) ); | 1306 | mod_timer(&pCh->BookmarkTimer, jiffies + timeout); |
1303 | } | 1307 | } |
1304 | 1308 | ||
1305 | i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ ); | 1309 | i2QueueCommands( PTYPE_INLINE, pCh, -1, 1, CMD_BMARK_REQ ); |