2005-01-05 01:47:57

by James Nelson

[permalink] [raw]
Subject: [PATCH 0/2] cris: remove cli()/sti() from arch/cris/*

This series of patches is to remove the last cli()/sti() function calls in arch/cris.

These are the only instances in active code that grep could find.

drivers/gpio.c | 24 ++++++++++++------------
kernel/fasttimer.c | 41 +++++++++++++++++------------------------
2 files changed, 29 insertions(+), 36 deletions(-)


2005-01-05 01:44:30

by James Nelson

[permalink] [raw]
Subject: [PATCH 2/2] cris: remove cli()/sti() in arch/cris/arch-v10/kernel/fasttimer.c

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

diff -urN --exclude='*~' linux-2.6.10-mm1-original/arch/cris/arch-v10/kernel/fasttimer.c linux-2.6.10-mm1/arch/cris/arch-v10/kernel/fasttimer.c
--- linux-2.6.10-mm1-original/arch/cris/arch-v10/kernel/fasttimer.c 2005-01-03 18:42:38.175748400 -0500
+++ linux-2.6.10-mm1/arch/cris/arch-v10/kernel/fasttimer.c 2005-01-04 20:21:49.052049939 -0500
@@ -148,8 +148,7 @@
#define DEBUG_LOG(string, value) \
{ \
unsigned long log_flags; \
- save_flags(log_flags); \
- cli(); \
+ local_irq_save(log_flags); \
debug_log_string[debug_log_cnt] = (string); \
debug_log_value[debug_log_cnt] = (unsigned long)(value); \
if (++debug_log_cnt >= DEBUG_LOG_MAX) \
@@ -157,7 +156,7 @@
debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \
debug_log_cnt_wrapped = 1; \
} \
- restore_flags(log_flags); \
+ local_irq_restore(log_flags); \
}
#else
#define DEBUG_LOG(string, value)
@@ -320,8 +319,7 @@

D1(printk("sft %s %d us\n", name, delay_us));

- save_flags(flags);
- cli();
+ local_irq_save(flags);

do_gettimeofday_fast(&t->tv_set);
tmp = fast_timer_list;
@@ -395,7 +393,7 @@

D2(printk("start_one_shot_timer: %d us done\n", delay_us));

- restore_flags(flags);
+ local_irq_restore(flags);
} /* start_one_shot_timer */

static inline int fast_timer_pending (const struct fast_timer * t)
@@ -425,11 +423,10 @@
unsigned long flags;
int ret;

- save_flags(flags);
- cli();
+ local_irq_save(flags);
ret = detach_fast_timer(t);
t->next = t->prev = NULL;
- restore_flags(flags);
+ local_irq_restore(flags);
return ret;
} /* del_fast_timer */

@@ -444,8 +441,7 @@
struct fast_timer *t;
unsigned long flags;

- save_flags(flags);
- cli();
+ local_irq_save(flags);

/* Clear timer1 irq */
*R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -462,7 +458,7 @@
fast_timer_running = 0;
fast_timer_ints++;

- restore_flags(flags);
+ local_irq_restore(flags);

t = fast_timer_list;
while (t)
@@ -482,8 +478,7 @@
fast_timers_expired++;

/* Remove this timer before call, since it may reuse the timer */
- save_flags(flags);
- cli();
+ local_irq_save(flags);
if (t->prev)
{
t->prev->next = t->next;
@@ -498,7 +493,7 @@
}
t->prev = NULL;
t->next = NULL;
- restore_flags(flags);
+ local_irq_restore(flags);

if (t->function != NULL)
{
@@ -515,8 +510,7 @@
D1(printk(".\n"));
}

- save_flags(flags);
- cli();
+ local_irq_save(flags);
if ((t = fast_timer_list) != NULL)
{
/* Start next timer.. */
@@ -535,7 +529,7 @@
#endif
start_timer1(us);
}
- restore_flags(flags);
+ local_irq_restore(flags);
break;
}
else
@@ -546,7 +540,7 @@
D1(printk("e! %d\n", us));
}
}
- restore_flags(flags);
+ local_irq_restore(flags);
}

if (!t)
@@ -748,13 +742,12 @@
#endif

