mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 16/19] mutex subsystem, semaphore to completion: SX8
@ 2006-01-03 10:09 Ingo Molnar
  2006-01-03 12:22 ` Nick Piggin
  0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2006-01-03 10:09 UTC (permalink / raw)
  To: lkml
  Cc: Linus Torvalds, Andrew Morton, Arjan van de Ven, Nicolas Pitre,
	Jes Sorensen, Al Viro, Oleg Nesterov, David Howells, Alan Cox,
	Christoph Hellwig, Andi Kleen, Russell King

From: Steven Rostedt <rostedt@goodmis.org>

change SX8 semaphores to completions.

Signed-off-by: Ingo Molnar <mingo@elte.hu>

----

 drivers/block/sx8.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

Index: linux/drivers/block/sx8.c
===================================================================
--- linux.orig/drivers/block/sx8.c
+++ linux/drivers/block/sx8.c
@@ -27,6 +27,7 @@
 #include <linux/time.h>
 #include <linux/hdreg.h>
 #include <linux/dma-mapping.h>
+#include <linux/completion.h>
 #include <asm/io.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
@@ -303,7 +304,7 @@ struct carm_host {
 
 	struct work_struct		fsm_task;
 
-	struct semaphore		probe_sem;
+	struct completion		probe_comp;
 };
 
 struct carm_response {
@@ -1365,7 +1366,7 @@ static void carm_fsm_task (void *_data)
 	}
 
 	case HST_PROBE_FINISHED:
-		up(&host->probe_sem);
+		complete(&host->probe_comp);
 		break;
 
 	case HST_ERROR:
@@ -1641,7 +1642,7 @@ static int carm_init_one (struct pci_dev
 	host->flags = pci_dac ? FL_DAC : 0;
 	spin_lock_init(&host->lock);
 	INIT_WORK(&host->fsm_task, carm_fsm_task, host);
-	init_MUTEX_LOCKED(&host->probe_sem);
+	init_completion(&host->probe_comp);
 
 	for (i = 0; i < ARRAY_SIZE(host->req); i++)
 		host->req[i].tag = i;
@@ -1710,8 +1711,8 @@ static int carm_init_one (struct pci_dev
 	if (rc)
 		goto err_out_free_irq;
 
-	DPRINTK("waiting for probe_sem\n");
-	down(&host->probe_sem);
+	DPRINTK("waiting for probe_comp\n");
+	wait_for_completion(&host->probe_comp);
 
 	printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n",
 	       host->name, pci_name(pdev), (int) CARM_MAX_PORTS,

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

* Re: [patch 16/19] mutex subsystem, semaphore to completion: SX8
  2006-01-03 10:09 [patch 16/19] mutex subsystem, semaphore to completion: SX8 Ingo Molnar
@ 2006-01-03 12:22 ` Nick Piggin
  2006-01-03 12:38   ` Ingo Molnar
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Piggin @ 2006-01-03 12:22 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven,
	Nicolas Pitre, Jes Sorensen, Al Viro, Oleg Nesterov,
	David Howells, Alan Cox, Christoph Hellwig, Andi Kleen,
	Russell King

Ingo Molnar wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
> 
> change SX8 semaphores to completions.
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> ----
> 
>  drivers/block/sx8.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> Index: linux/drivers/block/sx8.c
> ===================================================================
> --- linux.orig/drivers/block/sx8.c
> +++ linux/drivers/block/sx8.c
> @@ -27,6 +27,7 @@
>  #include <linux/time.h>
>  #include <linux/hdreg.h>
>  #include <linux/dma-mapping.h>
> +#include <linux/completion.h>
>  #include <asm/io.h>
>  #include <asm/semaphore.h>

These patches should remove the asm/semaphore.h when appropriate too.
At a glance, this looks like one such case.

Also, these aren't really part of a mutex subsystem patch series are
they?

-- 
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com 

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

* Re: [patch 16/19] mutex subsystem, semaphore to completion: SX8
  2006-01-03 12:22 ` Nick Piggin
