[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in init_task.h

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---
 init_task.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a2d95ff..7951023 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -138,7 +138,7 @@ extern struct group_info init_groups;
.journal_info   = NULL, \
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers),  \
.fs_excl= ATOMIC_INIT(0),   \
-   .pi_lock= SPIN_LOCK_UNLOCKED,   \
+   .pi_lock= __SPIN_LOCK_UNLOCKED(tsk.pi_lock),\
INIT_TRACE_IRQFLAGS \
INIT_LOCKDEP\
 }
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/atm, net

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 drivers/atm/atmtcp.c |2 +-
 net/atm/clip.c   |2 +-
 net/atm/lec.c|2 +-
 net/atm/mpc.c|2 +-
 net/atm/signaling.c  |2 +-
 net/dccp/minisocks.c |2 +-
 net/ipv6/mip6.c  |2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index fc518d8..3fde97b 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -352,7 +352,7 @@ static struct atm_dev atmtcp_control_dev = {
.ops= _c_dev_ops,
.type   = "atmtcp",
.number = 999,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(atmtcp_control_dev.lock)
 };
 
 
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 8c38258..d41137d 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -702,7 +702,7 @@ static struct atm_dev atmarpd_dev = {
.ops =  _dev_ops,
.type = "arpd",
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(atmarpd_dev.lock)
 };
 
 
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 3d804d6..7747586 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -630,7 +630,7 @@ static struct atm_dev lecatm_dev = {
.ops = _ops,
.type = "lec",
.number = 999,  /* dummy device number */
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(lecatm_dev.lock)
 };
 
 /*
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index cb3c004..2f0df1f 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -734,7 +734,7 @@ static struct atm_dev mpc_dev = {
.ops= _ops,
.type   = "mpc",
.number = 42,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(mpc_dev.lock)
/* members not explicitly initialised will be 0 */
 };
 
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index 31d98b5..d14baaf 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -256,7 +256,7 @@ static struct atm_dev sigd_dev = {
.ops =  _dev_ops,
.type = "sig",
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(sigd_dev.lock)
 };
 
 
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 6d235b3..e18e249 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -27,7 +27,7 @@
 struct inet_timewait_death_row dccp_death_row = {
.sysctl_max_tw_buckets = NR_FILE * 2,
.period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
-   .death_lock = SPIN_LOCK_UNLOCKED,
+   .death_lock = __SPIN_LOCK_UNLOCKED(dccp_death_row.death_lock),
.hashinfo   = _hashinfo,
.tw_timer   = TIMER_INITIALIZER(inet_twdr_hangman, 0,
(unsigned long)_death_row),
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 0afcabd..7aac558 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -122,7 +122,7 @@ struct mip6_report_rate_limiter {
 };
 
 static struct mip6_report_rate_limiter mip6_report_rl = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(mip6_report_rl.lock)
 };
 
 static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] sound: SPIN_LOCK_UNLOCKED cleanup

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 soc/at91/at91-i2s.c  |6 +++---
 1 file changed, 3  insertions(+), 3 deletions(-)

diff --git a/sound/soc/at91/at91-i2s.c b/sound/soc/at91/at91-i2s.c
index 9fc0c03..d65a47d 100644
--- a/sound/soc/at91/at91-i2s.c
+++ b/sound/soc/at91/at91-i2s.c
@@ -151,20 +151,20 @@ static struct at91_ssc_info {
 } ssc_info[NUM_SSC_DEVICES] = {
{
.name   = "ssc0",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[0].lock),
.dir_mask   = 0,
.initialized= 0,
},
 #if NUM_SSC_DEVICES == 3
{
.name   = "ssc1",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[1].lock),
.dir_mask   = 0,
.initialized= 0,
},
{
.name   = "ssc2",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[2].lock),
.dir_mask   = 0,
.initialized= 0,
},
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/char/keyboard

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 keyboard.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index cb8d691..df9bfc1 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -110,7 +110,7 @@ struct kbd_struct kbd_table[MAX_NR_CONSOLES];
 static struct kbd_struct *kbd = kbd_table;
 
 struct vt_spawn_console vt_spawn_con = {
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(vt_spawn_con.lock),
.pid  = NULL,
.sig  = 0,
 };
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/serial

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---

 cpm_uart/cpm_uart_core.c |   12 ++--
 s3c2410.c|6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index 7a3b97f..f23972b 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -934,7 +934,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SMC1_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC1].port.lock),
},
.flags = FLAG_SMC,
.tx_nrfifos = TX_NUM_FIFO,
@@ -948,7 +948,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SMC2_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC2].port.lock),
},
.flags = FLAG_SMC,
.tx_nrfifos = TX_NUM_FIFO,
@@ -965,7 +965,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC1_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC1].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -979,7 +979,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC2_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC2].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -993,7 +993,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC3_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC3].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -1007,7 +1007,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC4_IRQ,
.ops= _uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC4].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 3ba9208..10bc020 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -957,7 +957,7 @@ static struct uart_driver s3c24xx_uart_drv = {
 static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
[0] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX0,
.uartclk= 0,
@@ -969,7 +969,7 @@ static struct s3c24xx_uart_port 
s3c24xx_serial_ports[NR_PORTS] = {
},
[1] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[1].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX1,
.uartclk= 0,
@@ -983,7 +983,7 @@ static struct s3c24xx_uart_port 
s3c24xx_serial_ports[NR_PORTS] = {
 
[2] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[2].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX2,
.u

[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/mips

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---
 excite_setup.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/basler/excite/excite_setup.c 
b/arch/mips/basler/excite/excite_setup.c
index 42f0eda..2f0e4c0 100644
--- a/arch/mips/basler/excite/excite_setup.c
+++ b/arch/mips/basler/excite/excite_setup.c
@@ -63,7 +63,7 @@ volatile void __iomem * const ocd_base = (void *) 
(EXCITE_ADDR_OCD);
 volatile void __iomem * const titan_base = (void *) (EXCITE_ADDR_TITAN);
 
 /* Protect access to shared GPI registers */
-spinlock_t titan_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(titan_lock);
 int titan_irqflags;
 
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/mips

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---
 excite_setup.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/basler/excite/excite_setup.c 
b/arch/mips/basler/excite/excite_setup.c
index 42f0eda..2f0e4c0 100644
--- a/arch/mips/basler/excite/excite_setup.c
+++ b/arch/mips/basler/excite/excite_setup.c
@@ -63,7 +63,7 @@ volatile void __iomem * const ocd_base = (void *) 
(EXCITE_ADDR_OCD);
 volatile void __iomem * const titan_base = (void *) (EXCITE_ADDR_TITAN);
 
 /* Protect access to shared GPI registers */
-spinlock_t titan_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(titan_lock);
 int titan_irqflags;
 
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/serial

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---

 cpm_uart/cpm_uart_core.c |   12 ++--
 s3c2410.c|6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c 
b/drivers/serial/cpm_uart/cpm_uart_core.c
index 7a3b97f..f23972b 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -934,7 +934,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SMC1_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC1].port.lock),
},
.flags = FLAG_SMC,
.tx_nrfifos = TX_NUM_FIFO,
@@ -948,7 +948,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SMC2_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SMC2].port.lock),
},
.flags = FLAG_SMC,
.tx_nrfifos = TX_NUM_FIFO,
@@ -965,7 +965,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC1_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC1].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -979,7 +979,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC2_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC2].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -993,7 +993,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC3_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC3].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
@@ -1007,7 +1007,7 @@ struct uart_cpm_port cpm_uart_ports[UART_NR] = {
.irq= SCC4_IRQ,
.ops= cpm_uart_pops,
.iotype = UPIO_MEM,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(cpm_uart_ports[UART_SCC4].port.lock),
},
.tx_nrfifos = TX_NUM_FIFO,
.tx_fifosize = TX_BUF_SIZE,
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 3ba9208..10bc020 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -957,7 +957,7 @@ static struct uart_driver s3c24xx_uart_drv = {
 static struct s3c24xx_uart_port s3c24xx_serial_ports[NR_PORTS] = {
[0] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[0].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX0,
.uartclk= 0,
@@ -969,7 +969,7 @@ static struct s3c24xx_uart_port 
s3c24xx_serial_ports[NR_PORTS] = {
},
[1] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[1].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX1,
.uartclk= 0,
@@ -983,7 +983,7 @@ static struct s3c24xx_uart_port 
s3c24xx_serial_ports[NR_PORTS] = {
 
[2] = {
.port = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = 
__SPIN_LOCK_UNLOCKED(s3c24xx_serial_ports[2].port.lock),
.iotype = UPIO_MEM,
.irq= IRQ_S3CUART_RX2

[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/char/keyboard

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 keyboard.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index cb8d691..df9bfc1 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -110,7 +110,7 @@ struct kbd_struct kbd_table[MAX_NR_CONSOLES];
 static struct kbd_struct *kbd = kbd_table;
 
 struct vt_spawn_console vt_spawn_con = {
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(vt_spawn_con.lock),
.pid  = NULL,
.sig  = 0,
 };
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] sound: SPIN_LOCK_UNLOCKED cleanup

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 soc/at91/at91-i2s.c  |6 +++---
 1 file changed, 3  insertions(+), 3 deletions(-)

diff --git a/sound/soc/at91/at91-i2s.c b/sound/soc/at91/at91-i2s.c
index 9fc0c03..d65a47d 100644
--- a/sound/soc/at91/at91-i2s.c
+++ b/sound/soc/at91/at91-i2s.c
@@ -151,20 +151,20 @@ static struct at91_ssc_info {
 } ssc_info[NUM_SSC_DEVICES] = {
{
.name   = ssc0,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[0].lock),
.dir_mask   = 0,
.initialized= 0,
},
 #if NUM_SSC_DEVICES == 3
{
.name   = ssc1,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[1].lock),
.dir_mask   = 0,
.initialized= 0,
},
{
.name   = ssc2,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(ssc_info[2].lock),
.dir_mask   = 0,
.initialized= 0,
},
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/atm, net

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 drivers/atm/atmtcp.c |2 +-
 net/atm/clip.c   |2 +-
 net/atm/lec.c|2 +-
 net/atm/mpc.c|2 +-
 net/atm/signaling.c  |2 +-
 net/dccp/minisocks.c |2 +-
 net/ipv6/mip6.c  |2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)


diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index fc518d8..3fde97b 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -352,7 +352,7 @@ static struct atm_dev atmtcp_control_dev = {
.ops= atmtcp_c_dev_ops,
.type   = atmtcp,
.number = 999,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(atmtcp_control_dev.lock)
 };
 
 
diff --git a/net/atm/clip.c b/net/atm/clip.c
index 8c38258..d41137d 100644
--- a/net/atm/clip.c
+++ b/net/atm/clip.c
@@ -702,7 +702,7 @@ static struct atm_dev atmarpd_dev = {
.ops =  atmarpd_dev_ops,
.type = arpd,
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(atmarpd_dev.lock)
 };
 
 
diff --git a/net/atm/lec.c b/net/atm/lec.c
index 3d804d6..7747586 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -630,7 +630,7 @@ static struct atm_dev lecatm_dev = {
.ops = lecdev_ops,
.type = lec,
.number = 999,  /* dummy device number */
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(lecatm_dev.lock)
 };
 
 /*
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index cb3c004..2f0df1f 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -734,7 +734,7 @@ static struct atm_dev mpc_dev = {
.ops= mpc_ops,
.type   = mpc,
.number = 42,
-   .lock   = SPIN_LOCK_UNLOCKED
+   .lock   = __SPIN_LOCK_UNLOCKED(mpc_dev.lock)
/* members not explicitly initialised will be 0 */
 };
 
diff --git a/net/atm/signaling.c b/net/atm/signaling.c
index 31d98b5..d14baaf 100644
--- a/net/atm/signaling.c
+++ b/net/atm/signaling.c
@@ -256,7 +256,7 @@ static struct atm_dev sigd_dev = {
.ops =  sigd_dev_ops,
.type = sig,
.number =   999,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(sigd_dev.lock)
 };
 
 
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 6d235b3..e18e249 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -27,7 +27,7 @@
 struct inet_timewait_death_row dccp_death_row = {
.sysctl_max_tw_buckets = NR_FILE * 2,
.period = DCCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
-   .death_lock = SPIN_LOCK_UNLOCKED,
+   .death_lock = __SPIN_LOCK_UNLOCKED(dccp_death_row.death_lock),
.hashinfo   = dccp_hashinfo,
.tw_timer   = TIMER_INITIALIZER(inet_twdr_hangman, 0,
(unsigned long)dccp_death_row),
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index 0afcabd..7aac558 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -122,7 +122,7 @@ struct mip6_report_rate_limiter {
 };
 
 static struct mip6_report_rate_limiter mip6_report_rl = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(mip6_report_rl.lock)
 };
 
 static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in init_task.h

2007-04-19 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---
 init_task.h |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index a2d95ff..7951023 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -138,7 +138,7 @@ extern struct group_info init_groups;
.journal_info   = NULL, \
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers),  \
.fs_excl= ATOMIC_INIT(0),   \
-   .pi_lock= SPIN_LOCK_UNLOCKED,   \
+   .pi_lock= __SPIN_LOCK_UNLOCKED(tsk.pi_lock),\
INIT_TRACE_IRQFLAGS \
INIT_LOCKDEP\
 }
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/s390

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead.
 
Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 char/vmlogrdr.c |6 +++---
 cio/cmf.c   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index b87d3b0..75d61a4 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -125,7 +125,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = "EREP",
  .minor_num  = 0,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[0].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
},
@@ -134,7 +134,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = "ACCOUNT",
  .minor_num  = 1,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[1].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
},
@@ -143,7 +143,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = "SYMPTOM",
  .minor_num  = 2,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[2].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
}
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 90b22fa..28abd69 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -476,7 +476,7 @@ struct cmb_area {
 };
 
 static struct cmb_area cmb_area = {
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(cmb_area.lock),
.list = LIST_HEAD_INIT(cmb_area.list),
    .num_channels  = 1024,
 };
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] i2c: SPIN_LOCK_UNLOCKED cleanup

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 i2c-pxa.c |2 +-
 i2c-s3c2410.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 14e83d0..d5d44ed 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -825,7 +825,7 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
 };
 
 static struct pxa_i2c i2c_pxa = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock),
.adap   = {
.owner  = THIS_MODULE,
.algo   = _pxa_algorithm,
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 556f244..3eb5958 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -570,7 +570,7 @@ static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
 };
 
 static struct s3c24xx_i2c s3c24xx_i2c = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(s3c24xx_i2c.lock),
.wait   = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait),
.adap   = {
.name   = "s3c2410-i2c",

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/m68k

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---

 amiga/amiints.c  |2 +-
 amiga/cia.c  |4 ++--
 apollo/dn_ints.c |2 +-
 atari/ataints.c  |2 +-
 kernel/ints.c|4 ++--
 mac/macints.c|2 +-
 q40/q40ints.c|2 +-
 sun3/sun3ints.c  |2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)


diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index 28d95cf..907a553 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -54,7 +54,7 @@ static irqreturn_t ami_int5(int irq, void *dev_id);
 
 static struct irq_controller amiga_irq_controller = {
.name   = "amiga",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(amiga_irq_controller.lock),
.enable = amiga_enable_irq,
.disable= amiga_disable_irq,
 };
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 7a20058..c4a4ffd 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -123,7 +123,7 @@ static void cia_disable_irq(unsigned int irq)
 
 static struct irq_controller cia_irq_controller = {
.name   = "cia",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(cia_irq_controller.lock),
.enable = cia_enable_irq,
.disable= cia_disable_irq,
 };
@@ -160,7 +160,7 @@ static void auto_disable_irq(unsigned int irq)
 
 static struct irq_controller auto_irq_controller = {
.name   = "auto",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(auto_irq_controller.lock),
.enable = auto_enable_irq,
.disable= auto_disable_irq,
 };
diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
index 4274af1..13bd41b 100644
--- a/arch/m68k/apollo/dn_ints.c
+++ b/arch/m68k/apollo/dn_ints.c
@@ -31,7 +31,7 @@ void apollo_irq_shutdown(unsigned int irq)
 
 static struct irq_controller apollo_irq_controller = {
.name   = "apollo",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(apollo_irq_controller.lock),
.startup= apollo_irq_startup,
.shutdown   = apollo_irq_shutdown,
 };
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 7f81264..b85ca22 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -339,7 +339,7 @@ static void atari_shutdown_irq(unsigned int irq)
 
 static struct irq_controller atari_irq_controller = {
.name   = "atari",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(atari_irq_controller.lock),
.startup= atari_startup_irq,
.shutdown   = atari_shutdown_irq,
.enable = atari_enable_irq,
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index b66c97c..60d4d75 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -59,14 +59,14 @@ static int m68k_first_user_vec;
 
 static struct irq_controller auto_irq_controller = {
.name   = "auto",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(auto_irq_controller.lock),
.startup= m68k_irq_startup,
.shutdown   = m68k_irq_shutdown,
 };
 
 static struct irq_controller user_irq_controller = {
.name   = "user",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(user_irq_controller.lock),
.startup= m68k_irq_startup,
.shutdown   = m68k_irq_shutdown,
 };
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index f6fcd75..0fc72d8 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -219,7 +219,7 @@ static void mac_disable_irq(unsigned int irq);
 
 static struct irq_controller mac_irq_controller = {
.name   = "mac",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(mac_irq_controller.lock),
.enable = mac_enable_irq,
.disable= mac_disable_irq,
 };
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index 31cc07d..2fb25ae 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -59,7 +59,7 @@ static void q40_irq_shutdown(unsigned int irq)
 
 static struct irq_controller q40_irq_controller = {
.name   = "q40",
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(q40_irq_controller.lock),
.startup= q40_irq_startup,
.shutdown   = q40_irq_shutdown,
.enable = q40_enable_irq,
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index baf74e

[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/m68k

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---

 amiga/amiints.c  |2 +-
 amiga/cia.c  |4 ++--
 apollo/dn_ints.c |2 +-
 atari/ataints.c  |2 +-
 kernel/ints.c|4 ++--
 mac/macints.c|2 +-
 q40/q40ints.c|2 +-
 sun3/sun3ints.c  |2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)


diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index 28d95cf..907a553 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -54,7 +54,7 @@ static irqreturn_t ami_int5(int irq, void *dev_id);
 
 static struct irq_controller amiga_irq_controller = {
.name   = amiga,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(amiga_irq_controller.lock),
.enable = amiga_enable_irq,
.disable= amiga_disable_irq,
 };
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 7a20058..c4a4ffd 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -123,7 +123,7 @@ static void cia_disable_irq(unsigned int irq)
 
 static struct irq_controller cia_irq_controller = {
.name   = cia,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(cia_irq_controller.lock),
.enable = cia_enable_irq,
.disable= cia_disable_irq,
 };
@@ -160,7 +160,7 @@ static void auto_disable_irq(unsigned int irq)
 
 static struct irq_controller auto_irq_controller = {
.name   = auto,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(auto_irq_controller.lock),
.enable = auto_enable_irq,
.disable= auto_disable_irq,
 };
diff --git a/arch/m68k/apollo/dn_ints.c b/arch/m68k/apollo/dn_ints.c
index 4274af1..13bd41b 100644
--- a/arch/m68k/apollo/dn_ints.c
+++ b/arch/m68k/apollo/dn_ints.c
@@ -31,7 +31,7 @@ void apollo_irq_shutdown(unsigned int irq)
 
 static struct irq_controller apollo_irq_controller = {
.name   = apollo,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(apollo_irq_controller.lock),
.startup= apollo_irq_startup,
.shutdown   = apollo_irq_shutdown,
 };
diff --git a/arch/m68k/atari/ataints.c b/arch/m68k/atari/ataints.c
index 7f81264..b85ca22 100644
--- a/arch/m68k/atari/ataints.c
+++ b/arch/m68k/atari/ataints.c
@@ -339,7 +339,7 @@ static void atari_shutdown_irq(unsigned int irq)
 
 static struct irq_controller atari_irq_controller = {
.name   = atari,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(atari_irq_controller.lock),
.startup= atari_startup_irq,
.shutdown   = atari_shutdown_irq,
.enable = atari_enable_irq,
diff --git a/arch/m68k/kernel/ints.c b/arch/m68k/kernel/ints.c
index b66c97c..60d4d75 100644
--- a/arch/m68k/kernel/ints.c
+++ b/arch/m68k/kernel/ints.c
@@ -59,14 +59,14 @@ static int m68k_first_user_vec;
 
 static struct irq_controller auto_irq_controller = {
.name   = auto,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(auto_irq_controller.lock),
.startup= m68k_irq_startup,
.shutdown   = m68k_irq_shutdown,
 };
 
 static struct irq_controller user_irq_controller = {
.name   = user,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(user_irq_controller.lock),
.startup= m68k_irq_startup,
.shutdown   = m68k_irq_shutdown,
 };
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index f6fcd75..0fc72d8 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -219,7 +219,7 @@ static void mac_disable_irq(unsigned int irq);
 
 static struct irq_controller mac_irq_controller = {
.name   = mac,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(mac_irq_controller.lock),
.enable = mac_enable_irq,
.disable= mac_disable_irq,
 };
diff --git a/arch/m68k/q40/q40ints.c b/arch/m68k/q40/q40ints.c
index 31cc07d..2fb25ae 100644
--- a/arch/m68k/q40/q40ints.c
+++ b/arch/m68k/q40/q40ints.c
@@ -59,7 +59,7 @@ static void q40_irq_shutdown(unsigned int irq)
 
 static struct irq_controller q40_irq_controller = {
.name   = q40,
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(q40_irq_controller.lock),
.startup= q40_irq_startup,
.shutdown   = q40_irq_shutdown,
.enable = q40_enable_irq,
diff --git a/arch/m68k/sun3/sun3ints.c b/arch/m68k/sun3/sun3ints.c
index baf74e8..9a3621d 100644
--- a/arch/m68k/sun3/sun3ints.c
+++ b/arch/m68k/sun3/sun3ints.c
@@ -90,7 +90,7 @@ static void

[KJ][PATCH] i2c: SPIN_LOCK_UNLOCKED cleanup

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 i2c-pxa.c |2 +-
 i2c-s3c2410.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 14e83d0..d5d44ed 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -825,7 +825,7 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
 };
 
 static struct pxa_i2c i2c_pxa = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(i2c_pxa.lock),
.adap   = {
.owner  = THIS_MODULE,
.algo   = i2c_pxa_algorithm,
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 556f244..3eb5958 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -570,7 +570,7 @@ static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
 };
 
 static struct s3c24xx_i2c s3c24xx_i2c = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(s3c24xx_i2c.lock),
.wait   = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait),
.adap   = {
.name   = s3c2410-i2c,

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in drivers/s390

2007-04-18 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use __SPIN_LOCK_UNLOCKED instead.
 
Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 char/vmlogrdr.c |6 +++---
 cio/cmf.c   |2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/drivers/s390/char/vmlogrdr.c b/drivers/s390/char/vmlogrdr.c
index b87d3b0..75d61a4 100644
--- a/drivers/s390/char/vmlogrdr.c
+++ b/drivers/s390/char/vmlogrdr.c
@@ -125,7 +125,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = EREP,
  .minor_num  = 0,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[0].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
},
@@ -134,7 +134,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = ACCOUNT,
  .minor_num  = 1,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[1].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
},
@@ -143,7 +143,7 @@ static struct vmlogrdr_priv_t sys_ser[] = {
  .recording_name = SYMPTOM,
  .minor_num  = 2,
  .buffer_free= 1,
- .priv_lock  = SPIN_LOCK_UNLOCKED,
+ .priv_lock  = __SPIN_LOCK_UNLOCKED(sys_ser[2].priv_lock),
  .autorecording  = 1,
  .autopurge  = 1,
}
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 90b22fa..28abd69 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -476,7 +476,7 @@ struct cmb_area {
 };
 
 static struct cmb_area cmb_area = {
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(cmb_area.lock),
.list = LIST_HEAD_INIT(cmb_area.list),
.num_channels  = 1024,
 };
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH]Rocket port:use mutex instead of binary semaphore

