Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] net/sb1000: replace nicedelay() with ssleep()

Use ssleep() instead of nicedelay()
to guarantee the task delays as expected. Remove the prototype and
definition of nicedelay(). This is a very weird function, because it is
called to sleep in terms of usecs, but always sleeps for 1 second,
completely ignoring the parameter. I have gone ahead and followed suit,
just sleeping for a second in all cases, but maybe someone with the
hardware could tell me if perhaps the paramter *should* matter. Additionally,
nicedelay() is called in TASK_INTERRUPTIBLE state, but doesn't deal with signals
in case these longer delays do not complete, so I believe ssleep() is more
appropriate.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>

authored by

Nishanth Aravamudan and committed by
Jeff Garzik
a26c074c 62595eb9

+3 -11
+3 -11
drivers/net/sb1000.c
··· 90 90 91 91 92 92 /* SB1000 hardware routines to be used during open/configuration phases */ 93 - static inline void nicedelay(unsigned long usecs); 94 93 static inline int card_wait_for_busy_clear(const int ioaddr[], 95 94 const char* name); 96 95 static inline int card_wait_for_ready(const int ioaddr[], const char* name, ··· 252 253 */ 253 254 254 255 static const int TimeOutJiffies = (875 * HZ) / 100; 255 - 256 - static inline void nicedelay(unsigned long usecs) 257 - { 258 - current->state = TASK_INTERRUPTIBLE; 259 - schedule_timeout(HZ); 260 - return; 261 - } 262 256 263 257 /* Card Wait For Busy Clear (cannot be used during an interrupt) */ 264 258 static inline int ··· 467 475 udelay(1000); 468 476 outb(0x0, port); 469 477 inb(port); 470 - nicedelay(60000); 478 + ssleep(1); 471 479 outb(0x4, port); 472 480 inb(port); 473 481 udelay(1000); ··· 529 537 const unsigned char Command0[6] = {0x80, 0x11, 0x00, 0x00, 0x00, 0x00}; 530 538 const unsigned char Command1[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00}; 531 539 532 - nicedelay(50000); 540 + ssleep(1); 533 541 if ((status = card_send_command(ioaddr, name, Command0, st))) 534 542 return status; 535 543 if ((status = card_send_command(ioaddr, name, Command1, st))) ··· 936 944 /* initialize sb1000 */ 937 945 if ((status = sb1000_reset(ioaddr, name))) 938 946 return status; 939 - nicedelay(200000); 947 + ssleep(1); 940 948 if ((status = sb1000_check_CRC(ioaddr, name))) 941 949 return status; 942 950