All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 00/30] semaphore cleanup
@ 2010-09-07 14:31 Thomas Gleixner
  2010-09-07 14:31 ` [patch 01/30] semaphore: Add DEFINE_SEMAPHORE Thomas Gleixner
                   ` (30 more replies)
  0 siblings, 31 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:31 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

init_MUTEX[_LOCKED] and DECLARE_MUTEX are deprecated for quite some
time. Cleanup the remaining users and remove the cruft.

Thanks,

	tglx


^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 01/30] semaphore: Add DEFINE_SEMAPHORE
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:31 ` Thomas Gleixner
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
                   ` (29 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:31 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

[-- Attachment #1: mutex-semaphore.patch --]
[-- Type: text/plain, Size: 889 bytes --]

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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/semaphore.h |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/include/linux/semaphore.h
===================================================================
--- linux-2.6.orig/include/linux/semaphore.h
+++ linux-2.6/include/linux/semaphore.h
@@ -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)
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
  2010-09-07 14:31 ` [patch 01/30] semaphore: Add DEFINE_SEMAPHORE Thomas Gleixner
@ 2010-09-07 14:31 ` Thomas Gleixner
  2010-09-08 15:37   ` Dmitry Torokhov
  2010-10-12 15:49   ` [tip:core/locking] input: Misc/hp_sdc_rtc: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 03/30] input: serio/hil_mlc: " Thomas Gleixner
                   ` (28 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:31 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Dmitry Torokhov

[-- Attachment #1: drivers-input-misc-sema.patch --]
[-- Type: text/plain, Size: 915 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dmitry Torokhov <dtor@mail.ru>

---
 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
===================================================================
--- linux-2.6.orig/drivers/input/misc/hp_sdc_rtc.c
+++ linux-2.6/drivers/input/misc/hp_sdc_rtc.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 03/30] input: serio/hil_mlc: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
  2010-09-07 14:31 ` [patch 01/30] semaphore: Add DEFINE_SEMAPHORE Thomas Gleixner
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-10-12 15:49   ` [tip:core/locking] input: Serio/hil_mlc: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 04/30] input: serio/hp_sdc: " Thomas Gleixner
                   ` (27 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Dmitry Torokhov

[-- Attachment #1: drivers-input-hil-mlc-sema.patch --]
[-- Type: text/plain, Size: 872 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dmitry Torokhov <dtor@mail.ru>

---
 drivers/input/serio/hil_mlc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/input/serio/hil_mlc.c
===================================================================
--- linux-2.6.orig/drivers/input/serio/hil_mlc.c
+++ linux-2.6/drivers/input/serio/hil_mlc.c
@@ -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);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 04/30] input: serio/hp_sdc: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (2 preceding siblings ...)
  2010-09-07 14:32 ` [patch 03/30] input: serio/hil_mlc: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-10-12 15:49   ` [tip:core/locking] input: Serio/hp_sdc: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 05/30] net: 3c527: " Thomas Gleixner
                   ` (26 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Dmitry Torokhov

[-- Attachment #1: drivers-input-hp-sdc-sema.patch --]
[-- Type: text/plain, Size: 973 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dmitry Torokhov <dtor@mail.ru>

---
 drivers/input/serio/hp_sdc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/input/serio/hp_sdc.c
===================================================================
--- linux-2.6.orig/drivers/input/serio/hp_sdc.c
+++ linux-2.6/drivers/input/serio/hp_sdc.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 05/30] net: 3c527: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (3 preceding siblings ...)
  2010-09-07 14:32 ` [patch 04/30] input: serio/hp_sdc: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 06/30] hamradio: 6pack: " Thomas Gleixner
                   ` (25 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David Miller, netdev

[-- Attachment #1: drivers-net-3c527-sema.patch --]
[-- Type: text/plain, Size: 789 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---
 drivers/net/3c527.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/3c527.c
===================================================================
--- linux-2.6.orig/drivers/net/3c527.c
+++ linux-2.6/drivers/net/3c527.c
@@ -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);
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 06/30] hamradio: 6pack: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (4 preceding siblings ...)
  2010-09-07 14:32 ` [patch 05/30] net: 3c527: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 07/30] hamradio: mkiss: " Thomas Gleixner
                   ` (24 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David Miller, netdev

[-- Attachment #1: drivers-net-hamradio-6pack-sema.patch --]
[-- Type: text/plain, Size: 737 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org

---
 drivers/net/hamradio/6pack.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/hamradio/6pack.c
===================================================================
--- linux-2.6.orig/drivers/net/hamradio/6pack.c
+++ linux-2.6/drivers/net/hamradio/6pack.c
@@ -608,7 +608,7 @@ static int sixpack_open(struct tty_struc
 
 	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!  */
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 07/30] hamradio: mkiss: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (5 preceding siblings ...)
  2010-09-07 14:32 ` [patch 06/30] hamradio: 6pack: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] hamradio: Mkiss: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 08/30] net: ppp_async: " Thomas Gleixner
                   ` (23 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David Miller, netdev

[-- Attachment #1: drivers-net-hamradio-mkiss-sema.patch --]
[-- Type: text/plain, Size: 715 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org

---
 drivers/net/hamradio/mkiss.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/hamradio/mkiss.c
===================================================================
--- linux-2.6.orig/drivers/net/hamradio/mkiss.c
+++ linux-2.6/drivers/net/hamradio/mkiss.c
@@ -747,7 +747,7 @@ static int mkiss_open(struct tty_struct 
 
 	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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 08/30] net: ppp_async: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (6 preceding siblings ...)
  2010-09-07 14:32 ` [patch 07/30] hamradio: mkiss: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:28   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] net: Ppp_async: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
                   ` (22 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David Miller, netdev

[-- Attachment #1: drivers-net-ppp-async-sema.patch --]
[-- Type: text/plain, Size: 742 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org

---
 drivers/net/ppp_async.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/ppp_async.c
===================================================================
--- linux-2.6.orig/drivers/net/ppp_async.c
+++ linux-2.6/drivers/net/ppp_async.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (7 preceding siblings ...)
  2010-09-07 14:32 ` [patch 08/30] net: ppp_async: " Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:29   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] net: Wan/cosa.c: " tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 10/30] irda: semaphore cleanup Thomas Gleixner
                   ` (21 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David S. Miller, netdev

[-- Attachment #1: drivers-net-wan-cosa-sema.patch --]
[-- Type: text/plain, Size: 748 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org

---
 drivers/net/wan/cosa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/wan/cosa.c
===================================================================
--- linux-2.6.orig/drivers/net/wan/cosa.c
+++ linux-2.6/drivers/net/wan/cosa.c
@@ -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))) {



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 10/30] irda: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (8 preceding siblings ...)
  2010-09-07 14:32 ` [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 16:29   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] irda: Semaphore cleanup tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 11/30] parport: semaphore cleanup Thomas Gleixner
                   ` (20 subsequent siblings)
  30 siblings, 2 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	David S. Miller, netdev

[-- Attachment #1: drivers-net-irda-sir-dev-sema.patch --]
[-- Type: text/plain, Size: 696 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org

---
 drivers/net/irda/sir_dev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/net/irda/sir_dev.c
===================================================================
--- linux-2.6.orig/drivers/net/irda/sir_dev.c
+++ linux-2.6/drivers/net/irda/sir_dev.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 11/30] parport: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (9 preceding siblings ...)
  2010-09-07 14:32 ` [patch 10/30] irda: semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-10-12 15:52   ` [tip:core/locking] parport: Semaphore cleanup tip-bot for Thomas Gleixner
  2010-09-07 14:32 ` [patch 12/30] ibmphp-hpc: semaphore cleanup Thomas Gleixner
                   ` (19 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig, Alan Cox

[-- Attachment #1: drivers-parport-sema.patch --]
[-- Type: text/plain, Size: 851 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>

---
 drivers/parport/share.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/parport/share.c
===================================================================
--- linux-2.6.orig/drivers/parport/share.c
+++ linux-2.6/drivers/parport/share.c
@@ -306,7 +306,7 @@ struct parport *parport_register_port(un
 	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);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 12/30] ibmphp-hpc: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (10 preceding siblings ...)
  2010-09-07 14:32 ` [patch 11/30] parport: semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-09 20:42   ` Jesse Barnes
  2010-09-07 14:32 ` [patch 13/30] usb: ftdi-elan: Convert "mutex" to semaphore Thomas Gleixner
                   ` (18 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Jesse Barnes, linux-pci

[-- Attachment #1: drivers-pci-hotplug-ibmphp-hpc-sema.patch --]
[-- Type: text/plain, Size: 812 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: linux-pci@vger.kernel.org

---
 drivers/pci/hotplug/ibmphp_hpc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/pci/hotplug/ibmphp_hpc.c
===================================================================
--- linux-2.6.orig/drivers/pci/hotplug/ibmphp_hpc.c
+++ linux-2.6/drivers/pci/hotplug/ibmphp_hpc.c
@@ -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__);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 13/30] usb: ftdi-elan: Convert "mutex" to semaphore
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (11 preceding siblings ...)
  2010-09-07 14:32 ` [patch 12/30] ibmphp-hpc: semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 14:32 ` [patch 14/30] scsi: aacraid semaphore cleanup Thomas Gleixner
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Greg Kroah-Hartman, linux-usb

[-- Attachment #1: drivers-usb-ftdi-elan-sema.patch --]
[-- Type: text/plain, Size: 937 bytes --]

The "mutex" ftdi->sw_lock is used as a lock and a completion. Convert
it to a real semaphore which allows both.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-usb@vger.kernel.org

---
 drivers/usb/misc/ftdi-elan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/usb/misc/ftdi-elan.c
===================================================================
--- linux-2.6.orig/drivers/usb/misc/ftdi-elan.c
+++ linux-2.6/drivers/usb/misc/ftdi-elan.c
@@ -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);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 14/30] scsi: aacraid semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (12 preceding siblings ...)
  2010-09-07 14:32 ` [patch 13/30] usb: ftdi-elan: Convert "mutex" to semaphore Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	James Bottomley, linux-scsi