2007-04-16 Thread Milind Arun Choudhary
On 10:46 Mon 16 Apr , Roland Dreier wrote:
>  > -  down_interruptible(>write_sem);
>  > +  if(mutex_lock_interruptible(>write_lock)){
>  > +  return -ERESTARTSYS;
>  > +  }
> 
> 1) This is a semantic change.  Of course using down_interruptible()
> without checking the return value is almost certainly a bug, but have
> you thought about whether returning ERESTARTSYS is correct here?  If
> you have, then please include the reasoning in your patch description.
> (Another possibility would be to just use an uninterruptible mutex_lock())
no,frankly not much..
and something which i didn't understand is
why a down  in one control path & an down_interruptible in other?

but i had in mind,which you rightly pointed out 
handling the return from _interruptible.

i have some bits and pieces of information regarding thie,
searching for more, and correction to my current understanding,
  so that i can make something meaningfull out of it.

earlier kernels used to return in EINTR & it was up to the use space to 
handle the interrupted system call. ..reissue..


then ERESTARTSYS mechanism was added and the kernel could restart the 
syscall on its own

so its up to us whether we want the interruption to be taken care by 
the userspace or kernel.
i.e return EINTR or ERESTARTSYS respectively.
CMIIW.


also i read somewhere that
ERESTARTSYS should never be seen by user space code.  The kernel should
either restart the current syscall or convert the code to EINTR before
returning to user space.  If you are seeing ERESTARTSYS in user space
then it is a kernel bug.


> 2) The coding style for the if statement is not quite right.  The
> correct way is to do
> 
>   if (condition)
>   one_liner;
> 
> (note the space between the 'if' and the '(', and no braces used)
> 
ok.. got it..

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ]use mutex instead of a binary semaphore

2007-04-16 Thread Milind Arun Choudhary

As the new mutex primitive is now in place, I read,it is advised 
not to use binary semaphore for mutual exclusion.

while looking at different place where a binary semaphore is initialized,
I came accross bd_mount_sem.

I read a thread on LKML few months back related to the bd_mount_sem 
and realized that there are cases where a binary semaphore  can not be replaced 
by a mutex.
The reason being mutex has a sense of ownership, i.e. 
a mutex can only be unlocked from the context
 from which it was locked.

e.g bd_mount_sem in the block device structure is 
used to make sure no new mounts happen on bdev
 in between freeze_bdev and thaw_bdev().

so locking is done in freeze_bdev &
 unlocking in thaw_bdev these can be from different context i guess..

is my understandig correct..
CMIIW..
would appreciate some pointers on how to identify such cases.. 


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]Rocket port:use mutex instead of binary semaphore

2007-04-16 Thread Milind Arun Choudhary
Use mutex instead of binary semaphore for mutual exclusion.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 rocket.c |   22 --
 rocket_int.h |2 +-
 2 files changed, 13 insertions(+), 11 deletions(-)


diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 76357c8..07255c3 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -35,7 +35,7 @@
  *is data to be transmitted.  Protected by atomic bit operations.
  * -  rp_num_ports, int indicating number of open ports, protected by atomic 
operations.
  * 
- * rp_write() and rp_write_char() functions use a per port semaphore to 
protect against
+ * rp_write() and rp_write_char() functions use a per port mutex to protect 
against
  * simultaneous access to the same port by more than one process.
  */
 
@@ -67,7 +67,7 @@
 
 #ifdef MODVERSIONS
 #include 
-#endif 
+#endif
 
 #include 
 #include 
@@ -93,7 +93,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 /** RocketPort includes **/
@@ -702,7 +702,7 @@ static void init_r_port(int board, int aiop, int chan, 
struct pci_dev *pci_dev)
}
}
spin_lock_init(>slock);
-   sema_init(>write_sem, 1);
+   mutex_init(>write_lock);
rp_table[line] = info;
if (pci_dev)
tty_register_device(rocket_driver, line, _dev->dev);
@@ -1661,8 +1661,8 @@ static void rp_put_char(struct tty_struct *tty, unsigned 
char ch)
if (rocket_paranoia_check(info, "rp_put_char"))
return;
 
-   /*  Grab the port write semaphore, locking out other processes that try 
to write to this port */
-   down(>write_sem);
+   /*  Grab the port write mutex, locking out other processes that try to 
write to this port */
+   mutex_lock(>write_lock);
 
 #ifdef ROCKET_DEBUG_WRITE
printk(KERN_INFO "rp_put_char %c...", ch);
@@ -1684,12 +1684,12 @@ static void rp_put_char(struct tty_struct *tty, 
unsigned char ch)
info->xmit_fifo_room--;
}
spin_unlock_irqrestore(>slock, flags);
-   up(>write_sem);
+   mutex_unlock(>write_lock);
 }
 
 /*
  *  Exception handler - write routine, called when user app writes to the 
device.
- *  A per port write semaphore is used to protect from another process writing 
to
+ *  A per port write mutex is used to protect from another process writing to
  *  this port at the same time.  This other process could be running on the 
other CPU
  *  or get control of the CPU if the copy_from_user() blocks due to a page 
fault (swapped out). 
  *  Spinlocks protect the info xmit members.
@@ -1706,7 +1706,9 @@ static int rp_write(struct tty_struct *tty,
if (count <= 0 || rocket_paranoia_check(info, "rp_write"))
return 0;
 
-   down_interruptible(>write_sem);
+   if(mutex_lock_interruptible(>write_lock)){
+   return -ERESTARTSYS;
+   }
 
 #ifdef ROCKET_DEBUG_WRITE
printk(KERN_INFO "rp_write %d chars...", count);
@@ -1777,7 +1779,7 @@ end:
wake_up_interruptible(>poll_wait);
 #endif
}
-   up(>write_sem);
+   mutex_unlock(>write_lock);
return retval;
 }
 
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 3a8bcc8..e91a1cb 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1171,7 +1171,7 @@ struct r_port {
struct wait_queue *close_wait;
 #endif
spinlock_t slock;
-   struct semaphore write_sem;
+   struct mutex write_lock;
 };
 
 #define RPORT_MAGIC 0x525001

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]Rocket port:use mutex instead of binary semaphore

2007-04-16 Thread Milind Arun Choudhary
Use mutex instead of binary semaphore for mutual exclusion.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 rocket.c |   22 --
 rocket_int.h |2 +-
 2 files changed, 13 insertions(+), 11 deletions(-)


diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 76357c8..07255c3 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -35,7 +35,7 @@
  *is data to be transmitted.  Protected by atomic bit operations.
  * -  rp_num_ports, int indicating number of open ports, protected by atomic 
operations.
  * 
- * rp_write() and rp_write_char() functions use a per port semaphore to 
protect against
+ * rp_write() and rp_write_char() functions use a per port mutex to protect 
against
  * simultaneous access to the same port by more than one process.
  */
 
@@ -67,7 +67,7 @@
 
 #ifdef MODVERSIONS
 #include config/modversions.h
-#endif 
+#endif
 
 #include linux/module.h
 #include linux/errno.h
@@ -93,7 +93,7 @@
 #include asm/atomic.h
 #include linux/bitops.h
 #include linux/spinlock.h
-#include asm/semaphore.h
+#include linux/mutex.h
 #include linux/init.h
 
 /** RocketPort includes **/
@@ -702,7 +702,7 @@ static void init_r_port(int board, int aiop, int chan, 
struct pci_dev *pci_dev)
}
}
spin_lock_init(info-slock);
-   sema_init(info-write_sem, 1);
+   mutex_init(info-write_lock);
rp_table[line] = info;
if (pci_dev)
tty_register_device(rocket_driver, line, pci_dev-dev);
@@ -1661,8 +1661,8 @@ static void rp_put_char(struct tty_struct *tty, unsigned 
char ch)
if (rocket_paranoia_check(info, rp_put_char))
return;
 
-   /*  Grab the port write semaphore, locking out other processes that try 
to write to this port */
-   down(info-write_sem);
+   /*  Grab the port write mutex, locking out other processes that try to 
write to this port */
+   mutex_lock(info-write_lock);
 
 #ifdef ROCKET_DEBUG_WRITE
printk(KERN_INFO rp_put_char %c..., ch);
@@ -1684,12 +1684,12 @@ static void rp_put_char(struct tty_struct *tty, 
unsigned char ch)
info-xmit_fifo_room--;
}
spin_unlock_irqrestore(info-slock, flags);
-   up(info-write_sem);
+   mutex_unlock(info-write_lock);
 }
 
 /*
  *  Exception handler - write routine, called when user app writes to the 
device.
- *  A per port write semaphore is used to protect from another process writing 
to
+ *  A per port write mutex is used to protect from another process writing to
  *  this port at the same time.  This other process could be running on the 
other CPU
  *  or get control of the CPU if the copy_from_user() blocks due to a page 
fault (swapped out). 
  *  Spinlocks protect the info xmit members.
@@ -1706,7 +1706,9 @@ static int rp_write(struct tty_struct *tty,
if (count = 0 || rocket_paranoia_check(info, rp_write))
return 0;
 
-   down_interruptible(info-write_sem);
+   if(mutex_lock_interruptible(info-write_lock)){
+   return -ERESTARTSYS;
+   }
 
 #ifdef ROCKET_DEBUG_WRITE
printk(KERN_INFO rp_write %d chars..., count);
@@ -1777,7 +1779,7 @@ end:
wake_up_interruptible(tty-poll_wait);
 #endif
}
-   up(info-write_sem);
+   mutex_unlock(info-write_lock);
return retval;
 }
 
diff --git a/drivers/char/rocket_int.h b/drivers/char/rocket_int.h
index 3a8bcc8..e91a1cb 100644
--- a/drivers/char/rocket_int.h
+++ b/drivers/char/rocket_int.h
@@ -1171,7 +1171,7 @@ struct r_port {
struct wait_queue *close_wait;
 #endif
spinlock_t slock;
-   struct semaphore write_sem;
+   struct mutex write_lock;
 };
 
 #define RPORT_MAGIC 0x525001

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ]use mutex instead of a binary semaphore

2007-04-16 Thread Milind Arun Choudhary

As the new mutex primitive is now in place, I read,it is advised 
not to use binary semaphore for mutual exclusion.

while looking at different place where a binary semaphore is initialized,
I came accross bd_mount_sem.

I read a thread on LKML few months back related to the bd_mount_sem 
and realized that there are cases where a binary semaphore  can not be replaced 
by a mutex.
The reason being mutex has a sense of ownership, i.e. 
a mutex can only be unlocked from the context
 from which it was locked.

e.g bd_mount_sem in the block device structure is 
used to make sure no new mounts happen on bdev
 in between freeze_bdev and thaw_bdev().

so locking is done in freeze_bdev 
 unlocking in thaw_bdev these can be from different context i guess..

is my understandig correct..
CMIIW..
would appreciate some pointers on how to identify such cases.. 


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH]Rocket port:use mutex instead of binary semaphore

2007-04-16 Thread Milind Arun Choudhary
On 10:46 Mon 16 Apr , Roland Dreier wrote:
   -  down_interruptible(info-write_sem);
   +  if(mutex_lock_interruptible(info-write_lock)){
   +  return -ERESTARTSYS;
   +  }
 
 1) This is a semantic change.  Of course using down_interruptible()
 without checking the return value is almost certainly a bug, but have
 you thought about whether returning ERESTARTSYS is correct here?  If
 you have, then please include the reasoning in your patch description.
 (Another possibility would be to just use an uninterruptible mutex_lock())
no,frankly not much..
and something which i didn't understand is
why a down  in one control path  an down_interruptible in other?

but i had in mind,which you rightly pointed out 
handling the return from _interruptible.

i have some bits and pieces of information regarding thie,
searching for more, and correction to my current understanding,
  so that i can make something meaningfull out of it.

earlier kernels used to return in EINTR  it was up to the use space to 
handle the interrupted system call. ..reissue..


then ERESTARTSYS mechanism was added and the kernel could restart the 
syscall on its own

so its up to us whether we want the interruption to be taken care by 
the userspace or kernel.
i.e return EINTR or ERESTARTSYS respectively.
CMIIW.


also i read somewhere that
ERESTARTSYS should never be seen by user space code.  The kernel should
either restart the current syscall or convert the code to EINTR before
returning to user space.  If you are seeing ERESTARTSYS in user space
then it is a kernel bug.


 2) The coding style for the if statement is not quite right.  The
 correct way is to do
 
   if (condition)
   one_liner;
 
 (note the space between the 'if' and the '(', and no braces used)
 
ok.. got it..

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED macro cleanup in arch/ia64

2007-04-15 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED macro cleanup, use __SPIN_LOCK_UNLOCKED instead.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 kernel/traps.c  |6 +++---
 kernel/unwind.c |2 +-
 mm/tlb.c|6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 765cbe5..cd5189f 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -59,9 +59,9 @@ die (const char *str, struct pt_regs *regs, long err)
u32 lock_owner;
int lock_owner_depth;
} die = {
-   .lock = SPIN_LOCK_UNLOCKED,
-   .lock_owner =   -1,
-   .lock_owner_depth = 0
+   .lock = __SPIN_LOCK_UNLOCKED(die.lock),
+   .lock_owner = -1,
+   .lock_owner_depth = 0
};
static int die_counter;
int cpu = get_cpu();
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 93d5a3b..e3be21c 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -145,7 +145,7 @@ static struct {
 # endif
 } unw = {
.tables = _table,
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(unw.lock),
.save_order = {
UNW_REG_RP, UNW_REG_PFS, UNW_REG_PSP, UNW_REG_PR,
UNW_REG_UNAT, UNW_REG_LC, UNW_REG_FPSR, UNW_REG_PRI_UNAT_GR
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index ffad762..fa4e6d4 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -32,9 +32,9 @@ static struct {
 } purge;
 
 struct ia64_ctx ia64_ctx = {
-   .lock = SPIN_LOCK_UNLOCKED,
-   .next = 1,
-   .max_ctx =  ~0U
+   .lock = __SPIN_LOCK_UNLOCKED(ia64_ctx.lock),
+   .next = 1,
+   .max_ctx = ~0U
 };
 
 DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED macro cleanup in arch/ia64

2007-04-15 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED macro cleanup, use __SPIN_LOCK_UNLOCKED instead.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 kernel/traps.c  |6 +++---
 kernel/unwind.c |2 +-
 mm/tlb.c|6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index 765cbe5..cd5189f 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -59,9 +59,9 @@ die (const char *str, struct pt_regs *regs, long err)
u32 lock_owner;
int lock_owner_depth;
} die = {
-   .lock = SPIN_LOCK_UNLOCKED,
-   .lock_owner =   -1,
-   .lock_owner_depth = 0
+   .lock = __SPIN_LOCK_UNLOCKED(die.lock),
+   .lock_owner = -1,
+   .lock_owner_depth = 0
};
static int die_counter;
int cpu = get_cpu();
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 93d5a3b..e3be21c 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -145,7 +145,7 @@ static struct {
 # endif
 } unw = {
.tables = unw.kernel_table,
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(unw.lock),
.save_order = {
UNW_REG_RP, UNW_REG_PFS, UNW_REG_PSP, UNW_REG_PR,
UNW_REG_UNAT, UNW_REG_LC, UNW_REG_FPSR, UNW_REG_PRI_UNAT_GR
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index ffad762..fa4e6d4 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -32,9 +32,9 @@ static struct {
 } purge;
 
 struct ia64_ctx ia64_ctx = {
-   .lock = SPIN_LOCK_UNLOCKED,
-   .next = 1,
-   .max_ctx =  ~0U
+   .lock = __SPIN_LOCK_UNLOCKED(ia64_ctx.lock),
+   .next = 1,
+   .max_ctx = ~0U
 };
 
 DEFINE_PER_CPU(u8, ia64_need_tlb_flush);
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH 03/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
On 11:39 Sat 14 Apr , Eric Dumazet wrote:
> Milind Arun Choudhary a écrit :
> >use set_current_state(TASK_*) instead of current->state = TASK_*, in fs/nfs
> Probably a dumb question, so please forgive me.
no.
you have a valid point

My bad :(
I should probably be enjoying my weekend outdoors..
breath some fresh air...
rather than sending such dumb patches..

u
booting into  windows might help :)

> Why are you  forcing a memory barrier here, (and also on your other 
> patches).
> Is'nt a  __set_current_state(TASK_RUNNING); appropriate ?
it is..

would resend later

Njo!!!
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 03/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current->state = TASK_*, in fs/nfs

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>


---
 idmap.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 9d4a6b2..054ca15 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -272,7 +272,7 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h,
set_current_state(TASK_UNINTERRUPTIBLE);
mutex_unlock(>idmap_im_lock);
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>idmap_wq, );
mutex_lock(>idmap_im_lock);
 
@@ -333,7 +333,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
set_current_state(TASK_UNINTERRUPTIBLE);
mutex_unlock(>idmap_im_lock);
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>idmap_wq, );
mutex_lock(>idmap_im_lock);
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 04/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current->state = TASK_*, in fs/reiserfs

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 journal.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 7280a23..864b15a 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2918,7 +2918,7 @@ static void queue_log_writer(struct super_block *s)
set_current_state(TASK_UNINTERRUPTIBLE);
if (test_bit(J_WRITERS_QUEUED, >j_state))
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>j_join_wait, );
 }
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 02/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary

use set_current_state(TASK_*) instead of current->state = TASK_*, in fs/ocfs2

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 dlmthread.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 2b264c6..26f4474 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -76,7 +76,7 @@ repeat:
goto repeat;
}
remove_wait_queue(>wq, );
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
 }
 
 int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 01/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary

use set_current_state(TASK_*) instead of current->state = TASK_*, in fs/jfs

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 jfs_lock.h   |2 +-
 jfs_logmgr.c |4 ++--
 jfs_txnmgr.c |6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/fs/jfs/jfs_lock.h b/fs/jfs/jfs_lock.h
index df48ece..9e504bc 100644
--- a/fs/jfs/jfs_lock.h
+++ b/fs/jfs/jfs_lock.h
@@ -45,7 +45,7 @@ do {  \
io_schedule();  \
lock_cmd;   \
}   \
-   current->state = TASK_RUNNING;  \
+   set_current_state(TASK_RUNNING);\
remove_wait_queue(, &__wait);\
 } while (0)
 
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 5065baa..9e61514 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1590,7 +1590,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
set_current_state(TASK_UNINTERRUPTIBLE);
LOGGC_UNLOCK(log);
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
LOGGC_LOCK(log);
remove_wait_queue(>gcwait, &__wait);
}
@@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg)
} else {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());
 
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 03893ac..8fe4ced 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -136,7 +136,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * 
event)
set_current_state(TASK_UNINTERRUPTIBLE);
TXN_UNLOCK();
io_schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(event, );
 }
 
@@ -2798,7 +2798,7 @@ int jfs_lazycommit(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
LAZY_UNLOCK(flags);
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(_commit_thread_wait, );
}
} while (!kthread_should_stop());
@@ -2990,7 +2990,7 @@ int jfs_sync(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
TXN_UNLOCK();
schedule();
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]use set_current_state in drivers/char

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current->state = TASK_*,

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 amiserial.c |4 ++--
 cyclades.c  |4 ++--
 epca.c  |2 +-
 genrtc.c|2 +-
 mxser.c |2 +-
 mxser_new.c |2 +-
 n_r3964.c   |4 ++--
 riscom8.c   |2 +-
 rocket.c|4 ++--
 rtc.c   |2 +-
 selection.c |2 +-
 serial167.c |2 +-
 vt_ioctl.c  |2 +-
 13 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 0e2b72f..ccd7442 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -1574,7 +1574,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
if (timeout && time_after(jiffies, orig_jiffies + timeout))
break;
}
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
printk("lsr = %d (jiff=%lu)...done\n", lsr, jiffies);
 #endif
@@ -1700,7 +1700,7 @@ static int block_til_ready(struct tty_struct *tty, struct 
file * filp,
 #endif
schedule();
}
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>open_wait, );
if (extra_count)
state->count++;
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 16dc5d1..73ccaa7 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2446,7 +2446,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
base_addr = cinfo->base_addr;
firm_id = base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)) {
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>open_wait, );
return -EINVAL;
}
@@ -2499,7 +2499,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
schedule();
}
}
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>open_wait, );
if (!tty_hung_up_p(filp)) {
info->count++;
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index de5be30..0822167 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -949,7 +949,7 @@ static int block_til_ready(struct tty_struct *tty,
 
} /* End forever while  */
 
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>open_wait, );
if (!tty_hung_up_p(filp))
ch->count++;
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 23b25ad..f2a3890 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -207,7 +207,7 @@ static ssize_t gen_rtc_read(struct file *file, char __user 
*buf,
sizeof(unsigned long);
}
  out:
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(_rtc_wait, );
 
