aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 0a817ad24f16..3bf7764659a4 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -667,8 +667,14 @@ static ssize_t
667acpi_device_sun_show(struct device *dev, struct device_attribute *attr, 667acpi_device_sun_show(struct device *dev, struct device_attribute *attr,
668 char *buf) { 668 char *buf) {
669 struct acpi_device *acpi_dev = to_acpi_device(dev); 669 struct acpi_device *acpi_dev = to_acpi_device(dev);
670 acpi_status status;
671 unsigned long long sun;
672
673 status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun);
674 if (ACPI_FAILURE(status))
675 return -ENODEV;
670 676
671 return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); 677 return sprintf(buf, "%llu\n", sun);
672} 678}
673static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); 679static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL);
674 680
@@ -690,7 +696,6 @@ static int acpi_device_setup_files(struct acpi_device *dev)
690{ 696{
691 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 697 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
692 acpi_status status; 698 acpi_status status;
693 unsigned long long sun;
694 int result = 0; 699 int result = 0;
695 700
696 /* 701 /*
@@ -731,14 +736,10 @@ static int acpi_device_setup_files(struct acpi_device *dev)
731 if (dev->pnp.unique_id) 736 if (dev->pnp.unique_id)
732 result = device_create_file(&dev->dev, &dev_attr_uid); 737 result = device_create_file(&dev->dev, &dev_attr_uid);
733 738
734 status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); 739 if (acpi_has_method(dev->handle, "_SUN")) {
735 if (ACPI_SUCCESS(status)) {
736 dev->pnp.sun = (unsigned long)sun;
737 result = device_create_file(&dev->dev, &dev_attr_sun); 740 result = device_create_file(&dev->dev, &dev_attr_sun);
738 if (result) 741 if (result)
739 goto end; 742 goto end;
740 } else {
741 dev->pnp.sun = (unsigned long)-1;
742 } 743 }
743 744
744 if (acpi_has_method(dev->handle, "_STA")) { 745 if (acpi_has_method(dev->handle, "_STA")) {
@@ -922,12 +923,17 @@ static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
922 device->driver->ops.notify(device, event); 923 device->driver->ops.notify(device, event);
923} 924}
924 925
925static acpi_status acpi_device_notify_fixed(void *data) 926static void acpi_device_notify_fixed(void *data)
926{ 927{
927 struct acpi_device *device = data; 928 struct acpi_device *device = data;
928 929
929 /* Fixed hardware devices have no handles */ 930 /* Fixed hardware devices have no handles */
930 acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device); 931 acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
932}
933
934static acpi_status acpi_device_fixed_event(void *data)
935{
936 acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
931 return AE_OK; 937 return AE_OK;
932} 938}
933 939
@@ -938,12 +944,12 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
938 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) 944 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
939 status = 945 status =
940 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 946 acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
941 acpi_device_notify_fixed, 947 acpi_device_fixed_event,
942 device); 948 device);
943 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) 949 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
944 status = 950 status =
945 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 951 acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
946 acpi_device_notify_fixed, 952 acpi_device_fixed_event,
947 device); 953 device);
948 else 954 else
949 status = acpi_install_notify_handler(device->handle, 955 status = acpi_install_notify_handler(device->handle,
@@ -960,10 +966,10 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
960{ 966{
961 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) 967 if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON)
962 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON, 968 acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
963 acpi_device_notify_fixed); 969 acpi_device_fixed_event);
964 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON) 970 else if (device->device_type == ACPI_BUS_TYPE_SLEEP_BUTTON)
965 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON, 971 acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
966 acpi_device_notify_fixed); 972 acpi_device_fixed_event);
967 else 973 else
968 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, 974 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
969 acpi_device_notify); 975 acpi_device_notify);
@@ -975,7 +981,7 @@ static int acpi_device_probe(struct device *dev)
975 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver); 981 struct acpi_driver *acpi_drv = to_acpi_driver(dev->driver);
976 int ret; 982 int ret;
977 983
978 if (acpi_dev->handler) 984 if (acpi_dev->handler && !acpi_is_pnp_device(acpi_dev))
979 return -EINVAL; 985 return -EINVAL;
980 986
981 if (!acpi_drv->ops.add) 987 if (!acpi_drv->ops.add)