used += sprintf(bigbuf + used, "Active timers:\n");
- save_flags(flags);
- cli();
+ local_irq_save(flags);
t = fast_timer_list;
while (t != NULL && (used+100 < BIG_BUF_SIZE))
{
nextt = t->next;
- restore_flags(flags);
+ local_irq_restore(flags);
used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
"d: %6li us data: 0x%08lX"
/* " func: 0x%08lX" */
@@ -768,14 +761,14 @@
t->data
/* , t->function */
);
- cli();
+ local_irq_save(flags);
if (t->next != nextt)
{
printk(KERN_WARNING "timer removed!\n");
}
t = nextt;
}
- restore_flags(flags);
+ local_irq_restore(flags);
}

if (used - offset < len)

2005-01-05 01:48:03

by James Nelson

[permalink] [raw]
Subject: [PATCH 1/2] cris: remove cli()/sti() in arch/cris/arch-v10/drivers/gpio.c

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

diff -urN --exclude='*~' linux-2.6.10-mm1-original/arch/cris/arch-v10/drivers/gpio.c linux-2.6.10-mm1/arch/cris/arch-v10/drivers/gpio.c
--- linux-2.6.10-mm1-original/arch/cris/arch-v10/drivers/gpio.c 2004-12-24 16:33:48.000000000 -0500
+++ linux-2.6.10-mm1/arch/cris/arch-v10/drivers/gpio.c 2005-01-04 20:21:46.356413860 -0500
@@ -270,10 +270,10 @@
*/
tmp = ~data & priv->highalarm & 0xFF;
tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
- save_flags(flags); cli();
+ local_irq_save(flags);
gpio_pa_irq_enabled_mask |= tmp;
*R_IRQ_MASK1_SET = tmp;
- restore_flags(flags);
+ local_irq_restore(flags);

} else if (priv->minor == GPIO_MINOR_B)
data = *R_PORT_PB_DATA;
@@ -372,7 +372,7 @@
data = *buf++;
if (priv->write_msb) {
for (i = 7; i >= 0;i--) {
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
*priv->port = *priv->shadow &= ~clk_mask;
if (data & 1<<i)
*priv->port = *priv->shadow |= data_mask;
@@ -384,7 +384,7 @@
}
} else {
for (i = 0; i <= 7;i++) {
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
*priv->port = *priv->shadow &= ~clk_mask;
if (data & 1<<i)
*priv->port = *priv->shadow |= data_mask;
@@ -491,14 +491,14 @@
*/
unsigned long flags;
if (USE_PORTS(priv)) {
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
*priv->dir = *priv->dir_shadow &=
~((unsigned char)arg & priv->changeable_dir);
local_irq_restore(flags);
return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */
} else if (priv->minor == GPIO_MINOR_G) {
/* We must fiddle with R_GEN_CONFIG to change dir */
- save_flags(flags); cli();
+ local_irq_save(flags)
if (((arg & dir_g_in_bits) != arg) &&
(arg & changeable_dir_g)) {
arg &= changeable_dir_g;
@@ -533,7 +533,7 @@
/* Must be a >120 ns delay before writing this again */

}
- restore_flags(flags);
+ local_irq_restore(flags);
return dir_g_in_bits;
}
return 0;
@@ -543,14 +543,14 @@
{
unsigned long flags;
if (USE_PORTS(priv)) {
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
*priv->dir = *priv->dir_shadow |=
((unsigned char)arg & priv->changeable_dir);
local_irq_restore(flags);
return *priv->dir_shadow;
} else if (priv->minor == GPIO_MINOR_G) {
/* We must fiddle with R_GEN_CONFIG to change dir */
- save_flags(flags); cli();
+ local_irq_save(flags);
if (((arg & dir_g_out_bits) != arg) &&
(arg & changeable_dir_g)) {
/* Set bits in genconfig to set to output */
@@ -583,7 +583,7 @@
*R_GEN_CONFIG = genconfig_shadow;
/* Must be a >120 ns delay before writing this again */
}
- restore_flags(flags);
+ local_irq_restore(flags);
return dir_g_out_bits & 0x7FFFFFFF;
}
return 0;
@@ -613,7 +613,7 @@
}
break;
case IO_SETBITS:
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
// set changeable bits with a 1 in arg
if (USE_PORTS(priv)) {
*priv->port = *priv->shadow |=
@@ -624,7 +624,7 @@
local_irq_restore(flags);
break;
case IO_CLRBITS:
- local_irq_save(flags); local_irq_disable();
+ local_irq_save(flags);
// clear changeable bits with a 1 in arg
if (USE_PORTS(priv)) {
*priv->port = *priv->shadow &=