aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/acpiphp_glue.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-13 17:27:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-22 22:00:25 -0400
commit5c8d0e1dc475f0f35b5a774c92c68c3f7dbd3f5f (patch)
treea852b2bf07e33f5e171aa2bf7f7747b631cf591b /drivers/pci/hotplug/acpiphp_glue.c
parentad21d2d046a8a6bbf1b10c04770ec835a4e379e6 (diff)
ACPI / hotplug / PCI: Do not queue up event handling work items in vain
Modify handle_hotplug_event() to avoid queing up the execution of handle_hotplug_event_work_fn() as a work item on kacpi_hotplug_wq for non-hotplug events, such as ACPI_NOTIFY_DEVICE_WAKE. Move the code printing diagnostic messages for those events into handle_hotplug_event(). In addition to that, remove the bogus comment about how the core should distinguish between hotplug and non-hotplug events and queue them up on different workqueues. The core clearly cannot know in advance what events will be interesting to the given caller of acpi_install_notify_handler(). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c64
1 files changed, 29 insertions, 35 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 6db790ebd1eb..44191db1f050 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -920,36 +920,11 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data)
920 920
921 break; 921 break;
922 922
923 case ACPI_NOTIFY_DEVICE_WAKE:
924 /* wake event */
925 dbg("%s: Device wake notify on %s\n", __func__, objname);
926 break;
927
928 case ACPI_NOTIFY_EJECT_REQUEST: 923 case ACPI_NOTIFY_EJECT_REQUEST:
929 /* request device eject */ 924 /* request device eject */
930 dbg("%s: Device eject notify on %s\n", __func__, objname); 925 dbg("%s: Device eject notify on %s\n", __func__, objname);
931 acpiphp_disable_and_eject_slot(func->slot); 926 acpiphp_disable_and_eject_slot(func->slot);
932 break; 927 break;
933
934 case ACPI_NOTIFY_FREQUENCY_MISMATCH:
935 printk(KERN_ERR "Device %s cannot be configured due"
936 " to a frequency mismatch\n", objname);
937 break;
938
939 case ACPI_NOTIFY_BUS_MODE_MISMATCH:
940 printk(KERN_ERR "Device %s cannot be configured due"
941 " to a bus mode mismatch\n", objname);
942 break;
943
944 case ACPI_NOTIFY_POWER_FAULT:
945 printk(KERN_ERR "Device %s has suffered a power fault\n",
946 objname);
947 break;
948
949 default:
950 warn("notify_handler: unknown event type 0x%x for %s\n", type,
951 objname);
952 break;
953 } 928 }
954 929
955 if (bridge) 930 if (bridge)
@@ -984,23 +959,42 @@ static void handle_hotplug_event(acpi_handle handle, u32 type, void *data)
984{ 959{
985 struct acpiphp_context *context; 960 struct acpiphp_context *context;
986 961
962 switch (type) {
963 case ACPI_NOTIFY_BUS_CHECK:
964 case ACPI_NOTIFY_DEVICE_CHECK:
965 case ACPI_NOTIFY_EJECT_REQUEST:
966 break;
967
968 case ACPI_NOTIFY_DEVICE_WAKE:
969 return;
970
971 case ACPI_NOTIFY_FREQUENCY_MISMATCH:
972 acpi_handle_err(handle, "Device cannot be configured due "
973 "to a frequency mismatch\n");
974 return;
975
976 case ACPI_NOTIFY_BUS_MODE_MISMATCH:
977 acpi_handle_err(handle, "Device cannot be configured due "
978 "to a bus mode mismatch\n");
979 return;
980
981 case ACPI_NOTIFY_POWER_FAULT:
982 acpi_handle_err(handle, "Device has suffered a power fault\n");
983 return;
984
985 default:
986 acpi_handle_warn(handle, "Unsupported event type 0x%x\n", type);
987 return;
988 }
989
987 mutex_lock(&acpiphp_context_lock); 990 mutex_lock(&acpiphp_context_lock);
988 context = acpiphp_get_context(handle); 991 context = acpiphp_get_context(handle);
989 if (context) { 992 if (context) {
990 get_bridge(context->func.parent); 993 get_bridge(context->func.parent);
991 acpiphp_put_context(context); 994 acpiphp_put_context(context);
995 alloc_acpi_hp_work(handle, type, context, hotplug_event_work);
992 } 996 }
993 mutex_unlock(&acpiphp_context_lock); 997 mutex_unlock(&acpiphp_context_lock);
994 /*
995 * Currently the code adds all hotplug events to the kacpid_wq
996 * queue when it should add hotplug events to the kacpi_hotplug_wq.
997 * The proper way to fix this is to reorganize the code so that
998 * drivers (dock, etc.) do not call acpi_os_execute(), etc.
999 * For now just re-add this work to the kacpi_hotplug_wq so we
1000 * don't deadlock on hotplug actions.
1001 */
1002 if (context)
1003 alloc_acpi_hp_work(handle, type, context, hotplug_event_work);
1004} 998}
1005 999
1006/* 1000/*