semaphore cleanup
Subsystems (23)
cover semaphore cleanup
init_MUTEX[_LOCKED] and DECLARE_MUTEX are deprecated for quite some time. Cleanup the remaining users and remove the cruft.
Thanks,
tglx
PATCH 1/30 semaphore: Add DEFINE_SEMAPHORE
The full cleanup of init_MUTEX[_LOCKED] and DECLARE_MUTEX has not been done. Some of the users are real semaphores and we should name them as such instead of confusing everyone with "MUTEX".
Provide the infrastructure to get finally rid of init_MUTEX[_LOCKED] and DECLARE_MUTEX.
--- include/linux/semaphore.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/semaphore.h +3 -0
@@ -26,6 +26,9 @@ struct semaphore { .wait_list = LIST_HEAD_INIT((name).wait_list), \ } +#define DEFINE_SEMAPHORE (name) \ + struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) +#define DECLARE_MUTEX (name) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
PATCH 2/30 input: misc/hp_sdc_rtc: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/input/misc/hp_sdc_rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/hp_sdc_rtc.c +2 -2
@@ -104,7 +104,7 @@ static int hp_sdc_rtc_do_read_bbrtc (str t.endidx =91 ; t.seq = tseq; t.act.semaphore = &tsem; -init_MUTEX_LOCKED (&tsem); +sema_init (&tsem,0 );if (hp_sdc_enqueue_transaction (&t))return -1 ;
@@ -698,7 +698,7 @@ static int __init hp_sdc_rtc_init(void)return -ENODEV ;#endif -init_MUTEX (&i8042tregs); +sema_init (&i8042tregs,1 );if ((ret =hp_sdc_request_timer_irq (&hp_sdc_rtc_isr)))return ret;
Dmitry Torokhov
maintainerRe: [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup
Quoted 4 lines · Thomas Gleixner
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Dmitry Torokhov <[email protected]>
All 3 look good to me Thomas, please merge with the rest of the patch series.
Quoted 29 lines
--- drivers/input/misc/hp_sdc_rtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
linux-2.6/drivers/input/misc/hp_sdc_rtc.c
===================================================================drivers/input/misc/hp_sdc_rtc.c +2
-2@@ -104,7 +104,7 @@ static int hp_sdc_rtc_do_read_bbrtc (str t.endidx =91 ; t.seq = tseq; t.act.semaphore = &tsem; -init_MUTEX_LOCKED (&tsem); +sema_init (&tsem,0 );if (hp_sdc_enqueue_transaction (&t))return -1 ;@@ -698,7 +698,7 @@ static int __init hp_sdc_rtc_init(void)return -ENODEV ;#endif -init_MUTEX (&i8042tregs); +sema_init (&i8042tregs,1 );if ((ret =hp_sdc_request_timer_irq (&hp_sdc_rtc_isr)))return ret;
Signature · 1 line
Dmitry
[tip:core/locking] input: Misc/hp_sdc_rtc: semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 10d0ff83078d5ef99aaf94a2aaceb740f5ced923 Gitweb: http://git.kernel.org/tip/10d0ff83078d5ef99aaf94a2aaceb740f5ced923 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:31:58 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:07 +0200
input: Misc/hp_sdc_rtc: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/input/misc/hp_sdc_rtc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/hp_sdc_rtc.c +2 -2
@@ -104,7 +104,7 @@ static int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm) t.endidx =91 ; t.seq = tseq; t.act.semaphore = &tsem; -init_MUTEX_LOCKED (&tsem); +sema_init (&tsem,0 );if (hp_sdc_enqueue_transaction (&t))return -1 ;
@@ -698,7 +698,7 @@ static int __init hp_sdc_rtc_init(void)return -ENODEV ;#endif -init_MUTEX (&i8042tregs); +sema_init (&i8042tregs,1 );if ((ret =hp_sdc_request_timer_irq (&hp_sdc_rtc_isr)))return ret;
PATCH 3/30 input: serio/hil_mlc: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/input/serio/hil_mlc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/input/serio/hil_mlc.c +3 -3
@@ -915,15 +915,15 @@ int hil_mlc_register(hil_mlc *mlc) mlc->ostarted =0 ;rwlock_init (&mlc->lock); -init_MUTEX (&mlc->osem); +sema_init (&mlc->osem,1 ); -init_MUTEX (&mlc->isem); +sema_init (&mlc->isem,1 ); mlc->icount =-1 ; mlc->imatch =0 ; mlc->opercnt =0 ; -init_MUTEX_LOCKED (&(mlc->csem)); +sema_init (&(mlc->csem),0 );hil_mlc_clear_di_scratch (mlc);hil_mlc_clear_di_map (mlc,0 );
[tip:core/locking] input: Serio/hil_mlc: semaphore cleanup
Commit-ID: 45e8492f594dcb17e8cbb26edb2dd3018a68dada Gitweb: http://git.kernel.org/tip/45e8492f594dcb17e8cbb26edb2dd3018a68dada Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:01 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:08 +0200
input: Serio/hil_mlc: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/input/serio/hil_mlc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/input/serio/hil_mlc.c +3 -3
@@ -915,15 +915,15 @@ int hil_mlc_register(hil_mlc *mlc) mlc->ostarted =0 ;rwlock_init (&mlc->lock); -init_MUTEX (&mlc->osem); +sema_init (&mlc->osem,1 ); -init_MUTEX (&mlc->isem); +sema_init (&mlc->isem,1 ); mlc->icount =-1 ; mlc->imatch =0 ; mlc->opercnt =0 ; -init_MUTEX_LOCKED (&(mlc->csem)); +sema_init (&(mlc->csem),0 );hil_mlc_clear_di_scratch (mlc);hil_mlc_clear_di_map (mlc,0 );
PATCH 4/30 input: serio/hp_sdc: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/input/serio/hp_sdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/serio/hp_sdc.c +2 -2
@@ -905,7 +905,7 @@ static int __init hp_sdc_init(void) ts_sync[1 ] =0x0f ; ts_sync[2 ] = ts_sync[3 ] = ts_sync[4 ] = ts_sync[5 ] =0 ; t_sync.act.semaphore = &s_sync; -init_MUTEX_LOCKED (&s_sync); +sema_init (&s_sync,0 );hp_sdc_enqueue_transaction (&t_sync);down (&s_sync);/* Wait for t_sync to complete */
@@ -1039,7 +1039,7 @@ static int __init hp_sdc_register(void)return hp_sdc.dev_err; } -init_MUTEX_LOCKED (&tq_init_sem); +sema_init (&tq_init_sem,0 ); tq_init.actidx =0 ; tq_init.idx =1 ;
[tip:core/locking] input: Serio/hp_sdc: semaphore cleanup
Commit-ID: 4a4a506f81eebe63fb1b8e9e99f4bcd1fd9aac66 Gitweb: http://git.kernel.org/tip/4a4a506f81eebe63fb1b8e9e99f4bcd1fd9aac66 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:06 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:08 +0200
input: Serio/hp_sdc: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/input/serio/hp_sdc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/input/serio/hp_sdc.c +2 -2
@@ -905,7 +905,7 @@ static int __init hp_sdc_init(void) ts_sync[1 ] =0x0f ; ts_sync[2 ] = ts_sync[3 ] = ts_sync[4 ] = ts_sync[5 ] =0 ; t_sync.act.semaphore = &s_sync; -init_MUTEX_LOCKED (&s_sync); +sema_init (&s_sync,0 );hp_sdc_enqueue_transaction (&t_sync);down (&s_sync);/* Wait for t_sync to complete */
@@ -1039,7 +1039,7 @@ static int __init hp_sdc_register(void)return hp_sdc.dev_err; } -init_MUTEX_LOCKED (&tq_init_sem); +sema_init (&tq_init_sem,0 ); tq_init.actidx =0 ; tq_init.idx =1 ;
PATCH 5/30 net: 3c527: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/3c527.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/3c527.c +1 -1
@@ -522,7 +522,7 @@ static int __init mc32_probe1(struct net lp->tx_len = lp->exec_box->data[9 ];/* Transmit list count */ lp->rx_len = lp->exec_box->data[11 ];/* Receive list count */ -init_MUTEX_LOCKED (&lp->cmd_mutex); +sema_init (&lp->cmd_mutex,0 );init_completion (&lp->execution_cmd);init_completion (&lp->xceiver_cmd);
Re: [patch 05/30] net: 3c527: semaphore cleanup
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:10 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] net: 3c527: semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 50948ee8124c2125d833e8889002aa12a948b4e9 Gitweb: http://git.kernel.org/tip/50948ee8124c2125d833e8889002aa12a948b4e9 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:10 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:08 +0200
net: 3c527: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/3c527.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/3c527.c +1 -1
@@ -522,7 +522,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot) lp->tx_len = lp->exec_box->data[9 ];/* Transmit list count */ lp->rx_len = lp->exec_box->data[11 ];/* Receive list count */ -init_MUTEX_LOCKED (&lp->cmd_mutex); +sema_init (&lp->cmd_mutex,0 );init_completion (&lp->execution_cmd);init_completion (&lp->xceiver_cmd);
PATCH 6/30 hamradio: 6pack: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/hamradio/6pack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hamradio/6pack.c +1 -1
@@ -608,7 +608,7 @@ static int sixpack_open(struct tty_strucspin_lock_init (&sp->lock);atomic_set (&sp->refcnt,1 ); -init_MUTEX_LOCKED (&sp->dead_sem); +sema_init (&sp->dead_sem,0 );/* !!! length of the buffers. MTU is IP MTU, not PACLEN! */
Re: [patch 06/30] hamradio: 6pack: semaphore cleanup
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:14 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] hamradio: 6pack: semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 89d9f10d0b21268d3dba33db984ab03092861700 Gitweb: http://git.kernel.org/tip/89d9f10d0b21268d3dba33db984ab03092861700 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:14 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:08 +0200
hamradio: 6pack: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/hamradio/6pack.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/hamradio/6pack.c +1 -1
@@ -608,7 +608,7 @@ static int sixpack_open(struct tty_struct *tty)spin_lock_init (&sp->lock);atomic_set (&sp->refcnt,1 ); -init_MUTEX_LOCKED (&sp->dead_sem); +sema_init (&sp->dead_sem,0 );/* !!! length of the buffers. MTU is IP MTU, not PACLEN! */
PATCH 7/30 hamradio: mkiss: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/hamradio/mkiss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/hamradio/mkiss.c +1 -1
@@ -747,7 +747,7 @@ static int mkiss_open(struct tty_structspin_lock_init (&ax->buflock);atomic_set (&ax->refcnt,1 ); -init_MUTEX_LOCKED (&ax->dead_sem); +sema_init (&ax->dead_sem,0 ); ax->tty = tty; tty->disc_data = ax;
Re: [patch 07/30] hamradio: mkiss: semaphore cleanup
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:18 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] hamradio: Mkiss: semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 495e64bddeb9349395ed346177057fff7d52857e Gitweb: http://git.kernel.org/tip/495e64bddeb9349395ed346177057fff7d52857e Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:18 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:09 +0200
hamradio: Mkiss: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/hamradio/mkiss.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/hamradio/mkiss.c +1 -1
@@ -747,7 +747,7 @@ static int mkiss_open(struct tty_struct *tty)spin_lock_init (&ax->buflock);atomic_set (&ax->refcnt,1 ); -init_MUTEX_LOCKED (&ax->dead_sem); +sema_init (&ax->dead_sem,0 ); ax->tty = tty; tty->disc_data = ax;
PATCH 8/30 net: ppp_async: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/ppp_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp_async.c +1 -1
@@ -184,7 +184,7 @@ ppp_asynctty_open(struct tty_struct *ttytasklet_init (&ap->tsk, ppp_async_process, (unsigned long ) ap);atomic_set (&ap->refcnt,1 ); -init_MUTEX_LOCKED (&ap->dead_sem); +sema_init (&ap->dead_sem,0 ); ap->chan.private = ap; ap->chan.ops = &async_ops;
Re: [patch 08/30] net: ppp_async: semaphore cleanup
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:22 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] net: Ppp_async: semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 0bce198b7688911e072bd65032ab9278b577ee93 Gitweb: http://git.kernel.org/tip/0bce198b7688911e072bd65032ab9278b577ee93 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:22 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:09 +0200
net: Ppp_async: semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/ppp_async.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ppp_async.c +1 -1
@@ -184,7 +184,7 @@ ppp_asynctty_open(struct tty_struct *tty)tasklet_init (&ap->tsk, ppp_async_process, (unsigned long ) ap);atomic_set (&ap->refcnt,1 ); -init_MUTEX_LOCKED (&ap->dead_sem); +sema_init (&ap->dead_sem,0 ); ap->chan.private = ap; ap->chan.ops = &async_ops;
PATCH 9/30 net: wan/cosa.c: Convert "mutex" to semaphore
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/wan/cosa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/cosa.c +1 -1
@@ -575,7 +575,7 @@ static int cosa_probe(int base, int irq,/* Initialize the chardev data structures */ mutex_init (&chan->rlock); -init_MUTEX (&chan->wsem); +sema_init (&chan->wsem,1 );/* Register the network interface */ if (!(chan->netdev =alloc_hdlcdev (chan))) {
Re: [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:25 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] net: Wan/cosa.c: Convert "mutex" to semaphore
In reply to Thomas GleixnerCommit-ID: d1985508320ad40a68375bdbafa8a5d6c56d2114 Gitweb: http://git.kernel.org/tip/d1985508320ad40a68375bdbafa8a5d6c56d2114 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:25 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:09 +0200
net: Wan/cosa.c: Convert "mutex" to semaphore
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/wan/cosa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wan/cosa.c +1 -1
@@ -575,7 +575,7 @@ static int cosa_probe(int base, int irq, int dma)/* Initialize the chardev data structures */ mutex_init (&chan->rlock); -init_MUTEX (&chan->wsem); +sema_init (&chan->wsem,1 );/* Register the network interface */ if (!(chan->netdev =alloc_hdlcdev (chan))) {
PATCH 10/30 irda: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/net/irda/sir_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/irda/sir_dev.c +1 -1
@@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(con dev->tx_skb =NULL ;spin_lock_init (&dev->tx_lock); -init_MUTEX (&dev->fsm.sem); +sema_init (&dev->fsm.sem,1 ); dev->drv = drv; dev->netdev = ndev;
Re: [patch 10/30] irda: semaphore cleanup
From: Thomas Gleixner <[email protected]>
Date: Tue, 07 Sep 2010 14:32:30 -0000
Quoted 3 lines
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>
[tip:core/locking] irda: Semaphore cleanup
In reply to Thomas GleixnerCommit-ID: db7f859ec53c0bfaf3520afe2feafd18a27e48fb Gitweb: http://git.kernel.org/tip/db7f859ec53c0bfaf3520afe2feafd18a27e48fb Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:30 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:09 +0200
irda: Semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/net/irda/sir_dev.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/irda/sir_dev.c +1 -1
@@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n dev->tx_skb =NULL ;spin_lock_init (&dev->tx_lock); -init_MUTEX (&dev->fsm.sem); +sema_init (&dev->fsm.sem,1 ); dev->drv = drv; dev->netdev = ndev;
PATCH 11/30 parport: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/parport/share.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/parport/share.c +1 -1
@@ -306,7 +306,7 @@ struct parport *parport_register_port(unspin_lock_init (&tmp->pardevice_lock); tmp->ieee1284.mode =IEEE1284_MODE_COMPAT ; tmp->ieee1284.phase =IEEE1284_PH_FWD_IDLE ; -init_MUTEX_LOCKED (&tmp->ieee1284.irq);/* actually a semaphore at 0 */ +sema_init (&tmp->ieee1284.irq,0 ); tmp->spintime = parport_default_spintime;atomic_set (&tmp->ref_count,1 );INIT_LIST_HEAD (&tmp->full_list);
[tip:core/locking] parport: Semaphore cleanup
Commit-ID: a529f1505b6facfd0078dcb18a444976c1985962 Gitweb: http://git.kernel.org/tip/a529f1505b6facfd0078dcb18a444976c1985962 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:34 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:10 +0200
parport: Semaphore cleanup
Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- drivers/parport/share.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/parport/share.c +1 -1
@@ -306,7 +306,7 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma,spin_lock_init (&tmp->pardevice_lock); tmp->ieee1284.mode =IEEE1284_MODE_COMPAT ; tmp->ieee1284.phase =IEEE1284_PH_FWD_IDLE ; -init_MUTEX_LOCKED (&tmp->ieee1284.irq);/* actually a semaphore at 0 */ +sema_init (&tmp->ieee1284.irq,0 ); tmp->spintime = parport_default_spintime;atomic_set (&tmp->ref_count,1 );INIT_LIST_HEAD (&tmp->full_list);
PATCH 12/30 ibmphp-hpc: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/pci/hotplug/ibmphp_hpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/hotplug/ibmphp_hpc.c +2 -2
@@ -133,8 +133,8 @@ void __init ibmphp_hpc_initvars (void)debug ("%s - Entry\n" , __func__);mutex_init (&sem_hpcaccess); -init_MUTEX (&semOperations); -init_MUTEX_LOCKED (&sem_exit); +sema_init (&semOperations,1 ); +sema_init (&sem_exit,0 ); to_debug =0 ;debug ("%s - Exit\n" , __func__);
Jesse Barnes
AppliedRe: [patch 12/30] ibmphp-hpc: semaphore cleanup
Quoted 18 lines · On Tue, 07 Sep 2010 14:32:38 -0000 Thomas Gleixner <[email protected]> wrote:
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>Cc Jesse Barnes <[email protected]>--- drivers/pci/hotplug/ibmphp_hpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
linux-2.6/drivers/pci/hotplug/ibmphp_hpc.c
===================================================================
drivers/pci/hotplug/ibmphp_hpc.c void __init ibmphp_hpc_initvars (void) · line 140
Quoted 10 lines
drivers/pci/hotplug/ibmphp_hpc.c +2
-2@@ -133,8 +133,8 @@ void __init ibmphp_hpc_initvars (void)debug ("%s - Entry\n" , __func__);mutex_init (&sem_hpcaccess); -init_MUTEX (&semOperations); -init_MUTEX_LOCKED (&sem_exit); +sema_init (&semOperations,1 ); +sema_init (&sem_exit,0 ); to_debug =0 ;debug ("%s - Exit\n" , __func__);
Applied to my linux-next branch, thanks.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 13/30 usb: ftdi-elan: Convert "mutex" to semaphore
In reply to Thomas GleixnerThe "mutex" ftdi->sw_lock is used as a lock and a completion. Convert it to a real semaphore which allows both.
--- drivers/usb/misc/ftdi-elan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/ftdi-elan.c +1 -1
@@ -2769,7 +2769,7 @@ static int ftdi_elan_probe(struct usb_in ftdi->sequence_num = ++ftdi_instances;mutex_unlock (&ftdi_module_lock);ftdi_elan_init_kref (ftdi); -init_MUTEX (&ftdi->sw_lock); +sema_init (&ftdi->sw_lock,1 ); ftdi->udev =usb_get_dev (interface_to_usbdev (interface)); ftdi->interface = interface;mutex_init (&ftdi->u132_lock);
PATCH 14/30 scsi: aacraid semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/scsi/aacraid/commctrl.c | 2 +- drivers/scsi/aacraid/commsup.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/aacraid/commctrl.c +1 -1
@@ -190,7 +190,7 @@ static int open_getadapter_fib(struct aa/* * Initialize the mutex used to wait for the next AIF. */ -init_MUTEX_LOCKED (&fibctx->wait_sem); +sema_init (&fibctx->wait_sem,0 ); fibctx->wait =0 ;/* * Initialize the fibs and set the count of fibs on
drivers/scsi/aacraid/commsup.c +1 -1
@@ -124,7 +124,7 @@ int aac_fib_setup(struct aac_dev * dev) fibptr->hw_fib_va = hw_fib; fibptr->data = (void *) fibptr->hw_fib_va->data; fibptr->next = fibptr+1 ;/* Forward chain the fibs */ -init_MUTEX_LOCKED (&fibptr->event_wait); +sema_init (&fibptr->event_wait,0 );spin_lock_init (&fibptr->event_lock); hw_fib->header.XferState =cpu_to_le32 (0xffffffff ); hw_fib->header.SenderSize =cpu_to_le16 (dev->max_fib_size);
PATCH 15/30 smbfs: Convert server->sem to mutex
In reply to Thomas Gleixnerserver->sem is used as mutex so make it a mutex.
--- fs/smbfs/inode.c | 2 +- include/linux/smb_fs_sb.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
fs/smbfs/inode.c +1 -1
@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_b server->mnt =NULL ; server->sock_file =NULL ;init_waitqueue_head (&server->conn_wq); -init_MUTEX (&server->sem); +mutex_init (&server->mutex);INIT_LIST_HEAD (&server->entry);INIT_LIST_HEAD (&server->xmitq);INIT_LIST_HEAD (&server->recvq);
include/linux/smb_fs_sb.h +4 -4
@@ -58,7 +58,7 @@ struct smb_sb_info {struct smb_conn_opt opt;wait_queue_head_t conn_wq;int conn_complete; -struct semaphore sem; +struct mutex mutex;unsigned char header[SMB_HEADER_LEN +20 *2 +2 ];u32 header_len;
@@ -82,19 +82,19 @@ struct smb_sb_info {static inline int smb_lock_server_interruptible (struct smb_sb_info *server) { -return down_interruptible (&(server->sem)); +return mutex_lock_interruptible (&server->mutex); }static inline void smb_lock_server (struct smb_sb_info *server) { -down (&(server->sem)); +mutex_lock (&server->mutex); }static inline void smb_unlock_server (struct smb_sb_info *server) { -up (&(server->sem)); +mutex_unlock (&server->mutex); }#endif
Re: [patch 15/30] smbfs: Convert server->sem to mutex
Quoted 63 lines · On Tue, 07 Sep 2010 14:32:52 -0000 Thomas Gleixner <[email protected]> wrote:
server->semis used as mutex so make it a mutex.--- fs/smbfs/inode.c | 2 +- include/linux/smb_fs_sb.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)Index:
linux-2.6/fs/smbfs/inode.c
===================================================================fs/smbfs/inode.c +1
-1@@ -536,7 +536,7 @@ static int smb_fill_super(struct super_b server->mnt =NULL ; server->sock_file =NULL ;init_waitqueue_head (&server->conn_wq); -init_MUTEX (&server->sem); +mutex_init (&server->mutex);INIT_LIST_HEAD (&server->entry);INIT_LIST_HEAD (&server->xmitq);INIT_LIST_HEAD (&server->recvq);Index:
linux-2.6/include/linux/smb_fs_sb.h
===================================================================include/linux/smb_fs_sb.h +4
-5@@ -58,7 +58,7 @@ struct smb_sb_info {struct smb_conn_opt opt;wait_queue_head_t conn_wq;int conn_complete; -struct semaphore sem; +struct mutex mutex;unsigned char header[SMB_HEADER_LEN +20 *2 +2 ];u32 header_len;@@ -82,19 +82,19 @@ struct smb_sb_info {static inline int smb_lock_server_interruptible (struct smb_sb_info *server) { -return down_interruptible (&(server->sem)); +return mutex_lock_interruptible (&server->mutex); }static inline void smb_lock_server (struct smb_sb_info *server) { -down (&(server->sem)); +mutex_lock (&server->mutex); }static inline void smb_unlock_server (struct smb_sb_info *server) { -up (&(server->sem)); +mutex_unlock (&server->mutex); }#endif --
Quoted 5 lines
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/
Seems harmless...
PATCH 16/30 hpfs: Convert sbi->hpfs_creation_de to mutex
In reply to Thomas Gleixnersbi->hpfs_creation_de is used as mutex so make it a mutex.
--- fs/hpfs/buffer.c | 4 ++-- fs/hpfs/hpfs_fn.h | 2 +- fs/hpfs/super.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/hpfs/buffer.c +2 -2
@@ -14,7 +14,7 @@ void hpfs_lock_creation(struct super_blo#ifdef DEBUG_LOCKS printk ("lock creation\n" );#endif -down (&hpfs_sb (s)->hpfs_creation_de); +mutex_lock (&hpfs_sb (s)->hpfs_creation_de); }void hpfs_unlock_creation (struct super_block *s)
@@ -22,7 +22,7 @@ void hpfs_unlock_creation(struct super_b#ifdef DEBUG_LOCKS printk ("unlock creation\n" );#endif -up (&hpfs_sb (s)->hpfs_creation_de); +mutex_unlock (&hpfs_sb (s)->hpfs_creation_de); }/* Map a sector into a buffer and return pointers to it and to the buffer. */
fs/hpfs/hpfs_fn.h +1 -1
@@ -87,7 +87,7 @@ struct hpfs_sb_info {unsigned *sb_bmp_dir;/* main bitmap directory */ unsigned sb_c_bitmap;/* current bitmap */ unsigned sb_max_fwd_alloc;/* max forwad allocation */ -struct semaphore hpfs_creation_de;/* when creating dirents, nobody else +struct mutex hpfs_creation_de;/* when creating dirents, nobody else can alloc blocks */ /*unsigned sb_mounting : 1;*/ int sb_timeshift;
fs/hpfs/super.c +1 -1
@@ -487,7 +487,7 @@ static int hpfs_fill_super(struct super_ sbi->sb_bmp_dir =NULL ; sbi->sb_cp_table =NULL ; -init_MUTEX (&sbi->hpfs_creation_de); +mutex_init (&sbi->hpfs_creation_de); uid =current_uid (); gid =current_gid ();
[tip:core/locking] hpfs: Convert sbi->hpfs_creation_de to mutex
Commit-ID: 117bf5fbdbdc7a5394e5718b3354238961c83067 Gitweb: http://git.kernel.org/tip/117bf5fbdbdc7a5394e5718b3354238961c83067 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:32:56 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Sat, 30 Oct 2010 10:12:03 +0200
hpfs: Convert sbi->hpfs_creation_de to mutex
sbi->hpfs_creation_de is used as mutex so make it a mutex.
LKML-Reference: <[email protected]>
--- fs/hpfs/buffer.c | 4 ++-- fs/hpfs/hpfs_fn.h | 2 +- fs/hpfs/super.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/hpfs/buffer.c +2 -2
@@ -14,7 +14,7 @@ void hpfs_lock_creation(struct super_block *s)#ifdef DEBUG_LOCKS printk ("lock creation\n" );#endif -down (&hpfs_sb (s)->hpfs_creation_de); +mutex_lock (&hpfs_sb (s)->hpfs_creation_de); }void hpfs_unlock_creation (struct super_block *s)
@@ -22,7 +22,7 @@ void hpfs_unlock_creation(struct super_block *s)#ifdef DEBUG_LOCKS printk ("unlock creation\n" );#endif -up (&hpfs_sb (s)->hpfs_creation_de); +mutex_unlock (&hpfs_sb (s)->hpfs_creation_de); }/* Map a sector into a buffer and return pointers to it and to the buffer. */
fs/hpfs/hpfs_fn.h +1 -1
@@ -87,7 +87,7 @@ struct hpfs_sb_info {unsigned *sb_bmp_dir;/* main bitmap directory */ unsigned sb_c_bitmap;/* current bitmap */ unsigned sb_max_fwd_alloc;/* max forwad allocation */ -struct semaphore hpfs_creation_de;/* when creating dirents, nobody else +struct mutex hpfs_creation_de;/* when creating dirents, nobody else can alloc blocks */ /*unsigned sb_mounting : 1;*/ int sb_timeshift;
fs/hpfs/super.c +1 -1
@@ -491,7 +491,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) sbi->sb_bmp_dir =NULL ; sbi->sb_cp_table =NULL ; -init_MUTEX (&sbi->hpfs_creation_de); +mutex_init (&sbi->hpfs_creation_de); uid =current_uid (); gid =current_gid ();
PATCH 17/30 hpfsplus: Convert tree_lock to mutex
In reply to Thomas Gleixnertree_lock is used as mutex so make it a mutex.
--- fs/hfsplus/bfind.c | 4 ++-- fs/hfsplus/btree.c | 2 +- fs/hfsplus/hfsplus_fs.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/hfsplus/bfind.c +2 -2
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ;dprint (DBG_BNODE_REFS ,"find_init: %d (%p)\n" , tree->cnid,__builtin_return_address (0 )); -down (&tree->tree_lock); +mutex_lock (&tree->tree_lock);return 0 ; }
@@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_datahfs_bnode_put (fd->bnode);kfree (fd->search_key);dprint (DBG_BNODE_REFS ,"find_exit: %d (%p)\n" , fd->tree->cnid,__builtin_return_address (0 )); -up (&fd->tree->tree_lock); +mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ; }
fs/hfsplus/btree.c +1 -1
@@ -30,7 +30,7 @@ struct hfs_btree *hfs_btree_open(structif (!tree)return NULL ; -init_MUTEX (&tree->tree_lock); +mutex_init (&tree->tree_lock);spin_lock_init (&tree->hash_lock); tree->sb = sb; tree->cnid = id;
fs/hfsplus/hfsplus_fs.h +1 -1
@@ -62,7 +62,7 @@ struct hfs_btree {unsigned int depth;//unsigned int map1_size, map_size; -struct semaphore tree_lock; +struct mutex tree_lock;unsigned int pages_per_bnode;spinlock_t hash_lock;
PATCH 18/30 hfs: Convert tree_lock to mutex
In reply to Thomas Gleixnertree_lock is used as mutex so make it a mutex.
--- fs/hfs/bfind.c | 4 ++-- fs/hfs/btree.c | 2 +- fs/hfs/btree.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/hfs/bfind.c +2 -2
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ;dprint (DBG_BNODE_REFS ,"find_init: %d (%p)\n" , tree->cnid,__builtin_return_address (0 )); -down (&tree->tree_lock); +mutex_lock (&tree->tree_lock);return 0 ; }
@@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_datahfs_bnode_put (fd->bnode);kfree (fd->search_key);dprint (DBG_BNODE_REFS ,"find_exit: %d (%p)\n" , fd->tree->cnid,__builtin_return_address (0 )); -up (&fd->tree->tree_lock); +mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ; }
fs/hfs/btree.c +1 -1
@@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(structif (!tree)return NULL ; -init_MUTEX (&tree->tree_lock); +mutex_init (&tree->tree_lock);spin_lock_init (&tree->hash_lock);/* Set the correct compare function */ tree->sb = sb;
fs/hfs/btree.h +1 -1
@@ -33,7 +33,7 @@ struct hfs_btree {unsigned int depth;//unsigned int map1_size, map_size; -struct semaphore tree_lock; +struct mutex tree_lock;unsigned int pages_per_bnode;spinlock_t hash_lock;
[tip:core/locking] hfs: Convert tree_lock to mutex
Commit-ID: 4a9410355406c31695eab9daeba694d7d9714e9b Gitweb: http://git.kernel.org/tip/4a9410355406c31695eab9daeba694d7d9714e9b Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:33:08 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:11 +0200
hfs: Convert tree_lock to mutex
tree_lock is used as mutex so make it a mutex.
LKML-Reference: <[email protected]>
--- fs/hfs/bfind.c | 4 ++-- fs/hfs/btree.c | 2 +- fs/hfs/btree.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/hfs/bfind.c +2 -2
@@ -23,7 +23,7 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) fd->search_key = ptr; fd->key = ptr + tree->max_key_len +2 ;dprint (DBG_BNODE_REFS ,"find_init: %d (%p)\n" , tree->cnid,__builtin_return_address (0 )); -down (&tree->tree_lock); +mutex_lock (&tree->tree_lock);return 0 ; }
@@ -32,7 +32,7 @@ void hfs_find_exit(struct hfs_find_data *fd)hfs_bnode_put (fd->bnode);kfree (fd->search_key);dprint (DBG_BNODE_REFS ,"find_exit: %d (%p)\n" , fd->tree->cnid,__builtin_return_address (0 )); -up (&fd->tree->tree_lock); +mutex_unlock (&fd->tree->tree_lock); fd->tree =NULL ; }
fs/hfs/btree.c +1 -1
@@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp keif (!tree)return NULL ; -init_MUTEX (&tree->tree_lock); +mutex_init (&tree->tree_lock);spin_lock_init (&tree->hash_lock);/* Set the correct compare function */ tree->sb = sb;
fs/hfs/btree.h +1 -1
@@ -33,7 +33,7 @@ struct hfs_btree {unsigned int depth;//unsigned int map1_size, map_size; -struct semaphore tree_lock; +struct mutex tree_lock;unsigned int pages_per_bnode;spinlock_t hash_lock;
PATCH 19/30 affs: use sema_init instead of init_MUTEX
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- fs/affs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/affs/super.c +2 -2
@@ -109,8 +109,8 @@ static void init_once(void *foo) {struct affs_inode_info *ei = (struct affs_inode_info *) foo; -init_MUTEX (&ei->i_link_lock); -init_MUTEX (&ei->i_ext_lock); +sema_init (&ei->i_link_lock,1 ); +sema_init (&ei->i_ext_lock,1 );inode_init_once (&ei->vfs_inode); }
[tip:core/locking] affs: Use sema_init instead of init_MUTEX
Commit-ID: 756b0322e50aebc4b9afb4488a2d3f6c802b4e64 Gitweb: http://git.kernel.org/tip/756b0322e50aebc4b9afb4488a2d3f6c802b4e64 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:33:11 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:39:25 +0200
affs: Use sema_init instead of init_MUTEX
Get rid of init_MUTE() and use sema_init() instead.
LKML-Reference: <[email protected]>
--- fs/affs/super.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
fs/affs/super.c +2 -2
@@ -109,8 +109,8 @@ static void init_once(void *foo) {struct affs_inode_info *ei = (struct affs_inode_info *) foo; -init_MUTEX (&ei->i_link_lock); -init_MUTEX (&ei->i_ext_lock); +sema_init (&ei->i_link_lock,1 ); +sema_init (&ei->i_ext_lock,1 );inode_init_once (&ei->vfs_inode); }
PATCH 20/30 xfs: semaphore cleanup
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- fs/xfs/linux-2.6/xfs_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/linux-2.6/xfs_buf.c +1 -1
@@ -189,7 +189,7 @@ _xfs_buf_initialize(init_completion (&bp->b_iowait);INIT_LIST_HEAD (&bp->b_list);INIT_LIST_HEAD (&bp->b_hash_list); -init_MUTEX_LOCKED (&bp->b_sema);/* held, no waiters */ +sema_init (&bp->b_sema,0 );/* held, no waiters */ XB_SET_OWNER (bp); bp->b_target = target; bp->b_file_offset = range_base;
PATCH 21/30 mmc: Convert "mutex" to semaphore
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/mmc/card/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/card/queue.c +1 -1
@@ -209,7 +209,7 @@ int mmc_init_queue(struct mmc_queue *mq,sg_init_table (mq->sg, host->max_phys_segs); } -init_MUTEX (&mq->thread_sem); +sema_init (&mq->thread_sem,1 ); mq->thread =kthread_run (mmc_queue_thread, mq,"mmcqd" );if (IS_ERR (mq->thread)) {
Chris Ball
AppliedRe: [patch 21/30] mmc: Convert "mutex" to semaphore
Hi,
Quoted 16 lines · Thomas Gleixner
Get rid of init_MUTEX[_LOCKED]() and use
sema_init()instead.Signed-off-by Thomas Gleixner <[email protected]>--- drivers/mmc/card/queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
linux-2.6/drivers/mmc/card/queue.c
===================================================================
drivers/mmc/card/queue.c int mmc_init_queue(struct mmc_queue *mq, · line 215
Quoted 8 lines
drivers/mmc/card/queue.c +1
-1@@ -209,7 +209,7 @@ int mmc_init_queue(struct mmc_queue *mq,sg_init_table (mq->sg, host->max_phys_segs); } -init_MUTEX (&mq->thread_sem); +sema_init (&mq->thread_sem,1 ); mq->thread =kthread_run (mmc_queue_thread, mq,"mmcqd" );if (IS_ERR (mq->thread)) {
Thanks, applied to mmc-next.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
PATCH 22/30 dvb: Convert "mutex" to semaphore
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/media/dvb/dvb-core/dvb_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb/dvb-core/dvb_frontend.c +2 -2
@@ -702,7 +702,7 @@ static void dvb_frontend_stop(struct dvbkthread_stop (fepriv->thread); -init_MUTEX (&fepriv->sem); +sema_init (&fepriv->sem,1 ); fepriv->state =FESTATE_IDLE ;/* paranoia check in case a signal arrived */
@@ -2061,7 +2061,7 @@ int dvb_register_frontend(struct dvb_ada } fepriv = fe->frontend_priv; -init_MUTEX (&fepriv->sem); +sema_init (&fepriv->sem,1 );init_waitqueue_head (&fepriv->wait_queue);init_waitqueue_head (&fepriv->events.wait_queue);mutex_init (&fepriv->events.mtx);
PATCH 23/30 infiniband: Make user_mad semaphore a real one
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- drivers/infiniband/core/user_mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/user_mad.c +1 -1
@@ -1022,7 +1022,7 @@ static int ib_umad_init_port(struct ib_d port->ib_dev = device; port->port_num = port_num; -init_MUTEX (&port->sm_sem); +sema_init (&port->sm_sem,1 );mutex_init (&port->file_mutex);INIT_LIST_HEAD (&port->file_list);
Roland Dreier
AppliedRe: [patch 23/30] infiniband: Make user_mad semaphore a real one
thanks, applied.
PATCH 24/30 ia64: salinfo: sema_init instead of init_MUTEX
In reply to Thomas GleixnerGet rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
--- arch/ia64/kernel/salinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6/arch/ia64/kernel/salinfo.c =================================--- linux-2.6.orig/arch/ia64/kernel/salinfo.c +++ linux-2.6/arch/ia64/kernel/salinfo.c
@@ -642,7 +642,7 @@ salinfo_init(void)
for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
data = salinfo_data + i;
data->type = i;
- init_MUTEX(&data->mutex);
+ sema_init(&data->mutex, 1);
dir = proc_mkdir(salinfo_log_name[i], salinfo_dir); if (!dir)
continue;
PATCH 25/30 drivers/macintosh/adb: Do not claim that the semaphore is a mutex
In reply to Thomas GleixnerUser DEFINE_SEMAPHORE() instead of DECLARE_MUTEX()
--- drivers/macintosh/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +1 -1
@@ -83,7 +83,7 @@ static struct adb_driver *adb_controllerBLOCKING_NOTIFIER_HEAD (adb_client_list);static int adb_got_sleep;static int adb_inited; -static DECLARE_MUTEX (adb_probe_mutex); +static DEFINE_SEMAPHORE (adb_probe_mutex);static int sleepy_trackpad;static int autopoll_devs;int __adb_probe_sync;
[tip:core/locking] drivers/macintosh/adb: Do not claim that the semaphore is a mutex
Commit-ID: 8192b1f6b1a46b33213b993471356495a93ffc70 Gitweb: http://git.kernel.org/tip/8192b1f6b1a46b33213b993471356495a93ffc70 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:33:40 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:10 +0200
drivers/macintosh/adb: Do not claim that the semaphore is a mutex
User DEFINE_SEMAPHORE() instead of DECLARE_MUTEX()
LKML-Reference: <[email protected]>
--- drivers/macintosh/adb.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/macintosh/adb.c +1 -1
@@ -83,7 +83,7 @@ static struct adb_driver *adb_controller;BLOCKING_NOTIFIER_HEAD (adb_client_list);static int adb_got_sleep;static int adb_inited; -static DECLARE_MUTEX (adb_probe_mutex); +static DEFINE_SEMAPHORE (adb_probe_mutex);static int sleepy_trackpad;static int autopoll_devs;int __adb_probe_sync;
PATCH 26/30 printk: Make console_sem a semaphore not a pseudo mutex
In reply to Thomas GleixnerIt needs to be investigated whether it can be replaced by a real mutex, but that needs more thought.
--- kernel/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/printk.c +2 -2
@@ -85,7 +85,7 @@ EXPORT_SYMBOL(oops_in_progress);* provides serialisation for access to the entire console * driver system. */ -static DECLARE_MUTEX (console_sem); +static DEFINE_SEMAPHORE (console_sem);struct console *console_drivers;EXPORT_SYMBOL_GPL (console_drivers);
@@ -556,7 +556,7 @@ static void zap_locks(void)/* If a crash is occurring, make sure we can't deadlock */ spin_lock_init (&logbuf_lock);/* And make sure that we print immediately */ -init_MUTEX (&console_sem); +sema_init (&console_sem,1 ); }#if defined(CONFIG_PRINTK_TIME )
[tip:core/locking] printk: Make console_sem a semaphore not a pseudo mutex
Commit-ID: 5b8c4f23c54edda640a4850bc9b81dee70acb525 Gitweb: http://git.kernel.org/tip/5b8c4f23c54edda640a4850bc9b81dee70acb525 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:33:43 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:10 +0200
printk: Make console_sem a semaphore not a pseudo mutex
It needs to be investigated whether it can be replaced by a real mutex, but that needs more thought.
LKML-Reference: <[email protected]>
--- kernel/printk.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/printk.c +2 -2
@@ -85,7 +85,7 @@ EXPORT_SYMBOL(oops_in_progress);* provides serialisation for access to the entire console * driver system. */ -static DECLARE_MUTEX (console_sem); +static DEFINE_SEMAPHORE (console_sem);struct console *console_drivers;EXPORT_SYMBOL_GPL (console_drivers);
@@ -556,7 +556,7 @@ static void zap_locks(void)/* If a crash is occurring, make sure we can't deadlock */ spin_lock_init (&logbuf_lock);/* And make sure that we print immediately */ -init_MUTEX (&console_sem); +sema_init (&console_sem,1 ); }#if defined(CONFIG_PRINTK_TIME )
PATCH 27/30 staging: Bulk convert the semaphore mess
In reply to Thomas Gleixnerinit_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert staging users.
--- drivers/staging/comedi/drivers/dt9812.c | 2 +- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- drivers/staging/comedi/drivers/usbduxfast.c | 4 ++-- drivers/staging/cxt1e1/functions.c | 4 ++-- drivers/staging/dream/pmem.c | 2 +- drivers/staging/msm/mddihost.c | 2 +- drivers/staging/msm/mdp.c | 10 +++++----- drivers/staging/msm/msm_fb.c | 2 +- drivers/staging/otus/wwrap.c | 2 +- drivers/staging/rt2860/common/rtmp_init.c | 2 +- drivers/staging/solo6x10/solo6010-i2c.c | 2 +- drivers/staging/solo6x10/solo6010-p2m.c | 2 +- drivers/staging/vme/devices/vme_user.c | 2 +- 13 files changed, 20 insertions(+), 20 deletions(-)
drivers/staging/comedi/drivers/dt9812.c +1 -1
@@ -1128,7 +1128,7 @@ static int __init usb_dt9812_init(void)/* Initialize all driver slots */ for (i =0 ; i <DT9812_NUM_SLOTS ; i++) { -init_MUTEX (&dt9812[i].mutex); +sema_init (&dt9812[i].mutex,1 ); dt9812[i].serial =0 ; dt9812[i].usb =NULL ; dt9812[i].comedi =NULL ;
drivers/staging/comedi/drivers/usbdux.c +2 -2
@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * Stops the data acquision
@@ -2367,7 +2367,7 @@ static int usbduxsub_probe(struct usb_indev_dbg (dev,"comedi_: usbdux: " "usbduxsub[%d] is ready to connect to comedi.\n" , index); -init_MUTEX (&(usbduxsub[index].sem)); +sema_init (&(usbduxsub[index].sem),1 );/* save a pointer to the usb device */ usbduxsub[index].usbdev = udev;
drivers/staging/comedi/drivers/usbduxfast.c +2 -2
@@ -199,7 +199,7 @@ struct usbduxfastsub_s {*/ static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * bulk transfers to usbduxfast
@@ -1504,7 +1504,7 @@ static int usbduxfastsub_probe(struct us "connect to comedi.\n", index);#endif -init_MUTEX (&(usbduxfastsub[index].sem)); +sema_init (&(usbduxfastsub[index].sem),1 );/* save a pointer to the usb device */ usbduxfastsub[index].usbdev = udev;
drivers/staging/cxt1e1/functions.c +2 -2
@@ -184,10 +184,10 @@ OS_sem_init (void *sem, int state)switch (state) {case SEM_TAKEN : -init_MUTEX_LOCKED ((struct semaphore *) sem); +sema_init ((struct semaphore *) sem,0 );break ;case SEM_AVAILABLE : -init_MUTEX ((struct semaphore *) sem); +sema_init ((struct semaphore *) sem,1 );break ;default :/* otherwise, set sem.count to state's * value */
drivers/staging/dream/pmem.c +1 -1
@@ -1231,7 +1231,7 @@ int pmem_setup(struct android_pmem_platf pmem[id].ioctl = ioctl; pmem[id].release = release;init_rwsem (&pmem[id].bitmap_sem); -init_MUTEX (&pmem[id].data_list_sem); +sema_init (&pmem[id].data_list_sem,1 );INIT_LIST_HEAD (&pmem[id].data_list); pmem[id].dev.name = pdata->name; pmem[id].dev.minor = id;
drivers/staging/msm/mddihost.c +1 -1
@@ -67,7 +67,7 @@ void mddi_init(void) mddi_host_initialized = TRUE; -init_MUTEX (&mddi_host_mutex); +sema_init (&mddi_host_mutex,1 );if (!mddi_host_powered) {down (&mddi_host_mutex);
drivers/staging/msm/mdp.c +5 -5
@@ -669,24 +669,24 @@ static void mdp_drv_init(void)/* initialize semaphore */ init_completion (&mdp_ppp_comp); -init_MUTEX (&mdp_ppp_mutex); -init_MUTEX (&mdp_pipe_ctrl_mutex); +sema_init (&mdp_ppp_mutex,1 ); +sema_init (&mdp_pipe_ctrl_mutex,1 ); dma2_data.busy = FALSE; dma2_data.waiting = FALSE;init_completion (&dma2_data.comp); -init_MUTEX (&dma2_data.mutex); +sema_init (&dma2_data.mutex,1 );mutex_init (&dma2_data.ov_mutex); dma3_data.busy = FALSE; dma3_data.waiting = FALSE;init_completion (&dma3_data.comp); -init_MUTEX (&dma3_data.mutex); +sema_init (&dma3_data.mutex,1 ); dma_s_data.busy = FALSE; dma_s_data.waiting = FALSE;init_completion (&dma_s_data.comp); -init_MUTEX (&dma_s_data.mutex); +sema_init (&dma_s_data.mutex,1 ); dma_e_data.busy = FALSE; dma_e_data.waiting = FALSE;
drivers/staging/msm/msm_fb.c +1 -1
@@ -915,7 +915,7 @@ static int msm_fb_register(struct msm_fb mfd->pan_waiting = FALSE;init_completion (&mfd->pan_comp);init_completion (&mfd->refresher_comp); -init_MUTEX (&mfd->sem); +sema_init (&mfd->sem,1 ); fbram_offset =PAGE_ALIGN ((int )fbram)-(int )fbram; fbram += fbram_offset;
drivers/staging/otus/wwrap.c +1 -1
@@ -985,7 +985,7 @@ u8_t zfLnxCreateThread(zdev_t *dev)/* Create Mutex and keventd */ INIT_WORK (&macp->kevent, kevent); -init_MUTEX (&macp->ioctl_sem); +sema_init (&macp->ioctl_sem,1 );return 0 ; }
drivers/staging/rt2860/common/rtmp_init.c +1 -1
@@ -3509,7 +3509,7 @@ int RtmpRaDevCtrlInit(struct rt_rtmp_ada ("STA Driver version-%s\n", STA_DRIVER_VERSION));#ifdef RTMP_MAC_USB -init_MUTEX (&(pAd->UsbVendorReq_semaphore)); +sema_init (&(pAd->UsbVendorReq_semaphore),1 );os_alloc_mem (pAd, (u8 **) & pAd->UsbVendorReqBuf,MAX_PARAM_BUFFER_SIZE -1 );if (pAd->UsbVendorReqBuf ==NULL ) {
drivers/staging/solo6x10/solo6010-i2c.c +1 -1
@@ -284,7 +284,7 @@ int solo_i2c_init(struct solo6010_dev *s solo_dev->i2c_id =-1 ; solo_dev->i2c_state =IIC_STATE_IDLE ;init_waitqueue_head (&solo_dev->i2c_wait); -init_MUTEX (&solo_dev->i2c_sem); +sema_init (&solo_dev->i2c_sem,1 );for (i =0 ; i <SOLO_I2C_ADAPTERS ; i++) {struct i2c_adapter *adap = &solo_dev->i2c_adap[i];
drivers/staging/solo6x10/solo6010-p2m.c +1 -1
@@ -188,7 +188,7 @@ int solo_p2m_init(struct solo6010_dev *sfor (i =0 ; i <SOLO_NR_P2M ; i++) { p2m_dev = &solo_dev->p2m_dev[i]; -init_MUTEX (&p2m_dev->sem); +sema_init (&p2m_dev->sem,1 );init_completion (&p2m_dev->completion); solo_reg_write(solo_dev, SOLO_P2M_DES_ADR(i),
drivers/staging/vme/devices/vme_user.c +1 -1
@@ -683,7 +683,7 @@ static int __init vme_user_probe(structfor (i =0 ; i <VME_DEVS ; i++) { image[i].kern_buf =NULL ; image[i].pci_buf =0 ; -init_MUTEX (&(image[i].sem)); +sema_init (&(image[i].sem),1 ); image[i].device =NULL ; image[i].resource =NULL ; image[i].users =0 ;
Re: [patch 27/30] staging: Bulk convert the semaphore mess
Quoted 2 lines · Thomas Gleixner
init_MUTEX(_LOCKED)andDECLARE_MUTEXare going away. Bulk convert staging users.
I don't think you actually built this change:
drivers/staging/comedi/drivers/usbdux.c struct usbduxsub { · line 321
Quoted 11 lines
drivers/staging/comedi/drivers/usbdux.c +1
-1@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * Stops the data acquision
I don't see DEFINE_SEMAPHORE() in Linus's tree, what should we use instead?
thanks,
greg k-h
Re: [patch 27/30] staging: Bulk convert the semaphore mess
Quoted 12 lines · Greg KH
Quoted 2 lines · Thomas Gleixner
init_MUTEX(_LOCKED)andDECLARE_MUTEXare going away. Bulk convert staging users.I don't think you actually built this change:
Quoted 6 lines
drivers/staging/comedi/drivers/usbdux.c +0
-0@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ];
Quoted 8 lines
drivers/staging/comedi/drivers/usbdux.c struct usbduxsub { · line 321
Quoted 5 lines
drivers/staging/comedi/drivers/usbdux.c +1
-1-static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * Stops the data acquision I don't see
DEFINE_SEMAPHORE()in Linus's tree, what should we use instead?
It's the first patch in the series, which I want to get Linus wards now, so this does not trip over.
Thanks,
tglx
Re: [patch 27/30] staging: Bulk convert the semaphore mess
Quoted 17 lines · Thomas Gleixner
Quoted 15 lines · Greg KH
Quoted 2 lines · Thomas Gleixner
init_MUTEX(_LOCKED)andDECLARE_MUTEXare going away. Bulk convert staging users.I don't think you actually built this change:
Quoted 9 lines
drivers/staging/comedi/drivers/usbdux.c +1
-1@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);
Quoted 8 lines
Quoted 5 lines
drivers/staging/comedi/drivers/usbdux.c struct usbduxsub { · line 321
Quoted 2 lines
drivers/staging/comedi/drivers/usbdux.c +0
-0/* * Stops the data acquision I don't see
DEFINE_SEMAPHORE()in Linus's tree, what should we use instead?It's the first patch in the series, which I want to get Linus wards now, so this does not trip over.
Ah, that makes sense.
Well, it didn't hurt for me to take the other portions of this patch, right?
thanks,
greg k-h
Re: [patch 27/30] staging: Bulk convert the semaphore mess
Quoted 24 lines · Greg KH
Quoted 23 lines · Thomas Gleixner
Quoted 20 lines · Greg KH
Quoted 2 lines · Thomas Gleixner
init_MUTEX(_LOCKED)andDECLARE_MUTEXare going away. Bulk convert staging users.I don't think you actually built this change:
drivers/staging/comedi/drivers/usbdux.c struct usbduxsub { · line 321
Quoted 11 lines
drivers/staging/comedi/drivers/usbdux.c +1
-1@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * Stops the data acquision I don't see
DEFINE_SEMAPHORE()in Linus's tree, what should we use instead?
Quoted 7 lines
Quoted 2 lines
It's the first patch in the series, which I want to get Linus wards now, so this does not trip over.
Ah, that makes sense.
Well, it didn't hurt for me to take the other portions of this patch, right?
Not at all. FYI, DEFINE_SEMAPHORE is now in Linus tree.
Thanks,
tglx
Re: [patch 27/30] staging: Bulk convert the semaphore mess
In reply to Thomas GleixnerQuoted 6 lines · Thomas Gleixner
init_MUTEX(_LOCKED)andDECLARE_MUTEXare going away. Bulk convert staging users.--- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- drivers/staging/comedi/drivers/usbduxfast.c | 4 ++--
I applied the patch with the exception of these two files, as they fail to build with the patch applied.
thanks,
greg k-h
[tip:core/locking] staging: Final semaphore cleanup
In reply to Thomas GleixnerCommit-ID: 45f4d0243525b6bc747c946937ced437b135a84d Gitweb: http://git.kernel.org/tip/45f4d0243525b6bc747c946937ced437b135a84d Author: Thomas Gleixner <[email protected]> AuthorDate: Sat, 30 Oct 2010 11:06:57 +0200 Committer: Thomas Gleixner <[email protected]> CommitDate: Sat, 30 Oct 2010 12:12:50 +0200
staging: Final semaphore cleanup
Fixup the last remaining users of DECLARE_MUTEX and init_MUTEX.
Scripted conversion, resulting code is binary equivalent.
LKML-Reference: <[email protected]>
--- drivers/staging/ath6kl/os/linux/ar6000_raw_if.c | 4 ++-- drivers/staging/brcm80211/brcmfmac/dhd_linux.c | 4 ++-- drivers/staging/brcm80211/sys/wl_mac80211.c | 2 +- drivers/staging/comedi/drivers/dt9812.c | 2 +- drivers/staging/comedi/drivers/usbdux.c | 4 ++-- drivers/staging/comedi/drivers/usbduxfast.c | 4 ++-- drivers/staging/dream/camera/mt9d112.c | 2 +- drivers/staging/dream/camera/mt9p012_fox.c | 2 +- drivers/staging/dream/camera/mt9t013.c | 2 +- drivers/staging/dream/camera/s5k3e2fx.c | 2 +- drivers/staging/msm/msm_fb.c | 4 ++-- drivers/staging/rtl8712/osdep_service.h | 2 +- drivers/staging/smbfs/inode.c | 2 +- .../westbridge/astoria/block/cyasblkdev_block.c | 2 +- .../westbridge/astoria/block/cyasblkdev_queue.c | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-)
drivers/staging/ath6kl/os/linux/ar6000_raw_if.c +2 -2
@@ -198,8 +198,8 @@ int ar6000_htc_raw_open(AR_SOFTC_T *ar)for (streamID =HTC_RAW_STREAM_0 ; streamID <HTC_RAW_STREAM_NUM_MAX ; streamID++) {/* Initialize the data structures */ -init_MUTEX (&arRaw->raw_htc_read_sem[streamID]); -init_MUTEX (&arRaw->raw_htc_write_sem[streamID]); +sema_init (&arRaw->raw_htc_read_sem[streamID],1 ); +sema_init (&arRaw->raw_htc_write_sem[streamID],1 );init_waitqueue_head (&arRaw->raw_htc_read_queue[streamID]);init_waitqueue_head (&arRaw->raw_htc_write_queue[streamID]);
drivers/staging/brcm80211/brcmfmac/dhd_linux.c +2 -2
@@ -1929,7 +1929,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) goto fail; net->netdev_ops =NULL ; -init_MUTEX (&dhd->proto_sem); +sema_init (&dhd->proto_sem,1 );/* Initialize other structure content */ init_waitqueue_head (&dhd->ioctl_resp_wait);init_waitqueue_head (&dhd->ctrl_wait);
@@ -1977,7 +1977,7 @@ dhd_pub_t *dhd_attach(osl_t *osh, struct dhd_bus *bus, uint bus_hdrlen) dhd->timer.function = dhd_watchdog;/* Initialize thread based operation and lock */ -init_MUTEX (&dhd->sdsem); +sema_init (&dhd->sdsem,1 );if ((dhd_watchdog_prio >=0 ) && (dhd_dpc_prio >=0 )) dhd->threads_only = true;else
drivers/staging/brcm80211/sys/wl_mac80211.c +1 -1
@@ -866,7 +866,7 @@ static wl_info_t *wl_attach(u16 vendor, u16 device, unsigned long regs,spin_lock_init (&wl->rpcq_lock);spin_lock_init (&wl->txq_lock); -init_MUTEX (&wl->sem); +sema_init (&wl->sem,1 );#else spin_lock_init (&wl->lock);spin_lock_init (&wl->isr_lock);
drivers/staging/comedi/drivers/dt9812.c +1 -1
@@ -262,7 +262,7 @@ struct dt9812_usb_cmd {#define DT9812_NUM_SLOTS 16 -static DECLARE_MUTEX (dt9812_mutex); +static DEFINE_SEMAPHORE (dt9812_mutex);static const struct usb_device_id dt9812_table[] = { {USB_DEVICE (0x0867 ,0x9812 )},
drivers/staging/comedi/drivers/usbdux.c +2 -2
@@ -315,7 +315,7 @@ struct usbduxsub {*/ static struct usbduxsub usbduxsub[NUMUSBDUX ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * Stops the data acquision
@@ -2367,7 +2367,7 @@ static int usbduxsub_probe(struct usb_interface *uinterf,dev_dbg (dev,"comedi_: usbdux: " "usbduxsub[%d] is ready to connect to comedi.\n" , index); -init_MUTEX (&(usbduxsub[index].sem)); +sema_init (&(usbduxsub[index].sem),1 );/* save a pointer to the usb device */ usbduxsub[index].usbdev = udev;
drivers/staging/comedi/drivers/usbduxfast.c +2 -2
@@ -199,7 +199,7 @@ struct usbduxfastsub_s {*/ static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST ]; -static DECLARE_MUTEX (start_stop_sem); +static DEFINE_SEMAPHORE (start_stop_sem);/* * bulk transfers to usbduxfast
@@ -1504,7 +1504,7 @@ static int usbduxfastsub_probe(struct usb_interface *uinterf, "connect to comedi.\n", index);#endif -init_MUTEX (&(usbduxfastsub[index].sem)); +sema_init (&(usbduxfastsub[index].sem),1 );/* save a pointer to the usb device */ usbduxfastsub[index].usbdev = udev;
drivers/staging/dream/camera/mt9d112.c +1 -1
@@ -37,7 +37,7 @@ struct mt9d112_ctrl {static struct mt9d112_ctrl *mt9d112_ctrl;static DECLARE_WAIT_QUEUE_HEAD (mt9d112_wait_queue); -DECLARE_MUTEX (mt9d112_sem); +DEFINE_SEMAPHORE (mt9d112_sem);/*=============================================================
drivers/staging/dream/camera/mt9p012_fox.c +1 -1
@@ -123,7 +123,7 @@ struct mt9p012_ctrl {static struct mt9p012_ctrl *mt9p012_ctrl;static DECLARE_WAIT_QUEUE_HEAD (mt9p012_wait_queue); -DECLARE_MUTEX (mt9p012_sem); +DEFINE_SEMAPHORE (mt9p012_sem);/*============================================================= EXTERNAL DECLARATIONS
drivers/staging/dream/camera/mt9t013.c +1 -1
@@ -123,7 +123,7 @@ struct mt9t013_ctrl {static struct mt9t013_ctrl *mt9t013_ctrl;static DECLARE_WAIT_QUEUE_HEAD (mt9t013_wait_queue); -DECLARE_MUTEX (mt9t013_sem); +DEFINE_SEMAPHORE (mt9t013_sem);extern struct mt9t013_reg mt9t013_regs;/* from mt9t013_reg.c */
drivers/staging/dream/camera/s5k3e2fx.c +1 -1
@@ -313,7 +313,7 @@ struct s5k3e2fx_i2c_reg_conf {static struct s5k3e2fx_ctrl *s5k3e2fx_ctrl;static DECLARE_WAIT_QUEUE_HEAD (s5k3e2fx_wait_queue); -DECLARE_MUTEX (s5k3e2fx_sem); +DEFINE_SEMAPHORE (s5k3e2fx_sem);static int s5k3e2fx_i2c_rxdata (unsigned short saddr,unsigned char *rxdata,int length)
drivers/staging/msm/msm_fb.c +2 -2
@@ -1158,7 +1158,7 @@ static int msm_fb_release(struct fb_info *info, int user)return ret; } -DECLARE_MUTEX (msm_fb_pan_sem); +DEFINE_SEMAPHORE (msm_fb_pan_sem);static int msm_fb_pan_display (struct fb_var_screeninfo *var,struct fb_info *info)
@@ -1962,7 +1962,7 @@ static int msmfb_overlay_play(struct fb_info *info, unsigned long *argp)#endif -DECLARE_MUTEX (msm_fb_ioctl_ppp_sem); +DEFINE_SEMAPHORE (msm_fb_ioctl_ppp_sem);DEFINE_MUTEX (msm_fb_ioctl_lut_sem);DEFINE_MUTEX (msm_fb_ioctl_hist_sem);
drivers/staging/rtl8712/osdep_service.h +1 -1
@@ -161,7 +161,7 @@ static inline u32 _down_sema(struct semaphore *sema)static inline void _rtl_rwlock_init (struct semaphore *prwlock) { -init_MUTEX (prwlock); +sema_init (prwlock,1 ); }static inline void _init_listhead (struct list_head *list)
drivers/staging/smbfs/inode.c +1 -1
@@ -537,7 +537,7 @@ static int smb_fill_super(struct super_block *sb, void *raw_data, int silent) server->mnt =NULL ; server->sock_file =NULL ;init_waitqueue_head (&server->conn_wq); -init_MUTEX (&server->sem); +sema_init (&server->sem,1 );INIT_LIST_HEAD (&server->entry);INIT_LIST_HEAD (&server->xmitq);INIT_LIST_HEAD (&server->recvq);
drivers/staging/westbridge/astoria/block/cyasblkdev_block.c +1 -1
@@ -157,7 +157,7 @@ struct cyasblkdev_blk_data {/* pointer to west bridge block data device superstructure */ static struct cyasblkdev_blk_data *gl_bd; -static DECLARE_MUTEX (open_lock); +static DEFINE_SEMAPHORE (open_lock);/* local forwardd declarationss */ static cy_as_device_handle *cyas_dev_handle;
drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c +1 -1
@@ -334,7 +334,7 @@ int cyasblkdev_init_queue(struct cyasblkdev_queue *bq, spinlock_t *lock)init_completion (&bq->thread_complete);init_waitqueue_head (&bq->thread_wq); -init_MUTEX (&bq->thread_sem); +sema_init (&bq->thread_sem,1 ); ret =kernel_thread (cyasblkdev_queue_thread, bq,CLONE_KERNEL );if (ret >=0 ) {
PATCH 28/30 arm: bcmring: semaphore cleanup
In reply to Thomas GleixnerAn embedded and charset-unspecified text was scrubbed...
Name: arm-bcmring-semaphore-cleanup.patch
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100907/6f67f9ef/attachment.ksh>
[tip:core/locking] arm: Bcmring: semaphore cleanup
Commit-ID: 5356d94872502e77317f82e8fcae2a0b162af07c Gitweb: http://git.kernel.org/tip/5356d94872502e77317f82e8fcae2a0b162af07c Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:33:52 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Tue, 12 Oct 2010 17:36:10 +0200
arm: Bcmring: semaphore cleanup
LKML-Reference: <[email protected]>
--- arch/arm/mach-bcmring/dma.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-bcmring/dma.c +2 -2
@@ -691,7 +691,7 @@ int dma_init(void)memset (&gDMA,0 ,sizeof (gDMA)); -init_MUTEX_LOCKED (&gDMA.lock); +sema_init (&gDMA.lock,0 );init_waitqueue_head (&gDMA.freeChannelQ);/* Initialize the Hardware */
@@ -1574,7 +1574,7 @@ int dma_init_mem_map(DMA_MemMap_t *memMap) {memset (memMap,0 ,sizeof (*memMap)); -init_MUTEX (&memMap->lock); +sema_init (&memMap->lock,1 );return 0 ; }
PATCH 29/30 hwmon: s3c-hwmon: Use a real mutex
In reply to Thomas GleixnerThe semaphore which protects the ADC is semantically a mutex. Use a real mutex.
--- drivers/hwmon/s3c-hwmon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Index: linux-2.6/drivers/hwmon/s3c-hwmon.c =================================--- linux-2.6.orig/drivers/hwmon/s3c-hwmon.c +++ linux-2.6/drivers/hwmon/s3c-hwmon.c
@@ -51,7 +51,7 @@ struct s3c_hwmon_attr {
* @attr: The holders for the channel attributes.
*/
struct s3c_hwmon {
- struct semaphore lock;
+ struct mutex lock;
struct s3c_adc_client *client;
struct device *hwmon_dev;
@@ -73,14 +73,14 @@ static int s3c_hwmon_read_ch(struct devi
{
int ret;
- ret = down_interruptible(&hwmon->lock);
+ ret = mutex_lock_interruptible(&hwmon->lock);
if (ret < 0)
return ret;
dev_dbg(dev, "reading channel %d\n", channel);
ret = s3c_adc_read(hwmon->client, channel);
- up(&hwmon->lock);
+ mutex_unlock(&hwmon->lock);
return ret;
}
@@ -296,7 +296,7 @@ static int __devinit s3c_hwmon_probe(str
platform_set_drvdata(dev, hwmon);
- init_MUTEX(&hwmon->lock);
+ mutex_init(&hwmon->lock);
/* Register with the core ADC driver. */
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Jean Delvare
AppliedRe: [patch 29/30] hwmon: s3c-hwmon: Use a real mutex
Quoted 43 lines · Thomas Gleixner
The semaphore which protects the ADC is semantically a mutex. Use a real mutex.
Signed-off-by Thomas Gleixner <[email protected]>Cc Jean Delvare <[email protected]>Cc Ben Dooks <[email protected]>--- drivers/hwmon/s3c-hwmon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Index:
linux-2.6/drivers/hwmon/s3c-hwmon.c=================================> ---linux-2.6.orig/drivers/hwmon/s3c-hwmon.c+++linux-2.6/drivers/hwmon/s3c-hwmon.c(quoted diff) +3
-3@@ -51,7 +51,7 @@ struct s3c_hwmon_attr { * @attr: The holders for the channel attributes. */ struct s3c_hwmon { - struct semaphore lock; + struct mutex lock; struct s3c_adc_client *client; struct device *hwmon_dev;@@ -73,14 +73,14 @@ static int s3c_hwmon_read_ch(struct devi { int ret; - ret = down_interruptible(&hwmon->lock); + ret = mutex_lock_interruptible(&hwmon->lock); if (ret < 0) return ret; dev_dbg(dev, "reading channel %d\n", channel); ret = s3c_adc_read(hwmon->client, channel); - up(&hwmon->lock); + mutex_unlock(&hwmon->lock); return ret; }
Review static int __devinit s3c_hwmon_probe(str · line 302
Quoted 8 lines
(quoted diff) +1
-1@@ -296,7 +296,7 @@ static int __devinit s3c_hwmon_probe(str platform_set_drvdata(dev, hwmon); - init_MUTEX(&hwmon->lock); + mutex_init(&hwmon->lock); /* Register with the core ADC driver. */
Applied, thanks.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 30/30 semaphore: Remove mutex emulation
In reply to Thomas GleixnerSemaphores used as mutexes have been deprecated for years. Now that all users are either converted to real semaphores or to mutexes remove the cruft.
--- include/linux/semaphore.h | 6 ------ scripts/checkpatch.pl | 8 ++------ 2 files changed, 2 insertions(+), 12 deletions(-)
include/linux/semaphore.h +0 -6
@@ -29,9 +29,6 @@ struct semaphore {#define DEFINE_SEMAPHORE (name) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) -#define DECLARE_MUTEX (name) \ - struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) -static inline void sema_init (struct semaphore *sem,int val) {static struct lock_class_key __key;
@@ -39,9 +36,6 @@ static inline void sema_init(struct semalockdep_init_map (&sem->lock.dep_map,"semaphore->lock" , &__key,0 ); } -#define init_MUTEX (sem) sema_init(sem, 1) -#define init_MUTEX_LOCKED (sem) sema_init(sem, 0) -extern void down (struct semaphore *sem);extern int __must_check down_interruptible (struct semaphore *sem);extern int __must_check down_killable (struct semaphore *sem);
scripts/checkpatch.pl +2 -6
@@ -2701,12 +2701,8 @@ sub process { WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); } -# check for semaphores used as mutexes - if ($line =~ /^.\s*(DECLARE_MUTEX|init_MUTEX)\s*\(/) { - WARN("mutexes are preferred for single holder semaphores\n" . $herecurr); - } -# check for semaphores used as mutexes - if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { +# check for semaphores initialized locked + if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { WARN("consider using a completion\n" . $herecurr); }
[tip:core/locking] semaphore: Remove mutex emulation
Commit-ID: 4882720b267b7b1d1b0ce08334b205f0329d4615 Gitweb: http://git.kernel.org/tip/4882720b267b7b1d1b0ce08334b205f0329d4615 Author: Thomas Gleixner <[email protected]> AuthorDate: Tue, 7 Sep 2010 14:34:01 +0000 Committer: Thomas Gleixner <[email protected]> CommitDate: Sat, 30 Oct 2010 12:12:50 +0200
semaphore: Remove mutex emulation
Semaphores used as mutexes have been deprecated for years. Now that all users are either converted to real semaphores or to mutexes remove the cruft.
LKML-Reference: <[email protected]>
--- include/linux/semaphore.h | 6 ------ scripts/checkpatch.pl | 8 ++------ 2 files changed, 2 insertions(+), 12 deletions(-)
include/linux/semaphore.h +0 -6
@@ -29,9 +29,6 @@ struct semaphore {#define DEFINE_SEMAPHORE (name) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) -#define DECLARE_MUTEX (name) \ - struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1) -static inline void sema_init (struct semaphore *sem,int val) {static struct lock_class_key __key;
@@ -39,9 +36,6 @@ static inline void sema_init(struct semaphore *sem, int val)lockdep_init_map (&sem->lock.dep_map,"semaphore->lock" , &__key,0 ); } -#define init_MUTEX (sem) sema_init(sem, 1) -#define init_MUTEX_LOCKED (sem) sema_init(sem, 0) -extern void down (struct semaphore *sem);extern int __must_check down_interruptible (struct semaphore *sem);extern int __must_check down_killable (struct semaphore *sem);
scripts/checkpatch.pl +2 -6
@@ -2794,12 +2794,8 @@ sub process { WARN("__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr); } -# check for semaphores used as mutexes - if ($line =~ /^.\s*(DECLARE_MUTEX|init_MUTEX)\s*\(/) { - WARN("mutexes are preferred for single holder semaphores\n" . $herecurr); - } -# check for semaphores used as mutexes - if ($line =~ /^.\s*init_MUTEX_LOCKED\s*\(/) { +# check for semaphores initialized locked + if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { WARN("consider using a completion\n" . $herecurr); }
Quoted 2 lines · Thomas Gleixner
init_MUTEX[_LOCKED] and
DECLARE_MUTEXare deprecated for quite some time. Cleanup the remaining users and remove the cruft.
How many of these really need to be semaphores and can't be converted to mutex or completion? I thought that we wanted to send the classic semaphore the same way as the BKL eventually.
Arnd
Quoted 7 lines · Arnd Bergmann
Quoted 2 lines · Thomas Gleixner
init_MUTEX[_LOCKED] and
DECLARE_MUTEXare deprecated for quite some time. Cleanup the remaining users and remove the cruft.How many of these really need to be semaphores and can't be converted to mutex or completion? I thought that we wanted to send the classic semaphore the same way as the BKL eventually.
Some of those can be converted to completions, but most of them have utterly borked semantics. I'm not sure if its worth the trouble to actually change all this as most of that stuff is ancient. Real semaphores are not going away (at least not the counting type ones).
Thanks,
tglx
Quoted 4 lines · On Tuesday 07 September 2010 17:38:33 Thomas Gleixner wrote:
Some of those can be converted to completions, but most of them have utterly borked semantics. I'm not sure if its worth the trouble to actually change all this as most of that stuff is ancient. Real semaphores are not going away (at least not the counting type ones).
Ok. I thought I had seen a series from Ingo some time ago that actually converted all of them to something else, but maybe I was mistaken.
Not sure if there is anything to be gained (other than more work) from merging semaphore and rw_semaphore into a single implementation that is both counting and read-write.
One problem I see (not with your series, just with semaphores in general) is that they keep creeping in through drivers/staging: About half the users we currently have are in staging. Obviously they get removed from there in order for drivers to graduate from staging, but not exposing the interface to device drivers would reduce the number of bad choices for authors to make.
Arnd
Arnd,
Quoted 13 lines · Arnd Bergmann
Quoted 4 lines · On Tuesday 07 September 2010 17:38:33 Thomas Gleixner wrote:
Some of those can be converted to completions, but most of them have utterly borked semantics. I'm not sure if its worth the trouble to actually change all this as most of that stuff is ancient. Real semaphores are not going away (at least not the counting type ones).
Ok. I thought I had seen a series from Ingo some time ago that actually converted all of them to something else, but maybe I was mistaken.
Not sure if there is anything to be gained (other than more work) from merging semaphore and
rw_semaphoreinto a single implementation that is both counting and read-write.
Quoted 6 lines
One problem I see (not with your series, just with semaphores in general) is that they keep creeping in through
drivers/staging: About half the users we currently have are in staging. Obviously they get removed from there in order for drivers to graduate from staging, but not exposing the interface to device drivers would reduce the number of bad choices for authors to make.
sure, but most of them are really the init_MUTEX[_LOCKED] type which has been copied over and over again for almost a decade.
That's going away, so people are actually forced to look into the alternative solutions. And I do not worry too much about staging/*
Thanks,
tglx
Quoted 5 lines · On Tuesday 07 September 2010 22:23:06 Thomas Gleixner wrote:
sure, but most of them are really the init_MUTEX[_LOCKED] type which has been copied over and over again for almost a decade.
That's going away, so people are actually forced to look into the alternative solutions. And I do not worry too much about staging/*
Yes, good point.
Arnd