return retval;
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index a61fb6d..5a5df94 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1370,7 +1370,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct 
file *file, unsigned int c
}
cprev = cnow;
}
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>delta_msr_wait, );
break;
}
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 9af07e4..57e413e 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1790,7 +1790,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct 
file *file,
}
cprev = cnow;
}
-   current->state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(>delta_msr_wait, );
break;
}
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 65f2d3a..616c7c0 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -1088,13 +1088,13 @@ static ssize_t r3964_read(struct tty_struct *tty, 
struct file *file,
/* block until there is a message: */
add_wait_queue(>read_wait, );
 repeat:
-   current->state = TASK_INTERRUPTIBLE;
+   set_current_state(TASK_INTERRUPTIBLE);
pMsg = remove_msg(pInfo, pClient);
if (!pMsg && !signal_pending(curr

[KJ][PATCH]use set_current_state in drivers/char

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current-state = TASK_*,

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 amiserial.c |4 ++--
 cyclades.c  |4 ++--
 epca.c  |2 +-
 genrtc.c|2 +-
 mxser.c |2 +-
 mxser_new.c |2 +-
 n_r3964.c   |4 ++--
 riscom8.c   |2 +-
 rocket.c|4 ++--
 rtc.c   |2 +-
 selection.c |2 +-
 serial167.c |2 +-
 vt_ioctl.c  |2 +-
 13 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
index 0e2b72f..ccd7442 100644
--- a/drivers/char/amiserial.c
+++ b/drivers/char/amiserial.c
@@ -1574,7 +1574,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, 
int timeout)
if (timeout  time_after(jiffies, orig_jiffies + timeout))
break;
}
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
 #ifdef SERIAL_DEBUG_RS_WAIT_UNTIL_SENT
printk(lsr = %d (jiff=%lu)...done\n, lsr, jiffies);
 #endif
@@ -1700,7 +1700,7 @@ static int block_til_ready(struct tty_struct *tty, struct 
file * filp,
 #endif
schedule();
}
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(info-open_wait, wait);
if (extra_count)
state-count++;
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index 16dc5d1..73ccaa7 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2446,7 +2446,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
base_addr = cinfo-base_addr;
firm_id = base_addr + ID_ADDRESS;
if (!ISZLOADED(*cinfo)) {
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(info-open_wait, wait);
return -EINVAL;
}
@@ -2499,7 +2499,7 @@ block_til_ready(struct tty_struct *tty, struct file *filp,
schedule();
}
}
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(info-open_wait, wait);
if (!tty_hung_up_p(filp)) {
info-count++;
diff --git a/drivers/char/epca.c b/drivers/char/epca.c
index de5be30..0822167 100644
--- a/drivers/char/epca.c
+++ b/drivers/char/epca.c
@@ -949,7 +949,7 @@ static int block_til_ready(struct tty_struct *tty,
 
} /* End forever while  */
 
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(ch-open_wait, wait);
if (!tty_hung_up_p(filp))
ch-count++;
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
index 23b25ad..f2a3890 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
@@ -207,7 +207,7 @@ static ssize_t gen_rtc_read(struct file *file, char __user 
*buf,
sizeof(unsigned long);
}
  out:
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(gen_rtc_wait, wait);
 
return retval;
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index a61fb6d..5a5df94 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -1370,7 +1370,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct 
file *file, unsigned int c
}
cprev = cnow;
}
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(info-delta_msr_wait, wait);
break;
}
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 9af07e4..57e413e 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1790,7 +1790,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct 
file *file,
}
cprev = cnow;
}
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(info-delta_msr_wait, wait);
break;
}
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
index 65f2d3a..616c7c0 100644
--- a/drivers/char/n_r3964.c
+++ b/drivers/char/n_r3964.c
@@ -1088,13 +1088,13 @@ static ssize_t r3964_read(struct tty_struct *tty, 
struct file *file,
/* block until there is a message: */
add_wait_queue(pInfo-read_wait, wait);
 repeat:
-   current-state = TASK_INTERRUPTIBLE;
+   set_current_state(TASK_INTERRUPTIBLE);
pMsg = remove_msg(pInfo, pClient);
if (!pMsg  !signal_pending(current)) {
schedule();
goto repeat

[KJ][PATCH 01/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary

use set_current_state(TASK_*) instead of current-state = TASK_*, in fs/jfs

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 jfs_lock.h   |2 +-
 jfs_logmgr.c |4 ++--
 jfs_txnmgr.c |6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/fs/jfs/jfs_lock.h b/fs/jfs/jfs_lock.h
index df48ece..9e504bc 100644
--- a/fs/jfs/jfs_lock.h
+++ b/fs/jfs/jfs_lock.h
@@ -45,7 +45,7 @@ do {  \
io_schedule();  \
lock_cmd;   \
}   \
-   current-state = TASK_RUNNING;  \
+   set_current_state(TASK_RUNNING);\
remove_wait_queue(wq, __wait);\
 } while (0)
 
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 5065baa..9e61514 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -1590,7 +1590,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait)
set_current_state(TASK_UNINTERRUPTIBLE);
LOGGC_UNLOCK(log);
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
LOGGC_LOCK(log);
remove_wait_queue(target-gcwait, __wait);
}
@@ -2361,7 +2361,7 @@ int jfsIOWait(void *arg)
} else {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());
 
diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index 03893ac..8fe4ced 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -136,7 +136,7 @@ static inline void TXN_SLEEP_DROP_LOCK(wait_queue_head_t * 
event)
set_current_state(TASK_UNINTERRUPTIBLE);
TXN_UNLOCK();
io_schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(event, wait);
 }
 
@@ -2798,7 +2798,7 @@ int jfs_lazycommit(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
LAZY_UNLOCK(flags);
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(jfs_commit_thread_wait, wq);
}
} while (!kthread_should_stop());
@@ -2990,7 +2990,7 @@ int jfs_sync(void *arg)
set_current_state(TASK_INTERRUPTIBLE);
TXN_UNLOCK();
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
}
} while (!kthread_should_stop());
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 02/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary

use set_current_state(TASK_*) instead of current-state = TASK_*, in fs/ocfs2

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 dlmthread.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 2b264c6..26f4474 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -76,7 +76,7 @@ repeat:
goto repeat;
}
remove_wait_queue(res-wq, wait);
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
 }
 
 int __dlm_lockres_has_locks(struct dlm_lock_resource *res)
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 03/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current-state = TASK_*, in fs/nfs

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]


---
 idmap.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 9d4a6b2..054ca15 100644
--- a/fs/nfs/idmap.c
+++ b/fs/nfs/idmap.c
@@ -272,7 +272,7 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h,
set_current_state(TASK_UNINTERRUPTIBLE);
mutex_unlock(idmap-idmap_im_lock);
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(idmap-idmap_wq, wq);
mutex_lock(idmap-idmap_im_lock);
 
@@ -333,7 +333,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable 
*h,
set_current_state(TASK_UNINTERRUPTIBLE);
mutex_unlock(idmap-idmap_im_lock);
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(idmap-idmap_wq, wq);
mutex_lock(idmap-idmap_im_lock);
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 04/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
use set_current_state(TASK_*) instead of current-state = TASK_*, in fs/reiserfs

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 journal.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 7280a23..864b15a 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2918,7 +2918,7 @@ static void queue_log_writer(struct super_block *s)
set_current_state(TASK_UNINTERRUPTIBLE);
if (test_bit(J_WRITERS_QUEUED, journal-j_state))
schedule();
-   current-state = TASK_RUNNING;
+   set_current_state(TASK_RUNNING);
remove_wait_queue(journal-j_join_wait, wait);
 }
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH 03/04]use set_current_state in fs

2007-04-14 Thread Milind Arun Choudhary
On 11:39 Sat 14 Apr , Eric Dumazet wrote:
 Milind Arun Choudhary a écrit :
 use set_current_state(TASK_*) instead of current-state = TASK_*, in fs/nfs
 Probably a dumb question, so please forgive me.
no.
you have a valid point

My bad :(
I should probably be enjoying my weekend outdoors..
breath some fresh air...
rather than sending such dumb patches..

u
booting into  windows might help :)

 Why are you  forcing a memory barrier here, (and also on your other 
 patches).
 Is'nt a  __set_current_state(TASK_RUNNING); appropriate ?
it is..

would resend later

Njo!!!
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH 02/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
On 14:13 Thu 12 Apr , Luck, Tony wrote:
> On Fri, Apr 13, 2007 at 02:01:40AM +0530, Milind Arun Choudhary wrote:
> > -   size = ROUNDUP(size, iovp_size);
> > +   size = ALIGN(size, iovp_size);
> 
> Why is "ALIGN" better than "ROUNDUP"?  I can't see any point
> to this change.
Its a janitorial work. I'm trying to celanup 
all the corners where ROUNDUP/DOWN & likes are defined.
Kernel.h currently has macros like ALIGN roundup DIV_ROUND_UP.
in this patch series I've added ALIGN_DOWN & round_down
[waiting for comments on the same.]

So as ALIGN macro does the same work as ROUNDUP,
  is at a common place
  & is accessible to everyone
it should be used instead...i think

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 03/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP macro cleanup in arch/x86_64
ALIGN, ALIGN_DOWN  where ever appropriate.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 arch/x86_64/kernel/e820.c   |   16 
 arch/x86_64/kernel/signal.c |4 ++--
 arch/x86_64/mm/init.c   |8 
 arch/x86_64/mm/numa.c   |8 
 include/asm-x86_64/proto.h  |3 ---
 5 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index a490fab..d556177 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -207,11 +207,11 @@ unsigned long __init e820_hole_size(unsigned long start, 
unsigned long end)
ei->addr >= end)
continue;
 
-   addr = round_up(ei->addr, PAGE_SIZE);
+   addr = ALIGN(ei->addr, PAGE_SIZE);
if (addr < start)
addr = start;
 
-   last = round_down(ei->addr + ei->size, PAGE_SIZE);
+   last = ALIGN_DOWN(ei->addr + ei->size, PAGE_SIZE);
if (last >= end)
last = end;
 
@@ -284,17 +284,17 @@ void __init e820_mark_nosave_regions(void)
int i;
unsigned long paddr;
 
-   paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
+   paddr = ALIGN_DOWN(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
for (i = 1; i < e820.nr_map; i++) {
struct e820entry *ei = [i];
 
if (paddr < ei->addr)
e820_mark_nosave_range(paddr,
-   round_up(ei->addr, PAGE_SIZE));
+   ALIGN(ei->addr, PAGE_SIZE));
 
-   paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
+   paddr = ALIGN_DOWN(ei->addr + ei->size, PAGE_SIZE);
if (ei->type != E820_RAM)
-   e820_mark_nosave_range(round_up(ei->addr, PAGE_SIZE),
+   e820_mark_nosave_range(ALIGN(ei->addr, PAGE_SIZE),
paddr);
 
if (paddr >= (end_pfn << PAGE_SHIFT))
@@ -311,8 +311,8 @@ e820_register_active_regions(int nid, unsigned long 
start_pfn,
unsigned long ei_startpfn, ei_endpfn;
for (i = 0; i < e820.nr_map; i++) {
struct e820entry *ei = [i];
-   ei_startpfn = round_up(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
-   ei_endpfn = round_down(ei->addr + ei->size, PAGE_SIZE)
+   ei_startpfn = ALIGN(ei->addr, PAGE_SIZE) >> PAGE_SHIFT;
+   ei_endpfn = ALIGN_DOWN(ei->addr + ei->size, PAGE_SIZE)
>> PAGE_SHIFT;
 
/* Skip map entries smaller than a page */
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
index 49ec324..b89de2b 100644
--- a/arch/x86_64/kernel/signal.c
+++ b/arch/x86_64/kernel/signal.c
@@ -211,7 +211,7 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, 
unsigned long size)
rsp = current->sas_ss_sp + current->sas_ss_size;
}
 
-   return (void __user *)round_down(rsp - size, 16); 
+   return (void __user *)ALIGN_DOWN(rsp - size, 16); 
 }
 
 static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
@@ -224,7 +224,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
 
if (used_math()) {
fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
-   frame = (void __user *)round_down(
+   frame = (void __user *)ALIGN_DOWN(
(unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
 
if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index ec31534..d573f63 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -225,7 +225,7 @@ static __meminit void unmap_low_page(int i)
 /* Must run before zap_low_mappings */
 __init void *early_ioremap(unsigned long addr, unsigned long size)
 {
-   unsigned long map = round_down(addr, LARGE_PAGE_SIZE); 
+   unsigned long map = ALIGN_DOWN(addr, LARGE_PAGE_SIZE); 
 
/* actually usually some more */
if (size >= LARGE_PAGE_SIZE) { 
@@ -241,7 +241,7 @@ __init void *early_ioremap(unsigned long addr, unsigned 
long size)
 /* To avoid virtual aliases later */
 __init void early_iounmap(void *addr, unsigned long size)
 {
-   if ((void *)round_down((unsigned long)addr, LARGE_PAGE_SIZE) != 
temp_mappings[0].address)
+   if ((void *)ALIGN_DOWN((unsigned long)addr, LARGE_PAGE_SIZE) != 
temp_mappings[0].address)
printk("early_iounmap: bad address %p\n", addr);
set_pmd(temp_mappings[0].pmd, __pmd(0));
set_

[KJ][PATCH 01/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
Add ALIGN_DOWN and round_down macros to kernel.h

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 kernel.h |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9ddf25c..f8648b2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -34,11 +34,13 @@ extern const char linux_proc_banner[];
 
 #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)   (((x)+(mask))&~(mask))
+#define ALIGN_DOWN(x,a) ((x)&~((typeof(x))(a)-1))
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define roundup(x, y) x) + ((y) - 1)) / (y)) * (y))
+#define round_down(x, y) (((x) / (y)) * (y))
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define roundup(x, y) x) + ((y) - 1)) / (y)) * (y))
 
 #defineKERN_EMERG  "<0>"   /* system is unusable   
*/
 #defineKERN_ALERT  "<1>"   /* action must be taken immediately 
*/

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 02/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP|DOWN macro cleanup in arch/ia64,
 use ALIGN ALIGN_DOWN and round_down where ever appropriate.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 arch/ia64/hp/common/sba_iommu.c  |8 +++-
 arch/ia64/ia32/sys_ia32.c|4 +---
 arch/ia64/kernel/efi.c   |   14 +++---
 arch/ia64/kernel/machine_kexec.c |3 ++-
 arch/ia64/kernel/mca.c   |3 ++-
 arch/ia64/mm/discontig.c |   10 +-
 arch/ia64/mm/init.c  |4 ++--
 arch/ia64/mm/ioremap.c   |6 --
 include/asm-ia64/meminit.h   |7 ---
 9 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index c1dca22..2c49322 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -265,8 +265,6 @@ static u64 prefetch_spill_page;
 */
 #define DMA_CHUNK_SIZE  (BITS_PER_LONG*iovp_size)
 
-#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
-
 /
 ** SBA register read and write support
 **
@@ -520,7 +518,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long 
bits_wanted, int use_hint)
** SBA HW features in the unmap path.
*/
unsigned long o = 1 << get_iovp_order(bits_wanted << 
iovp_shift);
-   uint bitshiftcnt = ROUNDUP(ioc->res_bitshift, o);
+   uint bitshiftcnt = ALIGN(ioc->res_bitshift, o);
unsigned long mask, base_mask;
 
base_mask = RESMAP_MASK(bits_wanted);
@@ -1031,7 +1029,7 @@ void sba_unmap_single(struct device *dev, dma_addr_t 
iova, size_t size, int dir)
 
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, iovp_size);
+   size = ALIGN(size, iovp_size);
 
 #ifdef ENABLE_MARK_CLEAN
if (dir == DMA_FROM_DEVICE)
@@ -1217,7 +1215,7 @@ sba_fill_pdir(
dma_sg->dma_length += cnt;
cnt += dma_offset;
dma_offset=0;   /* only want offset on first chunk */
-   cnt = ROUNDUP(cnt, iovp_size);
+   cnt = ALIGN(cnt, iovp_size);
do {
sba_io_pdir_entry(pdirp, vaddr);
vaddr += iovp_size;
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 0afb4fe..842b329 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -70,8 +70,6 @@
 # define DBG(fmt...)
 #endif
 
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & 
~((a) - 1)))
-
 #define OFFSET4K(a)((a) & 0xfff)
 #define PAGE_START(addr)   ((addr) & PAGE_MASK)
 #define MINSIGSTKSZ_IA32   2048
@@ -1232,7 +1230,7 @@ filldir32 (void *__buf, const char *name, int namlen, 
loff_t offset, u64 ino,
 {
struct compat_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-   int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 
1, 4);
+   int reclen = ALIGN(offsetof(struct compat_dirent, d_name) + namlen + 1, 
4);
u32 d_ino;
 
buf->error = -EINVAL;   /* only used if we fail.. */
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f45f91d..65ae5bb 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -399,7 +399,7 @@ efi_map_pal_code (void)
 * Cannot write to CRx with PSR.ic=1
 */
psr = ia64_clear_ic();
-   ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) 
pal_vaddr),
+   ia64_itr(0x1, IA64_TR_PALCODE, ALIGN_DOWN((unsigned long) pal_vaddr, 
IA64_GRANULE_SIZE),
 pte_val(pfn_pte(__pa(pal_vaddr) >> PAGE_SHIFT, PAGE_KERNEL)),
 IA64_GRANULE_SHIFT);
ia64_set_psr(psr);  /* restore psr */
@@ -421,9 +421,9 @@ efi_init (void)
if (memcmp(cp, "mem=", 4) == 0) {
mem_limit = memparse(cp + 4, );
} else if (memcmp(cp, "max_addr=", 9) == 0) {
-   max_addr = GRANULEROUNDDOWN(memparse(cp + 9, ));
+   max_addr = ALIGN_DOWN(memparse(cp + 9, ), 
IA64_GRANULE_SIZE);
} else if (memcmp(cp, "min_addr=", 9) == 0) {
-   min_addr = GRANULEROUNDDOWN(memparse(cp + 9, ));
+   min_addr = ALIGN_DOWN(memparse(cp + 9, ), 
IA64_GRANULE_SIZE);
} else {
while (*cp != ' ' && *cp)
++cp;
@@ -880,7 +880,7 @@ find_memmap_space (void)
continue;
}
if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != 
md->phys_addr) {
-   contig_low = GRANULEROUNDUP(md->phys_addr);
+

[KJ][PATCH]ROUND_UP macro cleanup in arch/sparc,sparc64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---
 sparc/kernel/sys_sunos.c |5 ++---
 sparc64/kernel/sys_sunos32.c |5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index da6606f..23f4efe 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -322,7 +322,6 @@ struct sunos_dirent_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 loff_t offset, u64 ino, unsigned int d_type)
@@ -330,7 +329,7 @@ static int sunos_filldir(void * __buf, const char * name, 
int namlen,
struct sunos_dirent __user *dirent;
struct sunos_dirent_callback * buf = __buf;
unsigned long d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
 
buf->error = -EINVAL;   /* only used if we fail.. */
if (reclen > buf->count)
@@ -415,7 +414,7 @@ static int sunos_filldirentry(void * __buf, const char * 
name, int namlen,
struct sunos_direntry __user *dirent;
struct sunos_direntry_callback *buf = __buf;
unsigned long d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
 
buf->error = -EINVAL;   /* only used if we fail.. */
if (reclen > buf->count)
diff --git a/arch/sparc64/kernel/sys_sunos32.c 
b/arch/sparc64/kernel/sys_sunos32.c
index 4cff95b..937f19b 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -273,14 +273,13 @@ struct sunos_dirent_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(s32)-1) & ~(sizeof(s32)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 loff_t offset, ino_t ino, unsigned int d_type)
 {
struct sunos_dirent __user *dirent;
struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) 
__buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(s32));
u32 d_ino;
 
buf->error = -EINVAL;   /* only used if we fail.. */
@@ -367,7 +366,7 @@ static int sunos_filldirentry(void * __buf, const char * 
name, int namlen,
struct sunos_direntry __user *dirent;
struct sunos_direntry_callback * buf =
(struct sunos_direntry_callback *) __buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(s32));
u32 d_ino;
 
buf->error = -EINVAL;   /* only used if we fail.. */

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in arch/sparc,sparc64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---
 sparc/kernel/sys_sunos.c |5 ++---
 sparc64/kernel/sys_sunos32.c |5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index da6606f..23f4efe 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -322,7 +322,6 @@ struct sunos_dirent_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1)  ~(sizeof(long)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 loff_t offset, u64 ino, unsigned int d_type)