[-- Attachment #1: drivers-scsi-sema.patch --]
[-- Type: text/plain, Size: 1504 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/aacraid/commctrl.c |    2 +-
 drivers/scsi/aacraid/commsup.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/scsi/aacraid/commctrl.c
===================================================================
--- linux-2.6.orig/drivers/scsi/aacraid/commctrl.c
+++ linux-2.6/drivers/scsi/aacraid/commctrl.c
@@ -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
Index: linux-2.6/drivers/scsi/aacraid/commsup.c
===================================================================
--- linux-2.6.orig/drivers/scsi/aacraid/commsup.c
+++ linux-2.6/drivers/scsi/aacraid/commsup.c
@@ -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);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 15/30] smbfs: Convert server->sem to mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (13 preceding siblings ...)
  2010-09-07 14:32 ` [patch 14/30] scsi: aacraid semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-09-10 12:46   ` Jeff Layton
  2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
                   ` (15 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: smbfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1729 bytes --]

server->sem is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 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
===================================================================
--- linux-2.6.orig/fs/smbfs/inode.c
+++ linux-2.6/fs/smbfs/inode.c
@@ -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
===================================================================
--- linux-2.6.orig/include/linux/smb_fs_sb.h
+++ linux-2.6/include/linux/smb_fs_sb.h
@@ -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



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 16/30] hpfs: Convert sbi->hpfs_creation_de to mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (14 preceding siblings ...)
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
@ 2010-09-07 14:32 ` Thomas Gleixner
  2010-10-30  8:16   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
                   ` (14 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:32 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hpfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 2042 bytes --]

sbi->hpfs_creation_de is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hpfs/buffer.c  |    4 ++--
 fs/hpfs/hpfs_fn.h |    2 +-
 fs/hpfs/super.c   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hpfs/buffer.c
===================================================================
--- linux-2.6.orig/fs/hpfs/buffer.c
+++ linux-2.6/fs/hpfs/buffer.c
@@ -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. */
Index: linux-2.6/fs/hpfs/hpfs_fn.h
===================================================================
--- linux-2.6.orig/fs/hpfs/hpfs_fn.h
+++ linux-2.6/fs/hpfs/hpfs_fn.h
@@ -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;
Index: linux-2.6/fs/hpfs/super.c
===================================================================
--- linux-2.6.orig/fs/hpfs/super.c
+++ linux-2.6/fs/hpfs/super.c
@@ -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();



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 17/30] hpfsplus: Convert tree_lock to mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (15 preceding siblings ...)
  2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hpfs-plus-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1903 bytes --]

tree_lock is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hfsplus/bfind.c      |    4 ++--
 fs/hfsplus/btree.c      |    2 +-
 fs/hfsplus/hfsplus_fs.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hfsplus/bfind.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/bfind.c
+++ linux-2.6/fs/hfsplus/bfind.c
@@ -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_data 
 	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;
 }
 
Index: linux-2.6/fs/hfsplus/btree.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/btree.c
+++ linux-2.6/fs/hfsplus/btree.c
@@ -30,7 +30,7 @@ struct hfs_btree *hfs_btree_open(struct 
 	if (!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;
Index: linux-2.6/fs/hfsplus/hfsplus_fs.h
===================================================================
--- linux-2.6.orig/fs/hfsplus/hfsplus_fs.h
+++ linux-2.6/fs/hfsplus/hfsplus_fs.h
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 18/30] hfs: Convert tree_lock to mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (16 preceding siblings ...)
  2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-10-12 15:53   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
                   ` (12 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: hfs-sema-to-mutex.patch --]
[-- Type: text/plain, Size: 1847 bytes --]

tree_lock is used as mutex so make it a mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/hfs/bfind.c |    4 ++--
 fs/hfs/btree.c |    2 +-
 fs/hfs/btree.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/fs/hfs/bfind.c
===================================================================
--- linux-2.6.orig/fs/hfs/bfind.c
+++ linux-2.6/fs/hfs/bfind.c
@@ -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_data 
 	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;
 }
 
