aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/sleep/main.c8
-rw-r--r--drivers/acpi/sleep/poweroff.c4
-rw-r--r--drivers/acpi/sleep/proc.c2
-rw-r--r--drivers/base/dmapool.c3
-rw-r--r--drivers/block/cciss.c7
-rw-r--r--drivers/block/cfq-iosched.c3
-rw-r--r--drivers/block/paride/pcd.c3
-rw-r--r--drivers/block/paride/pf.c3
-rw-r--r--drivers/block/paride/pg.c3
-rw-r--r--drivers/block/paride/pt.c3
-rw-r--r--drivers/block/swim3.c9
-rw-r--r--drivers/block/swim_iop.c3
-rw-r--r--drivers/block/umem.c11
-rw-r--r--drivers/block/xd.c21
-rw-r--r--drivers/block/z2ram.c2
-rw-r--r--drivers/cdrom/sbpcd.c9
-rw-r--r--drivers/cdrom/sonycd535.c3
-rw-r--r--drivers/char/agp/backend.c7
-rw-r--r--drivers/char/applicom.c24
-rw-r--r--drivers/char/ftape/lowlevel/fdc-io.c6
-rw-r--r--drivers/char/hpet.c4
-rw-r--r--drivers/char/hw_random.c5
-rw-r--r--drivers/char/ip2/i2lib.c6
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c18
-rw-r--r--drivers/char/ipmi/ipmi_watchdog.c6
-rw-r--r--drivers/char/lcd.c7
-rw-r--r--drivers/char/lp.c3
-rw-r--r--drivers/char/mxser.c12
-rw-r--r--drivers/char/n_tty.c2
-rw-r--r--drivers/char/pcmcia/synclink_cs.c16
-rw-r--r--drivers/ide/ide-io.c6
-rw-r--r--drivers/ide/ide-tape.c3
-rw-r--r--drivers/ide/ide-timing.h25
-rw-r--r--drivers/ide/legacy/ide-cs.c4
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c14
-rw-r--r--drivers/isdn/i4l/isdn_common.c3
-rw-r--r--drivers/md/dm-exception-store.c9
-rw-r--r--drivers/md/md.c4
-rw-r--r--drivers/media/common/saa7146_core.c6
-rw-r--r--drivers/media/video/cpia_usb.c30
-rw-r--r--drivers/media/video/stradis.c32
-rw-r--r--drivers/media/video/video-buf.c8
-rw-r--r--drivers/media/video/zoran_driver.c2
-rw-r--r--drivers/media/video/zr36120.c6
-rw-r--r--drivers/misc/hdpuftrs/hdpu_cpustate.c23
-rw-r--r--drivers/mtd/devices/mtdram.c3
-rw-r--r--drivers/mtd/ftl.c11
-rw-r--r--drivers/net/bsd_comp.c28
-rw-r--r--drivers/net/ppp_generic.c23
-rw-r--r--drivers/net/tulip/de4x5.c4
-rw-r--r--drivers/parisc/lasi.c1
-rw-r--r--drivers/parport/ieee1284.c7
-rw-r--r--drivers/parport/ieee1284_ops.c10
-rw-r--r--drivers/parport/parport_pc.c3
-rw-r--r--drivers/pci/pci-sysfs.c10
-rw-r--r--drivers/pci/probe.c6
-rw-r--r--drivers/sbus/char/bbc_envctrl.c3
-rw-r--r--drivers/sbus/char/envctrl.c4
-rw-r--r--drivers/scsi/53c7xx.c4
-rw-r--r--drivers/scsi/ch.c27
-rw-r--r--drivers/scsi/cpqfcTSinit.c3
-rw-r--r--drivers/scsi/ibmmca.c1
-rw-r--r--drivers/scsi/osst.c13
-rw-r--r--drivers/serial/8250.c2
-rw-r--r--drivers/telephony/ixj.c116
-rw-r--r--drivers/usb/media/stv680.c26
-rw-r--r--drivers/video/vgastate.c15
67 files changed, 288 insertions, 420 deletions
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index 7249ba2b7a27..aee50b453265 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -23,7 +23,6 @@ u8 sleep_states[ACPI_S_STATE_COUNT];
23 23
24static struct pm_ops acpi_pm_ops; 24static struct pm_ops acpi_pm_ops;
25 25
26extern void do_suspend_lowlevel_s4bios(void);
27extern void do_suspend_lowlevel(void); 26extern void do_suspend_lowlevel(void);
28 27
29static u32 acpi_suspend_states[] = { 28static u32 acpi_suspend_states[] = {
@@ -98,8 +97,6 @@ static int acpi_pm_enter(suspend_state_t pm_state)
98 case PM_SUSPEND_DISK: 97 case PM_SUSPEND_DISK:
99 if (acpi_pm_ops.pm_disk_mode == PM_DISK_PLATFORM) 98 if (acpi_pm_ops.pm_disk_mode == PM_DISK_PLATFORM)
100 status = acpi_enter_sleep_state(acpi_state); 99 status = acpi_enter_sleep_state(acpi_state);
101 else
102 do_suspend_lowlevel_s4bios();
103 break; 100 break;
104 case PM_SUSPEND_MAX: 101 case PM_SUSPEND_MAX:
105 acpi_power_off(); 102 acpi_power_off();
@@ -206,11 +203,6 @@ static int __init acpi_sleep_init(void)
206 printk(" S%d", i); 203 printk(" S%d", i);
207 } 204 }
208 if (i == ACPI_STATE_S4) { 205 if (i == ACPI_STATE_S4) {
209 if (acpi_gbl_FACS->S4bios_f) {
210 sleep_states[i] = 1;
211 printk(" S4bios");
212 acpi_pm_ops.pm_disk_mode = PM_DISK_FIRMWARE;
213 }
214 if (sleep_states[i]) 206 if (sleep_states[i])
215 acpi_pm_ops.pm_disk_mode = PM_DISK_PLATFORM; 207 acpi_pm_ops.pm_disk_mode = PM_DISK_PLATFORM;
216 } 208 }
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c
index a5f947de879b..af7935a95bcc 100644
--- a/drivers/acpi/sleep/poweroff.c
+++ b/drivers/acpi/sleep/poweroff.c
@@ -21,9 +21,7 @@ int acpi_sleep_prepare(u32 acpi_state)
21{ 21{
22#ifdef CONFIG_ACPI_SLEEP 22#ifdef CONFIG_ACPI_SLEEP
23 /* do we have a wakeup address for S2 and S3? */ 23 /* do we have a wakeup address for S2 and S3? */
24 /* Here, we support only S4BIOS, those we set the wakeup address */ 24 if (acpi_state == ACPI_STATE_S3) {
25 /* S4OS is only supported for now via swsusp.. */
26 if (acpi_state == ACPI_STATE_S3 || acpi_state == ACPI_STATE_S4) {
27 if (!acpi_wakeup_address) { 25 if (!acpi_wakeup_address) {
28 return -EFAULT; 26 return -EFAULT;
29 } 27 }
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 09a603f3523e..4696a85a98b9 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -25,8 +25,6 @@ static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
25 for (i = 0; i <= ACPI_STATE_S5; i++) { 25 for (i = 0; i <= ACPI_STATE_S5; i++) {
26 if (sleep_states[i]) { 26 if (sleep_states[i]) {
27 seq_printf(seq, "S%d ", i); 27 seq_printf(seq, "S%d ", i);
28 if (i == ACPI_STATE_S4 && acpi_gbl_FACS->S4bios_f)
29 seq_printf(seq, "S4bios ");
30 } 28 }
31 } 29 }
32 30
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c
index c4aebf2f522d..60a7ef6a201b 100644
--- a/drivers/base/dmapool.c
+++ b/drivers/base/dmapool.c
@@ -262,7 +262,8 @@ dma_pool_destroy (struct dma_pool *pool)
262 * If such a memory block can't be allocated, null is returned. 262 * If such a memory block can't be allocated, null is returned.
263 */ 263 */
264void * 264void *
265dma_pool_alloc (struct dma_pool *pool, int mem_flags, dma_addr_t *handle) 265dma_pool_alloc (struct dma_pool *pool, unsigned int __nocast mem_flags,
266 dma_addr_t *handle)
266{ 267{
267 unsigned long flags; 268 unsigned long flags;
268 struct dma_page *page; 269 struct dma_page *page;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 418b1469d75d..28f2c177a541 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1713,10 +1713,9 @@ static unsigned long pollcomplete(int ctlr)
1713 1713
1714 for (i = 20 * HZ; i > 0; i--) { 1714 for (i = 20 * HZ; i > 0; i--) {
1715 done = hba[ctlr]->access.command_completed(hba[ctlr]); 1715 done = hba[ctlr]->access.command_completed(hba[ctlr]);
1716 if (done == FIFO_EMPTY) { 1716 if (done == FIFO_EMPTY)
1717 set_current_state(TASK_UNINTERRUPTIBLE); 1717 schedule_timeout_uninterruptible(1);
1718 schedule_timeout(1); 1718 else
1719 } else
1720 return (done); 1719 return (done);
1721 } 1720 }
1722 /* Invalid address to tell caller we ran out of time */ 1721 /* Invalid address to tell caller we ran out of time */
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 30c0903c7cdd..cd056e7e64ec 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -2260,6 +2260,8 @@ static void cfq_put_cfqd(struct cfq_data *cfqd)
2260 if (!atomic_dec_and_test(&cfqd->ref)) 2260 if (!atomic_dec_and_test(&cfqd->ref))
2261 return; 2261 return;
2262 2262
2263 blk_put_queue(q);
2264
2263 cfq_shutdown_timer_wq(cfqd); 2265 cfq_shutdown_timer_wq(cfqd);
2264 q->elevator->elevator_data = NULL; 2266 q->elevator->elevator_data = NULL;
2265 2267
@@ -2316,6 +2318,7 @@ static int cfq_init_queue(request_queue_t *q, elevator_t *e)
2316 e->elevator_data = cfqd; 2318 e->elevator_data = cfqd;
2317 2319
2318 cfqd->queue = q; 2320 cfqd->queue = q;
2321 atomic_inc(&q->refcnt);
2319 2322
2320 cfqd->max_queued = q->nr_requests / 4; 2323 cfqd->max_queued = q->nr_requests / 4;
2321 q->nr_batching = cfq_queued; 2324 q->nr_batching = cfq_queued;
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 7289f67e9568..ac5ba462710b 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -516,8 +516,7 @@ static int pcd_tray_move(struct cdrom_device_info *cdi, int position)
516 516
517static void pcd_sleep(int cs) 517static void pcd_sleep(int cs)
518{ 518{
519 current->state = TASK_INTERRUPTIBLE; 519 schedule_timeout_interruptible(cs);
520 schedule_timeout(cs);
521} 520}
522 521
523static int pcd_reset(struct pcd_unit *cd) 522static int pcd_reset(struct pcd_unit *cd)
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 060b1f2a91dd..711d2f314ac3 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -507,8 +507,7 @@ static void pf_eject(struct pf_unit *pf)
507 507
508static void pf_sleep(int cs) 508static void pf_sleep(int cs)
509{ 509{
510 current->state = TASK_INTERRUPTIBLE; 510 schedule_timeout_interruptible(cs);
511 schedule_timeout(cs);
512} 511}
513 512
514/* the ATAPI standard actually specifies the contents of all 7 registers 513/* the ATAPI standard actually specifies the contents of all 7 registers
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 84d8e291ed96..b3982395f22b 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -276,8 +276,7 @@ static inline u8 DRIVE(struct pg *dev)
276 276
277static void pg_sleep(int cs) 277static void pg_sleep(int cs)
278{ 278{
279 current->state = TASK_INTERRUPTIBLE; 279 schedule_timeout_interruptible(cs);
280 schedule_timeout(cs);
281} 280}
282 281
283static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg) 282static int pg_wait(struct pg *dev, int go, int stop, unsigned long tmo, char *msg)
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 5fe8ee86f095..d8d35233cf49 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -383,8 +383,7 @@ static int pt_atapi(struct pt_unit *tape, char *cmd, int dlen, char *buf, char *
383 383
384static void pt_sleep(int cs) 384static void pt_sleep(int cs)
385{ 385{
386 current->state = TASK_INTERRUPTIBLE; 386 schedule_timeout_interruptible(cs);
387 schedule_timeout(cs);
388} 387}
389 388
390static int pt_poll_dsc(struct pt_unit *tape, int pause, int tmo, char *msg) 389static int pt_poll_dsc(struct pt_unit *tape, int pause, int tmo, char *msg)
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index e5f7494c00ee..e425ad3eebba 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -834,8 +834,7 @@ static int fd_eject(struct floppy_state *fs)
834 break; 834 break;
835 } 835 }
836 swim3_select(fs, RELAX); 836 swim3_select(fs, RELAX);
837 current->state = TASK_INTERRUPTIBLE; 837 schedule_timeout_interruptible(1);
838 schedule_timeout(1);
839 if (swim3_readbit(fs, DISK_IN) == 0) 838 if (swim3_readbit(fs, DISK_IN) == 0)
840 break; 839 break;
841 } 840 }
@@ -906,8 +905,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
906 break; 905 break;
907 } 906 }
908 swim3_select(fs, RELAX); 907 swim3_select(fs, RELAX);
909 current->state = TASK_INTERRUPTIBLE; 908 schedule_timeout_interruptible(1);
910 schedule_timeout(1);
911 } 909 }
912 if (err == 0 && (swim3_readbit(fs, SEEK_COMPLETE) == 0 910 if (err == 0 && (swim3_readbit(fs, SEEK_COMPLETE) == 0
913 || swim3_readbit(fs, DISK_IN) == 0)) 911 || swim3_readbit(fs, DISK_IN) == 0))
@@ -992,8 +990,7 @@ static int floppy_revalidate(struct gendisk *disk)
992 if (signal_pending(current)) 990 if (signal_pending(current))
993 break; 991 break;
994 swim3_select(fs, RELAX); 992 swim3_select(fs, RELAX);
995 current->state = TASK_INTERRUPTIBLE; 993 schedule_timeout_interruptible(1);
996 schedule_timeout(1);
997 } 994 }
998 ret = swim3_readbit(fs, SEEK_COMPLETE) == 0 995 ret = swim3_readbit(fs, SEEK_COMPLETE) == 0
999 || swim3_readbit(fs, DISK_IN) == 0; 996 || swim3_readbit(fs, DISK_IN) == 0;
diff --git a/drivers/block/swim_iop.c b/drivers/block/swim_iop.c
index a1283f6dc018..89e3c2f8b776 100644
--- a/drivers/block/swim_iop.c
+++ b/drivers/block/swim_iop.c
@@ -338,8 +338,7 @@ static int swimiop_eject(struct floppy_state *fs)
338 err = -EINTR; 338 err = -EINTR;
339 break; 339 break;
340 } 340 }
341 current->state = TASK_INTERRUPTIBLE; 341 schedule_timeout_interruptible(1);
342 schedule_timeout(1);
343 } 342 }
344 release_drive(fs); 343 release_drive(fs);
345 return cmd->error; 344 return cmd->error;
diff --git a/drivers/block/umem.c b/drivers/block/umem.c
index 0c4c121d2e79..0f48301342da 100644
--- a/drivers/block/umem.c
+++ b/drivers/block/umem.c
@@ -34,6 +34,7 @@
34 * - set initialised bit then. 34 * - set initialised bit then.
35 */ 35 */
36 36
37//#define DEBUG /* uncomment if you want debugging info (pr_debug) */
37#include <linux/config.h> 38#include <linux/config.h>
38#include <linux/sched.h> 39#include <linux/sched.h>
39#include <linux/fs.h> 40#include <linux/fs.h>
@@ -58,10 +59,6 @@
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
59#include <asm/io.h> 60#include <asm/io.h>
60 61
61#define PRINTK(x...) do {} while (0)
62#define dprintk(x...) do {} while (0)
63/*#define dprintk(x...) printk(x) */
64
65#define MM_MAXCARDS 4 62#define MM_MAXCARDS 4
66#define MM_RAHEAD 2 /* two sectors */ 63#define MM_RAHEAD 2 /* two sectors */
67#define MM_BLKSIZE 1024 /* 1k blocks */ 64#define MM_BLKSIZE 1024 /* 1k blocks */
@@ -299,7 +296,7 @@ static void mm_start_io(struct cardinfo *card)
299 296
300 /* make the last descriptor end the chain */ 297 /* make the last descriptor end the chain */
301 page = &card->mm_pages[card->Active]; 298 page = &card->mm_pages[card->Active];
302 PRINTK("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1); 299 pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1);
303 desc = &page->desc[page->cnt-1]; 300 desc = &page->desc[page->cnt-1];
304 301
305 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN); 302 desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -532,7 +529,7 @@ static void process_page(unsigned long data)
532 activate(card); 529 activate(card);
533 } else { 530 } else {
534 /* haven't finished with this one yet */ 531 /* haven't finished with this one yet */
535 PRINTK("do some more\n"); 532 pr_debug("do some more\n");
536 mm_start_io(card); 533 mm_start_io(card);
537 } 534 }
538 out_unlock: 535 out_unlock:
@@ -555,7 +552,7 @@ static void process_page(unsigned long data)
555static int mm_make_request(request_queue_t *q, struct bio *bio) 552static int mm_make_request(request_queue_t *q, struct bio *bio)
556{ 553{
557 struct cardinfo *card = q->queuedata; 554 struct cardinfo *card = q->queuedata;
558 PRINTK("mm_make_request %ld %d\n", bh->b_rsector, bh->b_size); 555 pr_debug("mm_make_request %ld %d\n", bh->b_rsector, bh->b_size);
559 556
560 bio->bi_phys_segments = bio->bi_idx; /* count of completed segments*/ 557 bio->bi_phys_segments = bio->bi_idx; /* count of completed segments*/
561 spin_lock_irq(&card->lock); 558 spin_lock_irq(&card->lock);
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 1676033da6c6..68b6d7b154cf 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -47,6 +47,7 @@
47#include <linux/wait.h> 47#include <linux/wait.h>
48#include <linux/blkdev.h> 48#include <linux/blkdev.h>
49#include <linux/blkpg.h> 49#include <linux/blkpg.h>
50#include <linux/delay.h>
50 51
51#include <asm/system.h> 52#include <asm/system.h>
52#include <asm/io.h> 53#include <asm/io.h>
@@ -62,7 +63,7 @@ static int xd[5] = { -1,-1,-1,-1, };
62 63
63#define XD_DONT_USE_DMA 0 /* Initial value. may be overriden using 64#define XD_DONT_USE_DMA 0 /* Initial value. may be overriden using
64 "nodma" module option */ 65 "nodma" module option */
65#define XD_INIT_DISK_DELAY (30*HZ/1000) /* 30 ms delay during disk initialization */ 66#define XD_INIT_DISK_DELAY (30) /* 30 ms delay during disk initialization */
66 67
67/* Above may need to be increased if a problem with the 2nd drive detection 68/* Above may need to be increased if a problem with the 2nd drive detection
68 (ST11M controller) or resetting a controller (WD) appears */ 69 (ST11M controller) or resetting a controller (WD) appears */
@@ -529,10 +530,8 @@ static inline u_char xd_waitport (u_short port,u_char flags,u_char mask,u_long t
529 int success; 530 int success;
530 531
531 xdc_busy = 1; 532 xdc_busy = 1;
532 while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry)) { 533 while ((success = ((inb(port) & mask) != flags)) && time_before(jiffies, expiry))
533 set_current_state(TASK_UNINTERRUPTIBLE); 534 schedule_timeout_uninterruptible(1);
534 schedule_timeout(1);
535 }
536 xdc_busy = 0; 535 xdc_busy = 0;
537 return (success); 536 return (success);
538} 537}
@@ -633,14 +632,12 @@ static u_char __init xd_initdrives (void (*init_drive)(u_char drive))
633 for (i = 0; i < XD_MAXDRIVES; i++) { 632 for (i = 0; i < XD_MAXDRIVES; i++) {
634 xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0); 633 xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0);
635 if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) { 634 if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) {
636 set_current_state(TASK_INTERRUPTIBLE); 635 msleep_interruptible(XD_INIT_DISK_DELAY);
637 schedule_timeout(XD_INIT_DISK_DELAY);
638 636
639 init_drive(count); 637 init_drive(count);
640 count++; 638 count++;
641 639
642 set_current_state(TASK_INTERRUPTIBLE); 640 msleep_interruptible(XD_INIT_DISK_DELAY);
643 schedule_timeout(XD_INIT_DISK_DELAY);
644 } 641 }
645 } 642 }
646 return (count); 643 return (count);
@@ -761,8 +758,7 @@ static void __init xd_wd_init_controller (unsigned int address)
761 758
762 outb(0,XD_RESET); /* reset the controller */ 759 outb(0,XD_RESET); /* reset the controller */
763 760
764 set_current_state(TASK_UNINTERRUPTIBLE); 761 msleep(XD_INIT_DISK_DELAY);
765 schedule_timeout(XD_INIT_DISK_DELAY);
766} 762}
767 763
768static void __init xd_wd_init_drive (u_char drive) 764static void __init xd_wd_init_drive (u_char drive)
@@ -936,8 +932,7 @@ If you need non-standard settings use the xd=... command */
936 xd_maxsectors = 0x01; 932 xd_maxsectors = 0x01;
937 outb(0,XD_RESET); /* reset the controller */ 933 outb(0,XD_RESET); /* reset the controller */
938 934
939 set_current_state(TASK_UNINTERRUPTIBLE); 935 msleep(XD_INIT_DISK_DELAY);
940 schedule_timeout(XD_INIT_DISK_DELAY);
941} 936}
942 937
943static void __init xd_xebec_init_drive (u_char drive) 938static void __init xd_xebec_init_drive (u_char drive)
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index 007f6a662439..bb5e8d665a2a 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -296,7 +296,7 @@ z2_open( struct inode *inode, struct file *filp )
296 return 0; 296 return 0;
297 297
298err_out_kfree: 298err_out_kfree:
299 kfree( z2ram_map ); 299 kfree(z2ram_map);
300err_out: 300err_out:
301 return rc; 301 return rc;
302} 302}
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c
index 30a897755361..466e9c2974bd 100644
--- a/drivers/cdrom/sbpcd.c
+++ b/drivers/cdrom/sbpcd.c
@@ -827,8 +827,7 @@ static void mark_timeout_audio(u_long i)
827static void sbp_sleep(u_int time) 827static void sbp_sleep(u_int time)
828{ 828{
829 sti(); 829 sti();
830 current->state = TASK_INTERRUPTIBLE; 830 schedule_timeout_interruptible(time);
831 schedule_timeout(time);
832 sti(); 831 sti();
833} 832}
834/*==========================================================================*/ 833/*==========================================================================*/
@@ -4216,7 +4215,8 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd,
4216 4215
4217 case CDROMAUDIOBUFSIZ: /* configure the audio buffer size */ 4216 case CDROMAUDIOBUFSIZ: /* configure the audio buffer size */
4218 msg(DBG_IOC,"ioctl: CDROMAUDIOBUFSIZ entered.\n"); 4217 msg(DBG_IOC,"ioctl: CDROMAUDIOBUFSIZ entered.\n");
4219 if (current_drive->sbp_audsiz>0) vfree(current_drive->aud_buf); 4218 if (current_drive->sbp_audsiz>0)
4219 vfree(current_drive->aud_buf);
4220 current_drive->aud_buf=NULL; 4220 current_drive->aud_buf=NULL;
4221 current_drive->sbp_audsiz=arg; 4221 current_drive->sbp_audsiz=arg;
4222 4222
@@ -5910,7 +5910,8 @@ static void sbpcd_exit(void)
5910 put_disk(D_S[j].disk); 5910 put_disk(D_S[j].disk);
5911 devfs_remove("sbp/c0t%d", j); 5911 devfs_remove("sbp/c0t%d", j);
5912 vfree(D_S[j].sbp_buf); 5912 vfree(D_S[j].sbp_buf);
5913 if (D_S[j].sbp_audsiz>0) vfree(D_S[j].aud_buf); 5913 if (D_S[j].sbp_audsiz>0)
5914 vfree(D_S[j].aud_buf);
5914 if ((unregister_cdrom(D_S[j].sbpcd_infop) == -EINVAL)) 5915 if ((unregister_cdrom(D_S[j].sbpcd_infop) == -EINVAL))
5915 { 5916 {
5916 msg(DBG_INF, "What's that: can't unregister info %s.\n", major_name); 5917 msg(DBG_INF, "What's that: can't unregister info %s.\n", major_name);
diff --git a/drivers/cdrom/sonycd535.c b/drivers/cdrom/sonycd535.c
index 9f22e8f1f6c0..e65659926432 100644
--- a/drivers/cdrom/sonycd535.c
+++ b/drivers/cdrom/sonycd535.c
@@ -1478,8 +1478,7 @@ static int __init sony535_init(void)
1478 /* look for the CD-ROM, follows the procedure in the DOS driver */ 1478 /* look for the CD-ROM, follows the procedure in the DOS driver */
1479 inb(select_unit_reg); 1479 inb(select_unit_reg);
1480 /* wait for 40 18 Hz ticks (reverse-engineered from DOS driver) */ 1480 /* wait for 40 18 Hz ticks (reverse-engineered from DOS driver) */
1481 set_current_state(TASK_INTERRUPTIBLE); 1481 schedule_timeout_interruptible((HZ+17)*40/18);
1482 schedule_timeout((HZ+17)*40/18);
1483 inb(result_reg); 1482 inb(result_reg);
1484 1483
1485 outb(0, read_status_reg); /* does a reset? */ 1484 outb(0, read_status_reg); /* does a reset? */
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
index 4d4e602fdc7e..82b43c541c8d 100644
--- a/drivers/char/agp/backend.c
+++ b/drivers/char/agp/backend.c
@@ -206,10 +206,9 @@ static void agp_backend_cleanup(struct agp_bridge_data *bridge)
206 bridge->driver->cleanup(); 206 bridge->driver->cleanup();
207 if (bridge->driver->free_gatt_table) 207 if (bridge->driver->free_gatt_table)
208 bridge->driver->free_gatt_table(bridge); 208 bridge->driver->free_gatt_table(bridge);
209 if (bridge->key_list) { 209
210 vfree(bridge->key_list); 210 vfree(bridge->key_list);
211 bridge->key_list = NULL; 211 bridge->key_list = NULL;
212 }
213 212
214 if (bridge->driver->agp_destroy_page && 213 if (bridge->driver->agp_destroy_page &&
215 bridge->driver->needs_scratch_page) 214 bridge->driver->needs_scratch_page)
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 11f9ee581124..927a5bbe112c 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -172,7 +172,7 @@ static int ac_register_board(unsigned long physloc, void __iomem *loc,
172 172
173void cleanup_module(void) 173void cleanup_module(void)
174{ 174{
175 int i; 175 unsigned int i;
176 176
177 misc_deregister(&ac_miscdev); 177 misc_deregister(&ac_miscdev);
178 178
@@ -195,7 +195,7 @@ int __init applicom_init(void)
195 int i, numisa = 0; 195 int i, numisa = 0;
196 struct pci_dev *dev = NULL; 196 struct pci_dev *dev = NULL;
197 void __iomem *RamIO; 197 void __iomem *RamIO;
198 int boardno; 198 int boardno, ret;
199 199
200 printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n"); 200 printk(KERN_INFO "Applicom driver: $Id: ac.c,v 1.30 2000/03/22 16:03:57 dwmw2 Exp $\n");
201 201
@@ -294,7 +294,8 @@ int __init applicom_init(void)
294 } 294 }
295 295
296 if (!numisa) 296 if (!numisa)
297 printk(KERN_WARNING"ac.o: No valid ISA Applicom boards found at mem 0x%lx\n",mem); 297 printk(KERN_WARNING "ac.o: No valid ISA Applicom boards found "
298 "at mem 0x%lx\n", mem);
298 299
299 fin: 300 fin:
300 init_waitqueue_head(&FlagSleepRec); 301 init_waitqueue_head(&FlagSleepRec);
@@ -304,7 +305,11 @@ int __init applicom_init(void)
304 DeviceErrorCount = 0; 305 DeviceErrorCount = 0;
305 306
306 if (numboards) { 307 if (numboards) {
307 misc_register(&ac_miscdev); 308 ret = misc_register(&ac_miscdev);
309 if (ret) {
310 printk(KERN_WARNING "ac.o: Unable to register misc device\n");
311 goto out;
312 }
308 for (i = 0; i < MAX_BOARD; i++) { 313 for (i = 0; i < MAX_BOARD; i++) {
309 int serial; 314 int serial;
310 char boardname[(SERIAL_NUMBER - TYPE_CARD) + 1]; 315 char boardname[(SERIAL_NUMBER - TYPE_CARD) + 1];
@@ -337,6 +342,17 @@ int __init applicom_init(void)
337 342
338 else 343 else
339 return -ENXIO; 344 return -ENXIO;
345
346out:
347 for (i = 0; i < MAX_BOARD; i++) {
348 if (!apbs[i].RamIO)
349 continue;
350 if (apbs[i].irq)
351 free_irq(apbs[i].irq, &dummy);
352 iounmap(apbs[i].RamIO);
353 }
354 pci_disable_device(dev);
355 return ret;
340} 356}
341 357
342 358
diff --git a/drivers/char/ftape/lowlevel/fdc-io.c b/drivers/char/ftape/lowlevel/fdc-io.c
index 1704a2a57048..b2e0928e8428 100644
--- a/drivers/char/ftape/lowlevel/fdc-io.c
+++ b/drivers/char/ftape/lowlevel/fdc-io.c
@@ -387,10 +387,8 @@ int fdc_interrupt_wait(unsigned int time)
387 387
388 set_current_state(TASK_INTERRUPTIBLE); 388 set_current_state(TASK_INTERRUPTIBLE);
389 add_wait_queue(&ftape_wait_intr, &wait); 389 add_wait_queue(&ftape_wait_intr, &wait);
390 while (!ft_interrupt_seen && timeout) { 390 while (!ft_interrupt_seen && timeout)
391 set_current_state(TASK_INTERRUPTIBLE); 391 timeout = schedule_timeout_interruptible(timeout);
392 timeout = schedule_timeout(timeout);
393 }
394 392
395 spin_lock_irq(&current->sighand->siglock); 393 spin_lock_irq(&current->sighand->siglock);
396 current->blocked = old_sigmask; 394 current->blocked = old_sigmask;
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
index 5fe8461271fc..de0379b6d502 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -100,14 +100,14 @@ static struct hpets *hpets;
100#endif 100#endif
101 101
102#ifndef readq 102#ifndef readq
103static unsigned long long __inline readq(void __iomem *addr) 103static inline unsigned long long readq(void __iomem *addr)
104{ 104{
105 return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL); 105 return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL);
106} 106}
107#endif 107#endif
108 108
109#ifndef writeq 109#ifndef writeq
110static void __inline writeq(unsigned long long v, void __iomem *addr) 110static inline void writeq(unsigned long long v, void __iomem *addr)
111{ 111{
112 writel(v & 0xffffffff, addr); 112 writel(v & 0xffffffff, addr);
113 writel(v >> 32, addr + 4); 113 writel(v >> 32, addr + 4);
diff --git a/drivers/char/hw_random.c b/drivers/char/hw_random.c
index 3480535a09c5..6f673d2de0b1 100644
--- a/drivers/char/hw_random.c
+++ b/drivers/char/hw_random.c
@@ -513,10 +513,7 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
513 return ret ? : -EAGAIN; 513 return ret ? : -EAGAIN;
514 514
515 if(need_resched()) 515 if(need_resched())
516 { 516 schedule_timeout_interruptible(1);
517 current->state = TASK_INTERRUPTIBLE;
518 schedule_timeout(1);
519 }
520 else 517 else
521 udelay(200); /* FIXME: We could poll for 250uS ?? */ 518 udelay(200); /* FIXME: We could poll for 250uS ?? */
522 519
diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c
index 82c5f30375ac..ba85eb1b6ec7 100644
--- a/drivers/char/ip2/i2lib.c
+++ b/drivers/char/ip2/i2lib.c
@@ -655,8 +655,7 @@ i2QueueCommands(int type, i2ChanStrPtr pCh, int timeout, int nCommands,
655 timeout--; // So negative values == forever 655 timeout--; // So negative values == forever
656 656
657 if (!in_interrupt()) { 657 if (!in_interrupt()) {
658 current->state = TASK_INTERRUPTIBLE; 658 schedule_timeout_interruptible(1); // short nap
659 schedule_timeout(1); // short nap
660 } else { 659 } else {
661 // we cannot sched/sleep in interrrupt silly 660 // we cannot sched/sleep in interrrupt silly
662 return 0; 661 return 0;
@@ -1132,8 +1131,7 @@ i2Output(i2ChanStrPtr pCh, const char *pSource, int count, int user )
1132 1131
1133 ip2trace (CHANN, ITRC_OUTPUT, 61, 0 ); 1132 ip2trace (CHANN, ITRC_OUTPUT, 61, 0 );
1134 1133
1135 current->state = TASK_INTERRUPTIBLE; 1134 schedule_timeout_interruptible(2);
1136 schedule_timeout(2);
1137 if (signal_pending(current)) { 1135 if (signal_pending(current)) {
1138 break; 1136 break;
1139 } 1137 }
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 278f84104996..b6e5cbfb09f8 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1920,8 +1920,7 @@ static int try_get_dev_id(struct smi_info *smi_info)
1920 for (;;) 1920 for (;;)
1921 { 1921 {
1922 if (smi_result == SI_SM_CALL_WITH_DELAY) { 1922 if (smi_result == SI_SM_CALL_WITH_DELAY) {
1923 set_current_state(TASK_UNINTERRUPTIBLE); 1923 schedule_timeout_uninterruptible(1);
1924 schedule_timeout(1);
1925 smi_result = smi_info->handlers->event( 1924 smi_result = smi_info->handlers->event(
1926 smi_info->si_sm, 100); 1925 smi_info->si_sm, 100);
1927 } 1926 }
@@ -2256,10 +2255,8 @@ static int init_one_smi(int intf_num, struct smi_info **smi)
2256 2255
2257 /* Wait for the timer to stop. This avoids problems with race 2256 /* Wait for the timer to stop. This avoids problems with race
2258 conditions removing the timer here. */ 2257 conditions removing the timer here. */
2259 while (! new_smi->timer_stopped) { 2258 while (!new_smi->timer_stopped)
2260 set_current_state(TASK_UNINTERRUPTIBLE); 2259 schedule_timeout_uninterruptible(1);
2261 schedule_timeout(1);
2262 }
2263 2260
2264 out_err: 2261 out_err:
2265 if (new_smi->intf) 2262 if (new_smi->intf)
@@ -2379,17 +2376,14 @@ static void __exit cleanup_one_si(struct smi_info *to_clean)
2379 2376
2380 /* Wait for the timer to stop. This avoids problems with race 2377 /* Wait for the timer to stop. This avoids problems with race
2381 conditions removing the timer here. */ 2378 conditions removing the timer here. */
2382 while (! to_clean->timer_stopped) { 2379 while (!to_clean->timer_stopped)
2383 set_current_state(TASK_UNINTERRUPTIBLE); 2380 schedule_timeout_uninterruptible(1);
2384 schedule_timeout(1);
2385 }
2386 2381
2387 /* Interrupts and timeouts are stopped, now make sure the 2382 /* Interrupts and timeouts are stopped, now make sure the
2388 interface is in a clean state. */ 2383 interface is in a clean state. */
2389 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) { 2384 while (to_clean->curr_msg || (to_clean->si_state != SI_NORMAL)) {
2390 poll(to_clean); 2385 poll(to_clean);
2391 set_current_state(TASK_UNINTERRUPTIBLE); 2386 schedule_timeout_uninterruptible(1);
2392 schedule_timeout(1);
2393 } 2387 }
2394 2388
2395 rv = ipmi_unregister_smi(to_clean->intf); 2389 rv = ipmi_unregister_smi(to_clean->intf);
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index e71aaae855ad..2da64bf7469c 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -1037,10 +1037,8 @@ static __exit void ipmi_unregister_watchdog(void)
1037 /* Wait to make sure the message makes it out. The lower layer has 1037 /* Wait to make sure the message makes it out. The lower layer has
1038 pointers to our buffers, we want to make sure they are done before 1038 pointers to our buffers, we want to make sure they are done before
1039 we release our memory. */ 1039 we release our memory. */
1040 while (atomic_read(&set_timeout_tofree)) { 1040 while (atomic_read(&set_timeout_tofree))
1041 set_current_state(TASK_UNINTERRUPTIBLE); 1041 schedule_timeout_uninterruptible(1);
1042 schedule_timeout(1);
1043 }
1044 1042
1045 /* Disconnect from IPMI. */ 1043 /* Disconnect from IPMI. */
1046 rv = ipmi_destroy_user(watchdog_user); 1044 rv = ipmi_destroy_user(watchdog_user);
diff --git a/drivers/char/lcd.c b/drivers/char/lcd.c
index cf01a720eb2e..b77161146144 100644
--- a/drivers/char/lcd.c
+++ b/drivers/char/lcd.c
@@ -613,10 +613,15 @@ static struct miscdevice lcd_dev = {
613 613
614static int lcd_init(void) 614static int lcd_init(void)
615{ 615{
616 int ret;
616 unsigned long data; 617 unsigned long data;
617 618
618 pr_info("%s\n", LCD_DRIVER); 619 pr_info("%s\n", LCD_DRIVER);
619 misc_register(&lcd_dev); 620 ret = misc_register(&lcd_dev);
621 if (ret) {
622 printk(KERN_WARNING LCD "Unable to register misc device.\n");
623 return ret;
624 }
620 625
621 /* Check region? Naaah! Just snarf it up. */ 626 /* Check region? Naaah! Just snarf it up. */
622/* request_region(RTC_PORT(0), RTC_IO_EXTENT, "lcd");*/ 627/* request_region(RTC_PORT(0), RTC_IO_EXTENT, "lcd");*/
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 59eebe5a035f..2afb9038dbc5 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -128,6 +128,7 @@
128#include <linux/console.h> 128#include <linux/console.h>
129#include <linux/device.h> 129#include <linux/device.h>
130#include <linux/wait.h> 130#include <linux/wait.h>
131#include <linux/jiffies.h>
131 132
132#include <linux/parport.h> 133#include <linux/parport.h>
133#undef LP_STATS 134#undef LP_STATS
@@ -307,7 +308,7 @@ static ssize_t lp_write(struct file * file, const char __user * buf,
307 (LP_F(minor) & LP_ABORT)); 308 (LP_F(minor) & LP_ABORT));
308 309
309#ifdef LP_STATS 310#ifdef LP_STATS
310 if (jiffies-lp_table[minor].lastcall > LP_TIME(minor)) 311 if (time_after(jiffies, lp_table[minor].lastcall + LP_TIME(minor)))
311 lp_table[minor].runchars = 0; 312 lp_table[minor].runchars = 0;
312 313
313 lp_table[minor].lastcall = jiffies; 314 lp_table[minor].lastcall = jiffies;
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index d0ef1ae41298..45d012d85e8c 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1058,8 +1058,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1058 */ 1058 */
1059 timeout = jiffies + HZ; 1059 timeout = jiffies + HZ;
1060 while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) { 1060 while (!(inb(info->base + UART_LSR) & UART_LSR_TEMT)) {
1061 set_current_state(TASK_INTERRUPTIBLE); 1061 schedule_timeout_interruptible(5);
1062 schedule_timeout(5);
1063 if (time_after(jiffies, timeout)) 1062 if (time_after(jiffies, timeout))
1064 break; 1063 break;
1065 } 1064 }
@@ -1080,10 +1079,8 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
1080 info->event = 0; 1079 info->event = 0;
1081 info->tty = NULL; 1080 info->tty = NULL;
1082 if (info->blocked_open) { 1081 if (info->blocked_open) {
1083 if (info->close_delay) { 1082 if (info->close_delay)
1084 set_current_state(TASK_INTERRUPTIBLE); 1083 schedule_timeout_interruptible(info->close_delay);
1085 schedule_timeout(info->close_delay);
1086 }
1087 wake_up_interruptible(&info->open_wait); 1084 wake_up_interruptible(&info->open_wait);
1088 } 1085 }
1089 1086
@@ -1801,8 +1798,7 @@ static void mxser_wait_until_sent(struct tty_struct *tty, int timeout)
1801#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT 1798#ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
1802 printk("lsr = %d (jiff=%lu)...", lsr, jiffies); 1799 printk("lsr = %d (jiff=%lu)...", lsr, jiffies);
1803#endif 1800#endif
1804 set_current_state(TASK_INTERRUPTIBLE); 1801 schedule_timeout_interruptible(char_time);
1805 schedule_timeout(char_time);
1806 if (signal_pending(current)) 1802 if (signal_pending(current))
1807 break; 1803 break;
1808 if (timeout && time_after(jiffies, orig_jiffies + timeout)) 1804 if (timeout && time_after(jiffies, orig_jiffies + timeout))
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 09103b3d8f05..c9bdf544ed2c 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -62,7 +62,7 @@
62 62
63static inline unsigned char *alloc_buf(void) 63static inline unsigned char *alloc_buf(void)
64{ 64{
65 int prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; 65 unsigned int prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
66 66
67 if (PAGE_SIZE != N_TTY_BUF_SIZE) 67 if (PAGE_SIZE != N_TTY_BUF_SIZE)
68 return kmalloc(N_TTY_BUF_SIZE, prio); 68 return kmalloc(N_TTY_BUF_SIZE, prio);
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 7a0c74648124..02d7f046c10a 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/drivers/char/pcmcia/synclink_cs.c 2 * linux/drivers/char/pcmcia/synclink_cs.c
3 * 3 *
4 * $Id: synclink_cs.c,v 4.26 2004/08/11 19:30:02 paulkf Exp $ 4 * $Id: synclink_cs.c,v 4.34 2005/09/08 13:20:54 paulkf Exp $
5 * 5 *
6 * Device driver for Microgate SyncLink PC Card 6 * Device driver for Microgate SyncLink PC Card
7 * multiprotocol serial adapter. 7 * multiprotocol serial adapter.
@@ -472,7 +472,7 @@ module_param_array(dosyncppp, int, NULL, 0);
472MODULE_LICENSE("GPL"); 472MODULE_LICENSE("GPL");
473 473
474static char *driver_name = "SyncLink PC Card driver"; 474static char *driver_name = "SyncLink PC Card driver";
475static char *driver_version = "$Revision: 4.26 $"; 475static char *driver_version = "$Revision: 4.34 $";
476 476
477static struct tty_driver *serial_driver; 477static struct tty_driver *serial_driver;
478 478
@@ -1457,6 +1457,8 @@ static int startup(MGSLPC_INFO * info)
1457 1457
1458 info->pending_bh = 0; 1458 info->pending_bh = 0;
1459 1459
1460 memset(&info->icount, 0, sizeof(info->icount));
1461
1460 init_timer(&info->tx_timer); 1462 init_timer(&info->tx_timer);
1461 info->tx_timer.data = (unsigned long)info; 1463 info->tx_timer.data = (unsigned long)info;
1462 info->tx_timer.function = tx_timeout; 1464 info->tx_timer.function = tx_timeout;
@@ -1946,9 +1948,13 @@ static int get_stats(MGSLPC_INFO * info, struct mgsl_icount __user *user_icount)
1946 int err; 1948 int err;
1947 if (debug_level >= DEBUG_LEVEL_INFO) 1949 if (debug_level >= DEBUG_LEVEL_INFO)
1948 printk("get_params(%s)\n", info->device_name); 1950 printk("get_params(%s)\n", info->device_name);
1949 COPY_TO_USER(err,user_icount, &info->icount, sizeof(struct mgsl_icount)); 1951 if (!user_icount) {
1950 if (err) 1952 memset(&info->icount, 0, sizeof(info->icount));
1951 return -EFAULT; 1953 } else {
1954 COPY_TO_USER(err, user_icount, &info->icount, sizeof(struct mgsl_icount));
1955 if (err)
1956 return -EFAULT;
1957 }
1952 return 0; 1958 return 0;
1953} 1959}
1954 1960
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index f174aee659e5..9e9cf1407311 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -560,7 +560,7 @@ ide_startstop_t __ide_abort(ide_drive_t *drive, struct request *rq)
560EXPORT_SYMBOL_GPL(__ide_abort); 560EXPORT_SYMBOL_GPL(__ide_abort);
561 561
562/** 562/**
563 * ide_abort - abort pending IDE operatins 563 * ide_abort - abort pending IDE operations
564 * @drive: drive the error occurred on 564 * @drive: drive the error occurred on
565 * @msg: message to report 565 * @msg: message to report
566 * 566 *
@@ -623,7 +623,7 @@ static void ide_cmd (ide_drive_t *drive, u8 cmd, u8 nsect,
623 * @drive: drive the completion interrupt occurred on 623 * @drive: drive the completion interrupt occurred on
624 * 624 *
625 * drive_cmd_intr() is invoked on completion of a special DRIVE_CMD. 625 * drive_cmd_intr() is invoked on completion of a special DRIVE_CMD.
626 * We do any necessary daya reading and then wait for the drive to 626 * We do any necessary data reading and then wait for the drive to
627 * go non busy. At that point we may read the error data and complete 627 * go non busy. At that point we may read the error data and complete
628 * the request 628 * the request
629 */ 629 */
@@ -773,7 +773,7 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd);
773 773
774/** 774/**
775 * execute_drive_command - issue special drive command 775 * execute_drive_command - issue special drive command
776 * @drive: the drive to issue th command on 776 * @drive: the drive to issue the command on
777 * @rq: the request structure holding the command 777 * @rq: the request structure holding the command
778 * 778 *
779 * execute_drive_cmd() issues a special drive command, usually 779 * execute_drive_cmd() issues a special drive command, usually
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 5a3dc46008e6..ee38e6b143a4 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2903,8 +2903,7 @@ static int idetape_wait_ready(ide_drive_t *drive, unsigned long timeout)
2903 } else if (!(tape->sense_key == 2 && tape->asc == 4 && 2903 } else if (!(tape->sense_key == 2 && tape->asc == 4 &&
2904 (tape->ascq == 1 || tape->ascq == 8))) 2904 (tape->ascq == 1 || tape->ascq == 8)))
2905 return -EIO; 2905 return -EIO;
2906 current->state = TASK_INTERRUPTIBLE; 2906 msleep(100);
2907 schedule_timeout(HZ / 10);
2908 } 2907 }
2909 return -EIO; 2908 return -EIO;
2910} 2909}
diff --git a/drivers/ide/ide-timing.h b/drivers/ide/ide-timing.h
index c1196ce15b4d..2fcfac6e967a 100644
--- a/drivers/ide/ide-timing.h
+++ b/drivers/ide/ide-timing.h
@@ -27,6 +27,7 @@
27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
28 */ 28 */
29 29
30#include <linux/kernel.h>
30#include <linux/hdreg.h> 31#include <linux/hdreg.h>
31 32
32#define XFER_PIO_5 0x0d 33#define XFER_PIO_5 0x0d
@@ -96,11 +97,9 @@ static struct ide_timing ide_timing[] = {
96#define IDE_TIMING_UDMA 0x80 97#define IDE_TIMING_UDMA 0x80
97#define IDE_TIMING_ALL 0xff 98#define IDE_TIMING_ALL 0xff
98 99
99#define MIN(a,b) ((a)<(b)?(a):(b)) 100#define FIT(v,vmin,vmax) max_t(short,min_t(short,v,vmax),vmin)
100#define MAX(a,b) ((a)>(b)?(a):(b)) 101#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
101#define FIT(v,min,max) MAX(MIN(v,max),min) 102#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
102#define ENOUGH(v,unit) (((v)-1)/(unit)+1)
103#define EZ(v,unit) ((v)?ENOUGH(v,unit):0)
104 103
105#define XFER_MODE 0xf0 104#define XFER_MODE 0xf0
106#define XFER_UDMA_133 0x48 105#define XFER_UDMA_133 0x48
@@ -188,14 +187,14 @@ static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int
188 187
189static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, struct ide_timing *m, unsigned int what) 188static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, struct ide_timing *m, unsigned int what)
190{ 189{
191 if (what & IDE_TIMING_SETUP ) m->setup = MAX(a->setup, b->setup); 190 if (what & IDE_TIMING_SETUP ) m->setup = max(a->setup, b->setup);
192 if (what & IDE_TIMING_ACT8B ) m->act8b = MAX(a->act8b, b->act8b); 191 if (what & IDE_TIMING_ACT8B ) m->act8b = max(a->act8b, b->act8b);
193 if (what & IDE_TIMING_REC8B ) m->rec8b = MAX(a->rec8b, b->rec8b); 192 if (what & IDE_TIMING_REC8B ) m->rec8b = max(a->rec8b, b->rec8b);
194 if (what & IDE_TIMING_CYC8B ) m->cyc8b = MAX(a->cyc8b, b->cyc8b); 193 if (what & IDE_TIMING_CYC8B ) m->cyc8b = max(a->cyc8b, b->cyc8b);
195 if (what & IDE_TIMING_ACTIVE ) m->active = MAX(a->active, b->active); 194 if (what & IDE_TIMING_ACTIVE ) m->active = max(a->active, b->active);
196 if (what & IDE_TIMING_RECOVER) m->recover = MAX(a->recover, b->recover); 195 if (what & IDE_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
197 if (what & IDE_TIMING_CYCLE ) m->cycle = MAX(a->cycle, b->cycle); 196 if (what & IDE_TIMING_CYCLE ) m->cycle = max(a->cycle, b->cycle);
198 if (what & IDE_TIMING_UDMA ) m->udma = MAX(a->udma, b->udma); 197 if (what & IDE_TIMING_UDMA ) m->udma = max(a->udma, b->udma);
199} 198}
200 199
201static struct ide_timing* ide_timing_find_mode(short speed) 200static struct ide_timing* ide_timing_find_mode(short speed)
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index dc0841b2721c..0ccf85fcee34 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -43,6 +43,7 @@
43#include <linux/ide.h> 43#include <linux/ide.h>
44#include <linux/hdreg.h> 44#include <linux/hdreg.h>
45#include <linux/major.h> 45#include <linux/major.h>
46#include <linux/delay.h>
46#include <asm/io.h> 47#include <asm/io.h>
47#include <asm/system.h> 48#include <asm/system.h>
48 49
@@ -340,8 +341,7 @@ static void ide_config(dev_link_t *link)
340 break; 341 break;
341 } 342 }
342 } 343 }
343 __set_current_state(TASK_UNINTERRUPTIBLE); 344 msleep(100);
344 schedule_timeout(HZ/10);
345 } 345 }
346 346
347 if (hd < 0) { 347 if (hd < 0) {
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index baf4bcad9bf9..0afe442db3b0 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -283,23 +283,19 @@ static void bsd_free (void *state)
283 /* 283 /*
284 * Release the dictionary 284 * Release the dictionary
285 */ 285 */
286 if (db->dict) { 286 vfree(db->dict);
287 vfree (db->dict); 287 db->dict = NULL;
288 db->dict = NULL;
289 }
290 288
291 /* 289 /*
292 * Release the string buffer 290 * Release the string buffer
293 */ 291 */
294 if (db->lens) { 292 vfree(db->lens);
295 vfree (db->lens); 293 db->lens = NULL;
296 db->lens = NULL;
297 }
298 294
299 /* 295 /*
300 * Finally release the structure itself. 296 * Finally release the structure itself.
301 */ 297 */
302 kfree (db); 298 kfree(db);
303 } 299 }
304} 300}
305 301
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index eebcb0b97f0e..8a7d54a5c97d 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -1953,7 +1953,8 @@ isdn_add_channels(isdn_driver_t *d, int drvidx, int n, int adding)
1953 kfree(d->rcvcount); 1953 kfree(d->rcvcount);
1954 if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) { 1954 if (!(d->rcvcount = kmalloc(sizeof(int) * m, GFP_ATOMIC))) {
1955 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n"); 1955 printk(KERN_WARNING "register_isdn: Could not alloc rcvcount\n");
1956 if (!adding) kfree(d->rcverr); 1956 if (!adding)
1957 kfree(d->rcverr);
1957 return -1; 1958 return -1;
1958 } 1959 }
1959 memset((char *) d->rcvcount, 0, sizeof(int) * m); 1960 memset((char *) d->rcvcount, 0, sizeof(int) * m);
diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
index 17212b4201a1..cc07bbebbb16 100644
--- a/drivers/md/dm-exception-store.c
+++ b/drivers/md/dm-exception-store.c
@@ -568,12 +568,9 @@ int dm_create_persistent(struct exception_store *store, uint32_t chunk_size)
568 568
569 bad: 569 bad:
570 dm_io_put(sectors_to_pages(chunk_size)); 570 dm_io_put(sectors_to_pages(chunk_size));
571 if (ps) { 571 if (ps && ps->area)
572 if (ps->area) 572 free_area(ps);
573 free_area(ps); 573 kfree(ps);
574
575 kfree(ps);
576 }
577 return r; 574 return r;
578} 575}
579 576
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1554b924fbb9..2897df90df44 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pers_lock);
74 * Current RAID-1,4,5 parallel reconstruction 'guaranteed speed limit' 74 * Current RAID-1,4,5 parallel reconstruction 'guaranteed speed limit'
75 * is 1000 KB/sec, so the extra system load does not show up that much. 75 * is 1000 KB/sec, so the extra system load does not show up that much.
76 * Increase it if you want to have more _guaranteed_ speed. Note that 76 * Increase it if you want to have more _guaranteed_ speed. Note that
77 * the RAID driver will use the maximum available bandwith if the IO 77 * the RAID driver will use the maximum available bandwidth if the IO
78 * subsystem is idle. There is also an 'absolute maximum' reconstruction 78 * subsystem is idle. There is also an 'absolute maximum' reconstruction
79 * speed limit - in case reconstruction slows down your system despite 79 * speed limit - in case reconstruction slows down your system despite
80 * idle IO detection. 80 * idle IO detection.
@@ -3616,7 +3616,7 @@ static void md_do_sync(mddev_t *mddev)
3616 printk(KERN_INFO "md: syncing RAID array %s\n", mdname(mddev)); 3616 printk(KERN_INFO "md: syncing RAID array %s\n", mdname(mddev));
3617 printk(KERN_INFO "md: minimum _guaranteed_ reconstruction speed:" 3617 printk(KERN_INFO "md: minimum _guaranteed_ reconstruction speed:"
3618 " %d KB/sec/disc.\n", sysctl_speed_limit_min); 3618 " %d KB/sec/disc.\n", sysctl_speed_limit_min);
3619 printk(KERN_INFO "md: using maximum available idle IO bandwith " 3619 printk(KERN_INFO "md: using maximum available idle IO bandwidth "
3620 "(but not more than %d KB/sec) for reconstruction.\n", 3620 "(but not more than %d KB/sec) for reconstruction.\n",
3621 sysctl_speed_limit_max); 3621 sysctl_speed_limit_max);
3622 3622
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index cd5828b5e9e3..206cc2f61f26 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -168,10 +168,8 @@ void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt)
168 return; 168 return;
169 pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); 169 pci_free_consistent(pci, pt->size, pt->cpu, pt->dma);
170 pt->cpu = NULL; 170 pt->cpu = NULL;
171 if (NULL != pt->slist) { 171 kfree(pt->slist);
172 kfree(pt->slist); 172 pt->slist = NULL;
173 pt->slist = NULL;
174 }
175} 173}
176 174
177int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt) 175int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt)
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c
index cdda423386c5..9774e94d1e7d 100644
--- a/drivers/media/video/cpia_usb.c
+++ b/drivers/media/video/cpia_usb.c
@@ -445,10 +445,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try)
445 ucpia->sbuf[1].urb = NULL; 445 ucpia->sbuf[1].urb = NULL;
446 } 446 }
447 447
448 if (ucpia->sbuf[1].data) { 448 kfree(ucpia->sbuf[1].data);
449 kfree(ucpia->sbuf[1].data); 449 ucpia->sbuf[1].data = NULL;
450 ucpia->sbuf[1].data = NULL;
451 }
452 450
453 if (ucpia->sbuf[0].urb) { 451 if (ucpia->sbuf[0].urb) {
454 usb_kill_urb(ucpia->sbuf[0].urb); 452 usb_kill_urb(ucpia->sbuf[0].urb);
@@ -456,10 +454,8 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try)
456 ucpia->sbuf[0].urb = NULL; 454 ucpia->sbuf[0].urb = NULL;
457 } 455 }
458 456
459 if (ucpia->sbuf[0].data) { 457 kfree(ucpia->sbuf[0].data);
460 kfree(ucpia->sbuf[0].data); 458 ucpia->sbuf[0].data = NULL;
461 ucpia->sbuf[0].data = NULL;
462 }
463} 459}
464 460
465static int cpia_usb_close(void *privdata) 461static int cpia_usb_close(void *privdata)
@@ -623,20 +619,14 @@ static void cpia_disconnect(struct usb_interface *intf)
623 619
624 ucpia->curbuff = ucpia->workbuff = NULL; 620 ucpia->curbuff = ucpia->workbuff = NULL;
625 621
626 if (ucpia->buffers[2]) { 622 vfree(ucpia->buffers[2]);
627 vfree(ucpia->buffers[2]); 623 ucpia->buffers[2] = NULL;
628 ucpia->buffers[2] = NULL;
629 }
630 624
631 if (ucpia->buffers[1]) { 625 vfree(ucpia->buffers[1]);
632 vfree(ucpia->buffers[1]); 626 ucpia->buffers[1] = NULL;
633 ucpia->buffers[1] = NULL;
634 }
635 627
636 if (ucpia->buffers[0]) { 628 vfree(ucpia->buffers[0]);
637 vfree(ucpia->buffers[0]); 629 ucpia->buffers[0] = NULL;
638 ucpia->buffers[0] = NULL;
639 }
640 630
641 cam->lowlevel_data = NULL; 631 cam->lowlevel_data = NULL;
642 kfree(ucpia); 632 kfree(ucpia);
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index b57743571087..d4497dbae05c 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -2184,30 +2184,18 @@ static void release_saa(void)
2184 vfree(saa->vidbuf); 2184 vfree(saa->vidbuf);
2185 vfree(saa->audbuf); 2185 vfree(saa->audbuf);
2186 vfree(saa->osdbuf); 2186 vfree(saa->osdbuf);
2187 if (saa->dmavid2) 2187 kfree(saa->dmavid2);
2188 kfree((void *) saa->dmavid2);
2189 saa->audbuf = saa->vidbuf = saa->osdbuf = NULL; 2188 saa->audbuf = saa->vidbuf = saa->osdbuf = NULL;
2190 saa->dmavid2 = NULL; 2189 saa->dmavid2 = NULL;
2191 if (saa->dmadebi) 2190 kfree(saa->dmadebi);
2192 kfree((void *) saa->dmadebi); 2191 kfree(saa->dmavid1);
2193 if (saa->dmavid1) 2192 kfree(saa->dmavid3);
2194 kfree((void *) saa->dmavid1); 2193 kfree(saa->dmaa1in);
2195 if (saa->dmavid2) 2194 kfree(saa->dmaa1out);
2196 kfree((void *) saa->dmavid2); 2195 kfree(saa->dmaa2in);
2197 if (saa->dmavid3) 2196 kfree(saa->dmaa2out);
2198 kfree((void *) saa->dmavid3); 2197 kfree(saa->dmaRPS1);
2199 if (saa->dmaa1in) 2198 kfree(saa->dmaRPS2);
2200 kfree((void *) saa->dmaa1in);
2201 if (saa->dmaa1out)
2202 kfree((void *) saa->dmaa1out);
2203 if (saa->dmaa2in)
2204 kfree((void *) saa->dmaa2in);
2205 if (saa->dmaa2out)
2206 kfree((void *) saa->dmaa2out);
2207 if (saa->dmaRPS1)
2208 kfree((void *) saa->dmaRPS1);
2209 if (saa->dmaRPS2)
2210 kfree((void *) saa->dmaRPS2);
2211 free_irq(saa->irq, saa); 2199 free_irq(saa->irq, saa);
2212 if (saa->saa7146_mem) 2200 if (saa->saa7146_mem)
2213 iounmap(saa->saa7146_mem); 2201 iounmap(saa->saa7146_mem);
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
index 97354f253a80..574b8e36f3c6 100644
--- a/drivers/media/video/video-buf.c
+++ b/drivers/media/video/video-buf.c
@@ -267,10 +267,10 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
267 kfree(dma->pages); 267 kfree(dma->pages);
268 dma->pages = NULL; 268 dma->pages = NULL;
269 } 269 }
270 if (dma->vmalloc) { 270
271 vfree(dma->vmalloc); 271 vfree(dma->vmalloc);
272 dma->vmalloc = NULL; 272 dma->vmalloc = NULL;
273 } 273
274 if (dma->bus_addr) { 274 if (dma->bus_addr) {
275 dma->bus_addr = 0; 275 dma->bus_addr = 0;
276 } 276 }
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index ba838a42ec80..53adeb70f2ca 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -650,7 +650,7 @@ jpg_fbuffer_free (struct file *file)
650 off += PAGE_SIZE) 650 off += PAGE_SIZE)
651 ClearPageReserved(MAP_NR 651 ClearPageReserved(MAP_NR
652 (mem + off)); 652 (mem + off));
653 kfree((void *) mem); 653 kfree(mem);
654 fh->jpg_buffers.buffer[i].frag_tab[0] = 0; 654 fh->jpg_buffers.buffer[i].frag_tab[0] = 0;
655 fh->jpg_buffers.buffer[i].frag_tab[1] = 0; 655 fh->jpg_buffers.buffer[i].frag_tab[1] = 0;
656 } 656 }
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index c33533155cc7..07286816d7df 100644
--- a/drivers/media/video/zr36120.c
+++ b/drivers/media/video/zr36120.c
@@ -820,11 +820,9 @@ void zoran_close(struct video_device* dev)
820 msleep(100); /* Wait 1/10th of a second */ 820 msleep(100); /* Wait 1/10th of a second */
821 821
822 /* free the allocated framebuffer */ 822 /* free the allocated framebuffer */
823 if (ztv->fbuffer) 823 bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE);
824 bfree( ztv->fbuffer, ZORAN_MAX_FBUFSIZE );
825 ztv->fbuffer = 0; 824 ztv->fbuffer = 0;
826 if (ztv->overinfo.overlay) 825 kfree(ztv->overinfo.overlay);
827 kfree( ztv->overinfo.overlay );
828 ztv->overinfo.overlay = 0; 826 ztv->overinfo.overlay = 0;
829 827
830} 828}
diff --git a/drivers/misc/hdpuftrs/hdpu_cpustate.c b/drivers/misc/hdpuftrs/hdpu_cpustate.c
index 7501fab349e4..46de5c940555 100644
--- a/drivers/misc/hdpuftrs/hdpu_cpustate.c
+++ b/drivers/misc/hdpuftrs/hdpu_cpustate.c
@@ -192,22 +192,37 @@ static int hdpu_cpustate_probe(struct device *ddev)
192{ 192{
193 struct platform_device *pdev = to_platform_device(ddev); 193 struct platform_device *pdev = to_platform_device(ddev);
194 struct resource *res; 194 struct resource *res;
195 struct proc_dir_entry *proc_de;
196 int ret;
195 197
196 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 198 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
197 cpustate.set_addr = (unsigned long *)res->start; 199 cpustate.set_addr = (unsigned long *)res->start;
198 cpustate.clr_addr = (unsigned long *)res->end - 1; 200 cpustate.clr_addr = (unsigned long *)res->end - 1;
199 201
200 misc_register(&cpustate_dev); 202 ret = misc_register(&cpustate_dev);
201 create_proc_read_entry("sky_cpustate", 0, 0, cpustate_read_proc, NULL); 203 if (ret) {
204 printk(KERN_WARNING "sky_cpustate: Unable to register misc "
205 "device.\n");
206 cpustate.set_addr = NULL;
207 cpustate.clr_addr = NULL;
208 return ret;
209 }
210
211 proc_de = create_proc_read_entry("sky_cpustate", 0, 0,
212 cpustate_read_proc, NULL);
213 if (proc_de == NULL)
214 printk(KERN_WARNING "sky_cpustate: Unable to create proc "
215 "dir entry\n");
202 216
203 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n"); 217 printk(KERN_INFO "Sky CPU State Driver v" SKY_CPUSTATE_VERSION "\n");
204 return 0; 218 return 0;
205} 219}
220
206static int hdpu_cpustate_remove(struct device *ddev) 221static int hdpu_cpustate_remove(struct device *ddev)
207{ 222{
208 223
209 cpustate.set_addr = 0; 224 cpustate.set_addr = NULL;
210 cpustate.clr_addr = 0; 225 cpustate.clr_addr = NULL;
211 226
212 remove_proc_entry("sky_cpustate", NULL); 227 remove_proc_entry("sky_cpustate", NULL);
213 misc_deregister(&cpustate_dev); 228 misc_deregister(&cpustate_dev);
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index bb713fed2f37..1443117fd8f4 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -91,8 +91,7 @@ static void __exit cleanup_mtdram(void)
91{ 91{
92 if (mtd_info) { 92 if (mtd_info) {
93 del_mtd_device(mtd_info); 93 del_mtd_device(mtd_info);
94 if (mtd_info->priv) 94 vfree(mtd_info->priv);
95 vfree(mtd_info->priv);
96 kfree(mtd_info); 95 kfree(mtd_info);
97 } 96 }
98} 97}
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index d9ab60b36fd4..d32c1b3a8ce3 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1017,27 +1017,16 @@ static int ftl_writesect(struct mtd_blktrans_dev *dev,
1017 1017
1018void ftl_freepart(partition_t *part) 1018void ftl_freepart(partition_t *part)
1019{ 1019{
1020 if (part->VirtualBlockMap) {
1021 vfree(part->VirtualBlockMap); 1020 vfree(part->VirtualBlockMap);
1022 part->VirtualBlockMap = NULL; 1021 part->VirtualBlockMap = NULL;
1023 }
1024 if (part->VirtualPageMap) {
1025 kfree(part->VirtualPageMap); 1022 kfree(part->VirtualPageMap);
1026 part->VirtualPageMap = NULL; 1023 part->VirtualPageMap = NULL;
1027 }
1028 if (part->EUNInfo) {
1029 kfree(part->EUNInfo); 1024 kfree(part->EUNInfo);
1030 part->EUNInfo = NULL; 1025 part->EUNInfo = NULL;
1031 }
1032 if (part->XferInfo) {
1033 kfree(part->XferInfo); 1026 kfree(part->XferInfo);
1034 part->XferInfo = NULL; 1027 part->XferInfo = NULL;
1035 }
1036 if (part->bam_cache) {
1037 kfree(part->bam_cache); 1028 kfree(part->bam_cache);
1038 part->bam_cache = NULL; 1029 part->bam_cache = NULL;
1039 }
1040
1041} /* ftl_freepart */ 1030} /* ftl_freepart */
1042 1031
1043static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) 1032static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
diff --git a/drivers/net/bsd_comp.c b/drivers/net/bsd_comp.c
index 3d88ad622bdb..fb4098ed469e 100644
--- a/drivers/net/bsd_comp.c
+++ b/drivers/net/bsd_comp.c
@@ -323,33 +323,27 @@ static void bsd_reset (void *state)
323 */ 323 */
324 324
325static void bsd_free (void *state) 325static void bsd_free (void *state)
326 { 326{
327 struct bsd_db *db = (struct bsd_db *) state; 327 struct bsd_db *db = state;
328 328
329 if (db) 329 if (!db)
330 { 330 return;
331
331/* 332/*
332 * Release the dictionary 333 * Release the dictionary
333 */ 334 */
334 if (db->dict) 335 vfree(db->dict);
335 { 336 db->dict = NULL;
336 vfree (db->dict);
337 db->dict = NULL;
338 }
339/* 337/*
340 * Release the string buffer 338 * Release the string buffer
341 */ 339 */
342 if (db->lens) 340 vfree(db->lens);
343 { 341 db->lens = NULL;
344 vfree (db->lens);
345 db->lens = NULL;
346 }
347/* 342/*
348 * Finally release the structure itself. 343 * Finally release the structure itself.
349 */ 344 */
350 kfree (db); 345 kfree(db);
351 } 346}
352 }
353 347
354/* 348/*
355 * Allocate space for a (de) compressor. 349 * Allocate space for a (de) compressor.
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index bb71638a7c44..0df7e92b0bf8 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1232,9 +1232,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1232 navail = 0; /* total # of usable channels (not deregistered) */ 1232 navail = 0; /* total # of usable channels (not deregistered) */
1233 hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; 1233 hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
1234 i = 0; 1234 i = 0;
1235 list = &ppp->channels; 1235 list_for_each_entry(pch, &ppp->channels, clist) {
1236 while ((list = list->next) != &ppp->channels) {
1237 pch = list_entry(list, struct channel, clist);
1238 navail += pch->avail = (pch->chan != NULL); 1236 navail += pch->avail = (pch->chan != NULL);
1239 if (pch->avail) { 1237 if (pch->avail) {
1240 if (skb_queue_empty(&pch->file.xq) || 1238 if (skb_queue_empty(&pch->file.xq) ||
@@ -1280,6 +1278,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1280 1278
1281 /* skip to the channel after the one we last used 1279 /* skip to the channel after the one we last used
1282 and start at that one */ 1280 and start at that one */
1281 list = &ppp->channels;
1283 for (i = 0; i < ppp->nxchan; ++i) { 1282 for (i = 0; i < ppp->nxchan; ++i) {
1284 list = list->next; 1283 list = list->next;
1285 if (list == &ppp->channels) { 1284 if (list == &ppp->channels) {
@@ -1730,7 +1729,7 @@ static void
1730ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch) 1729ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1731{ 1730{
1732 u32 mask, seq; 1731 u32 mask, seq;
1733 struct list_head *l; 1732 struct channel *ch;
1734 int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; 1733 int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
1735 1734
1736 if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0) 1735 if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0)
@@ -1784,8 +1783,7 @@ ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
1784 * The list of channels can't change because we have the receive 1783 * The list of channels can't change because we have the receive
1785 * side of the ppp unit locked. 1784 * side of the ppp unit locked.
1786 */ 1785 */
1787 for (l = ppp->channels.next; l != &ppp->channels; l = l->next) { 1786 list_for_each_entry(ch, &ppp->channels, clist) {
1788 struct channel *ch = list_entry(l, struct channel, clist);
1789 if (seq_before(ch->lastseq, seq)) 1787 if (seq_before(ch->lastseq, seq))
1790 seq = ch->lastseq; 1788 seq = ch->lastseq;
1791 } 1789 }
@@ -2271,10 +2269,8 @@ static struct compressor_entry *
2271find_comp_entry(int proto) 2269find_comp_entry(int proto)
2272{ 2270{
2273 struct compressor_entry *ce; 2271 struct compressor_entry *ce;
2274 struct list_head *list = &compressor_list;
2275 2272
2276 while ((list = list->next) != &compressor_list) { 2273 list_for_each_entry(ce, &compressor_list, list) {
2277 ce = list_entry(list, struct compressor_entry, list);
2278 if (ce->comp->compress_proto == proto) 2274 if (ce->comp->compress_proto == proto)
2279 return ce; 2275 return ce;
2280 } 2276 }
@@ -2540,20 +2536,15 @@ static struct channel *
2540ppp_find_channel(int unit) 2536ppp_find_channel(int unit)
2541{ 2537{
2542 struct channel *pch; 2538 struct channel *pch;
2543 struct list_head *list;
2544 2539
2545 list = &new_channels; 2540 list_for_each_entry(pch, &new_channels, list) {
2546 while ((list = list->next) != &new_channels) {
2547 pch = list_entry(list, struct channel, list);
2548 if (pch->file.index == unit) { 2541 if (pch->file.index == unit) {
2549 list_del(&pch->list); 2542 list_del(&pch->list);
2550 list_add(&pch->list, &all_channels); 2543 list_add(&pch->list, &all_channels);
2551 return pch; 2544 return pch;
2552 } 2545 }
2553 } 2546 }
2554 list = &all_channels; 2547 list_for_each_entry(pch, &all_channels, list) {
2555 while ((list = list->next) != &all_channels) {
2556 pch = list_entry(list, struct channel, list);
2557 if (pch->file.index == unit) 2548 if (pch->file.index == unit)
2558 return pch; 2549 return pch;
2559 } 2550 }
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 93800c126e86..ee48bfd67349 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -2144,9 +2144,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
2144 u_long iobase = 0; /* Clear upper 32 bits in Alphas */ 2144 u_long iobase = 0; /* Clear upper 32 bits in Alphas */
2145 int i, j, cfrv; 2145 int i, j, cfrv;
2146 struct de4x5_private *lp = netdev_priv(dev); 2146 struct de4x5_private *lp = netdev_priv(dev);
2147 struct list_head *walk = &pdev->bus_list; 2147 struct list_head *walk;
2148 2148
2149 for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) { 2149 list_for_each(walk, &pdev->bus_list) {
2150 struct pci_dev *this_dev = pci_dev_b(walk); 2150 struct pci_dev *this_dev = pci_dev_b(walk);
2151 2151
2152 /* Skip the pci_bus list entry */ 2152 /* Skip the pci_bus list entry */
diff --git a/drivers/parisc/lasi.c b/drivers/parisc/lasi.c
index 731855053392..cb84a4e84a2f 100644
--- a/drivers/parisc/lasi.c
+++ b/drivers/parisc/lasi.c
@@ -20,7 +20,6 @@
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/slab.h>
24#include <linux/types.h> 23#include <linux/types.h>
25 24
26#include <asm/io.h> 25#include <asm/io.h>
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 694bae162fed..5b887ba5aaf9 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -196,7 +196,7 @@ int parport_wait_peripheral(struct parport *port,
196 return 1; 196 return 1;
197 197
198 /* 40ms of slow polling. */ 198 /* 40ms of slow polling. */
199 deadline = jiffies + (HZ + 24) / 25; 199 deadline = jiffies + msecs_to_jiffies(40);
200 while (time_before (jiffies, deadline)) { 200 while (time_before (jiffies, deadline)) {
201 int ret; 201 int ret;
202 202
@@ -205,7 +205,7 @@ int parport_wait_peripheral(struct parport *port,
205 205
206 /* Wait for 10ms (or until an interrupt occurs if 206 /* Wait for 10ms (or until an interrupt occurs if
207 * the handler is set) */ 207 * the handler is set) */
208 if ((ret = parport_wait_event (port, (HZ + 99) / 100)) < 0) 208 if ((ret = parport_wait_event (port, msecs_to_jiffies(10))) < 0)
209 return ret; 209 return ret;
210 210
211 status = parport_read_status (port); 211 status = parport_read_status (port);
@@ -216,8 +216,7 @@ int parport_wait_peripheral(struct parport *port,
216 /* parport_wait_event didn't time out, but the 216 /* parport_wait_event didn't time out, but the
217 * peripheral wasn't actually ready either. 217 * peripheral wasn't actually ready either.
218 * Wait for another 10ms. */ 218 * Wait for another 10ms. */
219 __set_current_state (TASK_INTERRUPTIBLE); 219 schedule_timeout_interruptible(msecs_to_jiffies(10));
220 schedule_timeout ((HZ+ 99) / 100);
221 } 220 }
222 } 221 }
223 222
diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c
index 6624278c6ed8..ce1e2aad8b10 100644
--- a/drivers/parport/ieee1284_ops.c
+++ b/drivers/parport/ieee1284_ops.c
@@ -60,7 +60,7 @@ size_t parport_ieee1284_write_compat (struct parport *port,
60 parport_data_forward (port); 60 parport_data_forward (port);
61 while (count < len) { 61 while (count < len) {
62 unsigned long expire = jiffies + dev->timeout; 62 unsigned long expire = jiffies + dev->timeout;
63 long wait = (HZ + 99) / 100; 63 long wait = msecs_to_jiffies(10);
64 unsigned char mask = (PARPORT_STATUS_ERROR 64 unsigned char mask = (PARPORT_STATUS_ERROR
65 | PARPORT_STATUS_BUSY); 65 | PARPORT_STATUS_BUSY);
66 unsigned char val = (PARPORT_STATUS_ERROR 66 unsigned char val = (PARPORT_STATUS_ERROR
@@ -97,8 +97,7 @@ size_t parport_ieee1284_write_compat (struct parport *port,
97 our interrupt handler called. */ 97 our interrupt handler called. */
98 if (count && no_irq) { 98 if (count && no_irq) {
99 parport_release (dev); 99 parport_release (dev);
100 __set_current_state (TASK_INTERRUPTIBLE); 100 schedule_timeout_interruptible(wait);
101 schedule_timeout (wait);
102 parport_claim_or_block (dev); 101 parport_claim_or_block (dev);
103 } 102 }
104 else 103 else
@@ -542,13 +541,12 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port,
542 /* Yield the port for a while. */ 541 /* Yield the port for a while. */
543 if (count && dev->port->irq != PARPORT_IRQ_NONE) { 542 if (count && dev->port->irq != PARPORT_IRQ_NONE) {
544 parport_release (dev); 543 parport_release (dev);
545 __set_current_state (TASK_INTERRUPTIBLE); 544 schedule_timeout_interruptible(msecs_to_jiffies(40));
546 schedule_timeout ((HZ + 24) / 25);
547 parport_claim_or_block (dev); 545 parport_claim_or_block (dev);
548 } 546 }
549 else 547 else
550 /* We must have the device claimed here. */ 548 /* We must have the device claimed here. */
551 parport_wait_event (port, (HZ + 24) / 25); 549 parport_wait_event (port, msecs_to_jiffies(40));
552 550
553 /* Is there a signal pending? */ 551 /* Is there a signal pending? */
554 if (signal_pending (current)) 552 if (signal_pending (current))
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 1b938bb9be3c..c6493ad7c0c8 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -173,8 +173,7 @@ static int change_mode(struct parport *p, int m)
173 if (time_after_eq (jiffies, expire)) 173 if (time_after_eq (jiffies, expire))
174 /* The FIFO is stuck. */ 174 /* The FIFO is stuck. */
175 return -EBUSY; 175 return -EBUSY;
176 __set_current_state (TASK_INTERRUPTIBLE); 176 schedule_timeout_interruptible(msecs_to_jiffies(10));
177 schedule_timeout ((HZ + 99) / 100);
178 if (signal_pending (current)) 177 if (signal_pending (current))
179 break; 178 break;
180 } 179 }
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index cc9d65388e62..56a3b397efee 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -44,10 +44,14 @@ pci_config_attr(subsystem_device, "0x%04x\n");
44pci_config_attr(class, "0x%06x\n"); 44pci_config_attr(class, "0x%06x\n");
45pci_config_attr(irq, "%u\n"); 45pci_config_attr(irq, "%u\n");
46 46
47static ssize_t local_cpus_show(struct device *dev, struct device_attribute *attr, char *buf) 47static ssize_t local_cpus_show(struct device *dev,
48 struct device_attribute *attr, char *buf)
48{ 49{
49 cpumask_t mask = pcibus_to_cpumask(to_pci_dev(dev)->bus); 50 cpumask_t mask;
50 int len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask); 51 int len;
52
53 mask = pcibus_to_cpumask(to_pci_dev(dev)->bus);
54 len = cpumask_scnprintf(buf, PAGE_SIZE-2, mask);
51 strcat(buf,"\n"); 55 strcat(buf,"\n");
52 return 1+len; 56 return 1+len;
53} 57}
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 35caec13023a..26a55d08b506 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -72,11 +72,13 @@ void pci_remove_legacy_files(struct pci_bus *bus) { return; }
72/* 72/*
73 * PCI Bus Class Devices 73 * PCI Bus Class Devices
74 */ 74 */
75static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev, char *buf) 75static ssize_t pci_bus_show_cpuaffinity(struct class_device *class_dev,
76 char *buf)
76{ 77{
77 cpumask_t cpumask = pcibus_to_cpumask(to_pci_bus(class_dev));
78 int ret; 78 int ret;
79 cpumask_t cpumask;
79 80
81 cpumask = pcibus_to_cpumask(to_pci_bus(class_dev));
80 ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask); 82 ret = cpumask_scnprintf(buf, PAGE_SIZE, cpumask);
81 if (ret < PAGE_SIZE) 83 if (ret < PAGE_SIZE)
82 buf[ret++] = '\n'; 84 buf[ret++] = '\n';
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index d44205d52bf3..d89f83f769f5 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7#define __KERNEL_SYSCALLS__ 7#define __KERNEL_SYSCALLS__
8static int errno;
8 9
9#include <linux/kernel.h> 10#include <linux/kernel.h>
10#include <linux/kthread.h> 11#include <linux/kthread.h>
@@ -13,8 +14,6 @@
13#include <linux/delay.h> 14#include <linux/delay.h>
14#include <asm/oplib.h> 15#include <asm/oplib.h>
15#include <asm/ebus.h> 16#include <asm/ebus.h>
16static int errno;
17#include <asm/unistd.h>
18 17
19#include "bbc_i2c.h" 18#include "bbc_i2c.h"
20#include "max1617.h" 19#include "max1617.h"
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index d765cc1bf060..b0cc3c2588fd 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#define __KERNEL_SYSCALLS__ 22#define __KERNEL_SYSCALLS__
23static int errno;
23 24
24#include <linux/config.h> 25#include <linux/config.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -38,9 +39,6 @@
38#include <asm/uaccess.h> 39#include <asm/uaccess.h>
39#include <asm/envctrl.h> 40#include <asm/envctrl.h>
40 41
41static int errno;
42#include <asm/unistd.h>
43
44#define ENVCTRL_MINOR 162 42#define ENVCTRL_MINOR 162
45 43
46#define PCF8584_ADDRESS 0x55 44#define PCF8584_ADDRESS 0x55
diff --git a/drivers/scsi/53c7xx.c b/drivers/scsi/53c7xx.c
index 2341d27ceed7..7a33c708f5b3 100644
--- a/drivers/scsi/53c7xx.c
+++ b/drivers/scsi/53c7xx.c
@@ -6090,8 +6090,8 @@ NCR53c7x0_release(struct Scsi_Host *host) {
6090 if (hostdata->num_cmds) 6090 if (hostdata->num_cmds)
6091 printk ("scsi%d : leaked %d NCR53c7x0_cmd structures\n", 6091 printk ("scsi%d : leaked %d NCR53c7x0_cmd structures\n",
6092 host->host_no, hostdata->num_cmds); 6092 host->host_no, hostdata->num_cmds);
6093 if (hostdata->events) 6093
6094 vfree ((void *)hostdata->events); 6094 vfree(hostdata->events);
6095 6095
6096 /* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which 6096 /* XXX This assumes default cache mode to be IOMAP_FULL_CACHING, which
6097 * XXX may be invalid (CONFIG_060_WRITETHROUGH) 6097 * XXX may be invalid (CONFIG_060_WRITETHROUGH)
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 13ecd0c47404..da6e51c7fe69 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -560,7 +560,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
560 return result; 560 return result;
561} 561}
562 562
563static int ch_gstatus(scsi_changer *ch, int type, unsigned char *dest) 563static int ch_gstatus(scsi_changer *ch, int type, unsigned char __user *dest)
564{ 564{
565 int retval = 0; 565 int retval = 0;
566 u_char data[16]; 566 u_char data[16];
@@ -634,6 +634,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
634{ 634{
635 scsi_changer *ch = file->private_data; 635 scsi_changer *ch = file->private_data;
636 int retval; 636 int retval;
637 void __user *argp = (void __user *)arg;
637 638
638 switch (cmd) { 639 switch (cmd) {
639 case CHIOGPARAMS: 640 case CHIOGPARAMS:
@@ -646,7 +647,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
646 params.cp_nportals = ch->counts[CHET_IE]; 647 params.cp_nportals = ch->counts[CHET_IE];
647 params.cp_ndrives = ch->counts[CHET_DT]; 648 params.cp_ndrives = ch->counts[CHET_DT];
648 649
649 if (copy_to_user((void *) arg, &params, sizeof(params))) 650 if (copy_to_user(argp, &params, sizeof(params)))
650 return -EFAULT; 651 return -EFAULT;
651 return 0; 652 return 0;
652 } 653 }
@@ -671,7 +672,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
671 vparams.cvp_n4 = ch->counts[CHET_V4]; 672 vparams.cvp_n4 = ch->counts[CHET_V4];
672 strncpy(vparams.cvp_label4,vendor_labels[3],16); 673 strncpy(vparams.cvp_label4,vendor_labels[3],16);
673 } 674 }
674 if (copy_to_user((void *) arg, &vparams, sizeof(vparams))) 675 if (copy_to_user(argp, &vparams, sizeof(vparams)))
675 return -EFAULT; 676 return -EFAULT;
676 return 0; 677 return 0;
677 } 678 }
@@ -680,7 +681,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
680 { 681 {
681 struct changer_position pos; 682 struct changer_position pos;
682 683
683 if (copy_from_user(&pos, (void*)arg, sizeof (pos))) 684 if (copy_from_user(&pos, argp, sizeof (pos)))
684 return -EFAULT; 685 return -EFAULT;
685 686
686 if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) { 687 if (0 != ch_checkrange(ch, pos.cp_type, pos.cp_unit)) {
@@ -699,7 +700,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
699 { 700 {
700 struct changer_move mv; 701 struct changer_move mv;
701 702
702 if (copy_from_user(&mv, (void*)arg, sizeof (mv))) 703 if (copy_from_user(&mv, argp, sizeof (mv)))
703 return -EFAULT; 704 return -EFAULT;
704 705
705 if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) || 706 if (0 != ch_checkrange(ch, mv.cm_fromtype, mv.cm_fromunit) ||
@@ -721,7 +722,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
721 { 722 {
722 struct changer_exchange mv; 723 struct changer_exchange mv;
723 724
724 if (copy_from_user(&mv, (void*)arg, sizeof (mv))) 725 if (copy_from_user(&mv, argp, sizeof (mv)))
725 return -EFAULT; 726 return -EFAULT;
726 727
727 if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) || 728 if (0 != ch_checkrange(ch, mv.ce_srctype, mv.ce_srcunit ) ||
@@ -746,7 +747,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
746 { 747 {
747 struct changer_element_status ces; 748 struct changer_element_status ces;
748 749
749 if (copy_from_user(&ces, (void*)arg, sizeof (ces))) 750 if (copy_from_user(&ces, argp, sizeof (ces)))
750 return -EFAULT; 751 return -EFAULT;
751 if (ces.ces_type < 0 || ces.ces_type >= CH_TYPES) 752 if (ces.ces_type < 0 || ces.ces_type >= CH_TYPES)
752 return -EINVAL; 753 return -EINVAL;
@@ -762,7 +763,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
762 unsigned int elem; 763 unsigned int elem;
763 int result,i; 764 int result,i;
764 765
765 if (copy_from_user(&cge, (void*)arg, sizeof (cge))) 766 if (copy_from_user(&cge, argp, sizeof (cge)))
766 return -EFAULT; 767 return -EFAULT;
767 768
768 if (0 != ch_checkrange(ch, cge.cge_type, cge.cge_unit)) 769 if (0 != ch_checkrange(ch, cge.cge_type, cge.cge_unit))
@@ -825,7 +826,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
825 kfree(buffer); 826 kfree(buffer);
826 up(&ch->lock); 827 up(&ch->lock);
827 828
828 if (copy_to_user((void*)arg, &cge, sizeof (cge))) 829 if (copy_to_user(argp, &cge, sizeof (cge)))
829 return -EFAULT; 830 return -EFAULT;
830 return result; 831 return result;
831 } 832 }
@@ -843,7 +844,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
843 struct changer_set_voltag csv; 844 struct changer_set_voltag csv;
844 int elem; 845 int elem;
845 846
846 if (copy_from_user(&csv, (void*)arg, sizeof(csv))) 847 if (copy_from_user(&csv, argp, sizeof(csv)))
847 return -EFAULT; 848 return -EFAULT;
848 849
849 if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) { 850 if (0 != ch_checkrange(ch, csv.csv_type, csv.csv_unit)) {
@@ -861,7 +862,7 @@ static int ch_ioctl(struct inode * inode, struct file * file,
861 } 862 }
862 863
863 default: 864 default:
864 return scsi_ioctl(ch->device, cmd, (void*)arg); 865 return scsi_ioctl(ch->device, cmd, argp);
865 866
866 } 867 }
867} 868}
@@ -894,9 +895,9 @@ static long ch_ioctl_compat(struct file * file,
894 case CHIOGSTATUS32: 895 case CHIOGSTATUS32:
895 { 896 {
896 struct changer_element_status32 ces32; 897 struct changer_element_status32 ces32;
897 unsigned char *data; 898 unsigned char __user *data;
898 899
899 if (copy_from_user(&ces32, (void*)arg, sizeof (ces32))) 900 if (copy_from_user(&ces32, (void __user *)arg, sizeof (ces32)))
900 return -EFAULT; 901 return -EFAULT;
901 if (ces32.ces_type < 0 || ces32.ces_type >= CH_TYPES) 902 if (ces32.ces_type < 0 || ces32.ces_type >= CH_TYPES)
902 return -EINVAL; 903 return -EINVAL;
diff --git a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c
index d72be0ce89c8..3fda8d455c5b 100644
--- a/drivers/scsi/cpqfcTSinit.c
+++ b/drivers/scsi/cpqfcTSinit.c
@@ -691,8 +691,7 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
691 if( copy_to_user( vendor_cmd->bufp, buf, vendor_cmd->len)) 691 if( copy_to_user( vendor_cmd->bufp, buf, vendor_cmd->len))
692 result = -EFAULT; 692 result = -EFAULT;
693 693
694 if( buf) 694 kfree(buf);
695 kfree( buf);
696 695
697 return result; 696 return result;
698 } 697 }
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index b5dc35355570..6e54c7d9b33c 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -36,7 +36,6 @@
36#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
37#include <linux/stat.h> 37#include <linux/stat.h>
38#include <linux/mca.h> 38#include <linux/mca.h>
39#include <linux/string.h>
40#include <linux/spinlock.h> 39#include <linux/spinlock.h>
41#include <linux/init.h> 40#include <linux/init.h>
42#include <linux/mca-legacy.h> 41#include <linux/mca-legacy.h>
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 89a4a0615c22..3f2f2464fa63 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -1377,7 +1377,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
1377 1377
1378 if ((STp->buffer)->syscall_result || !SRpnt) { 1378 if ((STp->buffer)->syscall_result || !SRpnt) {
1379 printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name); 1379 printk(KERN_ERR "%s:E: Failed to read frame back from OnStream buffer\n", name);
1380 vfree((void *)buffer); 1380 vfree(buffer);
1381 *aSRpnt = SRpnt; 1381 *aSRpnt = SRpnt;
1382 return (-EIO); 1382 return (-EIO);
1383 } 1383 }
@@ -1419,7 +1419,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
1419 1419
1420 if (new_frame > frame + 1000) { 1420 if (new_frame > frame + 1000) {
1421 printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name); 1421 printk(KERN_ERR "%s:E: Failed to find writable tape media\n", name);
1422 vfree((void *)buffer); 1422 vfree(buffer);
1423 return (-EIO); 1423 return (-EIO);
1424 } 1424 }
1425 if ( i >= nframes + pending ) break; 1425 if ( i >= nframes + pending ) break;
@@ -1500,7 +1500,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
1500 SRpnt->sr_sense_buffer[12] == 0 && 1500 SRpnt->sr_sense_buffer[12] == 0 &&
1501 SRpnt->sr_sense_buffer[13] == 2) { 1501 SRpnt->sr_sense_buffer[13] == 2) {
1502 printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name); 1502 printk(KERN_ERR "%s:E: Volume overflow in write error recovery\n", name);
1503 vfree((void *)buffer); 1503 vfree(buffer);
1504 return (-EIO); /* hit end of tape = fail */ 1504 return (-EIO); /* hit end of tape = fail */
1505 } 1505 }
1506 i = ((SRpnt->sr_sense_buffer[3] << 24) | 1506 i = ((SRpnt->sr_sense_buffer[3] << 24) |
@@ -1525,7 +1525,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct scsi
1525 } 1525 }
1526 if (!pending) 1526 if (!pending)
1527 osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */ 1527 osst_copy_to_buffer(STp->buffer, p); /* so buffer content == at entry in all cases */
1528 vfree((void *)buffer); 1528 vfree(buffer);
1529 return 0; 1529 return 0;
1530} 1530}
1531 1531
@@ -5852,7 +5852,7 @@ static int osst_remove(struct device *dev)
5852 os_scsi_tapes[i] = NULL; 5852 os_scsi_tapes[i] = NULL;
5853 osst_nr_dev--; 5853 osst_nr_dev--;
5854 write_unlock(&os_scsi_tapes_lock); 5854 write_unlock(&os_scsi_tapes_lock);
5855 if (tpnt->header_cache != NULL) vfree(tpnt->header_cache); 5855 vfree(tpnt->header_cache);
5856 if (tpnt->buffer) { 5856 if (tpnt->buffer) {
5857 normalize_buffer(tpnt->buffer); 5857 normalize_buffer(tpnt->buffer);
5858 kfree(tpnt->buffer); 5858 kfree(tpnt->buffer);
@@ -5896,8 +5896,7 @@ static void __exit exit_osst (void)
5896 for (i=0; i < osst_max_dev; ++i) { 5896 for (i=0; i < osst_max_dev; ++i) {
5897 if (!(STp = os_scsi_tapes[i])) continue; 5897 if (!(STp = os_scsi_tapes[i])) continue;
5898 /* This is defensive, supposed to happen during detach */ 5898 /* This is defensive, supposed to happen during detach */
5899 if (STp->header_cache) 5899 vfree(STp->header_cache);
5900 vfree(STp->header_cache);
5901 if (STp->buffer) { 5900 if (STp->buffer) {
5902 normalize_buffer(STp->buffer); 5901 normalize_buffer(STp->buffer);
5903 kfree(STp->buffer); 5902 kfree(STp->buffer);
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 5b65e208893b..4d75cdfa0a0a 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -864,7 +864,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
864 /* 864 /*
865 * We're pretty sure there's a port here. Lets find out what 865 * We're pretty sure there's a port here. Lets find out what
866 * type of port it is. The IIR top two bits allows us to find 866 * type of port it is. The IIR top two bits allows us to find
867 * out if its 8250 or 16450, 16550, 16550A or later. This 867 * out if it's 8250 or 16450, 16550, 16550A or later. This
868 * determines what we test for next. 868 * determines what we test for next.
869 * 869 *
870 * We also initialise the EFR (if any) to zero for later. The 870 * We also initialise the EFR (if any) to zero for later. The
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c
index f2c9fa423d40..f6704688ee8c 100644
--- a/drivers/telephony/ixj.c
+++ b/drivers/telephony/ixj.c
@@ -774,10 +774,7 @@ static int ixj_wink(IXJ *j)
774 j->pots_winkstart = jiffies; 774 j->pots_winkstart = jiffies;
775 SLIC_SetState(PLD_SLIC_STATE_OC, j); 775 SLIC_SetState(PLD_SLIC_STATE_OC, j);
776 776
777 while (time_before(jiffies, j->pots_winkstart + j->winktime)) { 777 msleep(jiffies_to_msecs(j->winktime));
778 set_current_state(TASK_INTERRUPTIBLE);
779 schedule_timeout(1);
780 }
781 778
782 SLIC_SetState(slicnow, j); 779 SLIC_SetState(slicnow, j);
783 return 0; 780 return 0;
@@ -1912,7 +1909,6 @@ static int ixj_pcmcia_cable_check(IXJ *j)
1912 1909
1913static int ixj_hookstate(IXJ *j) 1910static int ixj_hookstate(IXJ *j)
1914{ 1911{
1915 unsigned long det;
1916 int fOffHook = 0; 1912 int fOffHook = 0;
1917 1913
1918 switch (j->cardtype) { 1914 switch (j->cardtype) {
@@ -1943,11 +1939,7 @@ static int ixj_hookstate(IXJ *j)
1943 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) { 1939 j->pld_slicr.bits.state == PLD_SLIC_STATE_STANDBY) {
1944 if (j->flags.ringing || j->flags.cringing) { 1940 if (j->flags.ringing || j->flags.cringing) {
1945 if (!in_interrupt()) { 1941 if (!in_interrupt()) {
1946 det = jiffies + (hertz / 50); 1942 msleep(20);
1947 while (time_before(jiffies, det)) {
1948 set_current_state(TASK_INTERRUPTIBLE);
1949 schedule_timeout(1);
1950 }
1951 } 1943 }
1952 SLIC_GetState(j); 1944 SLIC_GetState(j);
1953 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) { 1945 if (j->pld_slicr.bits.state == PLD_SLIC_STATE_RINGING) {
@@ -2062,7 +2054,7 @@ static void ixj_ring_start(IXJ *j)
2062static int ixj_ring(IXJ *j) 2054static int ixj_ring(IXJ *j)
2063{ 2055{
2064 char cntr; 2056 char cntr;
2065 unsigned long jif, det; 2057 unsigned long jif;
2066 2058
2067 j->flags.ringing = 1; 2059 j->flags.ringing = 1;
2068 if (ixj_hookstate(j) & 1) { 2060 if (ixj_hookstate(j) & 1) {
@@ -2070,7 +2062,6 @@ static int ixj_ring(IXJ *j)
2070 j->flags.ringing = 0; 2062 j->flags.ringing = 0;
2071 return 1; 2063 return 1;
2072 } 2064 }
2073 det = 0;
2074 for (cntr = 0; cntr < j->maxrings; cntr++) { 2065 for (cntr = 0; cntr < j->maxrings; cntr++) {
2075 jif = jiffies + (1 * hertz); 2066 jif = jiffies + (1 * hertz);
2076 ixj_ring_on(j); 2067 ixj_ring_on(j);
@@ -2080,8 +2071,7 @@ static int ixj_ring(IXJ *j)
2080 j->flags.ringing = 0; 2071 j->flags.ringing = 0;
2081 return 1; 2072 return 1;
2082 } 2073 }
2083 set_current_state(TASK_INTERRUPTIBLE); 2074 schedule_timeout_interruptible(1);
2084 schedule_timeout(1);
2085 if (signal_pending(current)) 2075 if (signal_pending(current))
2086 break; 2076 break;
2087 } 2077 }
@@ -2089,20 +2079,13 @@ static int ixj_ring(IXJ *j)
2089 ixj_ring_off(j); 2079 ixj_ring_off(j);
2090 while (time_before(jiffies, jif)) { 2080 while (time_before(jiffies, jif)) {
2091 if (ixj_hookstate(j) & 1) { 2081 if (ixj_hookstate(j) & 1) {
2092 det = jiffies + (hertz / 100); 2082 msleep(10);
2093 while (time_before(jiffies, det)) {
2094 set_current_state(TASK_INTERRUPTIBLE);
2095 schedule_timeout(1);
2096 if (signal_pending(current))
2097 break;
2098 }
2099 if (ixj_hookstate(j) & 1) { 2083 if (ixj_hookstate(j) & 1) {
2100 j->flags.ringing = 0; 2084 j->flags.ringing = 0;
2101 return 1; 2085 return 1;
2102 } 2086 }
2103 } 2087 }
2104 set_current_state(TASK_INTERRUPTIBLE); 2088 schedule_timeout_interruptible(1);
2105 schedule_timeout(1);
2106 if (signal_pending(current)) 2089 if (signal_pending(current))
2107 break; 2090 break;
2108 } 2091 }
@@ -2168,10 +2151,8 @@ static int ixj_release(struct inode *inode, struct file *file_p)
2168 * Set up locks to ensure that only one process is talking to the DSP at a time. 2151 * Set up locks to ensure that only one process is talking to the DSP at a time.
2169 * This is necessary to keep the DSP from locking up. 2152 * This is necessary to keep the DSP from locking up.
2170 */ 2153 */
2171 while(test_and_set_bit(board, (void *)&j->busyflags) != 0) { 2154 while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
2172 set_current_state(TASK_INTERRUPTIBLE); 2155 schedule_timeout_interruptible(1);
2173 schedule_timeout(1);
2174 }
2175 if (ixjdebug & 0x0002) 2156 if (ixjdebug & 0x0002)
2176 printk(KERN_INFO "Closing board %d\n", NUM(inode)); 2157 printk(KERN_INFO "Closing board %d\n", NUM(inode));
2177 2158
@@ -3301,14 +3282,10 @@ static void ixj_write_cidcw(IXJ *j)
3301 ixj_play_tone(j, 23); 3282 ixj_play_tone(j, 23);
3302 3283
3303 clear_bit(j->board, &j->busyflags); 3284 clear_bit(j->board, &j->busyflags);
3304 while(j->tone_state) { 3285 while(j->tone_state)
3305 set_current_state(TASK_INTERRUPTIBLE); 3286 schedule_timeout_interruptible(1);
3306 schedule_timeout(1); 3287 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3307 } 3288 schedule_timeout_interruptible(1);
3308 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3309 set_current_state(TASK_INTERRUPTIBLE);
3310 schedule_timeout(1);
3311 }
3312 if(ixjdebug & 0x0200) { 3289 if(ixjdebug & 0x0200) {
3313 printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies); 3290 printk("IXJ cidcw phone%d first tone end at %ld\n", j->board, jiffies);
3314 } 3291 }
@@ -3328,14 +3305,10 @@ static void ixj_write_cidcw(IXJ *j)
3328 ixj_play_tone(j, 24); 3305 ixj_play_tone(j, 24);
3329 3306
3330 clear_bit(j->board, &j->busyflags); 3307 clear_bit(j->board, &j->busyflags);
3331 while(j->tone_state) { 3308 while(j->tone_state)
3332 set_current_state(TASK_INTERRUPTIBLE); 3309 schedule_timeout_interruptible(1);
3333 schedule_timeout(1); 3310 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3334 } 3311 schedule_timeout_interruptible(1);
3335 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3336 set_current_state(TASK_INTERRUPTIBLE);
3337 schedule_timeout(1);
3338 }
3339 if(ixjdebug & 0x0200) { 3312 if(ixjdebug & 0x0200) {
3340 printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies); 3313 printk("IXJ cidcw phone%d sent second tone at %ld\n", j->board, jiffies);
3341 } 3314 }
@@ -3343,14 +3316,10 @@ static void ixj_write_cidcw(IXJ *j)
3343 j->cidcw_wait = jiffies + ((50 * hertz) / 100); 3316 j->cidcw_wait = jiffies + ((50 * hertz) / 100);
3344 3317
3345 clear_bit(j->board, &j->busyflags); 3318 clear_bit(j->board, &j->busyflags);
3346 while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait)) { 3319 while(!j->flags.cidcw_ack && time_before(jiffies, j->cidcw_wait))
3347 set_current_state(TASK_INTERRUPTIBLE); 3320 schedule_timeout_interruptible(1);
3348 schedule_timeout(1); 3321 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0)
3349 } 3322 schedule_timeout_interruptible(1);
3350 while(test_and_set_bit(j->board, (void *)&j->busyflags) != 0) {
3351 set_current_state(TASK_INTERRUPTIBLE);
3352 schedule_timeout(1);
3353 }
3354 j->cidcw_wait = 0; 3323 j->cidcw_wait = 0;
3355 if(!j->flags.cidcw_ack) { 3324 if(!j->flags.cidcw_ack) {
3356 if(ixjdebug & 0x0200) { 3325 if(ixjdebug & 0x0200) {
@@ -6125,10 +6094,8 @@ static int ixj_ioctl(struct inode *inode, struct file *file_p, unsigned int cmd,
6125 * Set up locks to ensure that only one process is talking to the DSP at a time. 6094 * Set up locks to ensure that only one process is talking to the DSP at a time.
6126 * This is necessary to keep the DSP from locking up. 6095 * This is necessary to keep the DSP from locking up.
6127 */ 6096 */
6128 while(test_and_set_bit(board, (void *)&j->busyflags) != 0) { 6097 while(test_and_set_bit(board, (void *)&j->busyflags) != 0)
6129 set_current_state(TASK_INTERRUPTIBLE); 6098 schedule_timeout_interruptible(1);
6130 schedule_timeout(1);
6131 }
6132 if (ixjdebug & 0x0040) 6099 if (ixjdebug & 0x0040)
6133 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg); 6100 printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
6134 if (minor >= IXJMAX) { 6101 if (minor >= IXJMAX) {
@@ -6694,8 +6661,6 @@ static struct file_operations ixj_fops =
6694 6661
6695static int ixj_linetest(IXJ *j) 6662static int ixj_linetest(IXJ *j)
6696{ 6663{
6697 unsigned long jifwait;
6698
6699 j->flags.pstncheck = 1; /* Testing */ 6664 j->flags.pstncheck = 1; /* Testing */
6700 j->flags.pstn_present = 0; /* Assume the line is not there */ 6665 j->flags.pstn_present = 0; /* Assume the line is not there */
6701 6666
@@ -6726,11 +6691,7 @@ static int ixj_linetest(IXJ *j)
6726 6691
6727 outb_p(j->pld_scrw.byte, j->XILINXbase); 6692 outb_p(j->pld_scrw.byte, j->XILINXbase);
6728 daa_set_mode(j, SOP_PU_CONVERSATION); 6693 daa_set_mode(j, SOP_PU_CONVERSATION);
6729 jifwait = jiffies + hertz; 6694 msleep(1000);
6730 while (time_before(jiffies, jifwait)) {
6731 set_current_state(TASK_INTERRUPTIBLE);
6732 schedule_timeout(1);
6733 }
6734 daa_int_read(j); 6695 daa_int_read(j);
6735 daa_set_mode(j, SOP_PU_RESET); 6696 daa_set_mode(j, SOP_PU_RESET);
6736 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6697 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6750,11 +6711,7 @@ static int ixj_linetest(IXJ *j)
6750 j->pld_slicw.bits.rly3 = 0; 6711 j->pld_slicw.bits.rly3 = 0;
6751 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01); 6712 outb_p(j->pld_slicw.byte, j->XILINXbase + 0x01);
6752 daa_set_mode(j, SOP_PU_CONVERSATION); 6713 daa_set_mode(j, SOP_PU_CONVERSATION);
6753 jifwait = jiffies + hertz; 6714 msleep(1000);
6754 while (time_before(jiffies, jifwait)) {
6755 set_current_state(TASK_INTERRUPTIBLE);
6756 schedule_timeout(1);
6757 }
6758 daa_int_read(j); 6715 daa_int_read(j);
6759 daa_set_mode(j, SOP_PU_RESET); 6716 daa_set_mode(j, SOP_PU_RESET);
6760 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) { 6717 if (j->m_DAAShadowRegs.XOP_REGS.XOP.xr0.bitreg.VDD_OK) {
@@ -6783,7 +6740,6 @@ static int ixj_linetest(IXJ *j)
6783static int ixj_selfprobe(IXJ *j) 6740static int ixj_selfprobe(IXJ *j)
6784{ 6741{
6785 unsigned short cmd; 6742 unsigned short cmd;
6786 unsigned long jif;
6787 int cnt; 6743 int cnt;
6788 BYTES bytes; 6744 BYTES bytes;
6789 6745
@@ -6933,29 +6889,13 @@ static int ixj_selfprobe(IXJ *j)
6933 } else { 6889 } else {
6934 if (j->cardtype == QTI_LINEJACK) { 6890 if (j->cardtype == QTI_LINEJACK) {
6935 LED_SetState(0x1, j); 6891 LED_SetState(0x1, j);
6936 jif = jiffies + (hertz / 10); 6892 msleep(100);
6937 while (time_before(jiffies, jif)) {
6938 set_current_state(TASK_INTERRUPTIBLE);
6939 schedule_timeout(1);
6940 }
6941 LED_SetState(0x2, j); 6893 LED_SetState(0x2, j);
6942 jif = jiffies + (hertz / 10); 6894 msleep(100);
6943 while (time_before(jiffies, jif)) {
6944 set_current_state(TASK_INTERRUPTIBLE);
6945 schedule_timeout(1);
6946 }
6947 LED_SetState(0x4, j); 6895 LED_SetState(0x4, j);
6948 jif = jiffies + (hertz / 10); 6896 msleep(100);
6949 while (time_before(jiffies, jif)) {
6950 set_current_state(TASK_INTERRUPTIBLE);
6951 schedule_timeout(1);
6952 }
6953 LED_SetState(0x8, j); 6897 LED_SetState(0x8, j);
6954 jif = jiffies + (hertz / 10); 6898 msleep(100);
6955 while (time_before(jiffies, jif)) {
6956 set_current_state(TASK_INTERRUPTIBLE);
6957 schedule_timeout(1);
6958 }
6959 LED_SetState(0x0, j); 6899 LED_SetState(0x0, j);
6960 daa_get_version(j); 6900 daa_get_version(j);
6961 if (ixjdebug & 0x0002) 6901 if (ixjdebug & 0x0002)
diff --git a/drivers/usb/media/stv680.c b/drivers/usb/media/stv680.c
index 7398a7f19c1e..0fd0fa9fec21 100644
--- a/drivers/usb/media/stv680.c
+++ b/drivers/usb/media/stv680.c
@@ -260,7 +260,7 @@ static int stv_stop_video (struct usb_stv *dev)
260 PDEBUG (0, "STV(i): Camera set to original resolution"); 260 PDEBUG (0, "STV(i): Camera set to original resolution");
261 } 261 }
262 /* origMode */ 262 /* origMode */
263 kfree (buf); 263 kfree(buf);
264 return i; 264 return i;
265} 265}
266 266
@@ -276,7 +276,7 @@ static int stv_set_video_mode (struct usb_stv *dev)
276 } 276 }
277 277
278 if ((i = stv_set_config (dev, 1, 0, 0)) < 0) { 278 if ((i = stv_set_config (dev, 1, 0, 0)) < 0) {
279 kfree (buf); 279 kfree(buf);
280 return i; 280 return i;
281 } 281 }
282 282
@@ -301,13 +301,13 @@ static int stv_set_video_mode (struct usb_stv *dev)
301 goto exit; 301 goto exit;
302 302
303error: 303error:
304 kfree (buf); 304 kfree(buf);
305 if (stop_video == 1) 305 if (stop_video == 1)
306 stv_stop_video (dev); 306 stv_stop_video (dev);
307 return -1; 307 return -1;
308 308
309exit: 309exit:
310 kfree (buf); 310 kfree(buf);
311 return 0; 311 return 0;
312} 312}
313 313
@@ -327,7 +327,7 @@ static int stv_init (struct usb_stv *stv680)
327 327
328 /* set config 1, interface 0, alternate 0 */ 328 /* set config 1, interface 0, alternate 0 */
329 if ((i = stv_set_config (stv680, 1, 0, 0)) < 0) { 329 if ((i = stv_set_config (stv680, 1, 0, 0)) < 0) {
330 kfree (buffer); 330 kfree(buffer);
331 PDEBUG (0, "STV(e): set config 1,0,0 failed"); 331 PDEBUG (0, "STV(e): set config 1,0,0 failed");
332 return -1; 332 return -1;
333 } 333 }
@@ -435,11 +435,11 @@ static int stv_init (struct usb_stv *stv680)
435error: 435error:
436 i = stv_sndctrl (0, stv680, 0x80, 0, buffer, 0x02); /* Get Last Error */ 436 i = stv_sndctrl (0, stv680, 0x80, 0, buffer, 0x02); /* Get Last Error */
437 PDEBUG (1, "STV(i): last error: %i, command = 0x%x", buffer[0], buffer[1]); 437 PDEBUG (1, "STV(i): last error: %i, command = 0x%x", buffer[0], buffer[1]);
438 kfree (buffer); 438 kfree(buffer);
439 return -1; 439 return -1;
440 440
441exit: 441exit:
442 kfree (buffer); 442 kfree(buffer);
443 443
444 /* video = 320x240, 352x288 */ 444 /* video = 320x240, 352x288 */
445 if (stv680->CIF == 1) { 445 if (stv680->CIF == 1) {
@@ -708,10 +708,10 @@ static int stv680_stop_stream (struct usb_stv *stv680)
708 usb_kill_urb (stv680->urb[i]); 708 usb_kill_urb (stv680->urb[i]);
709 usb_free_urb (stv680->urb[i]); 709 usb_free_urb (stv680->urb[i]);
710 stv680->urb[i] = NULL; 710 stv680->urb[i] = NULL;
711 kfree (stv680->sbuf[i].data); 711 kfree(stv680->sbuf[i].data);
712 } 712 }
713 for (i = 0; i < STV680_NUMSCRATCH; i++) { 713 for (i = 0; i < STV680_NUMSCRATCH; i++) {
714 kfree (stv680->scratch[i].data); 714 kfree(stv680->scratch[i].data);
715 stv680->scratch[i].data = NULL; 715 stv680->scratch[i].data = NULL;
716 } 716 }
717 717
@@ -1068,7 +1068,7 @@ static int stv_close (struct inode *inode, struct file *file)
1068 stv680->user = 0; 1068 stv680->user = 0;
1069 1069
1070 if (stv680->removed) { 1070 if (stv680->removed) {
1071 kfree (stv680); 1071 kfree(stv680);
1072 stv680 = NULL; 1072 stv680 = NULL;
1073 PDEBUG (0, "STV(i): device unregistered"); 1073 PDEBUG (0, "STV(i): device unregistered");
1074 } 1074 }
@@ -1445,14 +1445,14 @@ static inline void usb_stv680_remove_disconnected (struct usb_stv *stv680)
1445 usb_kill_urb (stv680->urb[i]); 1445 usb_kill_urb (stv680->urb[i]);
1446 usb_free_urb (stv680->urb[i]); 1446 usb_free_urb (stv680->urb[i]);
1447 stv680->urb[i] = NULL; 1447 stv680->urb[i] = NULL;
1448 kfree (stv680->sbuf[i].data); 1448 kfree(stv680->sbuf[i].data);
1449 } 1449 }
1450 for (i = 0; i < STV680_NUMSCRATCH; i++) 1450 for (i = 0; i < STV680_NUMSCRATCH; i++)
1451 kfree (stv680->scratch[i].data); 1451 kfree(stv680->scratch[i].data);
1452 PDEBUG (0, "STV(i): %s disconnected", stv680->camera_name); 1452 PDEBUG (0, "STV(i): %s disconnected", stv680->camera_name);
1453 1453
1454 /* Free the memory */ 1454 /* Free the memory */
1455 kfree (stv680); 1455 kfree(stv680);
1456} 1456}
1457 1457
1458static void stv680_disconnect (struct usb_interface *intf) 1458static void stv680_disconnect (struct usb_interface *intf)
diff --git a/drivers/video/vgastate.c b/drivers/video/vgastate.c
index 0ea62d8bc703..ca92940f3943 100644
--- a/drivers/video/vgastate.c
+++ b/drivers/video/vgastate.c
@@ -342,16 +342,11 @@ static void vga_cleanup(struct vgastate *state)
342 if (state->vidstate != NULL) { 342 if (state->vidstate != NULL) {
343 struct regstate *saved = (struct regstate *) state->vidstate; 343 struct regstate *saved = (struct regstate *) state->vidstate;
344 344
345 if (saved->vga_font0) 345 vfree(saved->vga_font0);
346 vfree(saved->vga_font0); 346 vfree(saved->vga_font1);
347 if (saved->vga_font1) 347 vfree(saved->vga_text);
348 vfree(saved->vga_font1); 348 vfree(saved->vga_cmap);
349 if (saved->vga_text) 349 vfree(saved->attr);
350 vfree(saved->vga_text);
351 if (saved->vga_cmap)
352 vfree(saved->vga_cmap);
353 if (saved->attr)
354 vfree(saved->attr);
355 kfree(saved); 350 kfree(saved);
356 state->vidstate = NULL; 351 state->vidstate = NULL;
357 } 352 }