aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-03 18:40:46 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-02-05 11:41:00 -0500
commitb75cece1a79a6259185442004e040511ed3a7341 (patch)
tree36c84e5c1fbb2e633f23f659d1406981b30bf8fb
parent661b40644190eb5987907584920cb11a4a2c7a9e (diff)
ACPI / hotplug / PCI: Simplify hotplug_event()
A few lines of code can be cut from hotplug_event() by defining and initializing the slot variable at the top of the function, so do that. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 0961911c706e..d00da68752ea 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -817,6 +817,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
817{ 817{
818 struct acpiphp_context *context = data; 818 struct acpiphp_context *context = data;
819 struct acpiphp_func *func = &context->func; 819 struct acpiphp_func *func = &context->func;
820 struct acpiphp_slot *slot = func->slot;
820 struct acpiphp_bridge *bridge; 821 struct acpiphp_bridge *bridge;
821 char objname[64]; 822 char objname[64];
822 struct acpi_buffer buffer = { .length = sizeof(objname), 823 struct acpi_buffer buffer = { .length = sizeof(objname),
@@ -838,14 +839,11 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
838 pr_debug("%s: Bus check notify on %s\n", __func__, objname); 839 pr_debug("%s: Bus check notify on %s\n", __func__, objname);
839 pr_debug("%s: re-enumerating slots under %s\n", 840 pr_debug("%s: re-enumerating slots under %s\n",
840 __func__, objname); 841 __func__, objname);
841 if (bridge) { 842 if (bridge)
842 acpiphp_check_bridge(bridge); 843 acpiphp_check_bridge(bridge);
843 } else { 844 else if (!(slot->flags & SLOT_IS_GOING_AWAY))
844 struct acpiphp_slot *slot = func->slot; 845 enable_slot(slot);
845 846
846 if (!(slot->flags & SLOT_IS_GOING_AWAY))
847 enable_slot(slot);
848 }
849 break; 847 break;
850 848
851 case ACPI_NOTIFY_DEVICE_CHECK: 849 case ACPI_NOTIFY_DEVICE_CHECK:
@@ -853,12 +851,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
853 pr_debug("%s: Device check notify on %s\n", __func__, objname); 851 pr_debug("%s: Device check notify on %s\n", __func__, objname);
854 if (bridge) { 852 if (bridge) {
855 acpiphp_check_bridge(bridge); 853 acpiphp_check_bridge(bridge);
856 } else { 854 } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) {
857 struct acpiphp_slot *slot = func->slot;
858
859 if (slot->flags & SLOT_IS_GOING_AWAY)
860 break;
861
862 /* 855 /*
863 * Check if anything has changed in the slot and rescan 856 * Check if anything has changed in the slot and rescan
864 * from the parent if that's the case. 857 * from the parent if that's the case.
@@ -871,7 +864,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
871 case ACPI_NOTIFY_EJECT_REQUEST: 864 case ACPI_NOTIFY_EJECT_REQUEST:
872 /* request device eject */ 865 /* request device eject */
873 pr_debug("%s: Device eject notify on %s\n", __func__, objname); 866 pr_debug("%s: Device eject notify on %s\n", __func__, objname);
874 acpiphp_disable_and_eject_slot(func->slot); 867 acpiphp_disable_and_eject_slot(slot);
875 break; 868 break;
876 } 869 }
877 870