Index: linux-2.6/fs/hfs/btree.c
===================================================================
--- linux-2.6.orig/fs/hfs/btree.c
+++ linux-2.6/fs/hfs/btree.c
@@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(struct 
 	if (!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;
Index: linux-2.6/fs/hfs/btree.h
===================================================================
--- linux-2.6.orig/fs/hfs/btree.h
+++ linux-2.6/fs/hfs/btree.h
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 19/30] affs: use sema_init instead of init_MUTEX
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (17 preceding siblings ...)
  2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-10-12 15:54   ` [tip:core/locking] affs: Use " tip-bot for Thomas Gleixner
  2010-09-07 14:33 ` [patch 20/30] xfs: semaphore cleanup Thomas Gleixner
                   ` (11 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Al Viro, linux-fsdevel

[-- Attachment #1: afs-sema.patch --]
[-- Type: text/plain, Size: 730 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org

---
 fs/affs/super.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/fs/affs/super.c
===================================================================
--- linux-2.6.orig/fs/affs/super.c
+++ linux-2.6/fs/affs/super.c
@@ -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);
 }
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 20/30] xfs: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (18 preceding siblings ...)
  2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 21/30] mmc: Convert "mutex" to semaphore Thomas Gleixner
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Dave Chinner

[-- Attachment #1: xfs-sema.patch --]
[-- Type: text/plain, Size: 810 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/linux-2.6/xfs_buf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 21/30] mmc: Convert "mutex" to semaphore
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (19 preceding siblings ...)
  2010-09-07 14:33 ` [patch 20/30] xfs: semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-14 12:47   ` Chris Ball
  2010-09-07 14:33 ` [patch 22/30] dvb: " Thomas Gleixner
                   ` (9 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig, linux-mmc

[-- Attachment #1: drivers-mmc-card-queue-sema.patch --]
[-- Type: text/plain, Size: 696 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mmc@vger.kernel.org

---
 drivers/mmc/card/queue.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/mmc/card/queue.c
===================================================================
--- linux-2.6.orig/drivers/mmc/card/queue.c
+++ linux-2.6/drivers/mmc/card/queue.c
@@ -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)) {



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 22/30] dvb: Convert "mutex" to semaphore
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (20 preceding siblings ...)
  2010-09-07 14:33 ` [patch 21/30] mmc: Convert "mutex" to semaphore Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-07 14:33 ` [patch 23/30] infiniband: Make user_mad semaphore a real one Thomas Gleixner
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Mauro Carvalho Chehab, linux-media

[-- Attachment #1: drivers-media-dvb-dvb-core-frontend-sema.patch --]
[-- Type: text/plain, Size: 1078 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org

---
 drivers/media/dvb/dvb-core/dvb_frontend.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
--- linux-2.6.orig/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ linux-2.6/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -702,7 +702,7 @@ static void dvb_frontend_stop(struct dvb
 
 	kthread_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);



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 23/30] infiniband: Make user_mad semaphore a real one
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (21 preceding siblings ...)
  2010-09-07 14:33 ` [patch 22/30] dvb: " Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-29  3:53   ` Roland Dreier
  2010-09-07 14:33   ` Thomas Gleixner
                   ` (7 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Roland Dreier

[-- Attachment #1: driver-infiniband-core-user-mad-sema.patch --]
[-- Type: text/plain, Size: 729 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Roland Dreier <rolandd@cisco.com>

---
 drivers/infiniband/core/user_mad.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/infiniband/core/user_mad.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/user_mad.c
+++ linux-2.6/drivers/infiniband/core/user_mad.c
@@ -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);
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 24/30] ia64: salinfo: sema_init instead of init_MUTEX
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:33   ` Thomas Gleixner
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Tony Luck, linux-ia64

[-- Attachment #1: ia64-salinfo-sema.patch --]
[-- Type: text/plain, Size: 757 bytes --]

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org

---
 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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 24/30] ia64: salinfo: sema_init instead of init_MUTEX
@ 2010-09-07 14:33   ` Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Tony Luck, linux-ia64

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-ia64@vger.kernel.org

---
 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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 25/30] drivers/macintosh/adb: Do not claim that the semaphore is a mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (23 preceding siblings ...)
  2010-09-07 14:33   ` Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-10-12 15:52   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:33 ` [patch 26/30] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
                   ` (5 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Benjamin Herrenschmidt

[-- Attachment #1: drivers-mac-adb-sema.patch --]
[-- Type: text/plain, Size: 752 bytes --]

User DEFINE_SEMAPHORE() instead of DECLARE_MUTEX()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
 drivers/macintosh/adb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/macintosh/adb.c
===================================================================
--- linux-2.6.orig/drivers/macintosh/adb.c
+++ linux-2.6/drivers/macintosh/adb.c
@@ -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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 26/30] printk: Make console_sem a semaphore not a pseudo mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (24 preceding siblings ...)
  2010-09-07 14:33 ` [patch 25/30] drivers/macintosh/adb: Do not claim that the semaphore is a mutex Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-10-12 15:53   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 14:33 ` [patch 27/30] staging: Bulk convert the semaphore mess Thomas Gleixner
                   ` (4 subsequent siblings)
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

[-- Attachment #1: printk-console-sem-sema.patch --]
[-- Type: text/plain, Size: 974 bytes --]

It needs to be investigated whether it can be replaced by a real
mutex, but that needs more thought.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/printk.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/printk.c
===================================================================
--- linux-2.6.orig/kernel/printk.c
+++ linux-2.6/kernel/printk.c
@@ -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)



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (25 preceding siblings ...)
  2010-09-07 14:33 ` [patch 26/30] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
@ 2010-09-07 14:33 ` Thomas Gleixner
  2010-09-08  2:30   ` Greg KH
                     ` (2 more replies)
  2010-09-07 14:33   ` Thomas Gleixner
                   ` (3 subsequent siblings)
  30 siblings, 3 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Greg Kroah-Hartman

[-- Attachment #1: drivers-staging-bulk-sema-fix.patch --]
[-- Type: text/plain, Size: 8878 bytes --]

init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
staging users.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>

---
 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(-)

Index: linux-2.6/drivers/staging/comedi/drivers/dt9812.c
===================================================================
--- linux-2.6.orig/drivers/staging/comedi/drivers/dt9812.c
+++ linux-2.6/drivers/staging/comedi/drivers/dt9812.c
@@ -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;
Index: linux-2.6/drivers/staging/comedi/drivers/usbdux.c
===================================================================
--- linux-2.6.orig/drivers/staging/comedi/drivers/usbdux.c
+++ linux-2.6/drivers/staging/comedi/drivers/usbdux.c
@@ -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_in
 	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;
 
Index: linux-2.6/drivers/staging/comedi/drivers/usbduxfast.c
===================================================================
--- linux-2.6.orig/drivers/staging/comedi/drivers/usbduxfast.c
+++ linux-2.6/drivers/staging/comedi/drivers/usbduxfast.c
@@ -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;
 
Index: linux-2.6/drivers/staging/cxt1e1/functions.c
===================================================================
--- linux-2.6.orig/drivers/staging/cxt1e1/functions.c
+++ linux-2.6/drivers/staging/cxt1e1/functions.c
@@ -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 */
Index: linux-2.6/drivers/staging/dream/pmem.c
===================================================================
--- linux-2.6.orig/drivers/staging/dream/pmem.c
+++ linux-2.6/drivers/staging/dream/pmem.c
@@ -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;
Index: linux-2.6/drivers/staging/msm/mddihost.c
===================================================================
--- linux-2.6.orig/drivers/staging/msm/mddihost.c
+++ linux-2.6/drivers/staging/msm/mddihost.c
@@ -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);
Index: linux-2.6/drivers/staging/msm/mdp.c
===================================================================
--- linux-2.6.orig/drivers/staging/msm/mdp.c
+++ linux-2.6/drivers/staging/msm/mdp.c
@@ -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;
Index: linux-2.6/drivers/staging/msm/msm_fb.c
===================================================================
--- linux-2.6.orig/drivers/staging/msm/msm_fb.c
+++ linux-2.6/drivers/staging/msm/msm_fb.c
@@ -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;
Index: linux-2.6/drivers/staging/otus/wwrap.c
===================================================================
--- linux-2.6.orig/drivers/staging/otus/wwrap.c
+++ linux-2.6/drivers/staging/otus/wwrap.c
@@ -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;
 }
