diff options
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r-- | drivers/acpi/scan.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0a817ad24f16..ae44d8654c82 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -130,7 +130,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { |
131 | count = snprintf(&modalias[len], size, "%s:", id->id); | 131 | count = snprintf(&modalias[len], size, "%s:", id->id); |
132 | if (count < 0) | 132 | if (count < 0) |
133 | return EINVAL; | 133 | return -EINVAL; |
134 | if (count >= size) | 134 | if (count >= size) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | len += count; | 136 | len += count; |
@@ -667,8 +667,14 @@ static ssize_t | |||
667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, | 667 | acpi_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 | } |
673 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); | 679 | static 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 | ||
925 | static acpi_status acpi_device_notify_fixed(void *data) | 926 | static 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 | |||
934 | static 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) |
@@ -2183,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2183 | ok: | 2189 | ok: |
2184 | list_for_each_entry(child, &device->children, node) | 2190 | list_for_each_entry(child, &device->children, node) |
2185 | acpi_bus_attach(child); | 2191 | acpi_bus_attach(child); |
2192 | |||
2193 | if (device->handler && device->handler->hotplug.notify_online) | ||
2194 | device->handler->hotplug.notify_online(device); | ||
2186 | } | 2195 | } |
2187 | 2196 | ||
2188 | /** | 2197 | /** |