linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 19/19] PCI: rpaphp: Remove semaphores
@ 2007-04-03 17:33 Linas Vepstas
  0 siblings, 0 replies; 2+ messages in thread
From: Linas Vepstas @ 2007-04-03 17:33 UTC (permalink / raw)
  To: Kristen Carlson Accardi; +Cc: Andrew Morton, linuxppc-dev, pcihpd-discuss


Remove the semaphores from the get routine. These do not 
appear to be protecting anything that I can make out, 
and they also do not seem to be required by the hotplug
driver.

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

----
 drivers/pci/hotplug/rpaphp_core.c |   38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

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:47.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c	2007-04-03 11:04:51.000000000 -0500
@@ -39,7 +39,6 @@
 #include "rpaphp.h"
 
 int debug;
-static struct semaphore rpaphp_sem;
 LIST_HEAD(rpaphp_slot_head);
 
 #define DRIVER_VERSION	"0.1"
@@ -66,7 +65,6 @@ static int set_attention_status(struct h
 	int rc;
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 
-	down(&rpaphp_sem);
 	switch (value) {
 	case 0:
 	case 1:
@@ -76,7 +74,6 @@ static int set_attention_status(struct h
 		value = 1;
 		break;
 	}
-	up(&rpaphp_sem);
 
 	rc = rtas_set_indicator(DR_INDICATOR, slot->index, value);
 	if (!rc)
@@ -95,11 +92,9 @@ static int get_power_status(struct hotpl
 	int retval, level;
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 
-	down(&rpaphp_sem);
 	retval = rtas_get_power_level (slot->power_domain, &level);
 	if (!retval)
 		*value = level;
-	up(&rpaphp_sem);
 	return retval;
 }
 
@@ -118,9 +113,7 @@ static int get_adapter_status(struct hot
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 	int rc, state;
 
-	down(&rpaphp_sem);
 	rc = rpaphp_get_sensor_state(slot, &state);
-	up(&rpaphp_sem);
 
 	*value = NOT_VALID;
 	if (rc)
@@ -138,7 +131,6 @@ static int get_max_bus_speed(struct hotp
 {
 	struct slot *slot = (struct slot *)hotplug_slot->private;
 
-	down(&rpaphp_sem);
 	switch (slot->type) {
 	case 1:
 	case 2:
@@ -169,7 +161,6 @@ static int get_max_bus_speed(struct hotp
 		break;
 
 	}
-	up(&rpaphp_sem);
 	return 0;
 }
 
@@ -374,7 +365,6 @@ static int __init rpaphp_init(void)
 	struct device_node *dn = NULL;
 
 	info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
-	init_MUTEX(&rpaphp_sem);
 
 	while ((dn = of_find_node_by_name(dn, "pci")))
 		rpaphp_add_slot(dn);
@@ -387,8 +377,9 @@ static void __exit rpaphp_exit(void)
 	cleanup_slots();
 }
 
-static int __enable_slot(struct slot *slot)
+static int enable_slot(struct hotplug_slot *hotplug_slot)
 {
+	struct slot *slot = (struct slot *)hotplug_slot->private;
 	int state;
 	int retval;
 
@@ -412,20 +403,9 @@ static int __enable_slot(struct slot *sl
 	return 0;
 }
 
-static int enable_slot(struct hotplug_slot *hotplug_slot)
+static int disable_slot(struct hotplug_slot *hotplug_slot)
 {
-	int retval;
 	struct slot *slot = (struct slot *)hotplug_slot->private;
-
-	down(&rpaphp_sem);
-	retval = __enable_slot(slot);
-	up(&rpaphp_sem);
-
-	return retval;
-}
-
-static inline int __disable_slot(struct slot *slot)
-{
 	if (slot->state == NOT_CONFIGURED)
 		return -EINVAL;
 
@@ -434,18 +414,6 @@ static inline int __disable_slot(struct 
 	return 0;
 }
 
-static int disable_slot(struct hotplug_slot *hotplug_slot)
-{
-	struct slot *slot = (struct slot *)hotplug_slot->private;
-	int retval;
-
-	down(&rpaphp_sem);
-	retval = __disable_slot (slot);
-	up(&rpaphp_sem);
-
-	return retval;
-}
-
 struct hotplug_slot_ops rpaphp_hotplug_slot_ops = {
 	.owner = THIS_MODULE,
 	.enable_slot = enable_slot,

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb
@ 2007-04-03  0:26 Linas Vepstas
  2007-04-03  0:51 ` [PATCH 19/19] PCI: rpaphp: Remove semaphores Linas Vepstas
  0 siblings, 1 reply; 2+ messages in thread
From: Linas Vepstas @ 2007-04-03  0:26 UTC (permalink / raw)
  To: Greg KH; +Cc: Andrew Morton, linuxppc-dev, linux-pci


Hi Greg, 

Please queue these cleanp patches for 2.6.22; cc'ing akpm.

This is a collection of very small patches that clean up various bits and 
pieces of the RPAPHP hotplug code. They eliminate about 100 lines of code, 
almost without changing any function; there are a few minor bugfixes to 
various error paths, and one memleak fix. Some documentation is added.
The result is, I beleive, slightly more readable, easier to understand
code. In particular, the enable/disable add/remove code paths are now
more obviously symmetrical in thier function.

--linas

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-03 17:33 [PATCH 19/19] PCI: rpaphp: Remove semaphores 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:51 ` [PATCH 19/19] PCI: rpaphp: Remove semaphores 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).