aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-13 17:27:24 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-22 22:00:21 -0400
commitc8ebcf1ff91a8f64b09c4df0ee21ae80a953c39c (patch)
treef52cc3e0ee1c543089864d2e2cee7031f9b880f7
parented13febf8fac1a08f939f97378574937a7d2f121 (diff)
ACPI / hotplug / PCI: Pass hotplug context objects to event handlers
Modify handle_hotplug_event() to pass the entire context object (instead of its fields individually) to work functions started by it. This change makes the subsequent consolidation of the event handling work functions a bit more straightforward. 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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 6cfd8a684766..b5a98f4baa3a 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -989,6 +989,7 @@ void acpiphp_check_host_bridge(acpi_handle handle)
989 989
990static void _handle_hotplug_event_bridge(struct work_struct *work) 990static void _handle_hotplug_event_bridge(struct work_struct *work)
991{ 991{
992 struct acpiphp_context *context;
992 struct acpiphp_bridge *bridge; 993 struct acpiphp_bridge *bridge;
993 char objname[64]; 994 char objname[64];
994 struct acpi_buffer buffer = { .length = sizeof(objname), 995 struct acpi_buffer buffer = { .length = sizeof(objname),
@@ -1000,7 +1001,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work)
1000 hp_work = container_of(work, struct acpi_hp_work, work); 1001 hp_work = container_of(work, struct acpi_hp_work, work);
1001 handle = hp_work->handle; 1002 handle = hp_work->handle;
1002 type = hp_work->type; 1003 type = hp_work->type;
1003 bridge = (struct acpiphp_bridge *)hp_work->context; 1004 context = hp_work->context;
1005 bridge = context->bridge;
1004 1006
1005 acpi_scan_lock_acquire(); 1007 acpi_scan_lock_acquire();
1006 1008
@@ -1105,18 +1107,18 @@ static void hotplug_event_func(acpi_handle handle, u32 type, void *context)
1105 1107
1106static void _handle_hotplug_event_func(struct work_struct *work) 1108static void _handle_hotplug_event_func(struct work_struct *work)
1107{ 1109{
1110 struct acpiphp_context *context;
1108 struct acpi_hp_work *hp_work; 1111 struct acpi_hp_work *hp_work;
1109 struct acpiphp_func *func;
1110 1112
1111 hp_work = container_of(work, struct acpi_hp_work, work); 1113 hp_work = container_of(work, struct acpi_hp_work, work);
1112 func = hp_work->context; 1114 context = hp_work->context;
1113 acpi_scan_lock_acquire(); 1115 acpi_scan_lock_acquire();
1114 1116
1115 hotplug_event_func(hp_work->handle, hp_work->type, func); 1117 hotplug_event_func(hp_work->handle, hp_work->type, context->func);
1116 1118
1117 acpi_scan_lock_release(); 1119 acpi_scan_lock_release();
1118 kfree(hp_work); /* allocated in handle_hotplug_event_func */ 1120 kfree(hp_work); /* allocated in handle_hotplug_event_func */
1119 put_bridge(func->slot->bridge); 1121 put_bridge(context->func->slot->bridge);
1120} 1122}
1121 1123
1122/** 1124/**
@@ -1137,11 +1139,9 @@ static void handle_hotplug_event(acpi_handle handle, u32 type, void *data)
1137 if (context) { 1139 if (context) {
1138 if (context->bridge) { 1140 if (context->bridge) {
1139 get_bridge(context->bridge); 1141 get_bridge(context->bridge);
1140 data = context->bridge;
1141 work_func = _handle_hotplug_event_bridge; 1142 work_func = _handle_hotplug_event_bridge;
1142 } else if (context->func) { 1143 } else if (context->func) {
1143 get_bridge(context->func->slot->bridge); 1144 get_bridge(context->func->slot->bridge);
1144 data = context->func;
1145 work_func = _handle_hotplug_event_func; 1145 work_func = _handle_hotplug_event_func;
1146 } 1146 }
1147 acpiphp_put_context(context); 1147 acpiphp_put_context(context);
@@ -1157,7 +1157,7 @@ static void handle_hotplug_event(acpi_handle handle, u32 type, void *data)
1157 * don't deadlock on hotplug actions. 1157 * don't deadlock on hotplug actions.
1158 */ 1158 */
1159 if (work_func) 1159 if (work_func)
1160 alloc_acpi_hp_work(handle, type, data, work_func); 1160 alloc_acpi_hp_work(handle, type, context, work_func);
1161} 1161}
1162 1162
1163/* 1163/*