* [patch 01/16] ide: min/max macros in ide-timing.h
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 02/16] net/ppp-generic: list_for_each_entry domen
` (14 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: min-max-ide_ide-timing.h.patch --]
[-- Type: text/plain, Size: 2698 bytes --]
From: Clemens Buchacher <drizzd@aon.at>
I replaced the custom MIN/MAX macros with the type safe min/max macros
from linux/kernel.h.
>From Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
ide-timing.h | 25 ++++++++++++-------------
1 files changed, 12 insertions(+), 13 deletions(-)
Index: quilt/drivers/ide/ide-timing.h
===================================================================
--- quilt.orig/drivers/ide/ide-timing.h
+++ 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)
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 02/16] net/ppp-generic: list_for_each_entry
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
2005-08-08 22:29 ` [patch 01/16] ide: min/max macros in ide-timing.h domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 03/16] jffs/intrep: list_for_each_entry domen
` (13 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: list-for-each-entry-drivers_net_ppp_generic.patch --]
[-- Type: text/plain, Size: 2738 bytes --]
From: Domen Puncer <domen@coderock.org>
Make code more readable with list_for_each_entry.
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
ppp_generic.c | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
Index: quilt/drivers/net/ppp_generic.c
===================================================================
--- quilt.orig/drivers/net/ppp_generic.c
+++ 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;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 03/16] jffs/intrep: list_for_each_entry
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
2005-08-08 22:29 ` [patch 01/16] ide: min/max macros in ide-timing.h domen
2005-08-08 22:29 ` [patch 02/16] net/ppp-generic: list_for_each_entry domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 04/16] fs/namespace.c: list_for_each_entry domen
` (12 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: list-for-each-entry-fs_jffs_intrep.patch --]
[-- Type: text/plain, Size: 2132 bytes --]
From: Domen Puncer <domen@coderock.org>
Use list_for_each_entry to make code more readable.
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
intrep.c | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
Index: quilt/fs/jffs/intrep.c
===================================================================
--- quilt.orig/fs/jffs/intrep.c
+++ 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 : ""),
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 04/16] fs/namespace.c: list_for_each_entry
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (2 preceding siblings ...)
2005-08-08 22:29 ` [patch 03/16] jffs/intrep: list_for_each_entry domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 05/16] fs/dcache.c: list_for_each* domen
` (11 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: list-for-each-entry-fs_namespace.patch --]
[-- Type: text/plain, Size: 1121 bytes --]
From: Domen Puncer <domen@coderock.org>
Make code more readable with list_for_each_entry.
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
namespace.c | 4 +---
1 files changed, 1 insertion(+), 3 deletions(-)
Index: quilt/fs/namespace.c
===================================================================
--- quilt.orig/fs/namespace.c
+++ 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;
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 05/16] fs/dcache.c: list_for_each*
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (3 preceding siblings ...)
2005-08-08 22:29 ` [patch 04/16] fs/namespace.c: list_for_each_entry domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 06/16] ide-tape: replace schedule_timeout() with msleep() domen
` (10 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: list-for-each-fs_dcache.patch --]
[-- Type: text/plain, Size: 1790 bytes --]
From: Domen Puncer <domen@coderock.org>
First one is list_for_each_entry (thanks maks), second 2 list_for_each_safe.
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
dcache.c | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
Index: quilt/fs/dcache.c
===================================================================
--- quilt.orig/fs/dcache.c
+++ 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;
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 06/16] ide-tape: replace schedule_timeout() with msleep()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (4 preceding siblings ...)
2005-08-08 22:29 ` [patch 05/16] fs/dcache.c: list_for_each* domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 07/16] block/umem: replace PRINTK with pr_debug domen
` (9 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, Maximilian Attems, domen
[-- Attachment #1: msleep-drivers_ide_ide-tape.patch --]
[-- Type: text/plain, Size: 867 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
Uses msleep() instead of schedule_timeout() to guarantee
the task delays at least the desired time amount.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
ide-tape.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
Index: quilt/drivers/ide/ide-tape.c
===================================================================
--- quilt.orig/drivers/ide/ide-tape.c
+++ 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;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 07/16] block/umem: replace PRINTK with pr_debug
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (5 preceding siblings ...)
2005-08-08 22:29 ` [patch 06/16] ide-tape: replace schedule_timeout() with msleep() domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 08/16] tulip/de4x5: list_for_each domen
` (8 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: pr_debug-drivers_block_umem.patch --]
[-- Type: text/plain, Size: 2053 bytes --]
From: Domen Puncer <domen@coderock.org>
Removed unused dprintk, replaced PRINTK with pr_debug.
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
umem.c | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
Index: quilt/drivers/block/umem.c
===================================================================
--- quilt.orig/drivers/block/umem.c
+++ 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);
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 08/16] tulip/de4x5: list_for_each
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (6 preceding siblings ...)
2005-08-08 22:29 ` [patch 07/16] block/umem: replace PRINTK with pr_debug domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 09/16] sh: bigsur/io: minmax-removal domen
` (7 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Maximilian Attems, domen
[-- Attachment #1: list-for-each-drivers_net_tulip_de4x5.patch --]
[-- Type: text/plain, Size: 980 bytes --]
From: Domen Puncer <domen@coderock.org>
s/for/list_for_each/
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
de4x5.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: quilt/drivers/net/tulip/de4x5.c
===================================================================
--- quilt.orig/drivers/net/tulip/de4x5.c
+++ 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 */
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 09/16] sh: bigsur/io: minmax-removal
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (7 preceding siblings ...)
2005-08-08 22:29 ` [patch 08/16] tulip/de4x5: list_for_each domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 10/16] sh: hd64465: minmax-removal domen
` (6 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Michael Veeck, Maximilian Attems, domen
[-- Attachment #1: min-max-arch_sh_boards_bigsur_io.patch --]
[-- Type: text/plain, Size: 1682 bytes --]
From: Michael Veeck <michael.veeck@gmx.net>
Patch removes unnecessary min/max macros and changes
calls to use kernel.h macros instead.
Signed-off-by: Michael Veeck <michael.veeck@gmx.net>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
io.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
Index: quilt/arch/sh/boards/bigsur/io.c
===================================================================
--- quilt.orig/arch/sh/boards/bigsur/io.c
+++ 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;
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 10/16] sh: hd64465: minmax-removal
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (8 preceding siblings ...)
2005-08-08 22:29 ` [patch 09/16] sh: bigsur/io: minmax-removal domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 11/16] block/xd: replace schedule_timeout() with msleep()/msleep_interruptible() domen
` (5 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Michael Veeck, Maximilian Attems, domen
[-- Attachment #1: min-max-arch_sh_cchips_hd6446x_hd64465_io.patch --]
[-- Type: text/plain, Size: 1786 bytes --]
From: Michael Veeck <michael.veeck@gmx.net>
Patch removes unnecessary min/max macros and changes
calls to use kernel.h macros instead.
Signed-off-by: Michael Veeck <michael.veeck@gmx.net>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
io.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
Index: quilt/arch/sh/cchips/hd6446x/hd64465/io.c
===================================================================
--- quilt.orig/arch/sh/cchips/hd6446x/hd64465/io.c
+++ 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;
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 11/16] block/xd: replace schedule_timeout() with msleep()/msleep_interruptible()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (9 preceding siblings ...)
2005-08-08 22:29 ` [patch 10/16] sh: hd64465: minmax-removal domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 12/16] ide/ide-cs: replace schedule_timeout() with msleep() domen
` (4 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, Maximilian Attems, domen
[-- Attachment #1: msleep-drivers_block_xd.patch --]
[-- Type: text/plain, Size: 2442 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
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.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
xd.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
Index: quilt/drivers/block/xd.c
===================================================================
--- quilt.orig/drivers/block/xd.c
+++ 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)
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 12/16] ide/ide-cs: replace schedule_timeout() with msleep()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (10 preceding siblings ...)
2005-08-08 22:29 ` [patch 11/16] block/xd: replace schedule_timeout() with msleep()/msleep_interruptible() domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 13/16] net/stir4200: replace direct assignment with set_current_state() domen
` (3 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, Maximilian Attems, domen
[-- Attachment #1: msleep-drivers_ide_ide-cs.patch --]
[-- Type: text/plain, Size: 932 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
Uses msleep() in place of schedule_timeout()
to guarantee the task delays as expected.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
ide-cs.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Index: quilt/drivers/ide/legacy/ide-cs.c
===================================================================
--- quilt.orig/drivers/ide/legacy/ide-cs.c
+++ 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) {
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 13/16] net/stir4200: replace direct assignment with set_current_state()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (11 preceding siblings ...)
2005-08-08 22:29 ` [patch 12/16] ide/ide-cs: replace schedule_timeout() with msleep() domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 14/16] net/tms380tr: " domen
` (2 subsequent siblings)
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, Maximilian Attems, domen
[-- Attachment #1: set_current_state-drivers_net_irda_stir4200.patch --]
[-- Type: text/plain, Size: 800 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
Use set_current_state() instead of direct assignment of
current->state.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
stir4200.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: quilt/drivers/net/irda/stir4200.c
===================================================================
--- quilt.orig/drivers/net/irda/stir4200.c
+++ 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);
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 14/16] net/tms380tr: replace direct assignment with set_current_state()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (12 preceding siblings ...)
2005-08-08 22:29 ` [patch 13/16] net/stir4200: replace direct assignment with set_current_state() domen
@ 2005-08-08 22:29 ` domen
2005-08-11 3:19 ` Jeff Garzik
2005-08-08 22:29 ` [patch 15/16] reiserfs: super.c - vfree() checking cleanups domen
2005-08-08 22:29 ` [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event() domen
15 siblings, 1 reply; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, Maximilian Attems, domen
[-- Attachment #1: set_current_state-drivers_net_tokenring_tms380tr.patch --]
[-- Type: text/plain, Size: 834 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
Use set_current_state() instead of direct assignment of
current->state.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
tms380tr.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
Index: quilt/drivers/net/tokenring/tms380tr.c
===================================================================
--- quilt.orig/drivers/net/tokenring/tms380tr.c
+++ 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
--
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [patch 14/16] net/tms380tr: replace direct assignment with set_current_state()
2005-08-08 22:29 ` [patch 14/16] net/tms380tr: " domen
@ 2005-08-11 3:19 ` Jeff Garzik
2005-08-11 3:27 ` Nishanth Aravamudan
0 siblings, 1 reply; 20+ messages in thread
From: Jeff Garzik @ 2005-08-11 3:19 UTC (permalink / raw)
To: domen; +Cc: akpm, linux-kernel, Nishanth Aravamudan, Maximilian Attems
domen@coderock.org wrote:
> From: Nishanth Aravamudan <nacc@us.ibm.com>
>
>
>
> Use set_current_state() instead of direct assignment of
> current->state.
>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> Signed-off-by: Domen Puncer <domen@coderock.org>
why?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [patch 14/16] net/tms380tr: replace direct assignment with set_current_state()
2005-08-11 3:19 ` Jeff Garzik
@ 2005-08-11 3:27 ` Nishanth Aravamudan
0 siblings, 0 replies; 20+ messages in thread
From: Nishanth Aravamudan @ 2005-08-11 3:27 UTC (permalink / raw)
To: Jeff Garzik; +Cc: domen, akpm, linux-kernel, Maximilian Attems
On 10.08.2005 [23:19:01 -0400], Jeff Garzik wrote:
> domen@coderock.org wrote:
> >From: Nishanth Aravamudan <nacc@us.ibm.com>
> >
> >
> >
> >Use set_current_state() instead of direct assignment of
> >current->state.
> >
> >Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> >Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> >Signed-off-by: Domen Puncer <domen@coderock.org>
>
> why?
This patch can be dropped, as -mm contains a function
(schedule_timeout_interruptible()) which makes these changes
unnecessary.
Thanks,
Nish
^ permalink raw reply [flat|nested] 20+ messages in thread
* [patch 15/16] reiserfs: super.c - vfree() checking cleanups
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (13 preceding siblings ...)
2005-08-08 22:29 ` [patch 14/16] net/tms380tr: " domen
@ 2005-08-08 22:29 ` domen
2005-08-08 22:29 ` [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event() domen
15 siblings, 0 replies; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, domen
[-- Attachment #1: vfree-fs_reiserfs_super.patch --]
[-- Type: text/plain, Size: 680 bytes --]
From: jlamanna@gmail.com
super.c vfree() checking cleanups.
Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
super.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
Index: quilt/fs/reiserfs/super.c
===================================================================
--- quilt.orig/fs/reiserfs/super.c
+++ 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));
--
^ permalink raw reply [flat|nested] 20+ messages in thread* [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event()
2005-08-08 22:29 [patch 00/16] old kernel janitor patches domen
` (14 preceding siblings ...)
2005-08-08 22:29 ` [patch 15/16] reiserfs: super.c - vfree() checking cleanups domen
@ 2005-08-08 22:29 ` domen
2005-08-09 6:14 ` Andrew Morton
15 siblings, 1 reply; 20+ messages in thread
From: domen @ 2005-08-08 22:29 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, Nishanth Aravamudan, domen
[-- Attachment #1: wait_event-drivers_block_ps2esdi.patch --]
[-- Type: text/plain, Size: 1519 bytes --]
From: Nishanth Aravamudan <nacc@us.ibm.com>
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.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
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);
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;
}
--
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event()
2005-08-08 22:29 ` [patch 16/16] block/ps2esdi: replace sleep_on() with wait_event() domen
@ 2005-08-09 6:14 ` Andrew Morton
0 siblings, 0 replies; 20+ messages in thread
From: Andrew Morton @ 2005-08-09 6:14 UTC (permalink / raw)
To: domen; +Cc: linux-kernel, nacc, domen
domen@coderock.org 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.
>
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Signed-off-by: Domen Puncer <domen@coderock.org>
> ---
> 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);
>
> 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".
^ permalink raw reply [flat|nested] 20+ messages in thread