@@ -330,7 +329,7 @@ static int sunos_filldir(void * __buf, const char * name, 
int namlen,
struct sunos_dirent __user *dirent;
struct sunos_dirent_callback * buf = __buf;
unsigned long d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
 
buf-error = -EINVAL;   /* only used if we fail.. */
if (reclen  buf-count)
@@ -415,7 +414,7 @@ static int sunos_filldirentry(void * __buf, const char * 
name, int namlen,
struct sunos_direntry __user *dirent;
struct sunos_direntry_callback *buf = __buf;
unsigned long d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(long));
 
buf-error = -EINVAL;   /* only used if we fail.. */
if (reclen  buf-count)
diff --git a/arch/sparc64/kernel/sys_sunos32.c 
b/arch/sparc64/kernel/sys_sunos32.c
index 4cff95b..937f19b 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -273,14 +273,13 @@ struct sunos_dirent_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(s32)-1)  ~(sizeof(s32)-1))
 
 static int sunos_filldir(void * __buf, const char * name, int namlen,
 loff_t offset, ino_t ino, unsigned int d_type)
 {
struct sunos_dirent __user *dirent;
struct sunos_dirent_callback * buf = (struct sunos_dirent_callback *) 
__buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(s32));
u32 d_ino;
 
buf-error = -EINVAL;   /* only used if we fail.. */
@@ -367,7 +366,7 @@ static int sunos_filldirentry(void * __buf, const char * 
name, int namlen,
struct sunos_direntry __user *dirent;
struct sunos_direntry_callback * buf =
(struct sunos_direntry_callback *) __buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, sizeof(s32));
u32 d_ino;
 
buf-error = -EINVAL;   /* only used if we fail.. */

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 01/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
Add ALIGN_DOWN and round_down macros to kernel.h

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 kernel.h |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 9ddf25c..f8648b2 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -34,11 +34,13 @@ extern const char linux_proc_banner[];
 
 #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)   (((x)+(mask))~(mask))
+#define ALIGN_DOWN(x,a) ((x)~((typeof(x))(a)-1))
+#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#define roundup(x, y) x) + ((y) - 1)) / (y)) * (y))
+#define round_down(x, y) (((x) / (y)) * (y))
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)-f))
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define roundup(x, y) x) + ((y) - 1)) / (y)) * (y))
 
 #defineKERN_EMERG  0   /* system is unusable   
*/
 #defineKERN_ALERT  1   /* action must be taken immediately 
*/

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH 02/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP|DOWN macro cleanup in arch/ia64,
 use ALIGN ALIGN_DOWN and round_down where ever appropriate.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 arch/ia64/hp/common/sba_iommu.c  |8 +++-
 arch/ia64/ia32/sys_ia32.c|4 +---
 arch/ia64/kernel/efi.c   |   14 +++---
 arch/ia64/kernel/machine_kexec.c |3 ++-
 arch/ia64/kernel/mca.c   |3 ++-
 arch/ia64/mm/discontig.c |   10 +-
 arch/ia64/mm/init.c  |4 ++--
 arch/ia64/mm/ioremap.c   |6 --
 include/asm-ia64/meminit.h   |7 ---
 9 files changed, 26 insertions(+), 33 deletions(-)

diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index c1dca22..2c49322 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -265,8 +265,6 @@ static u64 prefetch_spill_page;
 */
 #define DMA_CHUNK_SIZE  (BITS_PER_LONG*iovp_size)
 
-#define ROUNDUP(x,y) ((x + ((y)-1))  ~((y)-1))
-
 /
 ** SBA register read and write support
 **
@@ -520,7 +518,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long 
bits_wanted, int use_hint)
** SBA HW features in the unmap path.
*/
unsigned long o = 1  get_iovp_order(bits_wanted  
iovp_shift);
-   uint bitshiftcnt = ROUNDUP(ioc-res_bitshift, o);
+   uint bitshiftcnt = ALIGN(ioc-res_bitshift, o);
unsigned long mask, base_mask;
 
base_mask = RESMAP_MASK(bits_wanted);
@@ -1031,7 +1029,7 @@ void sba_unmap_single(struct device *dev, dma_addr_t 
iova, size_t size, int dir)
 
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, iovp_size);
+   size = ALIGN(size, iovp_size);
 
 #ifdef ENABLE_MARK_CLEAN
if (dir == DMA_FROM_DEVICE)
@@ -1217,7 +1215,7 @@ sba_fill_pdir(
dma_sg-dma_length += cnt;
cnt += dma_offset;
dma_offset=0;   /* only want offset on first chunk */
-   cnt = ROUNDUP(cnt, iovp_size);
+   cnt = ALIGN(cnt, iovp_size);
do {
sba_io_pdir_entry(pdirp, vaddr);
vaddr += iovp_size;
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 0afb4fe..842b329 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -70,8 +70,6 @@
 # define DBG(fmt...)
 #endif
 
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1))  
~((a) - 1)))
-
 #define OFFSET4K(a)((a)  0xfff)
 #define PAGE_START(addr)   ((addr)  PAGE_MASK)
 #define MINSIGSTKSZ_IA32   2048
@@ -1232,7 +1230,7 @@ filldir32 (void *__buf, const char *name, int namlen, 
loff_t offset, u64 ino,
 {
struct compat_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-   int reclen = ROUND_UP(offsetof(struct compat_dirent, d_name) + namlen + 
1, 4);
+   int reclen = ALIGN(offsetof(struct compat_dirent, d_name) + namlen + 1, 
4);
u32 d_ino;
 
buf-error = -EINVAL;   /* only used if we fail.. */
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f45f91d..65ae5bb 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -399,7 +399,7 @@ efi_map_pal_code (void)
 * Cannot write to CRx with PSR.ic=1
 */
psr = ia64_clear_ic();
-   ia64_itr(0x1, IA64_TR_PALCODE, GRANULEROUNDDOWN((unsigned long) 
pal_vaddr),
+   ia64_itr(0x1, IA64_TR_PALCODE, ALIGN_DOWN((unsigned long) pal_vaddr, 
IA64_GRANULE_SIZE),
 pte_val(pfn_pte(__pa(pal_vaddr)  PAGE_SHIFT, PAGE_KERNEL)),
 IA64_GRANULE_SHIFT);
ia64_set_psr(psr);  /* restore psr */
@@ -421,9 +421,9 @@ efi_init (void)
if (memcmp(cp, mem=, 4) == 0) {
mem_limit = memparse(cp + 4, cp);
} else if (memcmp(cp, max_addr=, 9) == 0) {
-   max_addr = GRANULEROUNDDOWN(memparse(cp + 9, cp));
+   max_addr = ALIGN_DOWN(memparse(cp + 9, cp), 
IA64_GRANULE_SIZE);
} else if (memcmp(cp, min_addr=, 9) == 0) {
-   min_addr = GRANULEROUNDDOWN(memparse(cp + 9, cp));
+   min_addr = ALIGN_DOWN(memparse(cp + 9, cp), 
IA64_GRANULE_SIZE);
} else {
while (*cp != ' '  *cp)
++cp;
@@ -880,7 +880,7 @@ find_memmap_space (void)
continue;
}
if (pmd == NULL || !efi_wb(pmd) || efi_md_end(pmd) != 
md-phys_addr) {
-   contig_low = GRANULEROUNDUP(md-phys_addr);
+   contig_low = ALIGN(md-phys_addr, IA64_GRANULE_SIZE);
contig_high = efi_md_end(md

[KJ][PATCH 03/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
ROUND_UP macro cleanup in arch/x86_64
ALIGN, ALIGN_DOWN  where ever appropriate.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 arch/x86_64/kernel/e820.c   |   16 
 arch/x86_64/kernel/signal.c |4 ++--
 arch/x86_64/mm/init.c   |8 
 arch/x86_64/mm/numa.c   |8 
 include/asm-x86_64/proto.h  |3 ---
 5 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index a490fab..d556177 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -207,11 +207,11 @@ unsigned long __init e820_hole_size(unsigned long start, 
unsigned long end)
ei-addr = end)
continue;
 
-   addr = round_up(ei-addr, PAGE_SIZE);
+   addr = ALIGN(ei-addr, PAGE_SIZE);
if (addr  start)
addr = start;
 
-   last = round_down(ei-addr + ei-size, PAGE_SIZE);
+   last = ALIGN_DOWN(ei-addr + ei-size, PAGE_SIZE);
if (last = end)
last = end;
 
@@ -284,17 +284,17 @@ void __init e820_mark_nosave_regions(void)
int i;
unsigned long paddr;
 
-   paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
+   paddr = ALIGN_DOWN(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
for (i = 1; i  e820.nr_map; i++) {
struct e820entry *ei = e820.map[i];
 
if (paddr  ei-addr)
e820_mark_nosave_range(paddr,
-   round_up(ei-addr, PAGE_SIZE));
+   ALIGN(ei-addr, PAGE_SIZE));
 
-   paddr = round_down(ei-addr + ei-size, PAGE_SIZE);
+   paddr = ALIGN_DOWN(ei-addr + ei-size, PAGE_SIZE);
if (ei-type != E820_RAM)
-   e820_mark_nosave_range(round_up(ei-addr, PAGE_SIZE),
+   e820_mark_nosave_range(ALIGN(ei-addr, PAGE_SIZE),
paddr);
 
if (paddr = (end_pfn  PAGE_SHIFT))
@@ -311,8 +311,8 @@ e820_register_active_regions(int nid, unsigned long 
start_pfn,
unsigned long ei_startpfn, ei_endpfn;
for (i = 0; i  e820.nr_map; i++) {
struct e820entry *ei = e820.map[i];
-   ei_startpfn = round_up(ei-addr, PAGE_SIZE)  PAGE_SHIFT;
-   ei_endpfn = round_down(ei-addr + ei-size, PAGE_SIZE)
+   ei_startpfn = ALIGN(ei-addr, PAGE_SIZE)  PAGE_SHIFT;
+   ei_endpfn = ALIGN_DOWN(ei-addr + ei-size, PAGE_SIZE)
 PAGE_SHIFT;
 
/* Skip map entries smaller than a page */
diff --git a/arch/x86_64/kernel/signal.c b/arch/x86_64/kernel/signal.c
index 49ec324..b89de2b 100644
--- a/arch/x86_64/kernel/signal.c
+++ b/arch/x86_64/kernel/signal.c
@@ -211,7 +211,7 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, 
unsigned long size)
rsp = current-sas_ss_sp + current-sas_ss_size;
}
 
-   return (void __user *)round_down(rsp - size, 16); 
+   return (void __user *)ALIGN_DOWN(rsp - size, 16); 
 }
 
 static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
@@ -224,7 +224,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, 
siginfo_t *info,
 
if (used_math()) {
fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
-   frame = (void __user *)round_down(
+   frame = (void __user *)ALIGN_DOWN(
(unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
 
if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index ec31534..d573f63 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -225,7 +225,7 @@ static __meminit void unmap_low_page(int i)
 /* Must run before zap_low_mappings */
 __init void *early_ioremap(unsigned long addr, unsigned long size)
 {
-   unsigned long map = round_down(addr, LARGE_PAGE_SIZE); 
+   unsigned long map = ALIGN_DOWN(addr, LARGE_PAGE_SIZE); 
 
/* actually usually some more */
if (size = LARGE_PAGE_SIZE) { 
@@ -241,7 +241,7 @@ __init void *early_ioremap(unsigned long addr, unsigned 
long size)
 /* To avoid virtual aliases later */
 __init void early_iounmap(void *addr, unsigned long size)
 {
-   if ((void *)round_down((unsigned long)addr, LARGE_PAGE_SIZE) != 
temp_mappings[0].address)
+   if ((void *)ALIGN_DOWN((unsigned long)addr, LARGE_PAGE_SIZE) != 
temp_mappings[0].address)
printk(early_iounmap: bad address %p\n, addr);
set_pmd(temp_mappings[0].pmd, __pmd(0));
set_pmd(temp_mappings[1].pmd, __pmd(0));
@@ -323,8 +323,8 @@ static void __init find_early_table_space(unsigned long end)
 
puds = (end + PUD_SIZE - 1)  PUD_SHIFT

Re: [KJ][PATCH 02/03]ROUND_UP|DOWN macro cleanup in arch/ia64,x86_64

2007-04-12 Thread Milind Arun Choudhary
On 14:13 Thu 12 Apr , Luck, Tony wrote:
 On Fri, Apr 13, 2007 at 02:01:40AM +0530, Milind Arun Choudhary wrote:
  -   size = ROUNDUP(size, iovp_size);
  +   size = ALIGN(size, iovp_size);
 
 Why is ALIGN better than ROUNDUP?  I can't see any point
 to this change.
Its a janitorial work. I'm trying to celanup 
all the corners where ROUNDUP/DOWN  likes are defined.
Kernel.h currently has macros like ALIGN roundup DIV_ROUND_UP.
in this patch series I've added ALIGN_DOWN  round_down
[waiting for comments on the same.]

So as ALIGN macro does the same work as ROUNDUP,
  is at a common place
   is accessible to everyone
it should be used instead...i think

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in arch/sh64/kernel/pci_sh5.c

2007-04-11 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN where ever appropriate.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 pci_sh5.c |   12 
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/sh64/kernel/pci_sh5.c b/arch/sh64/kernel/pci_sh5.c
index 9dae689..11d1fef 100644
--- a/arch/sh64/kernel/pci_sh5.c
+++ b/arch/sh64/kernel/pci_sh5.c
@@ -376,8 +376,6 @@ irqreturn_t pcish5_serr_irq(int irq, void *dev_id, struct 
pt_regs *regs)
return IRQ_NONE;
 }
 
-#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
-
 static void __init
 pcibios_size_bridge(struct pci_bus *bus, struct resource *ior,
struct resource *memr)
@@ -434,8 +432,8 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource 
*ior,
mem_res.end -= mem_res.start;
 
/* Align the sizes up by bridge rules */
-   io_res.end = ROUND_UP(io_res.end, 4*1024) - 1;
-   mem_res.end = ROUND_UP(mem_res.end, 1*1024*1024) - 1;
+   io_res.end = ALIGN(io_res.end, 4*1024) - 1;
+   mem_res.end = ALIGN(mem_res.end, 1*1024*1024) - 1;
 
/* Adjust the bridge's allocation requirements */
bridge->resource[0].end = bridge->resource[0].start + io_res.end;
@@ -448,18 +446,16 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource 
*ior,
 
/* adjust parent's resource requirements */
if (ior) {
-   ior->end = ROUND_UP(ior->end, 4*1024);
+   ior->end = ALIGN(ior->end, 4*1024);
ior->end += io_res.end;
}
 
if (memr) {
-   memr->end = ROUND_UP(memr->end, 1*1024*1024);
+   memr->end = ALIGN(memr->end, 1*1024*1024);
memr->end += mem_res.end;
}
 }
 
-#undef ROUND_UP
-
 static void __init pcibios_size_bridges(void)
 {
    struct resource io_res, mem_res;

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][RFC][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/arm

2007-04-11 Thread Milind Arun Choudhary
for arch/arm/kernel/smp.c

 static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {

will give a struct with name  per_cpu__ipi_data 
 
so I did
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(per_cpu__ipi_data.lock),

but this dosen't seem to be the right thing to do..
the DEFINE_PER_CPU macro internally creates an instance of 
the type passed with name as "per_cpu__##name"

the prefix should not be assumed i think
.if the DEFINE_PER_CPU changes ,this code will break..

how do we go about it?
thoughts!

plz CMIIW
---

 kernel/irq.c   |2 +-
 kernel/smp.c   |2 +-
 kernel/time.c  |2 +-
 mach-omap2/gpmc.c  |2 +-
 mach-pnx4008/dma.c |4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index e101846..0cbd51c 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -101,7 +101,7 @@ unlock:
 /* Handle bad interrupts */
 static struct irq_desc bad_irq_desc = {
.handle_irq = handle_bad_irq,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock)
 };
 
 /*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 070bcb7..cf8341d 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -60,7 +60,7 @@ struct ipi_data {
 };
 
 static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(per_cpu__ipi_data.lock),
 };
 
 enum ipi_msg_type {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index d8f5782..d2b08b4 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -54,7 +54,7 @@
 
 static struct resource gpmc_mem_root;
 static struct resource gpmc_cs_mem[GPMC_CS_NUM];
-static spinlock_t  gpmc_mem_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(gpmc_mem_lock);
 static unsignedgpmc_cs_map;
 
 static void __iomem *gpmc_base =
diff --git a/arch/arm/mach-pnx4008/dma.c b/arch/arm/mach-pnx4008/dma.c
index d6a279e..f7009d8 100644
--- a/arch/arm/mach-pnx4008/dma.c
+++ b/arch/arm/mach-pnx4008/dma.c
@@ -47,7 +47,7 @@ static struct ll_pool {
int count;
 } ll_pool;
 
-static spinlock_t ll_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ll_lock);
 
 struct pnx4008_dma_ll *pnx4008_alloc_ll_entry(dma_addr_t * ll_dma)
 {
@@ -135,7 +135,7 @@ static inline void dma_decrement_usage(void)
}
 }
 
-static spinlock_t dma_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(dma_lock);
 
 static inline void pnx4008_dma_lock(void)
 {
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index f61decb..77e7f20 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -510,7 +510,7 @@ void __init time_init(void)
 
 #ifdef CONFIG_NO_IDLE_HZ
if (system_timer->dyn_tick)
-   system_timer->dyn_tick->lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(_timer->dyn_tick->lock);
 #endif
 }
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/powerpc

2007-04-11 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK or 
__SPIN_LOCK_UNLOCKED where ever appropriate. 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

--

 kernel/irq.c  |2 +-
 kernel/rtas.c |2 +-
 oprofile/op_model_cell.c  |2 +-
 platforms/cell/spu_base.c |2 +-
 platforms/ps3/htab.c  |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1009308..6c83fe2 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -394,7 +394,7 @@ EXPORT_SYMBOL(do_softirq);
 #ifdef CONFIG_PPC_MERGE
 
 static LIST_HEAD(irq_hosts);
-static spinlock_t irq_big_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(irq_big_lock);
 static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
 static unsigned int irq_radix_writer;
 struct irq_map_entry irq_map[NR_IRQS];
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9d0735a..8746cb3 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -36,7 +36,7 @@
 #include 
 
 struct rtas_t rtas = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(rtas.lock)
 };
 EXPORT_SYMBOL(rtas);
 
diff --git a/arch/powerpc/oprofile/op_model_cell.c 
b/arch/powerpc/oprofile/op_model_cell.c
index e08e1d7..c9d734b 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -130,7 +130,7 @@ static int pm_rtas_token;
 static u32 reset_value[NR_PHYS_CTRS];
 static int num_counters;
 static int oprofile_running;
-static spinlock_t virt_cntr_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(virt_cntr_lock);
 
 static u32 ctr_enabled;
 
diff --git a/arch/powerpc/platforms/cell/spu_base.c 
b/arch/powerpc/platforms/cell/spu_base.c
index eba7a26..dc433f0 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -41,7 +41,7 @@ const struct spu_priv1_ops *spu_priv1_ops;
 static struct list_head spu_list[MAX_NUMNODES];
 static LIST_HEAD(spu_full_list);
 static DEFINE_MUTEX(spu_mutex);
-static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(spu_list_lock);
 
 EXPORT_SYMBOL_GPL(spu_priv1_ops);
 
diff --git a/arch/powerpc/platforms/ps3/htab.c 
b/arch/powerpc/platforms/ps3/htab.c
index e12e59f..ea60c45 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -39,7 +39,7 @@ static unsigned long htab_addr;
 static unsigned char *bolttab;
 static unsigned char *inusetab;
 
-static spinlock_t ps3_bolttab_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ps3_bolttab_lock);
 
 #define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \
_debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__)


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in

2007-04-11 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK instead 

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---

 ieee1394_transactions.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ieee1394/ieee1394_transactions.c 
b/drivers/ieee1394/ieee1394_transactions.c
index 0833fc9..8563077 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -32,7 +32,7 @@
 #ifndef HPSB_DEBUG_TLABELS
 static
 #endif
-spinlock_t hpsb_tlabel_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(hpsb_tlabel_lock);
 
 static DECLARE_WAIT_QUEUE_HEAD(tlabel_wq);
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] SPIN_LOCK_UNLOCKED cleanup in drivers/ata/pata_winbond.c

2007-04-11 Thread Milind Arun Choudhary
remove SPIN_LOCK_UNLOCKED, use DEFINE_SPINLOCK instead

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 pata_winbond.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 6c11103..cfcd2a5 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -36,7 +36,7 @@ static int probe_winbond = 1;
 static int probe_winbond;
 #endif
 
-static spinlock_t winbond_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(winbond_lock);
 
 static void winbond_writecfg(unsigned long port, u8 reg, u8 val)
 {

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] SPIN_LOCK_UNLOCKED cleanup in drivers/ata/pata_winbond.c

2007-04-11 Thread Milind Arun Choudhary
remove SPIN_LOCK_UNLOCKED, use DEFINE_SPINLOCK instead

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 pata_winbond.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)


diff --git a/drivers/ata/pata_winbond.c b/drivers/ata/pata_winbond.c
index 6c11103..cfcd2a5 100644
--- a/drivers/ata/pata_winbond.c
+++ b/drivers/ata/pata_winbond.c
@@ -36,7 +36,7 @@ static int probe_winbond = 1;
 static int probe_winbond;
 #endif
 
-static spinlock_t winbond_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(winbond_lock);
 
 static void winbond_writecfg(unsigned long port, u8 reg, u8 val)
 {

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in

2007-04-11 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK instead 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]
---

 ieee1394_transactions.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ieee1394/ieee1394_transactions.c 
b/drivers/ieee1394/ieee1394_transactions.c
index 0833fc9..8563077 100644
--- a/drivers/ieee1394/ieee1394_transactions.c
+++ b/drivers/ieee1394/ieee1394_transactions.c
@@ -32,7 +32,7 @@
 #ifndef HPSB_DEBUG_TLABELS
 static
 #endif
-spinlock_t hpsb_tlabel_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(hpsb_tlabel_lock);
 
 static DECLARE_WAIT_QUEUE_HEAD(tlabel_wq);
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/powerpc

2007-04-11 Thread Milind Arun Choudhary
SPIN_LOCK_UNLOCKED cleanup,use DEFINE_SPINLOCK or 
__SPIN_LOCK_UNLOCKED where ever appropriate. 

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

--

 kernel/irq.c  |2 +-
 kernel/rtas.c |2 +-
 oprofile/op_model_cell.c  |2 +-
 platforms/cell/spu_base.c |2 +-
 platforms/ps3/htab.c  |2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)


diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 1009308..6c83fe2 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -394,7 +394,7 @@ EXPORT_SYMBOL(do_softirq);
 #ifdef CONFIG_PPC_MERGE
 
 static LIST_HEAD(irq_hosts);
-static spinlock_t irq_big_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(irq_big_lock);
 static DEFINE_PER_CPU(unsigned int, irq_radix_reader);
 static unsigned int irq_radix_writer;
 struct irq_map_entry irq_map[NR_IRQS];
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 9d0735a..8746cb3 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -36,7 +36,7 @@
 #include asm/syscalls.h
 
 struct rtas_t rtas = {
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(rtas.lock)
 };
 EXPORT_SYMBOL(rtas);
 
diff --git a/arch/powerpc/oprofile/op_model_cell.c 
b/arch/powerpc/oprofile/op_model_cell.c
index e08e1d7..c9d734b 100644
--- a/arch/powerpc/oprofile/op_model_cell.c
+++ b/arch/powerpc/oprofile/op_model_cell.c
@@ -130,7 +130,7 @@ static int pm_rtas_token;
 static u32 reset_value[NR_PHYS_CTRS];
 static int num_counters;
 static int oprofile_running;
-static spinlock_t virt_cntr_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(virt_cntr_lock);
 
 static u32 ctr_enabled;
 
diff --git a/arch/powerpc/platforms/cell/spu_base.c 
b/arch/powerpc/platforms/cell/spu_base.c
index eba7a26..dc433f0 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -41,7 +41,7 @@ const struct spu_priv1_ops *spu_priv1_ops;
 static struct list_head spu_list[MAX_NUMNODES];
 static LIST_HEAD(spu_full_list);
 static DEFINE_MUTEX(spu_mutex);
-static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(spu_list_lock);
 
 EXPORT_SYMBOL_GPL(spu_priv1_ops);
 
diff --git a/arch/powerpc/platforms/ps3/htab.c 
b/arch/powerpc/platforms/ps3/htab.c
index e12e59f..ea60c45 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -39,7 +39,7 @@ static unsigned long htab_addr;
 static unsigned char *bolttab;
 static unsigned char *inusetab;
 
-static spinlock_t ps3_bolttab_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ps3_bolttab_lock);
 
 #define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \
_debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__)


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][RFC][PATCH]SPIN_LOCK_UNLOCKED cleanup in arch/arm

2007-04-11 Thread Milind Arun Choudhary
for arch/arm/kernel/smp.c

 static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {

will give a struct with name  per_cpu__ipi_data 
 
so I did
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(per_cpu__ipi_data.lock),

but this dosen't seem to be the right thing to do..
the DEFINE_PER_CPU macro internally creates an instance of 
the type passed with name as per_cpu__##name

the prefix should not be assumed i think
.if the DEFINE_PER_CPU changes ,this code will break..

how do we go about it?
thoughts!

plz CMIIW
---

 kernel/irq.c   |2 +-
 kernel/smp.c   |2 +-
 kernel/time.c  |2 +-
 mach-omap2/gpmc.c  |2 +-
 mach-pnx4008/dma.c |4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index e101846..0cbd51c 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -101,7 +101,7 @@ unlock:
 /* Handle bad interrupts */
 static struct irq_desc bad_irq_desc = {
.handle_irq = handle_bad_irq,
-   .lock = SPIN_LOCK_UNLOCKED
+   .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock)
 };
 
 /*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 070bcb7..cf8341d 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -60,7 +60,7 @@ struct ipi_data {
 };
 
 static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
-   .lock   = SPIN_LOCK_UNLOCKED,
+   .lock   = __SPIN_LOCK_UNLOCKED(per_cpu__ipi_data.lock),
 };
 
 enum ipi_msg_type {
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index d8f5782..d2b08b4 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -54,7 +54,7 @@
 
 static struct resource gpmc_mem_root;
 static struct resource gpmc_cs_mem[GPMC_CS_NUM];
-static spinlock_t  gpmc_mem_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(gpmc_mem_lock);
 static unsignedgpmc_cs_map;
 
 static void __iomem *gpmc_base =
diff --git a/arch/arm/mach-pnx4008/dma.c b/arch/arm/mach-pnx4008/dma.c
index d6a279e..f7009d8 100644
--- a/arch/arm/mach-pnx4008/dma.c
+++ b/arch/arm/mach-pnx4008/dma.c
@@ -47,7 +47,7 @@ static struct ll_pool {
int count;
 } ll_pool;
 
-static spinlock_t ll_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(ll_lock);
 
 struct pnx4008_dma_ll *pnx4008_alloc_ll_entry(dma_addr_t * ll_dma)
 {
@@ -135,7 +135,7 @@ static inline void dma_decrement_usage(void)
}
 }
 
-static spinlock_t dma_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(dma_lock);
 
 static inline void pnx4008_dma_lock(void)
 {
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index f61decb..77e7f20 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -510,7 +510,7 @@ void __init time_init(void)
 
 #ifdef CONFIG_NO_IDLE_HZ
if (system_timer-dyn_tick)
-   system_timer-dyn_tick-lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(system_timer-dyn_tick-lock);
 #endif
 }
 
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in arch/sh64/kernel/pci_sh5.c

2007-04-11 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN where ever appropriate.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 pci_sh5.c |   12 
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/sh64/kernel/pci_sh5.c b/arch/sh64/kernel/pci_sh5.c
index 9dae689..11d1fef 100644
--- a/arch/sh64/kernel/pci_sh5.c
+++ b/arch/sh64/kernel/pci_sh5.c
@@ -376,8 +376,6 @@ irqreturn_t pcish5_serr_irq(int irq, void *dev_id, struct 
pt_regs *regs)
return IRQ_NONE;
 }
 
-#define ROUND_UP(x, a) (((x) + (a) - 1)  ~((a) - 1))
-
 static void __init
 pcibios_size_bridge(struct pci_bus *bus, struct resource *ior,
struct resource *memr)
@@ -434,8 +432,8 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource 
*ior,
mem_res.end -= mem_res.start;
 
/* Align the sizes up by bridge rules */
-   io_res.end = ROUND_UP(io_res.end, 4*1024) - 1;
-   mem_res.end = ROUND_UP(mem_res.end, 1*1024*1024) - 1;
+   io_res.end = ALIGN(io_res.end, 4*1024) - 1;
+   mem_res.end = ALIGN(mem_res.end, 1*1024*1024) - 1;
 
/* Adjust the bridge's allocation requirements */
bridge-resource[0].end = bridge-resource[0].start + io_res.end;
@@ -448,18 +446,16 @@ pcibios_size_bridge(struct pci_bus *bus, struct resource 
*ior,
 
/* adjust parent's resource requirements */
if (ior) {
-   ior-end = ROUND_UP(ior-end, 4*1024);
+   ior-end = ALIGN(ior-end, 4*1024);
ior-end += io_res.end;
}
 
if (memr) {
-   memr-end = ROUND_UP(memr-end, 1*1024*1024);
+   memr-end = ALIGN(memr-end, 1*1024*1024);
memr-end += mem_res.end;
}
 }
 
-#undef ROUND_UP
-
 static void __init pcibios_size_bridges(void)
 {
struct resource io_res, mem_res;

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ] remove SPIN_LOCK_UNLOCKED

2007-04-10 Thread Milind Arun Choudhary

On 4/11/07, Matthew Wilcox <[EMAIL PROTECTED]> wrote:

On Tue, Apr 10, 2007 at 05:45:07PM -0400, Robert P. J. Day wrote:
> that works fine if you're defining a single spinlock, but what do you
> do in cases like this:
>
> arch/sparc/lib/atomic32.c:  [0 ... (ATOMIC_HASH_SIZE-1)] = 
SPIN_LOCK_UNLOCKED
>
> that is, when you're assigning an array of them?  you still need some
> kind of generic, unnamed spinlock in those circumstances, no?

That's a special case for architecture-only code.  It's not to be used
by drivers.

as per my understanding, [which i should have keyed in earlier]
different places where SPIN_LOCK_UNLOCKED currently appears are

1. static spinlock_t foobar = SPIN_LOCK_UNLOCKED;
needs to be replaced bye DEFINE_SPINLOCK

e.g  linux-core/drm_memory_debug.h
-static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(drm_mem_lock);

there are very few occurrences left in the tree i see

2. allocating a data structure dynamically
& initializing the spinlock embedded within

use spin_lock_init()
e.g   linux-core/via_dmablit.c

-   blitq->blit_lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(>blit_lock);

3. static initialization of structure members
struct foo bar ={
.
.
.
.lock = SPIN_LOCK_UNLOCKED,
.
}
use
struct foo bar ={
.
.
.
.lock = __SPIN_LOCK_UNLOCKED(bar.lock),
.
}

e.g arch/i386/kernel/traps.c
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(die.lock),

plenty of these are still there
may be some patches queued


4. arrays of spinlocks
e.g arch/cris/arch-v32/kernel/smp.c

-spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
SPIN_LOCK_UNLOCKED};
+raw_spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
__RAW_SPIN_LOCK_UNLOCKED};


my question is still there in the original post
about spin_lock_init()

CMIIW
Refer:
http://lkml.org/lkml/2005/6/20/47
http://lkml.org/lkml/2007/1/16/90
http://lists.openwall.net/linux-kernel/2007/02/01/258
--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ]remove SPIN_LOCK_UNLOCKED

2007-04-10 Thread Milind Arun Choudhary
"use spin_lock_init instead of SPIN_LOCK_UNLOCKED"


i'm a bit confused with SPIN_LOCK_UNLOCKED removal
 I just did the below mentioned change
but then came to know that  spin_lock_init is defined as

# define spin_lock_init(lock)   \
do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)

so what difference does it make..
eventually replacing SPIN_LOCK_UNLOCKED with itself

or is it just that this one [SPIN_LOCK_UNLOCKED] also needs 
to be replaced with __SPIN_LOCK_UNLOCKED?

after thought with CONFIG_DEBUG_SPINLOCK does make a diff


let me know if this is fine ..


 aerdrv.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index db6ad8e..6846fb4 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -157,7 +157,7 @@ static struct aer_rpc* aer_alloc_rpc(struct pcie_device 
*dev)
 * Initialize Root lock access, e_lock, to Root Error Status Reg,
 * Root Error ID Reg, and Root error producer/consumer index.
 */
-   rpc->e_lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(>e_lock);
 
rpc->rpd = dev;
INIT_WORK(>dpc_handler, aer_isr);


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ]remove SPIN_LOCK_UNLOCKED

2007-04-10 Thread Milind Arun Choudhary
use spin_lock_init instead of SPIN_LOCK_UNLOCKED


i'm a bit confused with SPIN_LOCK_UNLOCKED removal
 I just did the below mentioned change
but then came to know that  spin_lock_init is defined as

# define spin_lock_init(lock)   \
do { *(lock) = SPIN_LOCK_UNLOCKED; } while (0)

so what difference does it make..
eventually replacing SPIN_LOCK_UNLOCKED with itself

or is it just that this one [SPIN_LOCK_UNLOCKED] also needs 
to be replaced with __SPIN_LOCK_UNLOCKED?

after thought with CONFIG_DEBUG_SPINLOCK does make a diff


let me know if this is fine ..


 aerdrv.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/aer/aerdrv.c b/drivers/pci/pcie/aer/aerdrv.c
index db6ad8e..6846fb4 100644
--- a/drivers/pci/pcie/aer/aerdrv.c
+++ b/drivers/pci/pcie/aer/aerdrv.c
@@ -157,7 +157,7 @@ static struct aer_rpc* aer_alloc_rpc(struct pcie_device 
*dev)
 * Initialize Root lock access, e_lock, to Root Error Status Reg,
 * Root Error ID Reg, and Root error producer/consumer index.
 */
-   rpc-e_lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(rpc-e_lock);
 
rpc-rpd = dev;
INIT_WORK(rpc-dpc_handler, aer_isr);


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ] remove SPIN_LOCK_UNLOCKED

2007-04-10 Thread Milind Arun Choudhary

On 4/11/07, Matthew Wilcox [EMAIL PROTECTED] wrote:

On Tue, Apr 10, 2007 at 05:45:07PM -0400, Robert P. J. Day wrote:
 that works fine if you're defining a single spinlock, but what do you
 do in cases like this:

 arch/sparc/lib/atomic32.c:  [0 ... (ATOMIC_HASH_SIZE-1)] = 
SPIN_LOCK_UNLOCKED

 that is, when you're assigning an array of them?  you still need some
 kind of generic, unnamed spinlock in those circumstances, no?

That's a special case for architecture-only code.  It's not to be used
by drivers.

as per my understanding, [which i should have keyed in earlier]
different places where SPIN_LOCK_UNLOCKED currently appears are

1. static spinlock_t foobar = SPIN_LOCK_UNLOCKED;
needs to be replaced bye DEFINE_SPINLOCK

e.g  linux-core/drm_memory_debug.h
-static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(drm_mem_lock);

there are very few occurrences left in the tree i see

2. allocating a data structure dynamically
 initializing the spinlock embedded within

use spin_lock_init()
e.g   linux-core/via_dmablit.c

-   blitq-blit_lock = SPIN_LOCK_UNLOCKED;
+   spin_lock_init(blitq-blit_lock);

3. static initialization of structure members
struct foo bar ={
.
.
.
.lock = SPIN_LOCK_UNLOCKED,
.
}
use
struct foo bar ={
.
.
.
.lock = __SPIN_LOCK_UNLOCKED(bar.lock),
.
}

e.g arch/i386/kernel/traps.c
-   .lock = SPIN_LOCK_UNLOCKED,
+   .lock = __SPIN_LOCK_UNLOCKED(die.lock),

plenty of these are still there
may be some patches queued


4. arrays of spinlocks
e.g arch/cris/arch-v32/kernel/smp.c

-spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
SPIN_LOCK_UNLOCKED};
+raw_spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] =
__RAW_SPIN_LOCK_UNLOCKED};


my question is still there in the original post
about spin_lock_init()

CMIIW
Refer:
http://lkml.org/lkml/2005/6/20/47
http://lkml.org/lkml/2007/1/16/90
http://lists.openwall.net/linux-kernel/2007/02/01/258
--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][RFC]NAME_OFFSET macro

2007-04-06 Thread Milind Arun Choudhary

[EMAIL PROTECTED]:~/src/linux> egrep -rin "#define.*NAME_?OFFSET" .
./arch/alpha/kernel/osf_sys.c:95:#define NAME_OFFSEToffsetof (struct 
osf_dirent, d_name)
./arch/mips/kernel/sysirix.c:1738:#define NAME_OFFSET32(de) ((int) 
((de)->d_name - (char *) (de)))
./arch/mips/kernel/sysirix.c:1840:#define NAME_OFFSET64(de) ((int) 
((de)->d_name - (char *) (de)))
./arch/parisc/hpux/fs.c:72:#define NAME_OFFSET(de) ((int) ((de)->d_name - (char 
__user *) (de)))
./arch/parisc/kernel/sys_parisc32.c:315:#define NAME_OFFSET(de) ((int) 
((de)->d_name - (char __user *) (de)))
./arch/powerpc/kernel/sys_ppc32.c:57:#define NAME_OFFSET(de) ((int) 
((de)->d_name - (char __user *) (de)))
./arch/sparc/kernel/sys_sunos.c:324:#define NAME_OFFSET(de) ((int) 
((de)->d_name - (char __user *) (de)))
./arch/sparc64/kernel/sys_sunos32.c:275:#define NAME_OFFSET(de) ((int) 
((de)->d_name - (char __user *) (de)))
./drivers/isdn/hardware/eicon/s_4bri.c:184:#define FPGA_NAME_OFFSET 0x10
./fs/compat.c:903:#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user 
*) (de)))
./fs/readdir.c:54:#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user 
*) (de)))
./include/linux/fuse.h:342:#define FUSE_NAME_OFFSET ((unsigned) ((struct 
fuse_dirent *) 0)->name)