Index: linux-2.6/drivers/staging/rt2860/common/rtmp_init.c
===================================================================
--- linux-2.6.orig/drivers/staging/rt2860/common/rtmp_init.c
+++ linux-2.6/drivers/staging/rt2860/common/rtmp_init.c
@@ -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) {
Index: linux-2.6/drivers/staging/solo6x10/solo6010-i2c.c
===================================================================
--- linux-2.6.orig/drivers/staging/solo6x10/solo6010-i2c.c
+++ linux-2.6/drivers/staging/solo6x10/solo6010-i2c.c
@@ -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];
Index: linux-2.6/drivers/staging/solo6x10/solo6010-p2m.c
===================================================================
--- linux-2.6.orig/drivers/staging/solo6x10/solo6010-p2m.c
+++ linux-2.6/drivers/staging/solo6x10/solo6010-p2m.c
@@ -188,7 +188,7 @@ int solo_p2m_init(struct solo6010_dev *s
 	for (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),
Index: linux-2.6/drivers/staging/vme/devices/vme_user.c
===================================================================
--- linux-2.6.orig/drivers/staging/vme/devices/vme_user.c
+++ linux-2.6/drivers/staging/vme/devices/vme_user.c
@@ -683,7 +683,7 @@ static int __init vme_user_probe(struct 
 	for (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;



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 28/30] arm: bcmring: semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:33   ` Thomas Gleixner
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Leo Chen, linux-arm-kernel

[-- Attachment #1: arm-bcmring-semaphore-cleanup.patch --]
[-- Type: text/plain, Size: 827 bytes --]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Leo Chen <leochen@broadcom.com>
Cc: linux-arm-kernel@lists.infradead.org

---
 arch/arm/mach-bcmring/dma.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/arm/mach-bcmring/dma.c
===================================================================
--- linux-2.6.orig/arch/arm/mach-bcmring/dma.c
+++ linux-2.6/arch/arm/mach-bcmring/dma.c
@@ -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 *memMa
 {
 	memset(memMap, 0, sizeof(*memMap));
 
-	init_MUTEX(&memMap->lock);
+	sema_init(&memMap->lock, 1);
 
 	return 0;
 }



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 28/30] arm: bcmring: semaphore cleanup
@ 2010-09-07 14:33   ` Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: linux-arm-kernel

An 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>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 29/30] hwmon: s3c-hwmon: Use a real mutex
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
@ 2010-09-07 14:33   ` Thomas Gleixner
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
                     ` (29 subsequent siblings)
  30 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Jean Delvare, Ben Dooks, lm-sensors

[-- Attachment #1: drivers-hwmon-s3c-hwmon-sema.patch --]
[-- Type: text/plain, Size: 1329 bytes --]

The semaphore which protects the ADC is semantically a mutex. Use a
real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: lm-sensors@lm-sensors.org
---
 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. */
 



^ permalink raw reply	[flat|nested] 75+ messages in thread

* [lm-sensors] [patch 29/30] hwmon: s3c-hwmon: Use a real mutex
@ 2010-09-07 14:33   ` Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:33 UTC (permalink / raw)
  To: LKML
  Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig,
	Jean Delvare, Ben Dooks, lm-sensors

The semaphore which protects the ADC is semantically a mutex. Use a
real mutex.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: lm-sensors@lm-sensors.org
---
 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [patch 30/30] semaphore: Remove mutex emulation
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (28 preceding siblings ...)
  2010-09-07 14:33   ` [lm-sensors] " Thomas Gleixner
@ 2010-09-07 14:34 ` Thomas Gleixner
  2010-10-30 10:16   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  2010-09-07 15:27 ` [patch 00/30] semaphore cleanup Arnd Bergmann
  30 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 14:34 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

[-- Attachment #1: sema-remove-mutex-hack.patch --]
[-- Type: text/plain, Size: 2012 bytes --]

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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/semaphore.h |    6 ------
 scripts/checkpatch.pl     |    8 ++------
 2 files changed, 2 insertions(+), 12 deletions(-)

Index: linux-2.6/include/linux/semaphore.h
===================================================================
--- linux-2.6.orig/include/linux/semaphore.h
+++ linux-2.6/include/linux/semaphore.h
@@ -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 sema
 	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);
Index: linux-2.6/scripts/checkpatch.pl
===================================================================
--- linux-2.6.orig/scripts/checkpatch.pl
+++ linux-2.6/scripts/checkpatch.pl
@@ -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);
 
 		}



^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 00/30] semaphore cleanup
  2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
                   ` (29 preceding siblings ...)
  2010-09-07 14:34 ` [patch 30/30] semaphore: Remove mutex emulation Thomas Gleixner
@ 2010-09-07 15:27 ` Arnd Bergmann
  2010-09-07 15:38   ` Thomas Gleixner
  30 siblings, 1 reply; 75+ messages in thread
From: Arnd Bergmann @ 2010-09-07 15:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

On Tuesday 07 September 2010, Thomas Gleixner wrote:
> init_MUTEX[_LOCKED] and DECLARE_MUTEX are 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 00/30] semaphore cleanup
  2010-09-07 15:27 ` [patch 00/30] semaphore cleanup Arnd Bergmann
@ 2010-09-07 15:38   ` Thomas Gleixner
  2010-09-07 17:38     ` Arnd Bergmann
  0 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 15:38 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

On Tue, 7 Sep 2010, Arnd Bergmann wrote:

> On Tuesday 07 September 2010, Thomas Gleixner wrote:
> > init_MUTEX[_LOCKED] and DECLARE_MUTEX are 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 05/30] net: 3c527: semaphore cleanup
  2010-09-07 14:32 ` [patch 05/30] net: 3c527: " Thomas Gleixner
@ 2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:28 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:10 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 06/30] hamradio: 6pack: semaphore cleanup
  2010-09-07 14:32 ` [patch 06/30] hamradio: 6pack: " Thomas Gleixner
@ 2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:28 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:14 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 07/30] hamradio: mkiss: semaphore cleanup
  2010-09-07 14:32 ` [patch 07/30] hamradio: mkiss: " Thomas Gleixner
@ 2010-09-07 16:28   ` David Miller
  2010-10-12 15:50   ` [tip:core/locking] hamradio: Mkiss: " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:28 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:18 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 08/30] net: ppp_async: semaphore cleanup
  2010-09-07 14:32 ` [patch 08/30] net: ppp_async: " Thomas Gleixner
@ 2010-09-07 16:28   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] net: Ppp_async: " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:28 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:22 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore
  2010-09-07 14:32 ` [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
@ 2010-09-07 16:29   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] net: Wan/cosa.c: " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:29 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:25 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 10/30] irda: semaphore cleanup
  2010-09-07 14:32 ` [patch 10/30] irda: semaphore cleanup Thomas Gleixner
@ 2010-09-07 16:29   ` David Miller
  2010-10-12 15:51   ` [tip:core/locking] irda: Semaphore cleanup tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: David Miller @ 2010-09-07 16:29 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, akpm, mingo, peterz, hch, netdev

From: Thomas Gleixner <tglx@linutronix.de>
Date: Tue, 07 Sep 2010 14:32:30 -0000

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 00/30] semaphore cleanup
  2010-09-07 15:38   ` Thomas Gleixner
@ 2010-09-07 17:38     ` Arnd Bergmann
  2010-09-07 20:23       ` Thomas Gleixner
  0 siblings, 1 reply; 75+ messages in thread
From: Arnd Bergmann @ 2010-09-07 17:38 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 00/30] semaphore cleanup
  2010-09-07 17:38     ` Arnd Bergmann
@ 2010-09-07 20:23       ` Thomas Gleixner
  2010-09-07 20:40         ` Arnd Bergmann
  0 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-07 20:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

Arnd,

On Tue, 7 Sep 2010, Arnd Bergmann wrote:

> 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.

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 00/30] semaphore cleanup
  2010-09-07 20:23       ` Thomas Gleixner
@ 2010-09-07 20:40         ` Arnd Bergmann
  0 siblings, 0 replies; 75+ messages in thread
From: Arnd Bergmann @ 2010-09-07 20:40 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-07 14:33 ` [patch 27/30] staging: Bulk convert the semaphore mess Thomas Gleixner
@ 2010-09-08  2:30   ` Greg KH
  2010-09-08  8:59     ` Thomas Gleixner
  2010-09-08  2:35   ` Greg KH
  2010-10-30 10:16   ` [tip:core/locking] staging: Final semaphore cleanup tip-bot for Thomas Gleixner
  2 siblings, 1 reply; 75+ messages in thread
From: Greg KH @ 2010-09-08  2:30 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Greg Kroah-Hartman

On Tue, Sep 07, 2010 at 02:33:47PM -0000, Thomas Gleixner wrote:
> init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
> staging users.

I don't think you actually built this change:

