Skip to contentSkip to conversation

old kernel janitor patches

PATCH In review [email protected] 4 participants 20 messages Aug 8, 2005 – Aug 11, 2005

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover old kernel janitor patches

Hi Andrew, folks.

Here are patches I'm sending for inclusion in -mm tree. Patches were in -kj tree for more than five months, and as far as I can tell, they received no negative feedback.

List of them, which is a bit descriptive:

min-max-ide_ide-timing.h.patch list-for-each-entry-drivers_net_ppp_generic.patch list-for-each-entry-fs_jffs_intrep.patch list-for-each-entry-fs_namespace.patch list-for-each-fs_dcache.patch msleep-drivers_ide_ide-tape.patch pr_debug-drivers_block_umem.patch list-for-each-drivers_net_tulip_de4x5.patch min-max-arch_sh_boards_bigsur_io.patch min-max-arch_sh_cchips_hd6446x_hd64465_io.patch msleep-drivers_block_xd.patch msleep-drivers_ide_ide-cs.patch set_current_state-drivers_net_irda_stir4200.patch set_current_state-drivers_net_tokenring_tms380tr.patch vfree-fs_reiserfs_super.patch wait_event-drivers_block_ps2esdi.patch

#1 lore raw

PATCH 1/16 ide: min/max macros in ide-timing.h

From: Clemens Buchacher <[email protected]>

I replaced the custom MIN/MAX macros with the type safe min/max macros from linux/kernel.h.

Quoted 1 line

From Clemens Buchacher <[email protected]>

---
 ide-timing.h |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)
drivers/ide/ide-timing.h +12 -13
Index: quilt/drivers/ide/ide-timing.h
===================================================================
@@ -27,6 +27,7 @@
  * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
  */
 
+#include <linux/kernel.h>
 #include <linux/hdreg.h>
 
 #define XFER_PIO_5		0x0d
@@ -96,11 +97,9 @@ static struct ide_timing ide_timing[] = 
 #define IDE_TIMING_UDMA		0x80
 #define IDE_TIMING_ALL		0xff
 
-#define MIN(a,b)	((a)<(b)?(a):(b))
-#define MAX(a,b)	((a)>(b)?(a):(b))
-#define FIT(v,min,max)	MAX(MIN(v,max),min)
-#define ENOUGH(v,unit)	(((v)-1)/(unit)+1)
-#define EZ(v,unit)	((v)?ENOUGH(v,unit):0)
+#define FIT(v,vmin,vmax)	max_t(short,min_t(short,v,vmax),vmin)
+#define ENOUGH(v,unit)		(((v)-1)/(unit)+1)
+#define EZ(v,unit)		((v)?ENOUGH(v,unit):0)
 
 #define XFER_MODE	0xf0
 #define XFER_UDMA_133	0x48
