linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status()
  2007-04-03  0:26 [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb Linas Vepstas
@ 2007-04-03  0:44 ` Linas Vepstas
  2007-04-03 16:19   ` Nathan Lynch
  0 siblings, 1 reply; 4+ messages in thread
From: Linas Vepstas @ 2007-04-03  0:44 UTC (permalink / raw)
  To: Greg KH; +Cc: Andrew Morton, linuxppc-dev, linux-pci


The rpaphp_set_attention_status() routine seems to be a wrapper
around a single rtas call. Abolish it.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>

----
 drivers/pci/hotplug/rpaphp.h      |    1 -
 drivers/pci/hotplug/rpaphp_core.c |   21 ++++++++++-----------
 drivers/pci/hotplug/rpaphp_slot.c |   12 ------------
 3 files changed, 10 insertions(+), 24 deletions(-)

Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp.h
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp.h	2007-03-28 18:10:22.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp.h	2007-04-02 14:34:46.000000000 -0500
@@ -102,6 +102,5 @@ extern void dealloc_slot_struct(struct s
 extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
 extern int rpaphp_register_slot(struct slot *slot);
 extern int rpaphp_deregister_slot(struct slot *slot);
-extern int rpaphp_set_attention_status(struct slot *slot, u8 status);
 	
 #endif				/* _PPC64PHP_H */
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_core.c	2007-03-28 18:10:24.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c	2007-04-02 14:38:25.000000000 -0500
@@ -63,27 +63,26 @@ module_param(debug, bool, 0644);
  */
 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
 {
-	int retval = 0;
+	int rc;
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	switch (value) {
 	case 0:
-		retval = rpaphp_set_attention_status(slot, LED_OFF);
-		hotplug_slot->info->attention_status = 0;
-		break;
 	case 1:
-	default:
-		retval = rpaphp_set_attention_status(slot, LED_ON);
-		hotplug_slot->info->attention_status = 1;
-		break;
 	case 2:
-		retval = rpaphp_set_attention_status(slot, LED_ID);
-		hotplug_slot->info->attention_status = 2;
+		break;
+	default:
+		value = 1;
 		break;
 	}
 	up(&rpaphp_sem);
-	return retval;
+
+	rc = rtas_set_indicator(DR_INDICATOR, slot->index, value);
+	if (!rc)
+		hotplug_slot->info->attention_status = value;
+
+	return rc;
 }
 
 /**
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_slot.c	2007-03-28 18:10:19.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c	2007-04-02 14:31:00.000000000 -0500
@@ -184,15 +184,3 @@ sysfs_fail:
 	return retval;
 }
 
-int rpaphp_set_attention_status(struct slot *slot, u8 status)
-{
-	int rc;
-
-	/* status: LED_OFF or LED_ON */
-	rc = rtas_set_indicator(DR_INDICATOR, slot->index, status);
-	if (rc < 0)
-		err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n",
-		    slot->name, slot->location, slot->index, status, rc);
-
-	return rc;
-}

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