@ 2006-01-03 12:38   ` Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2006-01-03 12:38 UTC (permalink / raw)
  To: Nick Piggin
  Cc: lkml, Linus Torvalds, Andrew Morton, Arjan van de Ven,
	Nicolas Pitre, Jes Sorensen, Al Viro, Oleg Nesterov,
	David Howells, Alan Cox, Christoph Hellwig, Andi Kleen,
	Russell King


* Nick Piggin <nickpiggin@yahoo.com.au> wrote:

> Ingo Molnar wrote:
> >From: Steven Rostedt <rostedt@goodmis.org>
> >
> >change SX8 semaphores to completions.
> >
> >Signed-off-by: Ingo Molnar <mingo@elte.hu>

> >+#include <linux/completion.h>
> > #include <asm/io.h>
> > #include <asm/semaphore.h>
> 
> These patches should remove the asm/semaphore.h when appropriate too.  
> At a glance, this looks like one such case.

yeah, agreed. I did this in my tree. (the other sem2completion patches 
are not affected)

> Also, these aren't really part of a mutex subsystem patch series are 
> they?

i included them because they reduce the number of semaphores that are 
used in a non-mutex fashion, and thus make the mutex conversion easier. 
I.e. i consider both the sem2mutex and the sem2completion patches as 
part of the 'convert semaphores to mutexes' effort, even though 
sem2completions are independent technically. They can be applied 
independently of the mutex subsystem itself, of course.

	Ingo

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

* [patch 16/19] mutex subsystem, semaphore to completion: SX8
@ 2006-01-03 16:47 Ingo Molnar
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2006-01-03 16:47 UTC (permalink / raw)
  To: lkml
  Cc: Linus Torvalds, Andrew Morton, Arjan van de Ven, Nicolas Pitre,
	Jes Sorensen, Al Viro, Oleg Nesterov, David Howells, Alan Cox,
	Christoph Hellwig, Andi Kleen, Russell King

From: Steven Rostedt <rostedt@goodmis.org>

change SX8 semaphores to completions.

Signed-off-by: Ingo Molnar <mingo@elte.hu>

----

 drivers/block/sx8.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

Index: linux/drivers/block/sx8.c
===================================================================
--- linux.orig/drivers/block/sx8.c
+++ linux/drivers/block/sx8.c
@@ -27,8 +27,8 @@
 #include <linux/time.h>
 #include <linux/hdreg.h>
 #include <linux/dma-mapping.h>
+#include <linux/completion.h>
 #include <asm/io.h>
-#include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
 #if 0
@@ -303,7 +303,7 @@ struct carm_host {
 
 	struct work_struct		fsm_task;
 
-	struct semaphore		probe_sem;
+	struct completion		probe_comp;
 };
 
 struct carm_response {
@@ -1365,7 +1365,7 @@ static void carm_fsm_task (void *_data)
 	}
 
 	case HST_PROBE_FINISHED:
-		up(&host->probe_sem);
+		complete(&host->probe_comp);
 		break;
 
 	case HST_ERROR:
@@ -1641,7 +1641,7 @@ static int carm_init_one (struct pci_dev
 	host->flags = pci_dac ? FL_DAC : 0;
 	spin_lock_init(&host->lock);
 	INIT_WORK(&host->fsm_task, carm_fsm_task, host);
-	init_MUTEX_LOCKED(&host->probe_sem);
+	init_completion(&host->probe_comp);
 
 	for (i = 0; i < ARRAY_SIZE(host->req); i++)
 		host->req[i].tag = i;
@@ -1710,8 +1710,8 @@ static int carm_init_one (struct pci_dev
 	if (rc)
 		goto err_out_free_irq;
 
-	DPRINTK("waiting for probe_sem\n");
-	down(&host->probe_sem);
+	DPRINTK("waiting for probe_comp\n");
+	wait_for_completion(&host->probe_comp);
 
 	printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n",
 	       host->name, pci_name(pdev), (int) CARM_MAX_PORTS,

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

* [patch 16/19] mutex subsystem, semaphore to completion: SX8
@ 2006-01-02 16:35 Ingo Molnar, Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar, Steven Rostedt @ 2006-01-02 16:35 UTC (permalink / raw)
  To: lkml
  Cc: Linus Torvalds, Andrew Morton, Arjan van de Ven, Nicolas Pitre,
	Jes Sorensen, Al Viro, Oleg Nesterov, David Howells, Alan Cox,
	Christoph Hellwig, Andi Kleen, Russell King

change SX8 semaphores to completions.

Signed-off-by: Ingo Molnar <mingo@elte.hu>

----

 drivers/block/sx8.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

Index: linux/drivers/block/sx8.c
===================================================================
--- linux.orig/drivers/block/sx8.c
+++ linux/drivers/block/sx8.c
@@ -27,6 +27,7 @@
 #include <linux/time.h>
 #include <linux/hdreg.h>
 #include <linux/dma-mapping.h>
+#include <linux/completion.h>
 #include <asm/io.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
@@ -303,7 +304,7 @@ struct carm_host {
 
 	struct work_struct		fsm_task;
 
-	struct semaphore		probe_sem;
+	struct completion		probe_comp;
 };
 
 struct carm_response {
@@ -1365,7 +1366,7 @@ static void carm_fsm_task (void *_data)
 	}
 
 	case HST_PROBE_FINISHED:
-		up(&host->probe_sem);
+		complete(&host->probe_comp);
 		break;
 
 	case HST_ERROR:
@@ -1641,7 +1642,7 @@ static int carm_init_one (struct pci_dev
 	host->flags = pci_dac ? FL_DAC : 0;
 	spin_lock_init(&host->lock);
 	INIT_WORK(&host->fsm_task, carm_fsm_task, host);
-	init_MUTEX_LOCKED(&host->probe_sem);
+	init_completion(&host->probe_comp);
 
 	for (i = 0; i < ARRAY_SIZE(host->req); i++)
 		host->req[i].tag = i;
@@ -1710,8 +1711,8 @@ static int carm_init_one (struct pci_dev
 	if (rc)
 		goto err_out_free_irq;
 
-	DPRINTK("waiting for probe_sem\n");
-	down(&host->probe_sem);
+	DPRINTK("waiting for probe_comp\n");
+	wait_for_completion(&host->probe_comp);
 
 	printk(KERN_INFO "%s: pci %s, ports %d, io %lx, irq %u, major %d\n",
 	       host->name, pci_name(pdev), (int) CARM_MAX_PORTS,

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

end of thread, other threads:[~2006-01-03 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-03 10:09 [patch 16/19] mutex subsystem, semaphore to completion: SX8 Ingo Molnar
2006-01-03 12:22 ` Nick Piggin
2006-01-03 12:38   ` Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2006-01-03 16:47 Ingo Molnar
2006-01-02 16:35 Ingo Molnar, Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®