> --- linux-2.6.orig/drivers/staging/comedi/drivers/usbdux.c
> +++ linux-2.6/drivers/staging/comedi/drivers/usbdux.c
> @@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-07 14:33 ` [patch 27/30] staging: Bulk convert the semaphore mess Thomas Gleixner
  2010-09-08  2:30   ` Greg KH
@ 2010-09-08  2:35   ` Greg KH
  2010-10-30 10:16   ` [tip:core/locking] staging: Final semaphore cleanup tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 75+ messages in thread
From: Greg KH @ 2010-09-08  2:35 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Greg Kroah-Hartman

On Tue, Sep 07, 2010 at 02:33:47PM -0000, Thomas Gleixner wrote:
> init_MUTEX(_LOCKED) and DECLARE_MUTEX are 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-08  2:30   ` Greg KH
@ 2010-09-08  8:59     ` Thomas Gleixner
  2010-09-08  9:11       ` Greg KH
  0 siblings, 1 reply; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-08  8:59 UTC (permalink / raw)
  To: Greg KH
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Greg Kroah-Hartman

On Tue, 7 Sep 2010, Greg KH wrote:

> On Tue, Sep 07, 2010 at 02:33:47PM -0000, Thomas Gleixner wrote:
> > init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
> > staging users.
> 
> I don't think you actually built this change:
> 
> > --- linux-2.6.orig/drivers/staging/comedi/drivers/usbdux.c
> > +++ linux-2.6/drivers/staging/comedi/drivers/usbdux.c
> > @@ -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?

It's the first patch in the series, which I want to get Linus wards
now, so this does not trip over.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-08  8:59     ` Thomas Gleixner
@ 2010-09-08  9:11       ` Greg KH
  2010-09-13 18:45         ` Thomas Gleixner
  0 siblings, 1 reply; 75+ messages in thread
From: Greg KH @ 2010-09-08  9:11 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Greg Kroah-Hartman

On Wed, Sep 08, 2010 at 10:59:23AM +0200, Thomas Gleixner wrote:
> On Tue, 7 Sep 2010, Greg KH wrote:
> 
> > On Tue, Sep 07, 2010 at 02:33:47PM -0000, Thomas Gleixner wrote:
> > > init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
> > > staging users.
> > 
> > I don't think you actually built this change:
> > 
> > > --- linux-2.6.orig/drivers/staging/comedi/drivers/usbdux.c
> > > +++ linux-2.6/drivers/staging/comedi/drivers/usbdux.c
> > > @@ -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?
> 
> 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 29/30] hwmon: s3c-hwmon: Use a real mutex
  2010-09-07 14:33   ` [lm-sensors] " Thomas Gleixner
@ 2010-09-08 13:39     ` Jean Delvare
  -1 siblings, 0 replies; 75+ messages in thread
From: Jean Delvare @ 2010-09-08 13:39 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Ben Dooks, lm-sensors

On Tue, 07 Sep 2010 14:33:57 -0000, Thomas Gleixner wrote:
> The semaphore which protects the ADC is semantically a mutex. Use a
> real mutex.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jean Delvare <khali@linux-fr.org>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: lm-sensors@lm-sensors.org
> ---
>  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. */
>  
> 
> 

Applied, thanks.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [lm-sensors] [patch 29/30] hwmon: s3c-hwmon: Use a real mutex
@ 2010-09-08 13:39     ` Jean Delvare
  0 siblings, 0 replies; 75+ messages in thread
From: Jean Delvare @ 2010-09-08 13:39 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Ben Dooks, lm-sensors

On Tue, 07 Sep 2010 14:33:57 -0000, Thomas Gleixner wrote:
> The semaphore which protects the ADC is semantically a mutex. Use a
> real mutex.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jean Delvare <khali@linux-fr.org>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: lm-sensors@lm-sensors.org
> ---
>  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. */
>  
> 
> 

Applied, thanks.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
@ 2010-09-08 15:37   ` Dmitry Torokhov
  2010-10-12 15:49   ` [tip:core/locking] input: Misc/hp_sdc_rtc: " tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: Dmitry Torokhov @ 2010-09-08 15:37 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra, Christoph Hellwig

On Tue, Sep 07, 2010 at 02:31:58PM -0000, Thomas Gleixner wrote:
> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Dmitry Torokhov <dtor@mail.ru>

All 3 look good to me Thomas, please merge with the rest of the patch
series.

> 
> ---
>  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
> ===================================================================
> --- linux-2.6.orig/drivers/input/misc/hp_sdc_rtc.c
> +++ linux-2.6/drivers/input/misc/hp_sdc_rtc.c
> @@ -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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 12/30] ibmphp-hpc: semaphore cleanup
  2010-09-07 14:32 ` [patch 12/30] ibmphp-hpc: semaphore cleanup Thomas Gleixner
@ 2010-09-09 20:42   ` Jesse Barnes
  0 siblings, 0 replies; 75+ messages in thread
From: Jesse Barnes @ 2010-09-09 20:42 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, linux-pci

On Tue, 07 Sep 2010 14:32:38 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: linux-pci@vger.kernel.org
> 
> ---
>  drivers/pci/hotplug/ibmphp_hpc.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/drivers/pci/hotplug/ibmphp_hpc.c
> ===================================================================
> --- linux-2.6.orig/drivers/pci/hotplug/ibmphp_hpc.c
> +++ linux-2.6/drivers/pci/hotplug/ibmphp_hpc.c
> @@ -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.

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 15/30] smbfs: Convert server->sem to mutex
  2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
@ 2010-09-10 12:46   ` Jeff Layton
  0 siblings, 0 replies; 75+ messages in thread
From: Jeff Layton @ 2010-09-10 12:46 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Al Viro, linux-fsdevel

On Tue, 07 Sep 2010 14:32:52 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> server->sem is used as mutex so make it a mutex.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: linux-fsdevel@vger.kernel.org
> 
> ---
>  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
> ===================================================================
> --- linux-2.6.orig/fs/smbfs/inode.c
> +++ linux-2.6/fs/smbfs/inode.c
> @@ -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
> ===================================================================
> --- linux-2.6.orig/include/linux/smb_fs_sb.h
> +++ linux-2.6/include/linux/smb_fs_sb.h
> @@ -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
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


Seems harmless...

Acked-by: Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 27/30] staging: Bulk convert the semaphore mess
  2010-09-08  9:11       ` Greg KH
@ 2010-09-13 18:45         ` Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: Thomas Gleixner @ 2010-09-13 18:45 UTC (permalink / raw)
  To: Greg KH
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Greg Kroah-Hartman

On Wed, 8 Sep 2010, Greg KH wrote:

> On Wed, Sep 08, 2010 at 10:59:23AM +0200, Thomas Gleixner wrote:
> > On Tue, 7 Sep 2010, Greg KH wrote:
> > 
> > > On Tue, Sep 07, 2010 at 02:33:47PM -0000, Thomas Gleixner wrote:
> > > > init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
> > > > staging users.
> > > 
> > > I don't think you actually built this change:
> > > 
> > > > --- linux-2.6.orig/drivers/staging/comedi/drivers/usbdux.c
> > > > +++ linux-2.6/drivers/staging/comedi/drivers/usbdux.c
> > > > @@ -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?
> > 
> > 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

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 21/30] mmc: Convert "mutex" to semaphore
  2010-09-07 14:33 ` [patch 21/30] mmc: Convert "mutex" to semaphore Thomas Gleixner
@ 2010-09-14 12:47   ` Chris Ball
  0 siblings, 0 replies; 75+ messages in thread
From: Chris Ball @ 2010-09-14 12:47 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, linux-mmc

Hi,