* Re: [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status()
  2007-04-03  0:44 ` [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status() Linas Vepstas
@ 2007-04-03 16:19   ` Nathan Lynch
  2007-04-03 16:45     ` Linas Vepstas
  0 siblings, 1 reply; 4+ messages in thread
From: Nathan Lynch @ 2007-04-03 16:19 UTC (permalink / raw)
  To: Linas Vepstas; +Cc: Andrew Morton, linuxppc-dev, linux-pci, Greg KH

Linas Vepstas wrote:
> 
> The rpaphp_set_attention_status() routine seems to be a wrapper
> around a single rtas call. Abolish it.

...

>  static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
>  {
> -	int retval = 0;
> +	int rc;
>  	struct slot *slot = (struct slot *)hotplug_slot->private;
>  
>  	down(&rpaphp_sem);
>  	switch (value) {
>  	case 0:
> -		retval = rpaphp_set_attention_status(slot, LED_OFF);
> -		hotplug_slot->info->attention_status = 0;
> -		break;
>  	case 1:
> -	default:
> -		retval = rpaphp_set_attention_status(slot, LED_ON);
> -		hotplug_slot->info->attention_status = 1;
> -		break;
>  	case 2:
> -		retval = rpaphp_set_attention_status(slot, LED_ID);
> -		hotplug_slot->info->attention_status = 2;
> +		break;
> +	default:
> +		value = 1;
>  		break;
>  	}
>  	up(&rpaphp_sem);
> -	return retval;
> +
> +	rc = rtas_set_indicator(DR_INDICATOR, slot->index, value);
> +	if (!rc)
> +		hotplug_slot->info->attention_status = value;
> +
> +	return rc;

You're changing the locking behavior here -- you've moved the
rtas_set_indicator and the modification of
hotplug_slot->info->attention_status outside of the code which holds
rpaphp_sem.

P.S.  Should rpaphp_sem be changed to a mutex?

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

* Re: [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status()
  2007-04-03 16:19   ` Nathan Lynch
@ 2007-04-03 16:45     ` Linas Vepstas
  0 siblings, 0 replies; 4+ messages in thread
From: Linas Vepstas @ 2007-04-03 16:45 UTC (permalink / raw)
  To: Nathan Lynch
  Cc: Andrew Morton, pcihpd-discuss, Greg KH, linuxppc-dev, linux-pci,
	kristen.c.accardi

On Tue, Apr 03, 2007 at 11:19:38AM -0500, Nathan Lynch wrote:
> Linas Vepstas wrote:
> 
> You're changing the locking behavior here -- you've moved the
> rtas_set_indicator and the modification of
> hotplug_slot->info->attention_status outside of the code which holds
> rpaphp_sem.
> 
> P.S.  Should rpaphp_sem be changed to a mutex?

In patch 19, I remove the lock entirely. It doesn't seem to serve any
function that I could make out; it does not protect anything in the rpa
code, nor does it appear to be mandated by the hotplug code. Certainly,
none of the other hotplug drivers do this.  

--linas

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

* [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status()
@ 2007-04-03 17:26 Linas Vepstas
  0 siblings, 0 replies; 4+ messages in thread
From: Linas Vepstas @ 2007-04-03 17:26 UTC (permalink / raw)
  To: Kristen Carlson Accardi; +Cc: Andrew Morton, linuxppc-dev, pcihpd-discuss


The rpaphp_set_attention_status() routine seems to be a wrapper
around a single rtas call. Abolish it.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>

----
 drivers/pci/hotplug/rpaphp.h      |    1 -
 drivers/pci/hotplug/rpaphp_core.c |   21 ++++++++++-----------
 drivers/pci/hotplug/rpaphp_slot.c |   12 ------------
 3 files changed, 10 insertions(+), 24 deletions(-)

Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp.h
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp.h	2007-04-03 11:04:25.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp.h	2007-04-03 11:04:32.000000000 -0500
@@ -102,6 +102,5 @@ extern void dealloc_slot_struct(struct s
 extern struct slot *alloc_slot_struct(struct device_node *dn, int drc_index, char *drc_name, int power_domain);
 extern int rpaphp_register_slot(struct slot *slot);
 extern int rpaphp_deregister_slot(struct slot *slot);
-extern int rpaphp_set_attention_status(struct slot *slot, u8 status);
 	
 #endif				/* _PPC64PHP_H */
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_core.c	2007-04-03 11:04:26.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c	2007-04-03 11:04:32.000000000 -0500
@@ -63,27 +63,26 @@ module_param(debug, bool, 0644);
  */
 static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value)
 {
-	int retval = 0;
+	int rc;
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 
 	down(&rpaphp_sem);
 	switch (value) {
 	case 0:
-		retval = rpaphp_set_attention_status(slot, LED_OFF);
-		hotplug_slot->info->attention_status = 0;
-		break;
 	case 1:
-	default:
-		retval = rpaphp_set_attention_status(slot, LED_ON);
-		hotplug_slot->info->attention_status = 1;
-		break;
 	case 2:
-		retval = rpaphp_set_attention_status(slot, LED_ID);
-		hotplug_slot->info->attention_status = 2;
+		break;
+	default:
+		value = 1;
 		break;
 	}
 	up(&rpaphp_sem);
-	return retval;
+
+	rc = rtas_set_indicator(DR_INDICATOR, slot->index, value);
+	if (!rc)
+		hotplug_slot->info->attention_status = value;
+
+	return rc;
 }
 
 /**
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_slot.c	2007-04-03 11:04:23.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_slot.c	2007-04-03 11:04:32.000000000 -0500
@@ -184,15 +184,3 @@ sysfs_fail:
 	return retval;
 }
 
-int rpaphp_set_attention_status(struct slot *slot, u8 status)
-{
-	int rc;
-
-	/* status: LED_OFF or LED_ON */
-	rc = rtas_set_indicator(DR_INDICATOR, slot->index, status);
-	if (rc < 0)
-		err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n",
-		    slot->name, slot->location, slot->index, status, rc);
-
-	return rc;
-}

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

end of thread, other threads:[~2007-04-03 17:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03 17:26 [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status() Linas Vepstas
  -- strict thread matches above, loose matches on Subject: below --
2007-04-03  0:26 [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb Linas Vepstas
2007-04-03  0:44 ` [PATCH 12/19] PCI: rpaphp: remove rpaphp_set_attention_status() Linas Vepstas
2007-04-03 16:19   ` Nathan Lynch
2007-04-03 16:45     ` Linas Vepstas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).