just working out different options before putting it in kernel.h

as all the dirent structures have used the 
same name for the d_name member,so we can use

#define NAME_OFFSET(dirent) ((int) ((dirent)->d_name - (char __user *) 
(dirent)))

but then it becomes binding on the future users
 to maintain the same naming  convention.

#define NAME_OFFSET(dirent,d_name) ((int) ((dirent)->d_name - (char __user *) 
(dirent)))

#define NAME_OFFSET(dirent,d_name) offsetof(struct dirent,d_name)

though ..the first one seem to be just fine

thoughts

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][RFC]NAME_OFFSET macro

2007-04-06 Thread Milind Arun Choudhary

[EMAIL PROTECTED]:~/src/linux egrep -rin #define.*NAME_?OFFSET .
./arch/alpha/kernel/osf_sys.c:95:#define NAME_OFFSEToffsetof (struct 
osf_dirent, d_name)
./arch/mips/kernel/sysirix.c:1738:#define NAME_OFFSET32(de) ((int) 
((de)-d_name - (char *) (de)))
./arch/mips/kernel/sysirix.c:1840:#define NAME_OFFSET64(de) ((int) 
((de)-d_name - (char *) (de)))
./arch/parisc/hpux/fs.c:72:#define NAME_OFFSET(de) ((int) ((de)-d_name - (char 
__user *) (de)))
./arch/parisc/kernel/sys_parisc32.c:315:#define NAME_OFFSET(de) ((int) 
((de)-d_name - (char __user *) (de)))
./arch/powerpc/kernel/sys_ppc32.c:57:#define NAME_OFFSET(de) ((int) 
((de)-d_name - (char __user *) (de)))
./arch/sparc/kernel/sys_sunos.c:324:#define NAME_OFFSET(de) ((int) 
((de)-d_name - (char __user *) (de)))
./arch/sparc64/kernel/sys_sunos32.c:275:#define NAME_OFFSET(de) ((int) 
((de)-d_name - (char __user *) (de)))
./drivers/isdn/hardware/eicon/s_4bri.c:184:#define FPGA_NAME_OFFSET 0x10
./fs/compat.c:903:#define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user 
*) (de)))
./fs/readdir.c:54:#define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user 
*) (de)))
./include/linux/fuse.h:342:#define FUSE_NAME_OFFSET ((unsigned) ((struct 
fuse_dirent *) 0)-name)


just working out different options before putting it in kernel.h

as all the dirent structures have used the 
same name for the d_name member,so we can use

#define NAME_OFFSET(dirent) ((int) ((dirent)-d_name - (char __user *) 
(dirent)))

but then it becomes binding on the future users
 to maintain the same naming  convention.

#define NAME_OFFSET(dirent,d_name) ((int) ((dirent)-d_name - (char __user *) 
(dirent)))

#define NAME_OFFSET(dirent,d_name) offsetof(struct dirent,d_name)

though ..the first one seem to be just fine

thoughts

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in fs/smbfs/request.c

2007-04-05 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use ALIGN

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

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


diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index 723f7c6..c288fbe 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -6,6 +6,7 @@
  *  Please add a note about your changes to smbfs in the ChangeLog file.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -22,8 +23,6 @@
 /* #define SMB_SLAB_DEBUG  (SLAB_RED_ZONE | SLAB_POISON) */
 #define SMB_SLAB_DEBUG 0
 
-#define ROUND_UP(x) (((x)+3) & ~3)
-
 /* cache for request structures */
 static struct kmem_cache *req_cachep;
 
@@ -200,8 +199,8 @@ static int smb_setup_trans2request(struct smb_request *req)
 
const int smb_parameters = 15;
const int header = SMB_HEADER_LEN + 2 * smb_parameters + 2;
-   const int oparam = ROUND_UP(header + 3);
-   const int odata  = ROUND_UP(oparam + req->rq_lparm);
+   const int oparam = ALIGN(header + 3, sizeof(u32));
+   const int odata  = ALIGN(oparam + req->rq_lparm, sizeof(u32));
const int bcc = (req->rq_data ? odata + req->rq_ldata :
oparam + req->rq_lparm) - header;
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in fs/(select|compat|readdir).c

2007-04-05 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use,ALIGN or DIV_ROUND_UP where ever appropriate.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 compat.c  |   20 
 readdir.c |8 +++-
 select.c  |8 
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 040a8be..0e7559a 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -15,6 +15,7 @@
  *  published by the Free Software Foundation.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -901,8 +902,6 @@ asmlinkage long compat_sys_mount(char __user * dev_name, 
char __user * dir_name,
 }
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define COMPAT_ROUND_UP(x) (((x)+sizeof(compat_long_t)-1) & \
-   ~(sizeof(compat_long_t)-1))
 
 struct compat_old_linux_dirent {
compat_ulong_t  d_ino;
@@ -990,7 +989,7 @@ static int compat_filldir(void *__buf, const char *name, 
int namlen,
struct compat_linux_dirent __user * dirent;
struct compat_getdents_callback *buf = __buf;
compat_ulong_t d_ino;
-   int reclen = COMPAT_ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, 
sizeof(compat_long_t));
 
buf->error = -EINVAL;   /* only used if we fail.. */
if (reclen > buf->count)
@@ -1065,7 +1064,6 @@ out:
 }
 
 #ifndef __ARCH_OMIT_COMPAT_SYS_GETDENTS64