On Tue, Sep 07, 2010 at 02:33:22PM -0000, Thomas Gleixner wrote:
> Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-mmc@vger.kernel.org
> 
> ---
>  drivers/mmc/card/queue.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6/drivers/mmc/card/queue.c
> ===================================================================
> --- linux-2.6.orig/drivers/mmc/card/queue.c
> +++ linux-2.6/drivers/mmc/card/queue.c
> @@ -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.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [patch 23/30] infiniband: Make user_mad semaphore a real one
  2010-09-07 14:33 ` [patch 23/30] infiniband: Make user_mad semaphore a real one Thomas Gleixner
@ 2010-09-29  3:53   ` Roland Dreier
  0 siblings, 0 replies; 75+ messages in thread
From: Roland Dreier @ 2010-09-29  3:53 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: LKML, Andrew Morton, Ingo Molnar, Peter Zijlstra,
	Christoph Hellwig, Roland Dreier

thanks, applied.

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [tip:core/locking] input: Misc/hp_sdc_rtc: semaphore cleanup
  2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
  2010-09-08 15:37   ` Dmitry Torokhov
@ 2010-10-12 15:49   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, dtor, tglx, hch

Commit-ID:  10d0ff83078d5ef99aaf94a2aaceb740f5ced923
Gitweb:     http://git.kernel.org/tip/10d0ff83078d5ef99aaf94a2aaceb740f5ced923
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:31:58 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
LKML-Reference: <20100907125054.888438853@linutronix.de>

---
 drivers/input/misc/hp_sdc_rtc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/hp_sdc_rtc.c b/drivers/input/misc/hp_sdc_rtc.c
index c190664..7e2c12a 100644
--- a/drivers/input/misc/hp_sdc_rtc.c
+++ b/drivers/input/misc/hp_sdc_rtc.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] input: Serio/hil_mlc: semaphore cleanup
  2010-09-07 14:32 ` [patch 03/30] input: serio/hil_mlc: " Thomas Gleixner
@ 2010-10-12 15:49   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, dtor, tglx, hch

Commit-ID:  45e8492f594dcb17e8cbb26edb2dd3018a68dada
Gitweb:     http://git.kernel.org/tip/45e8492f594dcb17e8cbb26edb2dd3018a68dada
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:01 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
LKML-Reference: <20100907125054.985090435@linutronix.de>

---
 drivers/input/serio/hil_mlc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c
index c92f4ed..e5624d8 100644
--- a/drivers/input/serio/hil_mlc.c
+++ b/drivers/input/serio/hil_mlc.c
@@ -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);

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] input: Serio/hp_sdc: semaphore cleanup
  2010-09-07 14:32 ` [patch 04/30] input: serio/hp_sdc: " Thomas Gleixner
@ 2010-10-12 15:49   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:49 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, dtor, tglx, hch

Commit-ID:  4a4a506f81eebe63fb1b8e9e99f4bcd1fd9aac66
Gitweb:     http://git.kernel.org/tip/4a4a506f81eebe63fb1b8e9e99f4bcd1fd9aac66
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:06 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
LKML-Reference: <20100907125055.079737758@linutronix.de>

---
 drivers/input/serio/hp_sdc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c
index bcc2d30..8c0b51c 100644
--- a/drivers/input/serio/hp_sdc.c
+++ b/drivers/input/serio/hp_sdc.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] net: 3c527: semaphore cleanup
  2010-09-07 14:32 ` [patch 05/30] net: 3c527: " Thomas Gleixner
  2010-09-07 16:28   ` David Miller
@ 2010-10-12 15:50   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  50948ee8124c2125d833e8889002aa12a948b4e9
Gitweb:     http://git.kernel.org/tip/50948ee8124c2125d833e8889002aa12a948b4e9
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:10 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:08 +0200

net: 3c527: semaphore cleanup

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <20100907125055.175750769@linutronix.de>
---
 drivers/net/3c527.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c
index 70705d1..eca55c5 100644
--- a/drivers/net/3c527.c
+++ b/drivers/net/3c527.c
@@ -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);
 

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] hamradio: 6pack: semaphore cleanup
  2010-09-07 14:32 ` [patch 06/30] hamradio: 6pack: " Thomas Gleixner
  2010-09-07 16:28   ` David Miller
@ 2010-10-12 15:50   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  89d9f10d0b21268d3dba33db984ab03092861700
Gitweb:     http://git.kernel.org/tip/89d9f10d0b21268d3dba33db984ab03092861700
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:14 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:08 +0200

hamradio: 6pack: semaphore cleanup

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <20100907125055.269142443@linutronix.de>

---
 drivers/net/hamradio/6pack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 4b52c76..3e5d0b6 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -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!  */
 

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] hamradio: Mkiss: semaphore cleanup
  2010-09-07 14:32 ` [patch 07/30] hamradio: mkiss: " Thomas Gleixner
  2010-09-07 16:28   ` David Miller
@ 2010-10-12 15:50   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:50 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  495e64bddeb9349395ed346177057fff7d52857e
Gitweb:     http://git.kernel.org/tip/495e64bddeb9349395ed346177057fff7d52857e
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:18 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:09 +0200

hamradio: Mkiss: semaphore cleanup

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <20100907125055.368389976@linutronix.de>

---
 drivers/net/hamradio/mkiss.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
index 66e88bd..4c62839 100644
--- a/drivers/net/hamradio/mkiss.c
+++ b/drivers/net/hamradio/mkiss.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] net: Ppp_async: semaphore cleanup
  2010-09-07 14:32 ` [patch 08/30] net: ppp_async: " Thomas Gleixner
  2010-09-07 16:28   ` David Miller
@ 2010-10-12 15:51   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  0bce198b7688911e072bd65032ab9278b577ee93
Gitweb:     http://git.kernel.org/tip/0bce198b7688911e072bd65032ab9278b577ee93
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:22 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: David Miller <davem@davemloft.net>
LKML-Reference: <20100907125055.460765783@linutronix.de>

---
 drivers/net/ppp_async.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c
index af50a53..78d70a6 100644
--- a/drivers/net/ppp_async.c
+++ b/drivers/net/ppp_async.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] net: Wan/cosa.c: Convert "mutex" to semaphore
  2010-09-07 14:32 ` [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
  2010-09-07 16:29   ` David Miller
@ 2010-10-12 15:51   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  d1985508320ad40a68375bdbafa8a5d6c56d2114
Gitweb:     http://git.kernel.org/tip/d1985508320ad40a68375bdbafa8a5d6c56d2114
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:25 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: "David S. Miller" <davem@davemloft.net>
LKML-Reference: <20100907125055.557578360@linutronix.de>

---
 drivers/net/wan/cosa.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 04c6cd4..10bafd5 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -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))) {

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] irda: Semaphore cleanup
  2010-09-07 14:32 ` [patch 10/30] irda: semaphore cleanup Thomas Gleixner
  2010-09-07 16:29   ` David Miller
@ 2010-10-12 15:51   ` tip-bot for Thomas Gleixner
  1 sibling, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:51 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, davem, hch

Commit-ID:  db7f859ec53c0bfaf3520afe2feafd18a27e48fb
Gitweb:     http://git.kernel.org/tip/db7f859ec53c0bfaf3520afe2feafd18a27e48fb
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:30 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:09 +0200

irda: Semaphore cleanup

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Acked-by: "David S. Miller" <davem@davemloft.net>
LKML-Reference: <20100907125055.651362456@linutronix.de>

---
 drivers/net/irda/sir_dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index 1b051da..51d7444 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] parport: Semaphore cleanup
  2010-09-07 14:32 ` [patch 11/30] parport: semaphore cleanup Thomas Gleixner
@ 2010-10-12 15:52   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, alan, hch

Commit-ID:  a529f1505b6facfd0078dcb18a444976c1985962
Gitweb:     http://git.kernel.org/tip/a529f1505b6facfd0078dcb18a444976c1985962
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:34 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:10 +0200

parport: Semaphore cleanup

Get rid of init_MUTEX[_LOCKED]() and use sema_init() instead.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
LKML-Reference: <20100907125055.743613774@linutronix.de>

---
 drivers/parport/share.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index dffa5d4..a2d9d1e 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -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);

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] drivers/macintosh/adb: Do not claim that the semaphore is a mutex
  2010-09-07 14:33 ` [patch 25/30] drivers/macintosh/adb: Do not claim that the semaphore is a mutex Thomas Gleixner