@@ -188,14 +187,14 @@ static void ide_timing_quantize(struct i
 
 static void ide_timing_merge(struct ide_timing *a, struct ide_timing *b, struct ide_timing *m, unsigned int what)
 {
-	if (what & IDE_TIMING_SETUP  ) m->setup   = MAX(a->setup,   b->setup);
-	if (what & IDE_TIMING_ACT8B  ) m->act8b   = MAX(a->act8b,   b->act8b);
-	if (what & IDE_TIMING_REC8B  ) m->rec8b   = MAX(a->rec8b,   b->rec8b);
-	if (what & IDE_TIMING_CYC8B  ) m->cyc8b   = MAX(a->cyc8b,   b->cyc8b);
-	if (what & IDE_TIMING_ACTIVE ) m->active  = MAX(a->active,  b->active);
-	if (what & IDE_TIMING_RECOVER) m->recover = MAX(a->recover, b->recover);
-	if (what & IDE_TIMING_CYCLE  ) m->cycle   = MAX(a->cycle,   b->cycle);
-	if (what & IDE_TIMING_UDMA   ) m->udma    = MAX(a->udma,    b->udma);
+	if (what & IDE_TIMING_SETUP  ) m->setup   = max(a->setup,   b->setup);
+	if (what & IDE_TIMING_ACT8B  ) m->act8b   = max(a->act8b,   b->act8b);
+	if (what & IDE_TIMING_REC8B  ) m->rec8b   = max(a->rec8b,   b->rec8b);
+	if (what & IDE_TIMING_CYC8B  ) m->cyc8b   = max(a->cyc8b,   b->cyc8b);
+	if (what & IDE_TIMING_ACTIVE ) m->active  = max(a->active,  b->active);
+	if (what & IDE_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
+	if (what & IDE_TIMING_CYCLE  ) m->cycle   = max(a->cycle,   b->cycle);
+	if (what & IDE_TIMING_UDMA   ) m->udma    = max(a->udma,    b->udma);
 }
 
 static struct ide_timing* ide_timing_find_mode(short speed)

--

#2 lore raw

PATCH 2/16 net/ppp-generic: list_for_each_entry

In reply to [email protected]

From: Domen Puncer <[email protected]>

Make code more readable with list_for_each_entry.

---
 ppp_generic.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
drivers/net/ppp_generic.c +6 -15
Index: quilt/drivers/net/ppp_generic.c
===================================================================
@@ -1232,8 +1232,7 @@ static int ppp_mp_explode(struct ppp *pp
 	navail = 0;	/* total # of usable channels (not deregistered) */
 	hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
 	i = 0;
-	list = &ppp->channels;
-	while ((list = list->next) != &ppp->channels) {
+	list_for_each(list, &ppp->channels) {
 		pch = list_entry(list, struct channel, clist);
 		navail += pch->avail = (pch->chan != NULL);
 		if (pch->avail) {
@@ -1731,7 +1730,7 @@ static void
 ppp_receive_mp_frame(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
 {
 	u32 mask, seq;
-	struct list_head *l;
+	struct channel *ch;
 	int mphdrlen = (ppp->flags & SC_MP_SHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
 
 	if (!pskb_may_pull(skb, mphdrlen) || ppp->mrru == 0)
@@ -1785,8 +1784,7 @@ ppp_receive_mp_frame(struct ppp *ppp, st
 	 * The list of channels can't change because we have the receive
 	 * side of the ppp unit locked.
 	 */
-	for (l = ppp->channels.next; l != &ppp->channels; l = l->next) {
-		struct channel *ch = list_entry(l, struct channel, clist);
+	list_for_each_entry(ch, &ppp->channels, clist) {
 		if (seq_before(ch->lastseq, seq))
 			seq = ch->lastseq;
 	}
@@ -2272,10 +2270,8 @@ static struct compressor_entry *
 find_comp_entry(int proto)
 {
 	struct compressor_entry *ce;
-	struct list_head *list = &compressor_list;
 
-	while ((list = list->next) != &compressor_list) {
-		ce = list_entry(list, struct compressor_entry, list);
+	list_for_each_entry(ce, &compressor_list, list) {
 		if (ce->comp->compress_proto == proto)
 			return ce;
 	}
@@ -2541,20 +2537,15 @@ static struct channel *
 ppp_find_channel(int unit)
 {
 	struct channel *pch;
-	struct list_head *list;
 
-	list = &new_channels;
-	while ((list = list->next) != &new_channels) {
-		pch = list_entry(list, struct channel, list);
+	list_for_each_entry(pch, &new_channels, list) {
 		if (pch->file.index == unit) {
 			list_del(&pch->list);
 			list_add(&pch->list, &all_channels);
 			return pch;
 		}
 	}
-	list = &all_channels;
-	while ((list = list->next) != &all_channels) {
-		pch = list_entry(list, struct channel, list);
+	list_for_each_entry(pch, &all_channels, list) {
 		if (pch->file.index == unit)
 			return pch;
 	}

--

#3 lore raw

PATCH 3/16 jffs/intrep: list_for_each_entry

In reply to [email protected]

From: Domen Puncer <[email protected]>

Use list_for_each_entry to make code more readable.

---
 intrep.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
fs/jffs/intrep.c +9 -13
Index: quilt/fs/jffs/intrep.c
===================================================================
@@ -1701,12 +1701,10 @@ jffs_find_file(struct jffs_control *c, _
 {
 	struct jffs_file *f;
 	int i = ino % c->hash_len;
-	struct list_head *tmp;
 
 	D3(printk("jffs_find_file(): ino: %u\n", ino));
 
-	for (tmp = c->hash[i].next; tmp != &c->hash[i]; tmp = tmp->next) {
-		f = list_entry(tmp, struct jffs_file, hash);
+	list_for_each_entry(f, &c->hash[i], hash) {
 		if (ino != f->ino)
 			continue;
 		D3(printk("jffs_find_file(): Found file with ino "
@@ -2102,13 +2100,12 @@ jffs_foreach_file(struct jffs_control *c
 	int result = 0;
 
 	for (pos = 0; pos < c->hash_len; pos++) {
-		struct list_head *p, *next;
-		for (p = c->hash[pos].next; p != &c->hash[pos]; p = next) {
-			/* We need a reference to the next file in the
-			   list because `func' might remove the current
-			   file `f'.  */
-			next = p->next;
-			r = func(list_entry(p, struct jffs_file, hash));
+		struct jffs_file *f, *next;
+
+		/* We must do _safe, because 'func' might remove the
+		   current file 'f' from the list.  */
+		list_for_each_entry_safe(f, next, &c->hash[pos], hash) {
+			r = func(f);
 			if (r < 0)
 				return r;
 			result += r;
@@ -2613,9 +2610,8 @@ jffs_print_hash_table(struct jffs_contro
 
 	printk("JFFS: Dumping the file system's hash table...\n");
 	for (i = 0; i < c->hash_len; i++) {
-		struct list_head *p;
-		for (p = c->hash[i].next; p != &c->hash[i]; p = p->next) {
-			struct jffs_file *f=list_entry(p,struct jffs_file,hash);
+		struct jffs_file *f;
+		list_for_each_entry(f, &c->hash[i], hash) {
 			printk("*** c->hash[%u]: \"%s\" "
 			       "(ino: %u, pino: %u)\n",
 			       i, (f->name ? f->name : ""),

--

#4 lore raw

PATCH 4/16 fs/namespace.c: list_for_each_entry

In reply to [email protected]

From: Domen Puncer <[email protected]>

Make code more readable with list_for_each_entry.

---
 namespace.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)
fs/namespace.c +1 -3
Index: quilt/fs/namespace.c
===================================================================
@@ -537,7 +537,6 @@ lives_below_in_same_fs(struct dentry *d,
 static struct vfsmount *copy_tree(struct vfsmount *mnt, struct dentry *dentry)
 {
 	struct vfsmount *res, *p, *q, *r, *s;
-	struct list_head *h;
 	struct nameidata nd;
 
 	res = q = clone_mnt(mnt, dentry);
@@ -546,8 +545,7 @@ static struct vfsmount *copy_tree(struct
 	q->mnt_mountpoint = mnt->mnt_mountpoint;
 
 	p = mnt;
-	for (h = mnt->mnt_mounts.next; h != &mnt->mnt_mounts; h = h->next) {
-		r = list_entry(h, struct vfsmount, mnt_child);
+	list_for_each_entry(r, &mnt->mnt_mounts, mnt_child) {
 		if (!lives_below_in_same_fs(r->mnt_mountpoint, dentry))
 			continue;
 

--

#5 lore raw

PATCH 5/16 fs/dcache.c: list_for_each*

In reply to [email protected]

From: Domen Puncer <[email protected]>

First one is list_for_each_entry (thanks maks), second 2 list_for_each_safe.

---
 dcache.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)
fs/dcache.c +4 -12
Index: quilt/fs/dcache.c
===================================================================
@@ -335,12 +335,10 @@ struct dentry * d_find_alias(struct inod
  */
 void d_prune_aliases(struct inode *inode)
 {
-	struct list_head *tmp, *head = &inode->i_dentry;
+	struct dentry *dentry;
 restart:
 	spin_lock(&dcache_lock);
-	tmp = head;
-	while ((tmp = tmp->next) != head) {
-		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
+	list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
 		spin_lock(&dentry->d_lock);
 		if (!atomic_read(&dentry->d_count)) {
 			__dget_locked(dentry);
@@ -461,10 +459,7 @@ void shrink_dcache_sb(struct super_block
 	 * superblock to the most recent end of the unused list.
 	 */
 	spin_lock(&dcache_lock);
-	next = dentry_unused.next;
-	while (next != &dentry_unused) {
-		tmp = next;
-		next = tmp->next;
+	list_for_each_safe(tmp, next, &dentry_unused) {
 		dentry = list_entry(tmp, struct dentry, d_lru);
 		if (dentry->d_sb != sb)
 			continue;
@@ -476,10 +471,7 @@ void shrink_dcache_sb(struct super_block
 	 * Pass two ... free the dentries for this superblock.
 	 */
 repeat:
-	next = dentry_unused.next;
-	while (next != &dentry_unused) {
-		tmp = next;
-		next = tmp->next;
+	list_for_each_safe(tmp, next, &dentry_unused) {
 		dentry = list_entry(tmp, struct dentry, d_lru);
 		if (dentry->d_sb != sb)
 			continue;

--

#6 lore raw

PATCH 6/16 ide-tape: replace schedule_timeout() with msleep()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Uses msleep() instead of schedule_timeout() to guarantee the task delays at least the desired time amount.

---
 ide-tape.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/ide/ide-tape.c +1 -2
Index: quilt/drivers/ide/ide-tape.c
===================================================================
@@ -2903,8 +2903,7 @@ static int idetape_wait_ready(ide_drive_
 		} else if (!(tape->sense_key == 2 && tape->asc == 4 &&
 			     (tape->ascq == 1 || tape->ascq == 8)))
 			return -EIO;
-		current->state = TASK_INTERRUPTIBLE;
-  		schedule_timeout(HZ / 10);
+		msleep(100);
 	}
 	return -EIO;
 }

--

#7 lore raw

PATCH 7/16 block/umem: replace PRINTK with pr_debug

In reply to [email protected]

From: Domen Puncer <[email protected]>

Removed unused dprintk, replaced PRINTK with pr_debug.

---
 umem.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/block/umem.c +4 -7
Index: quilt/drivers/block/umem.c
===================================================================
@@ -34,6 +34,7 @@
  *			 - set initialised bit then.
  */
 
+//#define DEBUG /* uncomment if you want debugging info (pr_debug) */
 #include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -58,10 +59,6 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-#define PRINTK(x...) do {} while (0)
-#define dprintk(x...) do {} while (0)
-/*#define dprintk(x...) printk(x) */
-
 #define MM_MAXCARDS 4
 #define MM_RAHEAD 2      /* two sectors */
 #define MM_BLKSIZE 1024  /* 1k blocks */
@@ -299,7 +296,7 @@ static void mm_start_io(struct cardinfo 
 
 	/* make the last descriptor end the chain */
 	page = &card->mm_pages[card->Active];
-	PRINTK("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1);
+	pr_debug("start_io: %d %d->%d\n", card->Active, page->headcnt, page->cnt-1);
 	desc = &page->desc[page->cnt-1];
 
 	desc->control_bits |= cpu_to_le32(DMASCR_CHAIN_COMP_EN);
@@ -532,7 +529,7 @@ static void process_page(unsigned long d
 		activate(card);
 	} else {
 		/* haven't finished with this one yet */
-		PRINTK("do some more\n");
+		pr_debug("do some more\n");
 		mm_start_io(card);
 	}
  out_unlock:
@@ -555,7 +552,7 @@ static void process_page(unsigned long d
 static int mm_make_request(request_queue_t *q, struct bio *bio)
 {
 	struct cardinfo *card = q->queuedata;
-	PRINTK("mm_make_request %ld %d\n", bh->b_rsector, bh->b_size);
+	pr_debug("mm_make_request %ld %d\n", bh->b_rsector, bh->b_size);
 
 	bio->bi_phys_segments = bio->bi_idx; /* count of completed segments*/
 	spin_lock_irq(&card->lock);

--

#8 lore raw

PATCH 8/16 tulip/de4x5: list_for_each

In reply to [email protected]

From: Domen Puncer <[email protected]>

s/for/list_for_each/

---
 de4x5.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/tulip/de4x5.c +2 -2
Index: quilt/drivers/net/tulip/de4x5.c
===================================================================
@@ -2144,9 +2144,9 @@ srom_search(struct net_device *dev, stru
     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
     int i, j, cfrv;
     struct de4x5_private *lp = netdev_priv(dev);
-    struct list_head *walk = &pdev->bus_list;
+    struct list_head *walk;
 
-    for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) {
+    list_for_each(walk, &pdev->bus_list) {
 	struct pci_dev *this_dev = pci_dev_b(walk);
 
 	/* Skip the pci_bus list entry */

--

#9 lore raw

PATCH 9/16 sh: bigsur/io: minmax-removal

In reply to [email protected]

From: Michael Veeck <[email protected]>

Patch removes unnecessary min/max macros and changes calls to use kernel.h macros instead.

---
 io.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
arch/sh/boards/bigsur/io.c +2 -6
Index: quilt/arch/sh/boards/bigsur/io.c
===================================================================
@@ -37,10 +37,6 @@ static u8 bigsur_iomap_lo_shift[BIGSUR_I
 static u32 bigsur_iomap_hi[BIGSUR_IOMAP_HI_NMAP];
 static u8 bigsur_iomap_hi_shift[BIGSUR_IOMAP_HI_NMAP];
 
-#ifndef MAX
-#define MAX(a,b)    ((a)>(b)?(a):(b))
-#endif
-
 void bigsur_port_map(u32 baseport, u32 nports, u32 addr, u8 shift)
 {
 	u32 port, endport = baseport + nports;
@@ -57,7 +53,7 @@ void bigsur_port_map(u32 baseport, u32 n
 	    	addr += (1<<(BIGSUR_IOMAP_LO_SHIFT));
 	}
 
-	for (port = MAX(baseport, BIGSUR_IOMAP_LO_THRESH) ;
+	for (port = max_t(u32, baseport, BIGSUR_IOMAP_LO_THRESH);
 	     port < endport && port < BIGSUR_IOMAP_HI_THRESH ;
 	     port += (1<<BIGSUR_IOMAP_HI_SHIFT)) {
 	    	pr_debug("    maphi[0x%x] = 0x%08x\n", port, addr);
@@ -80,7 +76,7 @@ void bigsur_port_unmap(u32 baseport, u32
 		bigsur_iomap_lo[port>>BIGSUR_IOMAP_LO_SHIFT] = 0;
 	}
 
-	for (port = MAX(baseport, BIGSUR_IOMAP_LO_THRESH) ;
+	for (port = max_t(u32, baseport, BIGSUR_IOMAP_LO_THRESH);
 	     port < endport && port < BIGSUR_IOMAP_HI_THRESH ;
 	     port += (1<<BIGSUR_IOMAP_HI_SHIFT)) {
 		bigsur_iomap_hi[port>>BIGSUR_IOMAP_HI_SHIFT] = 0;

--

#10 lore raw

PATCH 10/16 sh: hd64465: minmax-removal

In reply to [email protected]

From: Michael Veeck <[email protected]>

Patch removes unnecessary min/max macros and changes calls to use kernel.h macros instead.

---
 io.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
arch/sh/cchips/hd6446x/hd64465/io.c +2 -6
Index: quilt/arch/sh/cchips/hd6446x/hd64465/io.c
===================================================================
@@ -48,10 +48,6 @@ static unsigned char	hd64465_iomap_lo_sh
 static unsigned long	hd64465_iomap_hi[HD64465_IOMAP_HI_NMAP];
 static unsigned char	hd64465_iomap_hi_shift[HD64465_IOMAP_HI_NMAP];
 
-#ifndef MAX
-#define MAX(a,b)    ((a)>(b)?(a):(b))
-#endif
-
 #define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x))
 
 void hd64465_port_map(unsigned short baseport, unsigned int nports,
@@ -71,7 +67,7 @@ void hd64465_port_map(unsigned short bas
 	    addr += (1<<(HD64465_IOMAP_LO_SHIFT));
 	}
 
-	for (port = MAX(baseport, HD64465_IOMAP_LO_THRESH) ;
+	for (port = max_t(unsigned int, baseport, HD64465_IOMAP_LO_THRESH);
 	     port < endport && port < HD64465_IOMAP_HI_THRESH ;
 	     port += (1<<HD64465_IOMAP_HI_SHIFT)) {
 	    DPRINTK("    maphi[0x%x] = 0x%08lx\n", port, addr);
@@ -95,7 +91,7 @@ void hd64465_port_unmap(unsigned short b
     	    hd64465_iomap_lo[port>>HD64465_IOMAP_LO_SHIFT] = 0;
 	}
 
-	for (port = MAX(baseport, HD64465_IOMAP_LO_THRESH) ;
+	for (port = max_t(unsigned int, baseport, HD64465_IOMAP_LO_THRESH);
 	     port < endport && port < HD64465_IOMAP_HI_THRESH ;
 	     port += (1<<HD64465_IOMAP_HI_SHIFT)) {
     	    hd64465_iomap_hi[port>>HD64465_IOMAP_HI_SHIFT] = 0;

--

#11 lore raw

PATCH 11/16 block/xd: replace schedule_timeout() with msleep()/msleep_interruptible()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Use msleep() or msleep_interruptible() [as appropriate] instead of schedule_timeout() to gurantee the task delays as expected. As a result changed the units of the timeout variable from jiffies to msecs.

---
 xd.c |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)
drivers/block/xd.c +6 -9
Index: quilt/drivers/block/xd.c
===================================================================
@@ -47,6 +47,7 @@
 #include <linux/wait.h>
 #include <linux/blkdev.h>
 #include <linux/blkpg.h>
+#include <linux/delay.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -62,7 +63,7 @@ static int xd[5] = { -1,-1,-1,-1, };
 
 #define XD_DONT_USE_DMA		0  /* Initial value. may be overriden using
 				      "nodma" module option */
-#define XD_INIT_DISK_DELAY	(30*HZ/1000)  /* 30 ms delay during disk initialization */
+#define XD_INIT_DISK_DELAY	(30)  /* 30 ms delay during disk initialization */
 
 /* Above may need to be increased if a problem with the 2nd drive detection
    (ST11M controller) or resetting a controller (WD) appears */
@@ -633,14 +634,12 @@ static u_char __init xd_initdrives (void
 	for (i = 0; i < XD_MAXDRIVES; i++) {
 		xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0);
 		if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) {
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(XD_INIT_DISK_DELAY);
+			msleep_interruptible(XD_INIT_DISK_DELAY);
 
 			init_drive(count);
 			count++;
 
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(XD_INIT_DISK_DELAY);
+			msleep_interruptible(XD_INIT_DISK_DELAY);
 		}
 	}
 	return (count);
@@ -761,8 +760,7 @@ static void __init xd_wd_init_controller
 
 	outb(0,XD_RESET);		/* reset the controller */
 
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(XD_INIT_DISK_DELAY);
+	msleep(XD_INIT_DISK_DELAY);
 }
 
 static void __init xd_wd_init_drive (u_char drive)
@@ -936,8 +934,7 @@ If you need non-standard settings use th
 	xd_maxsectors = 0x01;
 	outb(0,XD_RESET);		/* reset the controller */
 
-	set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(XD_INIT_DISK_DELAY);
+	msleep(XD_INIT_DISK_DELAY);
 }
 
 static void __init xd_xebec_init_drive (u_char drive)

--

#12 lore raw

PATCH 12/16 ide/ide-cs: replace schedule_timeout() with msleep()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Uses msleep() in place of schedule_timeout()
to guarantee the task delays as expected.

---
 ide-cs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/ide/legacy/ide-cs.c +2 -2
Index: quilt/drivers/ide/legacy/ide-cs.c
===================================================================
@@ -43,6 +43,7 @@
 #include <linux/ide.h>
 #include <linux/hdreg.h>
 #include <linux/major.h>
+#include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/system.h>
 
@@ -340,8 +341,7 @@ static void ide_config(dev_link_t *link)
 		break;
 	    }
 	}
-	__set_current_state(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ/10);
+	msleep(100);
     }
 
     if (hd < 0) {

--

#13 lore raw

PATCH 13/16 net/stir4200: replace direct assignment with set_current_state()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Use set_current_state() instead of direct assignment of current->state.

---
 stir4200.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/irda/stir4200.c +1 -1
Index: quilt/drivers/net/irda/stir4200.c
===================================================================
@@ -679,7 +679,7 @@ static void turnaround_delay(const struc
 
 	ticks = us / (1000000 / HZ);
 	if (ticks > 0) {
-		current->state = TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(1 + ticks);
 	} else
 		udelay(us);

--

#14 lore raw

PATCH 14/16 net/tms380tr: replace direct assignment with set_current_state()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Use set_current_state() instead of direct assignment of current->state.

---
 tms380tr.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/tokenring/tms380tr.c +1 -1
Index: quilt/drivers/net/tokenring/tms380tr.c
===================================================================
@@ -1244,7 +1244,7 @@ void tms380tr_wait(unsigned long time)
 	
 	tmp = jiffies + time/(1000000/HZ);
 	do {
-  		current->state 		= TASK_INTERRUPTIBLE;
+		set_current_state(TASK_INTERRUPTIBLE);
 		tmp = schedule_timeout(tmp);
 	} while(time_after(tmp, jiffies));
 #else

--

#16 lore raw

Re: [patch 14/16] net/tms380tr: replace direct assignment with set_current_state()

Quoted 5 lines · Jeff Garzik
Quoted 4 lines · [email protected] wrote:

From: Nishanth Aravamudan <[email protected]>

Quoted 8 lines
Quoted 6 lines

Use set_current_state() instead of direct assignment of current->state.

why?

This patch can be dropped, as -mm contains a function (schedule_timeout_interruptible()) which makes these changes unnecessary.

Thanks,
Nish

#17 lore raw

PATCH 15/16 reiserfs: super.c - vfree() checking cleanups

In reply to [email protected]

From: [email protected]

super.c vfree() checking cleanups.

Signed-off by: James Lamanna <[email protected]>

---
 super.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)
fs/reiserfs/super.c +1 -2
Index: quilt/fs/reiserfs/super.c
===================================================================
@@ -1934,8 +1934,7 @@ static int reiserfs_fill_super(struct su
 			if (SB_AP_BITMAP(s))
 				brelse(SB_AP_BITMAP(s)[j].bh);
 		}
-		if (SB_AP_BITMAP(s))
-			vfree(SB_AP_BITMAP(s));
+		vfree(SB_AP_BITMAP(s));
 	}
 	if (SB_BUFFER_WITH_SB(s))
 		brelse(SB_BUFFER_WITH_SB(s));

--

#18 lore raw

PATCH 16/16 block/ps2esdi: replace sleep_on() with wait_event()

In reply to [email protected]

From: Nishanth Aravamudan <[email protected]>

Use wait_event() instead of the deprecated sleep_on(). In all replacements, wait_event() expects the condition to *stop* on, so the existing conditional is negated and passed as the parameter. I am not sure if these changes are appropriate, as the condition to pass to wait_event() to guarantee the same behavior; I think this is the best choice, though.

---
 ps2esdi.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/block/ps2esdi.c +3 -4
Index: quilt/drivers/block/ps2esdi.c
===================================================================
@@ -43,6 +43,7 @@
 #include <linux/init.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
+#include <linux/delay.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -461,8 +462,7 @@ static void __init ps2esdi_get_device_cf
 	cmd_blk[1] = 0;
 	no_int_yet = TRUE;
 	ps2esdi_out_cmd_blk(cmd_blk);
-	if (no_int_yet)
-		sleep_on(&ps2esdi_int);
+	wait_event(ps2esdi_int, !no_int_yet);
 
 	if (ps2esdi_drives > 1) {
 		printk("%s: Drive 1\n", DEVICE_NAME);	/*BA */
@@ -470,8 +470,7 @@ static void __init ps2esdi_get_device_cf
 		cmd_blk[1] = 0;
 		no_int_yet = TRUE;
 		ps2esdi_out_cmd_blk(cmd_blk);
-		if (no_int_yet)
-			sleep_on(&ps2esdi_int);
+		wait_event(ps2esdi_int, !no_int_yet);
 	}			/* if second physical drive is present */
 	return;
 }

--

#19 lore raw

Re: [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event()

Quoted 33 lines · [email protected] wrote:

Use wait_event() instead of the deprecated sleep_on(). In all replacements, wait_event() expects the condition to *stop* on, so the existing conditional is negated and passed as the parameter. I am not sure if these changes are appropriate, as the condition to pass to wait_event() to guarantee the same behavior; I think this is the best choice, though.

---

  ps2esdi.c |    7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)

Index: quilt/drivers/block/ps2esdi.c
===================================================================
--- quilt.orig/drivers/block/ps2esdi.c
+++ quilt/drivers/block/ps2esdi.c
@@ -43,6 +43,7 @@
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/module.h>
+#include <linux/delay.h>

#include <asm/system.h>
#include <asm/io.h>
@@ -461,8 +462,7 @@ static void __init ps2esdi_get_device_cf
cmd_blk[1] = 0;
no_int_yet = TRUE; ps2esdi_out_cmd_blk(cmd_blk);
- if (no_int_yet)
- sleep_on(&ps2esdi_int);
+ wait_event(ps2esdi_int, !no_int_yet);

Quoted 12 lines

if (ps2esdi_drives > 1) {
printk("%s: Drive 1\n", DEVICE_NAME); /*BA */
@@ -470,8 +470,7 @@ static void __init ps2esdi_get_device_cf
cmd_blk[1] = 0;
no_int_yet = TRUE; ps2esdi_out_cmd_blk(cmd_blk);
- if (no_int_yet)
- sleep_on(&ps2esdi_int);
+ wait_event(ps2esdi_int, !no_int_yet);
} /* if second physical drive is present */
return;
}

hm, what a racy driver.

	wake_up(&ps2esdi_int);
	no_int_yet = FALSE;

these should be in the other order, no?

Anyway, I think I'll duck this patch until someone can say "it works".