-#define COMPAT_ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
 
 struct compat_getdents_callback64 {
struct linux_dirent64 __user *current_dir;
@@ -1080,7 +1078,7 @@ static int compat_filldir64(void * __buf, const char * 
name, int namlen, loff_t
struct linux_dirent64 __user *dirent;
struct compat_getdents_callback64 *buf = __buf;
int jj = NAME_OFFSET(dirent);
-   int reclen = COMPAT_ROUND_UP64(jj + namlen + 1);
+   int reclen = ALIGN(jj + namlen + 1, sizeof(u64));
u64 off;
 
buf->error = -EINVAL;   /* only used if we fail.. */
@@ -1593,8 +1591,6 @@ out_ret:
 
 #define __COMPAT_NFDBITS   (8 * sizeof(compat_ulong_t))
 
-#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
-
 /*
  * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
  * 64-bit unsigned longs.
@@ -1603,7 +1599,7 @@ static
 int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
unsigned long *fdset)
 {
-   nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+   nr = DIV_ROUND_UP(nr, __COMPAT_NFDBITS);
if (ufdset) {
unsigned long odd;
 
@@ -1637,7 +1633,7 @@ int compat_set_fd_set(unsigned long nr, compat_ulong_t 
__user *ufdset,
  unsigned long *fdset)
 {
unsigned long odd;
-   nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+   nr = DIV_ROUND_UP(nr, __COMPAT_NFDBITS);
 
if (!ufdset)
return 0;
@@ -1759,7 +1755,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t 
__user *inp,
if ((u64)tv.tv_sec >= (u64)MAX_INT64_SECONDS)
timeout = -1;   /* infinite */
else {
-   timeout = ROUND_UP(tv.tv_usec, 100/HZ);
+   timeout = DIV_ROUND_UP(tv.tv_usec, 100/HZ);
timeout += tv.tv_sec * HZ;
}
}
@@ -1827,7 +1823,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t 
__user *inp,
do {
if (tsp) {
if ((unsigned long)ts.tv_sec < MAX_SELECT_SECONDS) {
-   timeout = ROUND_UP(ts.tv_nsec, 10/HZ);
+   timeout = DIV_ROUND_UP(ts.tv_nsec, 
10/HZ);
timeout += ts.tv_sec * (unsigned long)HZ;
ts.tv_sec = 0;
ts.tv_nsec = 0;
@@ -1923,7 +1919,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user 
*ufds,
/* We assume that ts.tv_sec is always lower than
   the number of seconds that can be expressed in
   an s64. Otherwise the compiler bitches at us */
-   timeout = ROUND_UP(ts.tv_nsec, 10/HZ);
+   timeout = DIV_ROUND_UP(ts.tv_nsec, 10/HZ);
timeout += ts.tv_sec * HZ;
}
 
diff --git a/fs/readdir.c b/fs/readdir.c
index f39f5b3..9e1cead 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -4,6 +4,7 @@
  *  Copyright (C) 1995  Linus Torvalds
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -52,7 +53,6 @@ EXPORT_SYMBOL(vfs_readdir);
  * case (the low-level handlers don't need to care about this).
  */
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 #ifdef __ARCH_WANT_OLD_READDIR
 
@@ -147,7 +147,7 @@ static int filldir(void * __buf, const char * name, int 
namlen, loff_t offset,
struct li

[KJ][PATCH]ROUND_UP macro cleanup in arch/alpha/kernel/osf_sys.c

2007-04-05 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use ALIGN
 
Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>
---

 osf_sys.c |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)


diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index be133f1..c77d231 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -93,7 +93,6 @@ osf_set_program_attributes(unsigned long text_start, unsigned 
long text_len,
  * offset differences aren't the same as "d_reclen").
  */
 #define NAME_OFFSEToffsetof (struct osf_dirent, d_name)
-#define ROUND_UP(x)(((x)+3) & ~3)
 
 struct osf_dirent {
unsigned int d_ino;
@@ -115,7 +114,7 @@ osf_filldir(void *__buf, const char *name, int namlen, 
loff_t offset,
 {
struct osf_dirent __user *dirent;
struct osf_dirent_callback *buf = (struct osf_dirent_callback *) __buf;
-   unsigned int reclen = ROUND_UP(NAME_OFFSET + namlen + 1);
+   unsigned int reclen = ALIGN(NAME_OFFSET + namlen + 1, sizeof(u32));
unsigned int d_ino;
 
buf->error = -EINVAL;   /* only used if we fail */
@@ -174,7 +173,6 @@ osf_getdirentries(unsigned int fd, struct osf_dirent __user 
*dirent,
return error;
 }
 
-#undef ROUND_UP
 #undef NAME_OFFSET
 
 asmlinkage unsigned long
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in fs/(select|compat|readdir).c

2007-04-05 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use,ALIGN or DIV_ROUND_UP where ever appropriate.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 compat.c  |   20 
 readdir.c |8 +++-
 select.c  |8 
 3 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/fs/compat.c b/fs/compat.c
index 040a8be..0e7559a 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -15,6 +15,7 @@
  *  published by the Free Software Foundation.
  */
 
+#include linux/kernel.h
 #include linux/linkage.h
 #include linux/compat.h
 #include linux/errno.h
@@ -901,8 +902,6 @@ asmlinkage long compat_sys_mount(char __user * dev_name, 
char __user * dir_name,
 }
 
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
-#define COMPAT_ROUND_UP(x) (((x)+sizeof(compat_long_t)-1)  \
-   ~(sizeof(compat_long_t)-1))
 
 struct compat_old_linux_dirent {
compat_ulong_t  d_ino;
@@ -990,7 +989,7 @@ static int compat_filldir(void *__buf, const char *name, 
int namlen,
struct compat_linux_dirent __user * dirent;
struct compat_getdents_callback *buf = __buf;
compat_ulong_t d_ino;
-   int reclen = COMPAT_ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, 
sizeof(compat_long_t));
 
buf-error = -EINVAL;   /* only used if we fail.. */
if (reclen  buf-count)
@@ -1065,7 +1064,6 @@ out:
 }
 
 #ifndef __ARCH_OMIT_COMPAT_SYS_GETDENTS64
-#define COMPAT_ROUND_UP64(x) (((x)+sizeof(u64)-1)  ~(sizeof(u64)-1))
 
 struct compat_getdents_callback64 {
struct linux_dirent64 __user *current_dir;
@@ -1080,7 +1078,7 @@ static int compat_filldir64(void * __buf, const char * 
name, int namlen, loff_t
struct linux_dirent64 __user *dirent;
struct compat_getdents_callback64 *buf = __buf;
int jj = NAME_OFFSET(dirent);
-   int reclen = COMPAT_ROUND_UP64(jj + namlen + 1);
+   int reclen = ALIGN(jj + namlen + 1, sizeof(u64));
u64 off;
 
buf-error = -EINVAL;   /* only used if we fail.. */
@@ -1593,8 +1591,6 @@ out_ret:
 
 #define __COMPAT_NFDBITS   (8 * sizeof(compat_ulong_t))
 
-#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
-
 /*
  * Ooo, nasty.  We need here to frob 32-bit unsigned longs to
  * 64-bit unsigned longs.
@@ -1603,7 +1599,7 @@ static
 int compat_get_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
unsigned long *fdset)
 {
-   nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+   nr = DIV_ROUND_UP(nr, __COMPAT_NFDBITS);
if (ufdset) {
unsigned long odd;
 
@@ -1637,7 +1633,7 @@ int compat_set_fd_set(unsigned long nr, compat_ulong_t 
__user *ufdset,
  unsigned long *fdset)
 {
unsigned long odd;
-   nr = ROUND_UP(nr, __COMPAT_NFDBITS);
+   nr = DIV_ROUND_UP(nr, __COMPAT_NFDBITS);
 
if (!ufdset)
return 0;
@@ -1759,7 +1755,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t 
__user *inp,
if ((u64)tv.tv_sec = (u64)MAX_INT64_SECONDS)
timeout = -1;   /* infinite */
else {
-   timeout = ROUND_UP(tv.tv_usec, 100/HZ);
+   timeout = DIV_ROUND_UP(tv.tv_usec, 100/HZ);
timeout += tv.tv_sec * HZ;
}
}
@@ -1827,7 +1823,7 @@ asmlinkage long compat_sys_pselect7(int n, compat_ulong_t 
__user *inp,
do {
if (tsp) {
if ((unsigned long)ts.tv_sec  MAX_SELECT_SECONDS) {
-   timeout = ROUND_UP(ts.tv_nsec, 10/HZ);
+   timeout = DIV_ROUND_UP(ts.tv_nsec, 
10/HZ);
timeout += ts.tv_sec * (unsigned long)HZ;
ts.tv_sec = 0;
ts.tv_nsec = 0;
@@ -1923,7 +1919,7 @@ asmlinkage long compat_sys_ppoll(struct pollfd __user 
*ufds,
/* We assume that ts.tv_sec is always lower than
   the number of seconds that can be expressed in
   an s64. Otherwise the compiler bitches at us */
-   timeout = ROUND_UP(ts.tv_nsec, 10/HZ);
+   timeout = DIV_ROUND_UP(ts.tv_nsec, 10/HZ);
timeout += ts.tv_sec * HZ;
}
 
diff --git a/fs/readdir.c b/fs/readdir.c
index f39f5b3..9e1cead 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -4,6 +4,7 @@
  *  Copyright (C) 1995  Linus Torvalds
  */
 
+#include linux/kernel.h
 #include linux/module.h
 #include linux/time.h
 #include linux/mm.h
@@ -52,7 +53,6 @@ EXPORT_SYMBOL(vfs_readdir);
  * case (the low-level handlers don't need to care about this).
  */
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1)  ~(sizeof(long)-1))
 
 #ifdef __ARCH_WANT_OLD_READDIR
 
@@ -147,7 +147,7 @@ static int filldir(void * __buf, const char

[KJ][PATCH]ROUND_UP macro cleanup in fs/smbfs/request.c

2007-04-05 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use ALIGN

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

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


diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index 723f7c6..c288fbe 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -6,6 +6,7 @@
  *  Please add a note about your changes to smbfs in the ChangeLog file.
  */
 
+#include linux/kernel.h
 #include linux/types.h
 #include linux/fs.h
 #include linux/slab.h
@@ -22,8 +23,6 @@
 /* #define SMB_SLAB_DEBUG  (SLAB_RED_ZONE | SLAB_POISON) */
 #define SMB_SLAB_DEBUG 0
 
-#define ROUND_UP(x) (((x)+3)  ~3)
-
 /* cache for request structures */
 static struct kmem_cache *req_cachep;
 
@@ -200,8 +199,8 @@ static int smb_setup_trans2request(struct smb_request *req)
 
const int smb_parameters = 15;
const int header = SMB_HEADER_LEN + 2 * smb_parameters + 2;
-   const int oparam = ROUND_UP(header + 3);
-   const int odata  = ROUND_UP(oparam + req-rq_lparm);
+   const int oparam = ALIGN(header + 3, sizeof(u32));
+   const int odata  = ALIGN(oparam + req-rq_lparm, sizeof(u32));
const int bcc = (req-rq_data ? odata + req-rq_ldata :
oparam + req-rq_lparm) - header;
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/net/ppp_generic.c

2007-04-04 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use DIV_ROUND_UP

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 ppp_generic.c |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index ef58e41..4b302f3 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -88,8 +88,6 @@ struct ppp_file {
 #define PF_TO_PPP(pf)  PF_TO_X(pf, struct ppp)
 #define PF_TO_CHANNEL(pf)  PF_TO_X(pf, struct channel)
 
-#define ROUNDUP(n, x)  (((n) + (x) - 1) / (x))
-
 /*
  * Data structure describing one ppp unit.
  * A ppp unit corresponds to a ppp network interface device
@@ -1297,7 +1295,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff 
*skb)
 */
fragsize = len;
if (nfree > 1)
-   fragsize = ROUNDUP(fragsize, nfree);
+   fragsize = DIV_ROUND_UP(fragsize, nfree);
/* nbigger channels get fragsize bytes, the rest get fragsize-1,
   except if nbigger==0, then they all get fragsize. */
nbigger = len % nfree;
---
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/char/lp.c

2007-04-04 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use DIV_ROUND_UP

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 lp.c |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index b51d08b..c086910 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -139,9 +139,6 @@
 /* if you have more than 8 printers, remember to increase LP_NO */
 #define LP_NO 8
 
-/* ROUND_UP macro from fs/select.c */
-#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
-
 static struct lp_struct lp_table[LP_NO];
 
 static unsigned int lp_count = 0;
@@ -652,7 +649,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
(par_timeout.tv_usec < 0)) {
return -EINVAL;
}
-   to_jiffies = ROUND_UP(par_timeout.tv_usec, 100/HZ);
+   to_jiffies = DIV_ROUND_UP(par_timeout.tv_usec, 
100/HZ);
to_jiffies += par_timeout.tv_sec * (long) HZ;
if (to_jiffies <= 0) {
return -EINVAL;

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]Unused ROUND_UP, NAME_OFFSET macro in arch/powerpc

2007-04-04 Thread Milind Arun Choudhary
Unused ROUND_UP, NAME_OFFSET  macro cleanup

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 sys_ppc32.c |4 
 1 files changed, 4 deletions(-)


diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 673e8d9..047246a 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -53,10 +53,6 @@
 #include 
 #include 
 
-/* readdir & getdents */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
-
 struct old_linux_dirent32 {
u32 d_ino;
u32     d_offset;
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]Unused ROUND_UP, NAME_OFFSET macro in arch/powerpc

2007-04-04 Thread Milind Arun Choudhary
Unused ROUND_UP, NAME_OFFSET  macro cleanup

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 sys_ppc32.c |4 
 1 files changed, 4 deletions(-)


diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 673e8d9..047246a 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -53,10 +53,6 @@
 #include asm/ppc-pci.h
 #include asm/syscalls.h
 
-/* readdir  getdents */
-#define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1)  ~(sizeof(u32)-1))
-
 struct old_linux_dirent32 {
u32 d_ino;
u32 d_offset;
-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/char/lp.c

2007-04-04 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use DIV_ROUND_UP

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 lp.c |5 +
 1 files changed, 1 insertion(+), 4 deletions(-)


diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index b51d08b..c086910 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -139,9 +139,6 @@
 /* if you have more than 8 printers, remember to increase LP_NO */
 #define LP_NO 8
 
-/* ROUND_UP macro from fs/select.c */
-#define ROUND_UP(x,y) (((x)+(y)-1)/(y))
-
 static struct lp_struct lp_table[LP_NO];
 
 static unsigned int lp_count = 0;
@@ -652,7 +649,7 @@ static int lp_ioctl(struct inode *inode, struct file *file,
(par_timeout.tv_usec  0)) {
return -EINVAL;
}
-   to_jiffies = ROUND_UP(par_timeout.tv_usec, 100/HZ);
+   to_jiffies = DIV_ROUND_UP(par_timeout.tv_usec, 
100/HZ);
to_jiffies += par_timeout.tv_sec * (long) HZ;
if (to_jiffies = 0) {
return -EINVAL;

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/net/ppp_generic.c

2007-04-04 Thread Milind Arun Choudhary
ROUND_UP macro cleanup use DIV_ROUND_UP

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 ppp_generic.c |4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index ef58e41..4b302f3 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -88,8 +88,6 @@ struct ppp_file {
 #define PF_TO_PPP(pf)  PF_TO_X(pf, struct ppp)
 #define PF_TO_CHANNEL(pf)  PF_TO_X(pf, struct channel)
 
-#define ROUNDUP(n, x)  (((n) + (x) - 1) / (x))
-
 /*
  * Data structure describing one ppp unit.
  * A ppp unit corresponds to a ppp network interface device
@@ -1297,7 +1295,7 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff 
*skb)
 */
fragsize = len;
if (nfree  1)
-   fragsize = ROUNDUP(fragsize, nfree);
+   fragsize = DIV_ROUND_UP(fragsize, nfree);
/* nbigger channels get fragsize bytes, the rest get fragsize-1,
   except if nbigger==0, then they all get fragsize. */
nbigger = len % nfree;
---
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/net/ixgb

2007-04-02 Thread Milind Arun Choudhary
IXGB_ROUNDUP macro cleanup ,use ALIGN

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 ixgb.h |3 ---
 ixgb_ethtool.c |4 ++--
 ixgb_main.c|4 ++--
 ixgb_param.c   |4 ++--
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index cf30a10..c8e9086 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -111,9 +111,6 @@ struct ixgb_adapter;
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define IXGB_RX_BUFFER_WRITE   8   /* Must be power of 2 */
 
-/* only works for sizes that are powers of 2 */
-#define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct ixgb_buffer {
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index d6628bd..cdefaff 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -577,11 +577,11 @@ ixgb_set_ringparam(struct net_device *netdev,
 
rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD);
rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD);
-   IXGB_ROUNDUP(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 
+   rxdr->count = ALIGN(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 
 
txdr->count = max(ring->tx_pending,(uint32_t)MIN_TXD);
txdr->count = min(txdr->count,(uint32_t)MAX_TXD);
-   IXGB_ROUNDUP(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 
+   txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 
 
if(netif_running(adapter->netdev)) {
/* Try to get new resources before deleting old */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index afc2ec7..158c71e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -685,7 +685,7 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
/* round up to nearest 4K */
 
txdr->size = txdr->count * sizeof(struct ixgb_tx_desc);
-   IXGB_ROUNDUP(txdr->size, 4096);
+   txdr->size = ALIGN(txdr->size, 4096);
 
txdr->desc = pci_alloc_consistent(pdev, txdr->size, >dma);
if(!txdr->desc) {
@@ -774,7 +774,7 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
/* Round up to nearest 4K */
 
rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
-   IXGB_ROUNDUP(rxdr->size, 4096);
+   rxdr->size = ALIGN(rxdr->size, 4096);
 
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, >dma);
 
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index b27442a..ee8cc67 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -284,7 +284,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
} else {
tx_ring->count = opt.def;
}
-   IXGB_ROUNDUP(tx_ring->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
+   tx_ring->count = ALIGN(tx_ring->count, 
IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
}
{ /* Receive Descriptor Count */
struct ixgb_option opt = {
@@ -303,7 +303,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
} else {
rx_ring->count = opt.def;
}
-   IXGB_ROUNDUP(rx_ring->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
+   rx_ring->count = ALIGN(rx_ring->count, 
IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
}
{ /* Receive Checksum Offload Enable */
struct ixgb_option opt = {


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH]ROUND_UP macro cleanup in drivers/net/ixgb

2007-04-02 Thread Milind Arun Choudhary
IXGB_ROUNDUP macro cleanup ,use ALIGN

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 ixgb.h |3 ---
 ixgb_ethtool.c |4 ++--
 ixgb_main.c|4 ++--
 ixgb_param.c   |4 ++--
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index cf30a10..c8e9086 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -111,9 +111,6 @@ struct ixgb_adapter;
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
 #define IXGB_RX_BUFFER_WRITE   8   /* Must be power of 2 */
 
-/* only works for sizes that are powers of 2 */
-#define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1)  ~((size) - 1)))
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct ixgb_buffer {
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index d6628bd..cdefaff 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -577,11 +577,11 @@ ixgb_set_ringparam(struct net_device *netdev,
 
rxdr-count = max(ring-rx_pending,(uint32_t)MIN_RXD);
rxdr-count = min(rxdr-count,(uint32_t)MAX_RXD);
-   IXGB_ROUNDUP(rxdr-count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 
+   rxdr-count = ALIGN(rxdr-count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 
 
txdr-count = max(ring-tx_pending,(uint32_t)MIN_TXD);
txdr-count = min(txdr-count,(uint32_t)MAX_TXD);
-   IXGB_ROUNDUP(txdr-count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 
+   txdr-count = ALIGN(txdr-count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 
 
if(netif_running(adapter-netdev)) {
/* Try to get new resources before deleting old */
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index afc2ec7..158c71e 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -685,7 +685,7 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
/* round up to nearest 4K */
 
txdr-size = txdr-count * sizeof(struct ixgb_tx_desc);
-   IXGB_ROUNDUP(txdr-size, 4096);
+   txdr-size = ALIGN(txdr-size, 4096);
 
txdr-desc = pci_alloc_consistent(pdev, txdr-size, txdr-dma);
if(!txdr-desc) {
@@ -774,7 +774,7 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
/* Round up to nearest 4K */
 
rxdr-size = rxdr-count * sizeof(struct ixgb_rx_desc);
-   IXGB_ROUNDUP(rxdr-size, 4096);
+   rxdr-size = ALIGN(rxdr-size, 4096);
 
rxdr-desc = pci_alloc_consistent(pdev, rxdr-size, rxdr-dma);
 
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index b27442a..ee8cc67 100644
--- a/drivers/net/ixgb/ixgb_param.c
+++ b/drivers/net/ixgb/ixgb_param.c
@@ -284,7 +284,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
} else {
tx_ring-count = opt.def;
}
-   IXGB_ROUNDUP(tx_ring-count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
+   tx_ring-count = ALIGN(tx_ring-count, 
IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
}
{ /* Receive Descriptor Count */
struct ixgb_option opt = {
@@ -303,7 +303,7 @@ ixgb_check_options(struct ixgb_adapter *adapter)
} else {
rx_ring-count = opt.def;
}
-   IXGB_ROUNDUP(rx_ring-count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
+   rx_ring-count = ALIGN(rx_ring-count, 
IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
}
{ /* Receive Checksum Offload Enable */
struct ixgb_option opt = {


-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in drivers/net/e1000

2007-04-01 Thread Milind Arun Choudhary
E1000_ROUNDUP macro cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 e1000.h |3 ---
 e1000_ethtool.c |6 +++---
 e1000_main.c|   10 +-
 e1000_param.c   |4 ++--
 4 files changed, 10 insertions(+), 13 deletions(-)


diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index dd4b728..a9ea67e 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -155,9 +155,6 @@ struct e1000_adapter;
 /* Number of packet split data buffers (not including the header buffer) */
 #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
 
-/* only works for sizes that are powers of 2 */
-#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct e1000_buffer {
diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 6777887..0fbd873 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -686,12 +686,12 @@ e1000_set_ringparam(struct net_device *netdev,
rxdr->count = max(ring->rx_pending,(uint32_t)E1000_MIN_RXD);
rxdr->count = min(rxdr->count,(uint32_t)(mac_type < e1000_82544 ?
E1000_MAX_RXD : E1000_MAX_82544_RXD));
-   E1000_ROUNDUP(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
+   rxdr->count = ALIGN(rxdr->count, REQ_RX_DESCRIPTOR_MULTIPLE);
 
txdr->count = max(ring->tx_pending,(uint32_t)E1000_MIN_TXD);
txdr->count = min(txdr->count,(uint32_t)(mac_type < e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD));
-   E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
+   txdr->count = ALIGN(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
 
for (i = 0; i < adapter->num_tx_queues; i++)
txdr[i].count = txdr->count;
@@ -1068,7 +1068,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
memset(txdr->buffer_info, 0, size);
 
txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
-   E1000_ROUNDUP(txdr->size, 4096);
+   txdr->size = ALIGN(txdr->size, 4096);
if (!(txdr->desc = pci_alloc_consistent(pdev, txdr->size, >dma))) 
{
ret_val = 2;
goto err_nomem;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 1d08e93..d0af100 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -750,9 +750,9 @@ e1000_reset(struct e1000_adapter *adapter)
   VLAN_TAG_SIZE;
min_tx_space = min_rx_space;
min_tx_space *= 2;
-   E1000_ROUNDUP(min_tx_space, 1024);
+   min_tx_space = ALIGN(min_tx_space, 1024);
min_tx_space >>= 10;
-   E1000_ROUNDUP(min_rx_space, 1024);
+   min_rx_space = ALIGN(min_rx_space, 1024);
min_rx_space >>= 10;
 
/* If current Tx allocation is less than the min Tx FIFO size,
@@ -1545,7 +1545,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
/* round up to nearest 4K */
 
txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
-   E1000_ROUNDUP(txdr->size, 4096);
+   txdr->size = ALIGN(txdr->size, 4096);
 
txdr->desc = pci_alloc_consistent(pdev, txdr->size, >dma);
if (!txdr->desc) {
@@ -1788,7 +1788,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
/* Round up to nearest 4K */
 
rxdr->size = rxdr->count * desc_len;
-   E1000_ROUNDUP(rxdr->size, 4096);
+   rxdr->size = ALIGN(rxdr->size, 4096);
 
rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, >dma);
 
@@ -3162,7 +3162,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter 
*adapter, struct sk_buff *skb)
uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR;
 
-   E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR);
+   skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR);
 
if (adapter->link_duplex != HALF_DUPLEX)
goto no_fifo_stall_required;
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index f8862e2..f485874 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -305,7 +305,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(_ring->count, , adapter);
-   E1000_ROUNDUP(tx_ring->count,
+   tx_ring->count = ALIGN(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
 

[KJ][PATCH] ROUND_UP cleanup in arch/mips/kernel/sysirix.c

2007-04-01 Thread Milind Arun Choudhary
ROUND_UP(32|64) cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 sysirix.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)


diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 93a1484..59c25bc 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -1736,14 +1736,13 @@ struct irix_dirent32_callback {
 };
 
 #define NAME_OFFSET32(de) ((int) ((de)->d_name - (char *) (de)))
-#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
 
 static int irix_filldir32(void *__buf, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
struct irix_dirent32 __user *dirent;
struct irix_dirent32_callback *buf = __buf;
-   unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1);
+   unsigned short reclen = ALIGN(NAME_OFFSET32(dirent) + namlen + 1, 
sizeof(u32));
int err = 0;
u32 d_ino;
 
@@ -1838,14 +1837,13 @@ struct irix_dirent64_callback {
 };
 
 #define NAME_OFFSET64(de) ((int) ((de)->d_name - (char *) (de)))
-#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
 
 static int irix_filldir64(void *__buf, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
struct irix_dirent64 __user *dirent;
struct irix_dirent64_callback * buf = __buf;
-   unsigned short reclen = ROUND_UP64(NAME_OFFSET64(dirent) + namlen + 1);
+   unsigned short reclen = ALIGN(NAME_OFFSET64(dirent) + namlen + 
1,sizeof(u64));
int err = 0;
 
if (!access_ok(VERIFY_WRITE, buf, sizeof(*buf)))

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in drivers/pci

2007-04-01 Thread Milind Arun Choudhary

ROUND_UP macro cleanup, use ALIGN where ever appropriate

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 hotplug/cpci_hotplug_pci.c |2 --
 setup-bus.c|8 +++-
 2 files changed, 3 insertions(+), 7 deletions(-)


diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c 
b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 7b1beaa..5e9be44 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -45,8 +45,6 @@ extern int cpci_debug;
 #define info(format, arg...) printk(KERN_INFO "%s: " format "\n", MY_NAME , ## 
arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n", MY_NAME , 
## arg)
 
-#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
-
 
 u8 cpci_get_attention_status(struct slot* slot)
 {
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 3554f39..e02766f 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -34,8 +34,6 @@
 #define DBG(x...)
 #endif
 
-#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
-
 static void __devinit
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
@@ -314,7 +312,7 @@ pbus_size_io(struct pci_bus *bus)
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
size = (size & 0xff) + ((size & ~0xffUL) << 2);
 #endif
-   size = ROUND_UP(size + size1, 4096);
+   size = ALIGN(size + size1, 4096);
if (!size) {
b_res->flags = 0;
return;
@@ -383,11 +381,11 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, 
unsigned long type)
 
if (!align)
min_align = align1;
-   else if (ROUND_UP(align + min_align, min_align) < align1)
+   else if (ALIGN(align + min_align, min_align) < align1)
min_align = align1 >> 1;
align += aligns[order];
}
-   size = ROUND_UP(size, min_align);
+   size = ALIGN(size, min_align);
    if (!size) {
    b_res->flags = 0;
return 1;

--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in arch/parisc

2007-04-01 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN where ever appropriate

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 hpux/fs.c |5 ++---
 kernel/sys_parisc32.c |3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)



diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 4204cd1..7ff5546 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -21,6 +21,7 @@
  *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -70,7 +71,6 @@ struct getdents_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
u64 ino, unsigned d_type)
@@ -78,7 +78,7 @@ static int filldir(void * __buf, const char * name, int 
namlen, loff_t offset,
struct hpux_dirent * dirent;
struct getdents_callback * buf = (struct getdents_callback *) __buf;
ino_t d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1,sizeof(long));
 
buf->error = -EINVAL;   /* only used if we fail.. */
if (reclen > buf->count)
@@ -103,7 +103,6 @@ static int filldir(void * __buf, const char * name, int 
namlen, loff_t offset,
 }
 
 #undef NAME_OFFSET
-#undef ROUND_UP
 
 int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int 
count)
 {
diff --git a/arch/parisc/kernel/sys_parisc32.c 
b/arch/parisc/kernel/sys_parisc32.c
index ce3245f..e590880 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -311,14 +311,13 @@ struct readdir32_callback {
int count;
 };
 
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & 
~((a) - 1)))
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 static int filldir32 (void *__buf, const char *name, int namlen,
loff_t offset, u64 ino, unsigned int d_type)
 {
struct linux32_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4);
u32 d_ino;
 
buf->error = -EINVAL;   /* only used if we fail.. */

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in arch/parisc

2007-04-01 Thread Milind Arun Choudhary
ROUND_UP macro cleanup, use ALIGN where ever appropriate

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 hpux/fs.c |5 ++---
 kernel/sys_parisc32.c |3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)



diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 4204cd1..7ff5546 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -21,6 +21,7 @@
  *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include linux/kernel.h
 #include linux/mm.h
 #include linux/sched.h
 #include linux/file.h
@@ -70,7 +71,6 @@ struct getdents_callback {
 };
 
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1)  ~(sizeof(long)-1))
 
 static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
u64 ino, unsigned d_type)
@@ -78,7 +78,7 @@ static int filldir(void * __buf, const char * name, int 
namlen, loff_t offset,
struct hpux_dirent * dirent;
struct getdents_callback * buf = (struct getdents_callback *) __buf;
ino_t d_ino;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1,sizeof(long));
 
buf-error = -EINVAL;   /* only used if we fail.. */
if (reclen  buf-count)
@@ -103,7 +103,6 @@ static int filldir(void * __buf, const char * name, int 
namlen, loff_t offset,
 }
 
 #undef NAME_OFFSET
-#undef ROUND_UP
 
 int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int 
count)
 {
diff --git a/arch/parisc/kernel/sys_parisc32.c 
b/arch/parisc/kernel/sys_parisc32.c
index ce3245f..e590880 100644
--- a/arch/parisc/kernel/sys_parisc32.c
+++ b/arch/parisc/kernel/sys_parisc32.c
@@ -311,14 +311,13 @@ struct readdir32_callback {
int count;
 };
 
-#define ROUND_UP(x,a)  ((__typeof__(x))(((unsigned long)(x) + ((a) - 1))  
~((a) - 1)))
 #define NAME_OFFSET(de) ((int) ((de)-d_name - (char __user *) (de)))
 static int filldir32 (void *__buf, const char *name, int namlen,
loff_t offset, u64 ino, unsigned int d_type)
 {
struct linux32_dirent __user * dirent;
struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
-   int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
+   int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 1, 4);
u32 d_ino;
 
buf-error = -EINVAL;   /* only used if we fail.. */

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in drivers/pci

2007-04-01 Thread Milind Arun Choudhary

ROUND_UP macro cleanup, use ALIGN where ever appropriate

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 hotplug/cpci_hotplug_pci.c |2 --
 setup-bus.c|8 +++-
 2 files changed, 3 insertions(+), 7 deletions(-)


diff --git a/drivers/pci/hotplug/cpci_hotplug_pci.c 
b/drivers/pci/hotplug/cpci_hotplug_pci.c
index 7b1beaa..5e9be44 100644
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
@@ -45,8 +45,6 @@ extern int cpci_debug;
 #define info(format, arg...) printk(KERN_INFO %s:  format \n, MY_NAME , ## 
arg)
 #define warn(format, arg...) printk(KERN_WARNING %s:  format \n, MY_NAME , 
## arg)
 
-#define ROUND_UP(x, a) (((x) + (a) - 1)  ~((a) - 1))
-
 
 u8 cpci_get_attention_status(struct slot* slot)
 {
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 3554f39..e02766f 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -34,8 +34,6 @@
 #define DBG(x...)
 #endif
 
-#define ROUND_UP(x, a) (((x) + (a) - 1)  ~((a) - 1))
-
 static void __devinit
 pbus_assign_resources_sorted(struct pci_bus *bus)
 {
@@ -314,7 +312,7 @@ pbus_size_io(struct pci_bus *bus)
 #if defined(CONFIG_ISA) || defined(CONFIG_EISA)
size = (size  0xff) + ((size  ~0xffUL)  2);
 #endif
-   size = ROUND_UP(size + size1, 4096);
+   size = ALIGN(size + size1, 4096);
if (!size) {
b_res-flags = 0;
return;
@@ -383,11 +381,11 @@ pbus_size_mem(struct pci_bus *bus, unsigned long mask, 
unsigned long type)
 
if (!align)
min_align = align1;
-   else if (ROUND_UP(align + min_align, min_align)  align1)
+   else if (ALIGN(align + min_align, min_align)  align1)
min_align = align1  1;
align += aligns[order];
}
-   size = ROUND_UP(size, min_align);
+   size = ALIGN(size, min_align);
if (!size) {
b_res-flags = 0;
return 1;

--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP cleanup in arch/mips/kernel/sysirix.c

2007-04-01 Thread Milind Arun Choudhary
ROUND_UP(32|64) cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 sysirix.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)


diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 93a1484..59c25bc 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -1736,14 +1736,13 @@ struct irix_dirent32_callback {
 };
 
 #define NAME_OFFSET32(de) ((int) ((de)-d_name - (char *) (de)))
-#define ROUND_UP32(x) (((x)+sizeof(u32)-1)  ~(sizeof(u32)-1))
 
 static int irix_filldir32(void *__buf, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
struct irix_dirent32 __user *dirent;
struct irix_dirent32_callback *buf = __buf;
-   unsigned short reclen = ROUND_UP32(NAME_OFFSET32(dirent) + namlen + 1);
+   unsigned short reclen = ALIGN(NAME_OFFSET32(dirent) + namlen + 1, 
sizeof(u32));
int err = 0;
u32 d_ino;
 
@@ -1838,14 +1837,13 @@ struct irix_dirent64_callback {
 };
 
 #define NAME_OFFSET64(de) ((int) ((de)-d_name - (char *) (de)))
-#define ROUND_UP64(x) (((x)+sizeof(u64)-1)  ~(sizeof(u64)-1))
 
 static int irix_filldir64(void *__buf, const char *name,
int namlen, loff_t offset, u64 ino, unsigned int d_type)
 {
struct irix_dirent64 __user *dirent;
struct irix_dirent64_callback * buf = __buf;
-   unsigned short reclen = ROUND_UP64(NAME_OFFSET64(dirent) + namlen + 1);
+   unsigned short reclen = ALIGN(NAME_OFFSET64(dirent) + namlen + 
1,sizeof(u64));
int err = 0;
 
if (!access_ok(VERIFY_WRITE, buf, sizeof(*buf)))

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_UP macro cleanup in drivers/net/e1000

2007-04-01 Thread Milind Arun Choudhary
E1000_ROUNDUP macro cleanup, use ALIGN

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 e1000.h |3 ---
 e1000_ethtool.c |6 +++---
 e1000_main.c|   10 +-
 e1000_param.c   |4 ++--
 4 files changed, 10 insertions(+), 13 deletions(-)


diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index dd4b728..a9ea67e 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -155,9 +155,6 @@ struct e1000_adapter;
 /* Number of packet split data buffers (not including the header buffer) */
 #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
 
-/* only works for sizes that are powers of 2 */
-#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1)  ~((size) - 1)))
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct e1000_buffer {
diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 6777887..0fbd873 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -686,12 +686,12 @@ e1000_set_ringparam(struct net_device *netdev,
rxdr-count = max(ring-rx_pending,(uint32_t)E1000_MIN_RXD);
rxdr-count = min(rxdr-count,(uint32_t)(mac_type  e1000_82544 ?
E1000_MAX_RXD : E1000_MAX_82544_RXD));
-   E1000_ROUNDUP(rxdr-count, REQ_RX_DESCRIPTOR_MULTIPLE);
+   rxdr-count = ALIGN(rxdr-count, REQ_RX_DESCRIPTOR_MULTIPLE);
 
txdr-count = max(ring-tx_pending,(uint32_t)E1000_MIN_TXD);
txdr-count = min(txdr-count,(uint32_t)(mac_type  e1000_82544 ?
E1000_MAX_TXD : E1000_MAX_82544_TXD));
-   E1000_ROUNDUP(txdr-count, REQ_TX_DESCRIPTOR_MULTIPLE);
+   txdr-count = ALIGN(txdr-count, REQ_TX_DESCRIPTOR_MULTIPLE);
 
for (i = 0; i  adapter-num_tx_queues; i++)
txdr[i].count = txdr-count;
@@ -1068,7 +1068,7 @@ e1000_setup_desc_rings(struct e1000_adapter *adapter)
memset(txdr-buffer_info, 0, size);
 
txdr-size = txdr-count * sizeof(struct e1000_tx_desc);
-   E1000_ROUNDUP(txdr-size, 4096);
+   txdr-size = ALIGN(txdr-size, 4096);
if (!(txdr-desc = pci_alloc_consistent(pdev, txdr-size, txdr-dma))) 
{
ret_val = 2;
goto err_nomem;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 1d08e93..d0af100 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -750,9 +750,9 @@ e1000_reset(struct e1000_adapter *adapter)
   VLAN_TAG_SIZE;
min_tx_space = min_rx_space;
min_tx_space *= 2;
-   E1000_ROUNDUP(min_tx_space, 1024);
+   min_tx_space = ALIGN(min_tx_space, 1024);
min_tx_space = 10;
-   E1000_ROUNDUP(min_rx_space, 1024);
+   min_rx_space = ALIGN(min_rx_space, 1024);
min_rx_space = 10;
 
/* If current Tx allocation is less than the min Tx FIFO size,
@@ -1545,7 +1545,7 @@ e1000_setup_tx_resources(struct e1000_adapter *adapter,
/* round up to nearest 4K */
 
txdr-size = txdr-count * sizeof(struct e1000_tx_desc);
-   E1000_ROUNDUP(txdr-size, 4096);
+   txdr-size = ALIGN(txdr-size, 4096);
 
txdr-desc = pci_alloc_consistent(pdev, txdr-size, txdr-dma);
if (!txdr-desc) {
@@ -1788,7 +1788,7 @@ e1000_setup_rx_resources(struct e1000_adapter *adapter,
/* Round up to nearest 4K */
 
rxdr-size = rxdr-count * desc_len;
-   E1000_ROUNDUP(rxdr-size, 4096);
+   rxdr-size = ALIGN(rxdr-size, 4096);
 
rxdr-desc = pci_alloc_consistent(pdev, rxdr-size, rxdr-dma);
 
@@ -3162,7 +3162,7 @@ e1000_82547_fifo_workaround(struct e1000_adapter 
*adapter, struct sk_buff *skb)
uint32_t fifo_space = adapter-tx_fifo_size - adapter-tx_fifo_head;
uint32_t skb_fifo_len = skb-len + E1000_FIFO_HDR;
 
-   E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR);
+   skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR);
 
if (adapter-link_duplex != HALF_DUPLEX)
goto no_fifo_stall_required;
diff --git a/drivers/net/e1000/e1000_param.c b/drivers/net/e1000/e1000_param.c
index f8862e2..f485874 100644
--- a/drivers/net/e1000/e1000_param.c
+++ b/drivers/net/e1000/e1000_param.c
@@ -305,7 +305,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_TxDescriptors  bd) {
tx_ring-count = TxDescriptors[bd];
e1000_validate_option(tx_ring-count, opt, adapter);
-   E1000_ROUNDUP(tx_ring-count,
+   tx_ring-count = ALIGN(tx_ring-count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring-count = opt.def;
@@ -331,7 +331,7 @@ e1000_check_options(struct e1000_adapter *adapter)
if (num_RxDescriptors  bd) {
rx_ring-count

[KJ][PATCH] ROUND_?UP macro cleanup in drivers/parisc

2007-03-31 Thread Milind Arun Choudhary
Clean up ROUND_?UP, Use ALIGN where ever appropriate.

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---
 ccio-dma.c  |8 
 iommu-helpers.h |4 ++--
 sba_iommu.c |6 ++
 3 files changed, 8 insertions(+), 10 deletions(-)



diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 894fdb9..1459ca8 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -32,6 +32,7 @@
 */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -292,7 +293,6 @@ static int ioc_count;
 #define PDIR_INDEX(iovp)((iovp)>>IOVP_SHIFT)
 #define MKIOVP(pdir_idx)((long)(pdir_idx) << IOVP_SHIFT)
 #define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
-#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
 
 /*
 ** Don't worry about the 150% average search length on a miss.
@@ -668,7 +668,7 @@ ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t 
byte_cnt)
size_t saved_byte_cnt;
 
/* round up to nearest page size */
-   saved_byte_cnt = byte_cnt = ROUNDUP(byte_cnt, IOVP_SIZE);
+   saved_byte_cnt = byte_cnt = ALIGN(byte_cnt, IOVP_SIZE);
 
while(byte_cnt > 0) {
/* invalidate one page at a time */
@@ -751,7 +751,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
offset = ((unsigned long) addr) & ~IOVP_MASK;
 
/* round up to nearest IOVP_SIZE */
-   size = ROUNDUP(size + offset, IOVP_SIZE);
+   size = ALIGN(size + offset, IOVP_SIZE);
spin_lock_irqsave(>res_lock, flags);
 
 #ifdef CCIO_MAP_STATS
@@ -814,7 +814,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, 
size_t size,
 
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, IOVP_SIZE);
+   size = ALIGN(size, IOVP_SIZE);
 
spin_lock_irqsave(>res_lock, flags);
 
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 38d9e1a..0a1f99a 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -138,7 +138,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist 
*startsg, int nents,
** exceed DMA_CHUNK_SIZE if we coalesce the
** next entry.
*/   
-   if(unlikely(ROUNDUP(dma_len + dma_offset + 
startsg->length,
+   if(unlikely(ALIGN(dma_len + dma_offset + 
startsg->length,
IOVP_SIZE) > DMA_CHUNK_SIZE))
break;
 
@@ -158,7 +158,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist 
*startsg, int nents,
** Allocate space for DMA stream.
*/
sg_dma_len(contig_sg) = dma_len;
-   dma_len = ROUNDUP(dma_len + dma_offset, IOVP_SIZE);
+   dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
sg_dma_address(contig_sg) =
PIDE_FLAG 
| (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT)
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 76a29da..7d83d9f 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -113,8 +113,6 @@ module_param(sba_reserve_agpgart, int, 1);
 MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART");
 #endif
 
-#define ROUNDUP(x,y) ((x + ((y)-1)) & ~((y)-1))
-
 
 /
 ** SBA register read and write support
@@ -352,7 +350,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long 
bits_wanted)
** SBA HW features in the unmap path.
*/
unsigned long o = 1 << get_order(bits_wanted << PAGE_SHIFT);
-   uint bitshiftcnt = ROUNDUP(ioc->res_bitshift, o);
+   uint bitshiftcnt = ALIGN(ioc->res_bitshift, o);
unsigned long mask;
 
if (bitshiftcnt >= BITS_PER_LONG) {
@@ -779,7 +777,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, 
size_t size,
offset = iova & ~IOVP_MASK;
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, IOVP_SIZE);
+   size = ALIGN(size, IOVP_SIZE);
 
spin_lock_irqsave(>res_lock, flags);
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] ROUND_?UP macro cleanup in drivers/parisc

2007-03-31 Thread Milind Arun Choudhary
Clean up ROUND_?UP, Use ALIGN where ever appropriate.

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---
 ccio-dma.c  |8 
 iommu-helpers.h |4 ++--
 sba_iommu.c |6 ++
 3 files changed, 8 insertions(+), 10 deletions(-)



diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 894fdb9..1459ca8 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -32,6 +32,7 @@
 */
 
 #include linux/types.h
+#include linux/kernel.h
 #include linux/init.h
 #include linux/mm.h
 #include linux/spinlock.h
@@ -292,7 +293,6 @@ static int ioc_count;
 #define PDIR_INDEX(iovp)((iovp)IOVP_SHIFT)
 #define MKIOVP(pdir_idx)((long)(pdir_idx)  IOVP_SHIFT)
 #define MKIOVA(iovp,offset) (dma_addr_t)((long)iovp | (long)offset)
-#define ROUNDUP(x,y) ((x + ((y)-1))  ~((y)-1))
 
 /*
 ** Don't worry about the 150% average search length on a miss.
@@ -668,7 +668,7 @@ ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t 
byte_cnt)
size_t saved_byte_cnt;
 
/* round up to nearest page size */
-   saved_byte_cnt = byte_cnt = ROUNDUP(byte_cnt, IOVP_SIZE);
+   saved_byte_cnt = byte_cnt = ALIGN(byte_cnt, IOVP_SIZE);
 
while(byte_cnt  0) {
/* invalidate one page at a time */
@@ -751,7 +751,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
offset = ((unsigned long) addr)  ~IOVP_MASK;
 
/* round up to nearest IOVP_SIZE */
-   size = ROUNDUP(size + offset, IOVP_SIZE);
+   size = ALIGN(size + offset, IOVP_SIZE);
spin_lock_irqsave(ioc-res_lock, flags);
 
 #ifdef CCIO_MAP_STATS
@@ -814,7 +814,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, 
size_t size,
 
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, IOVP_SIZE);
+   size = ALIGN(size, IOVP_SIZE);
 
spin_lock_irqsave(ioc-res_lock, flags);
 
diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 38d9e1a..0a1f99a 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -138,7 +138,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist 
*startsg, int nents,
** exceed DMA_CHUNK_SIZE if we coalesce the
** next entry.
*/   
-   if(unlikely(ROUNDUP(dma_len + dma_offset + 
startsg-length,
+   if(unlikely(ALIGN(dma_len + dma_offset + 
startsg-length,
IOVP_SIZE)  DMA_CHUNK_SIZE))
break;
 
@@ -158,7 +158,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct scatterlist 
*startsg, int nents,
** Allocate space for DMA stream.
*/
sg_dma_len(contig_sg) = dma_len;
-   dma_len = ROUNDUP(dma_len + dma_offset, IOVP_SIZE);
+   dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
sg_dma_address(contig_sg) =
PIDE_FLAG 
| (iommu_alloc_range(ioc, dma_len)  IOVP_SHIFT)
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
index 76a29da..7d83d9f 100644
--- a/drivers/parisc/sba_iommu.c
+++ b/drivers/parisc/sba_iommu.c
@@ -113,8 +113,6 @@ module_param(sba_reserve_agpgart, int, 1);
 MODULE_PARM_DESC(sba_reserve_agpgart, Reserve half of IO pdir as AGPGART);
 #endif
 
-#define ROUNDUP(x,y) ((x + ((y)-1))  ~((y)-1))
-
 
 /
 ** SBA register read and write support
@@ -352,7 +350,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long 
bits_wanted)
** SBA HW features in the unmap path.
*/
unsigned long o = 1  get_order(bits_wanted  PAGE_SHIFT);
-   uint bitshiftcnt = ROUNDUP(ioc-res_bitshift, o);
+   uint bitshiftcnt = ALIGN(ioc-res_bitshift, o);
unsigned long mask;
 
if (bitshiftcnt = BITS_PER_LONG) {
@@ -779,7 +777,7 @@ sba_unmap_single(struct device *dev, dma_addr_t iova, 
size_t size,
offset = iova  ~IOVP_MASK;
iova ^= offset;/* clear offset bits */
size += offset;
-   size = ROUNDUP(size, IOVP_SIZE);
+   size = ALIGN(size, IOVP_SIZE);
 
spin_lock_irqsave(ioc-res_lock, flags);
 

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH] BIT macro cleanup

2007-03-30 Thread Milind Arun Choudhary

On 3/29/07, Richard Knutsson <[EMAIL PROTECTED]> wrote:

Alexey Dobriyan wrote:
> On Wed, Mar 28, 2007 at 09:03:09AM +0530, Milind Arun Choudhary wrote:
>
>> +#define BIT(nr)   (1UL << ((nr) % BITS_PER_LONG))
>>
>
> I think this would be a disaster because something like
>
>BIT(123)
>
> would not even generate a warning.
>
There were a discussion on this, at KJ, when BIT was first used with a
modular operation. I said the same thing as you do now, but a big user
of BIT is the input-subsystem who defined their BIT as above. Also it
was mentioned that the compiler can only find the statical errors, a
variable input can break it in runtime.
+ if we _really_ want to check the tree for such warnings, it is easy to
remove the modular operation temporarily (and keep away of input/)

I don't say I like this, just that it is a choose between possible errors.

as discussed in earlier thread there are two kinds of users of BIT
1. input sybsystem which needs the "% BITS_PER_LONG"
2. & all other who don't, so that they are warned when the bit no overflows
I think a simple macro cant serve both the purposes

so IMHO there should be two macros
+#define BIT(nr)(1UL << (nr))
which server the first case

&
+#define XXXBITXXX(nr)  (1UL << ((nr) % BITS_PER_LONG))
for input users
earlier i suggested a name BITWRAP
but some people hate it i think
'm fine with any other name as well
inputssuggest a name

so that we can still keep these two macros (along with LLBIT) in
bitops.h & use apporpriately

only hassle is the whole input tree is to be searched & replaced for BIT
is this OK

--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][PATCH] BIT macro cleanup

2007-03-30 Thread Milind Arun Choudhary

On 3/29/07, Richard Knutsson [EMAIL PROTECTED] wrote:

Alexey Dobriyan wrote:
 On Wed, Mar 28, 2007 at 09:03:09AM +0530, Milind Arun Choudhary wrote:

 +#define BIT(nr)   (1UL  ((nr) % BITS_PER_LONG))


 I think this would be a disaster because something like

BIT(123)

 would not even generate a warning.

There were a discussion on this, at KJ, when BIT was first used with a
modular operation. I said the same thing as you do now, but a big user
of BIT is the input-subsystem who defined their BIT as above. Also it
was mentioned that the compiler can only find the statical errors, a
variable input can break it in runtime.
+ if we _really_ want to check the tree for such warnings, it is easy to
remove the modular operation temporarily (and keep away of input/)

I don't say I like this, just that it is a choose between possible errors.

as discussed in earlier thread there are two kinds of users of BIT
1. input sybsystem which needs the % BITS_PER_LONG
2.  all other who don't, so that they are warned when the bit no overflows
I think a simple macro cant serve both the purposes

so IMHO there should be two macros
+#define BIT(nr)(1UL  (nr))
which server the first case


+#define XXXBITXXX(nr)  (1UL  ((nr) % BITS_PER_LONG))
for input users
earlier i suggested a name BITWRAP
but some people hate it i think
'm fine with any other name as well
inputssuggest a name

so that we can still keep these two macros (along with LLBIT) in
bitops.h  use apporpriately

only hassle is the whole input tree is to be searched  replaced for BIT
is this OK

--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[KJ][PATCH] BIT macro cleanup

2007-03-27 Thread Milind Arun Choudhary

BIT macro cleanup,now in bitops.h

Signed-off-by: Milind Arun Choudhary <[EMAIL PROTECTED]>

---

 arch/ppc/platforms/chestnut.c   |1 
 drivers/edac/edac_mc.h  |2 -
 drivers/i2c/busses/i2c-pxa.c|   55 ++--
 drivers/net/eth16i.c|1 
 drivers/net/meth.h  |3 -
 drivers/net/s2io.h  |1 
 drivers/net/wireless/hostap/hostap_common.h |3 -
 drivers/scsi/nsp32.h|4 --
 drivers/scsi/pcmcia/nsp_cs.h|1 
 drivers/serial/amba-pl011.c |   37 --
 drivers/video/cyber2000fb.c |   44 +++---
 fs/select.c |1 
 include/asm-mips/ip32/crime.h   |3 -
 include/asm-mips/ip32/mace.h|3 -
 include/linux/bitops.h  |3 +
 include/linux/input.h   |2 -
 include/video/sstfb.h   |1 
 include/video/tdfx.h|3 -
 18 files changed, 73 insertions(+), 95 deletions(-)


diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index a764ae7..248bfdd 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -48,7 +48,6 @@ extern void gen550_progress(char *, unsigned short);
 extern void gen550_init(int, struct uart_port *);
 extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh);
 
-#define BIT(x) (1<> (loc))
 #define vBIT(val, loc, sz) (((u64)val) << (64-loc-sz))
 #define INV(d)  ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| 
((d>>24)&0xff)
diff --git a/drivers/net/wireless/hostap/hostap_common.h 
b/drivers/net/wireless/hostap/hostap_common.h
index 0162400..429c9dd 100644
--- a/drivers/net/wireless/hostap/hostap_common.h
+++ b/drivers/net/wireless/hostap/hostap_common.h
@@ -3,8 +3,7 @@
 
 #include 
 #include 
-
-#define BIT(x) (1 << (x))
+#include 
 
 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h
index a976e81..9779c5a 100644
--- a/drivers/scsi/nsp32.h
+++ b/drivers/scsi/nsp32.h
@@ -68,10 +68,6 @@ static char * nsp32_model[] = {
 typedef u32 u32_le;
 typedef u16 u16_le;
 
-/*
- * MACRO
- */
-#define BIT(x)  (1UL << (x))
 
 /*
  * BASIC Definitions
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index 9102cbd..0a3e2d1 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -26,7 +26,6 @@
 /
  * Some useful macros...
  */
-#define BIT(x)  (1L << (x))
 
 /* SCSI initiator must be ID 7 */
 #define NSP_INITIATOR_ID  7
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 44639e7..dfff378 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -53,6 +53,9 @@
 #include 
 #include 
 
+#define SETBITS(data,mask)(data |= mask)
+#define CLRBITS(data,mask)(data &= ~mask)
+
 #define UART_NR14
 
 #define SERIAL_AMBA_MAJOR  204
@@ -262,15 +265,11 @@ static unsigned int pl01x_get_mctrl(struct uart_port 
*port)
unsigned int result = 0;
unsigned int status = readw(uap->port.membase + UART01x_FR);
 
-#define BIT(uartbit, tiocmbit) \
-   if (status & uartbit)   \
-   result |= tiocmbit
+   result |= (status & UART01x_FR_DCD) ? TIOCM_CAR  : 0 ;
+   result |= (status & UART01x_FR_DSR) ? TIOCM_DSR  : 0 ;
+   result |= (status & UART01x_FR_CTS) ? TIOCM_CTS  : 0 ;
+   result |= (status & UART011_FR_RI)  ? TIOCM_RNG  : 0 ;
 
-   BIT(UART01x_FR_DCD, TIOCM_CAR);
-   BIT(UART01x_FR_DSR, TIOCM_DSR);
-   BIT(UART01x_FR_CTS, TIOCM_CTS);
-   BIT(UART011_FR_RI, TIOCM_RNG);
-#undef BIT
return result;
 }
 
@@ -281,18 +280,16 @@ static void pl011_set_mctrl(struct uart_port *port, 
unsigned int mctrl)
 
cr = readw(uap->port.membase + UART011_CR);
 
-#defineBIT(tiocmbit, uartbit)  \
-   if (mctrl & tiocmbit)   \
-   cr |= uartbit;  \
-   else\
-   cr &= ~uartbit
-
-   BIT(TIOCM_RTS, UART011_CR_RTS);
-   BIT(TIOCM_DTR, UART011_CR_DTR);
-   BIT(TIOCM_OUT1, UART011_CR_OUT1);
-   BIT(TIOCM_OUT2, UART011_CR_OUT2);
-   BIT(TIOCM_LOOP, UART011_CR_LBE);
-#undef BIT
+   (mctrl & TIOCM_RTS)  ?
+   SETBITS(cr, UART011_CR_DTR)  : CLRBITS(cr, UART011_CR_DTR);
+   (mctrl & TIOCM_DTR)  ?
+   SETBITS(cr, UART011_CR_DTR)  : CLRBITS(cr, UART011_CR_DTR);
+   (mctrl & TIOCM_OUT1) ?
+   SETBITS(cr, UART01

[KJ][PATCH] BIT macro cleanup

2007-03-27 Thread Milind Arun Choudhary

BIT macro cleanup,now in bitops.h

Signed-off-by: Milind Arun Choudhary [EMAIL PROTECTED]

---

 arch/ppc/platforms/chestnut.c   |1 
 drivers/edac/edac_mc.h  |2 -
 drivers/i2c/busses/i2c-pxa.c|   55 ++--
 drivers/net/eth16i.c|1 
 drivers/net/meth.h  |3 -
 drivers/net/s2io.h  |1 
 drivers/net/wireless/hostap/hostap_common.h |3 -
 drivers/scsi/nsp32.h|4 --
 drivers/scsi/pcmcia/nsp_cs.h|1 
 drivers/serial/amba-pl011.c |   37 --
 drivers/video/cyber2000fb.c |   44 +++---
 fs/select.c |1 
 include/asm-mips/ip32/crime.h   |3 -
 include/asm-mips/ip32/mace.h|3 -
 include/linux/bitops.h  |3 +
 include/linux/input.h   |2 -
 include/video/sstfb.h   |1 
 include/video/tdfx.h|3 -
 18 files changed, 73 insertions(+), 95 deletions(-)


diff --git a/arch/ppc/platforms/chestnut.c b/arch/ppc/platforms/chestnut.c
index a764ae7..248bfdd 100644
--- a/arch/ppc/platforms/chestnut.c
+++ b/arch/ppc/platforms/chestnut.c
@@ -48,7 +48,6 @@ extern void gen550_progress(char *, unsigned short);
 extern void gen550_init(int, struct uart_port *);
 extern void mv64360_pcibios_fixup(mv64x60_handle_t *bh);
 
-#define BIT(x) (1x)
 #define CHESTNUT_PRESERVE_MASK (BIT(MV64x60_CPU2DEV_0_WIN) | \
BIT(MV64x60_CPU2DEV_1_WIN) | \
BIT(MV64x60_CPU2DEV_2_WIN) | \
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index 713444c..1d8c495 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -79,8 +79,6 @@ extern int edac_debug_level;
 
 #endif  /* !CONFIG_EDAC_DEBUG */
 
-#define BIT(x) (1  (x))
-
 #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
PCI_DEVICE_ID_ ## vend ## _ ## dev
 
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 14e83d0..abed806 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -82,7 +82,8 @@ struct bits {
const char *set;
const char *unset;
 };
-#define BIT(m, s, u)   { .mask = m, .set = s, .unset = u }
+
+#define INIT_BITS(m, s, u) { .mask = m, .set = s, .unset = u }
 
 static inline void
 decode_bits(const char *prefix, const struct bits *bits, int num, u32 val)
@@ -97,17 +98,17 @@ decode_bits(const char *prefix, const struct bits *bits, 
int num, u32 val)
 }
 
 static const struct bits isr_bits[] = {
-   BIT(ISR_RWM,RX,   TX),
-   BIT(ISR_ACKNAK, NAK,  ACK),
-   BIT(ISR_UB, Bsy,  Rdy),
-   BIT(ISR_IBB,BusBsy,   BusRdy),
-   BIT(ISR_SSD,SlaveStop,NULL),
-   BIT(ISR_ALD,ALD,  NULL),
-   BIT(ISR_ITE,TxEmpty,  NULL),
-   BIT(ISR_IRF,RxFull,   NULL),
-   BIT(ISR_GCAD,   GenCall,  NULL),
-   BIT(ISR_SAD,SlaveAddr,NULL),
-   BIT(ISR_BED,BusErr,   NULL),
+   INIT_BITS(ISR_RWM,  RX,   TX),
+   INIT_BITS(ISR_ACKNAK,   NAK,  ACK),
+   INIT_BITS(ISR_UB,   Bsy,  Rdy),
+   INIT_BITS(ISR_IBB,  BusBsy,   BusRdy),
+   INIT_BITS(ISR_SSD,  SlaveStop,NULL),
+   INIT_BITS(ISR_ALD,  ALD,  NULL),
+   INIT_BITS(ISR_ITE,  TxEmpty,  NULL),
+   INIT_BITS(ISR_IRF,  RxFull,   NULL),
+   INIT_BITS(ISR_GCAD, GenCall,  NULL),
+   INIT_BITS(ISR_SAD,  SlaveAddr,NULL),
+   INIT_BITS(ISR_BED,  BusErr,   NULL),
 };
 
 static void decode_ISR(unsigned int val)
@@ -117,21 +118,21 @@ static void decode_ISR(unsigned int val)
 }
 
 static const struct bits icr_bits[] = {
-   BIT(ICR_START,  START,NULL),
-   BIT(ICR_STOP,   STOP, NULL),
-   BIT(ICR_ACKNAK, ACKNAK,   NULL),
-   BIT(ICR_TB, TB,   NULL),
-   BIT(ICR_MA, MA,   NULL),
-   BIT(ICR_SCLE,   SCLE, scle),
-   BIT(ICR_IUE,IUE,  iue),
-   BIT(ICR_GCD,GCD,  NULL),
-   BIT(ICR_ITEIE,  ITEIE,NULL),
-   BIT(ICR_IRFIE,  IRFIE,NULL),
-   BIT(ICR_BEIE,   BEIE, NULL),
-   BIT(ICR_SSDIE,  SSDIE,NULL),
-   BIT(ICR_ALDIE,  ALDIE,NULL),
-   BIT(ICR_SADIE,  SADIE,NULL),
-   BIT(ICR_UR, UR,   ur),
+   INIT_BITS(ICR_START,  START,  NULL),
+   INIT_BITS(ICR_STOP,   STOP,   NULL),
+   INIT_BITS(ICR_ACKNAK, ACKNAK, NULL),
+   INIT_BITS(ICR_TB, TB, NULL),
+   INIT_BITS(ICR_MA, MA, NULL),
+   INIT_BITS(ICR_SCLE,   SCLE,   scle),
+   INIT_BITS(ICR_IUE,IUE

Re: [KJ][RFC][PATCH] BIT macro cleanup

2007-02-24 Thread Milind Arun Choudhary
On 12:11 Sat 24 Feb , Vojtech Pavlik wrote:
> 
> That would be my only concern - losing compiler warnings.
yes
see
I wanted a single BIT macro which can be used by the whole tree

was looking for a multipurpose one.  found it in input.h
so i thought i will put it at a common place

why bitops.h? coz BIT qualifies for a "bitop" 
& bitops.h is  inclued by kernel.h, hence accessible from every part 
of the tree without mucb efforts

now
a> this was written for input user,so they are perfectly happy with it
only change would be now input.h will have
 to fetch it from bitops.h..trivial

b> currently almost all other users of BIT are well within the BITS_PER_LONG
limit

c>but it is not sutaible for  those who want to go beyond this limit, 
as they will not be warned 

Now if we have LLBIT which takes care of above case
[& as  LLBIT has no wrap it will warn if we go beyond "long long" for
some reason]

So all we need is  people to be carefull  before passing anything to BIT
& use LLBIT whereever appropriate

so  now i think it should be ok to have

#define BIT(nr) (1UL << ((nr) % BITS_PER_LONG))
#define LLBIT(nr) (1ULL << (nr))


thoughts

> > And what about the "1%"?
> 
> The 1% will need either LLBIT or an extra % 8.

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [KJ][RFC][PATCH] BIT macro cleanup

2007-02-24 Thread Milind Arun Choudhary
On 12:11 Sat 24 Feb , Vojtech Pavlik wrote:
 
 That would be my only concern - losing compiler warnings.
yes
see
I wanted a single BIT macro which can be used by the whole tree

was looking for a multipurpose one.  found it in input.h
so i thought i will put it at a common place

why bitops.h? coz BIT qualifies for a bitop 
 bitops.h is  inclued by kernel.h, hence accessible from every part 
of the tree without mucb efforts

now
a this was written for input user,so they are perfectly happy with it
only change would be now input.h will have
 to fetch it from bitops.h..trivial

b currently almost all other users of BIT are well within the BITS_PER_LONG
limit

cbut it is not sutaible for  those who want to go beyond this limit, 
as they will not be warned 

Now if we have LLBIT which takes care of above case
[ as  LLBIT has no wrap it will warn if we go beyond long long for
some reason]

So all we need is  people to be carefull  before passing anything to BIT
 use LLBIT whereever appropriate

so  now i think it should be ok to have

#define BIT(nr) (1UL  ((nr) % BITS_PER_LONG))
#define LLBIT(nr) (1ULL  (nr))


thoughts

  And what about the 1%?
 
 The 1% will need either LLBIT or an extra % 8.

-- 
Milind Arun Choudhary
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/