@ 2010-10-12 15:52   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:52 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, benh, peterz, tglx, hch

Commit-ID:  8192b1f6b1a46b33213b993471356495a93ffc70
Gitweb:     http://git.kernel.org/tip/8192b1f6b1a46b33213b993471356495a93ffc70
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:33:40 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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()

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
LKML-Reference: <20100907125057.086367802@linutronix.de>

---
 drivers/macintosh/adb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index 1c4ee6e..bf64e49 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] printk: Make console_sem a semaphore not a pseudo mutex
  2010-09-07 14:33 ` [patch 26/30] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
@ 2010-10-12 15:53   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, hch

Commit-ID:  5b8c4f23c54edda640a4850bc9b81dee70acb525
Gitweb:     http://git.kernel.org/tip/5b8c4f23c54edda640a4850bc9b81dee70acb525
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:33:43 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
LKML-Reference: <20100907125057.179587334@linutronix.de>

---
 kernel/printk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 8fe465a..2531017 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -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)

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] arm: Bcmring: semaphore cleanup
  2010-09-07 14:33   ` Thomas Gleixner
  (?)
@ 2010-10-12 15:53   ` tip-bot for Thomas Gleixner
  -1 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, leochen, peterz, tglx, hch

Commit-ID:  5356d94872502e77317f82e8fcae2a0b162af07c
Gitweb:     http://git.kernel.org/tip/5356d94872502e77317f82e8fcae2a0b162af07c
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:33:52 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 12 Oct 2010 17:36:10 +0200

arm: Bcmring: semaphore cleanup

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Leo Chen <leochen@broadcom.com>
LKML-Reference: <20100907125057.371771121@linutronix.de>

---
 arch/arm/mach-bcmring/dma.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-bcmring/dma.c b/arch/arm/mach-bcmring/dma.c
index 29c0a91..77eb35c 100644
--- a/arch/arm/mach-bcmring/dma.c
+++ b/arch/arm/mach-bcmring/dma.c
@@ -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;
 }

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] hfs: Convert tree_lock to mutex
  2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
@ 2010-10-12 15:53   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:53 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, hch, peterz, tglx, viro

Commit-ID:  4a9410355406c31695eab9daeba694d7d9714e9b
Gitweb:     http://git.kernel.org/tip/4a9410355406c31695eab9daeba694d7d9714e9b
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:33:08 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
LKML-Reference: <20100907125056.416332114@linutronix.de>

---
 fs/hfs/bfind.c |    4 ++--
 fs/hfs/btree.c |    2 +-
 fs/hfs/btree.h |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index 4129cdb..571abe9 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -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;
 }
 
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 38a0a99..3ebc437 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -27,7 +27,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
 	if (!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;
diff --git a/fs/hfs/btree.h b/fs/hfs/btree.h
index cc51905..2a1d712 100644
--- a/fs/hfs/btree.h
+++ b/fs/hfs/btree.h
@@ -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;

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] affs: Use sema_init instead of init_MUTEX
  2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
@ 2010-10-12 15:54   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-12 15:54 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, viro, hch

Commit-ID:  756b0322e50aebc4b9afb4488a2d3f6c802b4e64
Gitweb:     http://git.kernel.org/tip/756b0322e50aebc4b9afb4488a2d3f6c802b4e64
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:33:11 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
LKML-Reference: <20100907125056.511395595@linutronix.de>
---
 fs/affs/super.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/affs/super.c b/fs/affs/super.c
index 33c4e7e..9581ea9 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -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);
 }
 

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] hpfs: Convert sbi->hpfs_creation_de to mutex
  2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
@ 2010-10-30  8:16   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-30  8:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, viro, hch

Commit-ID:  117bf5fbdbdc7a5394e5718b3354238961c83067
Gitweb:     http://git.kernel.org/tip/117bf5fbdbdc7a5394e5718b3354238961c83067
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:32:56 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
LKML-Reference: <20100907125056.228874895@linutronix.de>

---
 fs/hpfs/buffer.c  |    4 ++--
 fs/hpfs/hpfs_fn.h |    2 +-
 fs/hpfs/super.c   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c
index eac5f96..793cb9d 100644
--- a/fs/hpfs/buffer.c
+++ b/fs/hpfs/buffer.c
@@ -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. */
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index b59eac0..2fee17d 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -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;
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index c969a1a..18e1d45 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -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();

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] staging: Final semaphore cleanup
  2010-09-07 14:33 ` [patch 27/30] staging: Bulk convert the semaphore mess Thomas Gleixner
  2010-09-08  2:30   ` Greg KH
  2010-09-08  2:35   ` Greg KH
@ 2010-10-30 10:16   ` tip-bot for Thomas Gleixner
  2 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-30 10:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, gregkh, tglx

Commit-ID:  45f4d0243525b6bc747c946937ced437b135a84d
Gitweb:     http://git.kernel.org/tip/45f4d0243525b6bc747c946937ced437b135a84d
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Sat, 30 Oct 2010 11:06:57 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
LKML-Reference: <20100907125057.278833764@linutronix.de>
---
 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(-)

diff --git a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c b/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
index c196098..6b8eeea 100644
--- a/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
+++ b/drivers/staging/ath6kl/os/linux/ar6000_raw_if.c
@@ -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]);
 
diff --git a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
index e535787..bbbe7c5 100644
--- a/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
+++ b/drivers/staging/brcm80211/brcmfmac/dhd_linux.c
@@ -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
diff --git a/drivers/staging/brcm80211/sys/wl_mac80211.c b/drivers/staging/brcm80211/sys/wl_mac80211.c
index ad635ee..d060377 100644
--- a/drivers/staging/brcm80211/sys/wl_mac80211.c
+++ b/drivers/staging/brcm80211/sys/wl_mac80211.c
@@ -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);
diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
index 0560a74..0605985 100644
--- a/drivers/staging/comedi/drivers/dt9812.c
+++ b/drivers/staging/comedi/drivers/dt9812.c
@@ -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)},
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index 6131e2d..1f177a6 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -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;
 
diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c
index 0a164a9..5b15e6d 100644
--- a/drivers/staging/comedi/drivers/usbduxfast.c
+++ b/drivers/staging/comedi/drivers/usbduxfast.c
@@ -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;
 
diff --git a/drivers/staging/dream/camera/mt9d112.c b/drivers/staging/dream/camera/mt9d112.c
index e6f2d51..27c978f 100644
--- a/drivers/staging/dream/camera/mt9d112.c
+++ b/drivers/staging/dream/camera/mt9d112.c
@@ -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);
 
 
 /*=============================================================
diff --git a/drivers/staging/dream/camera/mt9p012_fox.c b/drivers/staging/dream/camera/mt9p012_fox.c
index 791bd6c..544a973 100644
--- a/drivers/staging/dream/camera/mt9p012_fox.c
+++ b/drivers/staging/dream/camera/mt9p012_fox.c
@@ -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
diff --git a/drivers/staging/dream/camera/mt9t013.c b/drivers/staging/dream/camera/mt9t013.c
index 8fd7727..75e78aa 100644
--- a/drivers/staging/dream/camera/mt9t013.c
+++ b/drivers/staging/dream/camera/mt9t013.c
@@ -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 */
 
diff --git a/drivers/staging/dream/camera/s5k3e2fx.c b/drivers/staging/dream/camera/s5k3e2fx.c
index 1459903..d66b453 100644
--- a/drivers/staging/dream/camera/s5k3e2fx.c
+++ b/drivers/staging/dream/camera/s5k3e2fx.c
@@ -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)
diff --git a/drivers/staging/msm/msm_fb.c b/drivers/staging/msm/msm_fb.c
index ea268ed..23fa049 100644
--- a/drivers/staging/msm/msm_fb.c
+++ b/drivers/staging/msm/msm_fb.c
@@ -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);
 
diff --git a/drivers/staging/rtl8712/osdep_service.h b/drivers/staging/rtl8712/osdep_service.h
index 7fca42c..d1674cd 100644
--- a/drivers/staging/rtl8712/osdep_service.h
+++ b/drivers/staging/rtl8712/osdep_service.h
@@ -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)
diff --git a/drivers/staging/smbfs/inode.c b/drivers/staging/smbfs/inode.c
index 552951a..fa42f40 100644
--- a/drivers/staging/smbfs/inode.c
+++ b/drivers/staging/smbfs/inode.c
@@ -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);
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
index f428a7a..e1851f0 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_block.c
@@ -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;
diff --git a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
index 24e959e..0bbb8a3 100644
--- a/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
+++ b/drivers/staging/westbridge/astoria/block/cyasblkdev_queue.c
@@ -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) {

^ permalink raw reply related	[flat|nested] 75+ messages in thread

* [tip:core/locking] semaphore: Remove mutex emulation
  2010-09-07 14:34 ` [patch 30/30] semaphore: Remove mutex emulation Thomas Gleixner
