Commit b75cece1 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 661b4064
...@@ -817,6 +817,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) ...@@ -817,6 +817,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
{ {
struct acpiphp_context *context = data; struct acpiphp_context *context = data;
struct acpiphp_func *func = &context->func; struct acpiphp_func *func = &context->func;
struct acpiphp_slot *slot = func->slot;
struct acpiphp_bridge *bridge; struct acpiphp_bridge *bridge;
char objname[64]; char objname[64];
struct acpi_buffer buffer = { .length = sizeof(objname), struct acpi_buffer buffer = { .length = sizeof(objname),
...@@ -838,14 +839,11 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) ...@@ -838,14 +839,11 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
pr_debug("%s: Bus check notify on %s\n", __func__, objname); pr_debug("%s: Bus check notify on %s\n", __func__, objname);
pr_debug("%s: re-enumerating slots under %s\n", pr_debug("%s: re-enumerating slots under %s\n",
__func__, objname); __func__, objname);
if (bridge) { if (bridge)
acpiphp_check_bridge(bridge); acpiphp_check_bridge(bridge);
} else { else if (!(slot->flags & SLOT_IS_GOING_AWAY))
struct acpiphp_slot *slot = func->slot; enable_slot(slot);
if (!(slot->flags & SLOT_IS_GOING_AWAY))
enable_slot(slot);
}
break; break;
case ACPI_NOTIFY_DEVICE_CHECK: case ACPI_NOTIFY_DEVICE_CHECK:
...@@ -853,12 +851,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) ...@@ -853,12 +851,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
pr_debug("%s: Device check notify on %s\n", __func__, objname); pr_debug("%s: Device check notify on %s\n", __func__, objname);
if (bridge) { if (bridge) {
acpiphp_check_bridge(bridge); acpiphp_check_bridge(bridge);
} else { } else if (!(slot->flags & SLOT_IS_GOING_AWAY)) {
struct acpiphp_slot *slot = func->slot;
if (slot->flags & SLOT_IS_GOING_AWAY)
break;
/* /*
* Check if anything has changed in the slot and rescan * Check if anything has changed in the slot and rescan
* from the parent if that's the case. * from the parent if that's the case.
...@@ -871,7 +864,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) ...@@ -871,7 +864,7 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */ /* request device eject */
pr_debug("%s: Device eject notify on %s\n", __func__, objname); pr_debug("%s: Device eject notify on %s\n", __func__, objname);
acpiphp_disable_and_eject_slot(func->slot); acpiphp_disable_and_eject_slot(slot);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment