]> git.hungrycats.org Git - linux/commitdiff
[PATCH] PCI Hotplug: Don't up() twice in acpiphp
authorMatthew Wilcox <willy@debian.org>
Fri, 26 Mar 2004 08:32:21 +0000 (00:32 -0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Fri, 26 Mar 2004 08:32:21 +0000 (00:32 -0800)
On the error path, we currently try to up() a semaphore twice.
There was also a typo in an error message.

drivers/pci/hotplug/acpiphp_glue.c

index 628fb25cca60303aed8e389468573a1044f51ba5..4f3594293e8fb19daea5e70b63234145eab3b909 100644 (file)
@@ -1243,40 +1243,38 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot)
 
 /**
  * acpiphp_check_bridge - re-enumerate devices
+ *
+ * Iterate over all slots under this bridge and make sure that if a
+ * card is present they are enabled, and if not they are disabled.
  */
 int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
 {
        struct acpiphp_slot *slot;
-       unsigned int sta;
        int retval = 0;
        int enabled, disabled;
 
        enabled = disabled = 0;
 
        for (slot = bridge->slots; slot; slot = slot->next) {
-               sta = get_slot_status(slot);
+               unsigned int status = get_slot_status(slot);
                if (slot->flags & SLOT_ENABLED) {
-                       /* if enabled but not present, disable */
-                       if (sta != ACPI_STA_ALL) {
-                               retval = acpiphp_disable_slot(slot);
-                               if (retval) {
-                                       err("Error occurred in enabling\n");
-                                       up(&slot->crit_sect);
-                                       goto err_exit;
-                               }
-                               disabled++;
+                       if (status == ACPI_STA_ALL)
+                               continue;
+                       retval = acpiphp_disable_slot(slot);
+                       if (retval) {
+                               err("Error occurred in disabling\n");
+                               goto err_exit;
                        }
+                       disabled++;
                } else {
-                       /* if disabled but present, enable */
-                       if (sta == ACPI_STA_ALL) {
-                               retval = acpiphp_enable_slot(slot);
-                               if (retval) {
-                                       err("Error occurred in enabling\n");
-                                       up(&slot->crit_sect);
-                                       goto err_exit;
-                               }
-                               enabled++;
+                       if (status != ACPI_STA_ALL)
+                               continue;
+                       retval = acpiphp_enable_slot(slot);
+                       if (retval) {
+                               err("Error occurred in enabling\n");
+                               goto err_exit;
                        }
+                       enabled++;
                }
        }