@ 2010-10-30 10:16   ` tip-bot for Thomas Gleixner
  0 siblings, 0 replies; 75+ messages in thread
From: tip-bot for Thomas Gleixner @ 2010-10-30 10:16 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, peterz, tglx, hch

Commit-ID:  4882720b267b7b1d1b0ce08334b205f0329d4615
Gitweb:     http://git.kernel.org/tip/4882720b267b7b1d1b0ce08334b205f0329d4615
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 7 Sep 2010 14:34:01 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
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.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
LKML-Reference: <20100907125057.562399240@linutronix.de>

---
 include/linux/semaphore.h |    6 ------
 scripts/checkpatch.pl     |    8 ++------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
index 5310d27..39fa049 100644
--- a/include/linux/semaphore.h
+++ b/include/linux/semaphore.h
@@ -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);
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 90b54d4..e3c7fc0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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);
 
 		}

^ permalink raw reply related	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2010-10-30 10:16 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-07 14:31 [patch 00/30] semaphore cleanup Thomas Gleixner
2010-09-07 14:31 ` [patch 01/30] semaphore: Add DEFINE_SEMAPHORE Thomas Gleixner
2010-09-07 14:31 ` [patch 02/30] input: misc/hp_sdc_rtc: semaphore cleanup Thomas Gleixner
2010-09-08 15:37   ` Dmitry Torokhov
2010-10-12 15:49   ` [tip:core/locking] input: Misc/hp_sdc_rtc: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 03/30] input: serio/hil_mlc: " Thomas Gleixner
2010-10-12 15:49   ` [tip:core/locking] input: Serio/hil_mlc: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 04/30] input: serio/hp_sdc: " Thomas Gleixner
2010-10-12 15:49   ` [tip:core/locking] input: Serio/hp_sdc: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 05/30] net: 3c527: " Thomas Gleixner
2010-09-07 16:28   ` David Miller
2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 06/30] hamradio: 6pack: " Thomas Gleixner
2010-09-07 16:28   ` David Miller
2010-10-12 15:50   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 07/30] hamradio: mkiss: " Thomas Gleixner
2010-09-07 16:28   ` David Miller
2010-10-12 15:50   ` [tip:core/locking] hamradio: Mkiss: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 08/30] net: ppp_async: " Thomas Gleixner
2010-09-07 16:28   ` David Miller
2010-10-12 15:51   ` [tip:core/locking] net: Ppp_async: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 09/30] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
2010-09-07 16:29   ` David Miller
2010-10-12 15:51   ` [tip:core/locking] net: Wan/cosa.c: " tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 10/30] irda: semaphore cleanup Thomas Gleixner
2010-09-07 16:29   ` David Miller
2010-10-12 15:51   ` [tip:core/locking] irda: Semaphore cleanup tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 11/30] parport: semaphore cleanup Thomas Gleixner
2010-10-12 15:52   ` [tip:core/locking] parport: Semaphore cleanup tip-bot for Thomas Gleixner
2010-09-07 14:32 ` [patch 12/30] ibmphp-hpc: semaphore cleanup Thomas Gleixner
2010-09-09 20:42   ` Jesse Barnes
2010-09-07 14:32 ` [patch 13/30] usb: ftdi-elan: Convert "mutex" to semaphore Thomas Gleixner
2010-09-07 14:32 ` [patch 14/30] scsi: aacraid semaphore cleanup Thomas Gleixner
2010-09-07 14:32 ` [patch 15/30] smbfs: Convert server->sem to mutex Thomas Gleixner
2010-09-10 12:46   ` Jeff Layton
2010-09-07 14:32 ` [patch 16/30] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
2010-10-30  8:16   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 17/30] hpfsplus: Convert tree_lock " Thomas Gleixner
2010-09-07 14:33 ` [patch 18/30] hfs: " Thomas Gleixner
2010-10-12 15:53   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 19/30] affs: use sema_init instead of init_MUTEX Thomas Gleixner
2010-10-12 15:54   ` [tip:core/locking] affs: Use " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 20/30] xfs: semaphore cleanup Thomas Gleixner
2010-09-07 14:33 ` [patch 21/30] mmc: Convert "mutex" to semaphore Thomas Gleixner
2010-09-14 12:47   ` Chris Ball
2010-09-07 14:33 ` [patch 22/30] dvb: " Thomas Gleixner
2010-09-07 14:33 ` [patch 23/30] infiniband: Make user_mad semaphore a real one Thomas Gleixner
2010-09-29  3:53   ` Roland Dreier
2010-09-07 14:33 ` [patch 24/30] ia64: salinfo: sema_init instead of init_MUTEX Thomas Gleixner
2010-09-07 14:33   ` Thomas Gleixner
2010-09-07 14:33 ` [patch 25/30] drivers/macintosh/adb: Do not claim that the semaphore is a mutex Thomas Gleixner
2010-10-12 15:52   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 26/30] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
2010-10-12 15:53   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 27/30] staging: Bulk convert the semaphore mess Thomas Gleixner
2010-09-08  2:30   ` Greg KH
2010-09-08  8:59     ` Thomas Gleixner
2010-09-08  9:11       ` Greg KH
2010-09-13 18:45         ` Thomas Gleixner
2010-09-08  2:35   ` Greg KH
2010-10-30 10:16   ` [tip:core/locking] staging: Final semaphore cleanup tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 28/30] arm: bcmring: " Thomas Gleixner
2010-09-07 14:33   ` Thomas Gleixner
2010-10-12 15:53   ` [tip:core/locking] arm: Bcmring: " tip-bot for Thomas Gleixner
2010-09-07 14:33 ` [patch 29/30] hwmon: s3c-hwmon: Use a real mutex Thomas Gleixner
2010-09-07 14:33   ` [lm-sensors] " Thomas Gleixner
2010-09-08 13:39   ` Jean Delvare
2010-09-08 13:39     ` [lm-sensors] " Jean Delvare
2010-09-07 14:34 ` [patch 30/30] semaphore: Remove mutex emulation Thomas Gleixner
2010-10-30 10:16   ` [tip:core/locking] " tip-bot for Thomas Gleixner
2010-09-07 15:27 ` [patch 00/30] semaphore cleanup Arnd Bergmann
2010-09-07 15:38   ` Thomas Gleixner
2010-09-07 17:38     ` Arnd Bergmann
2010-09-07 20:23       ` Thomas Gleixner
2010-09-07 20:40         ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.