diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-08 10:44:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-04-08 10:44:53 -0400 |
commit | 0a2851b9a837cb025d48bb8118f35ebd12bce4b5 (patch) | |
tree | 5d836783b18a51c74e3e643aeef036dce31b543b /drivers | |
parent | f5284e7635787224dda1a2bf82a4c56b1c75671f (diff) | |
parent | c25f7cf2032aaac9bd50d6eee982719878538082 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
ACPI / PM: Move ACPI video resume to a PM notifier
ACPI: Reduce ACPI resource conflict message to KERN_WARNING, printk cleanup
ACPI: battery drivers should call power_supply_changed()
ACPI: battery: Fix CONFIG_ACPI_SYSFS_POWER=n
PNPACPI: truncate _CRS windows with _LEN > _MAX - _MIN + 1
ACPI: Don't send KEY_UNKNOWN for random video notifications
ACPI: NUMA: map pxms to low node ids
ACPI: use _HID when supplied by root-level devices
ACPI / ACPICA: Do not check reference counters in acpi_ev_enable_gpe()
ACPI: fixes a false alarm from lockdep
ACPI dock: support multiple ACPI dock devices
ACPI: EC: Allow multibyte access to EC
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/acpica/evgpe.c | 19 | ||||
-rw-r--r-- | drivers/acpi/acpica/exprep.c | 12 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 6 | ||||
-rw-r--r-- | drivers/acpi/dock.c | 7 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 35 | ||||
-rw-r--r-- | drivers/acpi/numa.c | 6 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 23 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 12 | ||||
-rw-r--r-- | drivers/acpi/video.c | 67 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/rsparser.c | 42 |
10 files changed, 131 insertions, 98 deletions
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 837de669743a..78c55508aff5 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -117,19 +117,14 @@ acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info) | |||
117 | if (ACPI_FAILURE(status)) | 117 | if (ACPI_FAILURE(status)) |
118 | return_ACPI_STATUS(status); | 118 | return_ACPI_STATUS(status); |
119 | 119 | ||
120 | /* Mark wake-enabled or HW enable, or both */ | 120 | /* Clear the GPE (of stale events), then enable it */ |
121 | 121 | status = acpi_hw_clear_gpe(gpe_event_info); | |
122 | if (gpe_event_info->runtime_count) { | 122 | if (ACPI_FAILURE(status)) |
123 | /* Clear the GPE (of stale events), then enable it */ | 123 | return_ACPI_STATUS(status); |
124 | status = acpi_hw_clear_gpe(gpe_event_info); | ||
125 | if (ACPI_FAILURE(status)) | ||
126 | return_ACPI_STATUS(status); | ||
127 | |||
128 | /* Enable the requested runtime GPE */ | ||
129 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
130 | } | ||
131 | 124 | ||
132 | return_ACPI_STATUS(AE_OK); | 125 | /* Enable the requested GPE */ |
126 | status = acpi_hw_write_gpe_enable_reg(gpe_event_info); | ||
127 | return_ACPI_STATUS(status); | ||
133 | } | 128 | } |
134 | 129 | ||
135 | /******************************************************************************* | 130 | /******************************************************************************* |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index edf62bf5b266..a610ebe18edd 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -468,6 +468,18 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
468 | 468 | ||
469 | acpi_ut_add_reference(obj_desc->field.region_obj); | 469 | acpi_ut_add_reference(obj_desc->field.region_obj); |
470 | 470 | ||
471 | /* allow full data read from EC address space */ | ||
472 | if (obj_desc->field.region_obj->region.space_id == | ||
473 | ACPI_ADR_SPACE_EC) { | ||
474 | if (obj_desc->common_field.bit_length > 8) | ||
475 | obj_desc->common_field.access_bit_width = | ||
476 | ACPI_ROUND_UP(obj_desc->common_field. | ||
477 | bit_length, 8); | ||
478 | obj_desc->common_field.access_byte_width = | ||
479 | ACPI_DIV_8(obj_desc->common_field. | ||
480 | access_bit_width); | ||
481 | } | ||
482 | |||
471 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 483 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
472 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", | 484 | "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n", |
473 | obj_desc->field.start_field_bit_offset, | 485 | obj_desc->field.start_field_bit_offset, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 5717bd300869..3026e3fa83ef 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -568,13 +568,13 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
568 | result = acpi_battery_get_status(battery); | 568 | result = acpi_battery_get_status(battery); |
569 | if (result) | 569 | if (result) |
570 | return result; | 570 | return result; |
571 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
572 | if (!acpi_battery_present(battery)) { | 571 | if (!acpi_battery_present(battery)) { |
572 | #ifdef CONFIG_ACPI_SYSFS_POWER | ||
573 | sysfs_remove_battery(battery); | 573 | sysfs_remove_battery(battery); |
574 | #endif | ||
574 | battery->update_time = 0; | 575 | battery->update_time = 0; |
575 | return 0; | 576 | return 0; |
576 | } | 577 | } |
577 | #endif | ||
578 | if (!battery->update_time || | 578 | if (!battery->update_time || |
579 | old_present != acpi_battery_present(battery)) { | 579 | old_present != acpi_battery_present(battery)) { |
580 | result = acpi_battery_get_info(battery); | 580 | result = acpi_battery_get_info(battery); |
@@ -880,7 +880,7 @@ static void acpi_battery_notify(struct acpi_device *device, u32 event) | |||
880 | #ifdef CONFIG_ACPI_SYSFS_POWER | 880 | #ifdef CONFIG_ACPI_SYSFS_POWER |
881 | /* acpi_battery_update could remove power_supply object */ | 881 | /* acpi_battery_update could remove power_supply object */ |
882 | if (battery->bat.dev) | 882 | if (battery->bat.dev) |
883 | kobject_uevent(&battery->bat.dev->kobj, KOBJ_CHANGE); | 883 | power_supply_changed(&battery->bat); |
884 | #endif | 884 | #endif |
885 | } | 885 | } |
886 | 886 | ||
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index a9c429c5d50f..3fe29e992be8 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -1026,13 +1026,10 @@ static int dock_remove(struct dock_station *ds) | |||
1026 | static acpi_status | 1026 | static acpi_status |
1027 | find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) | 1027 | find_dock(acpi_handle handle, u32 lvl, void *context, void **rv) |
1028 | { | 1028 | { |
1029 | acpi_status status = AE_OK; | ||
1030 | |||
1031 | if (is_dock(handle)) | 1029 | if (is_dock(handle)) |
1032 | if (dock_add(handle) >= 0) | 1030 | dock_add(handle); |
1033 | status = AE_CTRL_TERMINATE; | ||
1034 | 1031 | ||
1035 | return status; | 1032 | return AE_OK; |
1036 | } | 1033 | } |
1037 | 1034 | ||
1038 | static acpi_status | 1035 | static acpi_status |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 35ba2547f544..f2234db85da0 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -629,12 +629,12 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
629 | 629 | ||
630 | static acpi_status | 630 | static acpi_status |
631 | acpi_ec_space_handler(u32 function, acpi_physical_address address, | 631 | acpi_ec_space_handler(u32 function, acpi_physical_address address, |
632 | u32 bits, u64 *value, | 632 | u32 bits, u64 *value64, |
633 | void *handler_context, void *region_context) | 633 | void *handler_context, void *region_context) |
634 | { | 634 | { |
635 | struct acpi_ec *ec = handler_context; | 635 | struct acpi_ec *ec = handler_context; |
636 | int result = 0, i; | 636 | int result = 0, i, bytes = bits / 8; |
637 | u8 temp = 0; | 637 | u8 *value = (u8 *)value64; |
638 | 638 | ||
639 | if ((address > 0xFF) || !value || !handler_context) | 639 | if ((address > 0xFF) || !value || !handler_context) |
640 | return AE_BAD_PARAMETER; | 640 | return AE_BAD_PARAMETER; |
@@ -642,32 +642,15 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address, | |||
642 | if (function != ACPI_READ && function != ACPI_WRITE) | 642 | if (function != ACPI_READ && function != ACPI_WRITE) |
643 | return AE_BAD_PARAMETER; | 643 | return AE_BAD_PARAMETER; |
644 | 644 | ||
645 | if (bits != 8 && acpi_strict) | 645 | if (EC_FLAGS_MSI || bits > 8) |
646 | return AE_BAD_PARAMETER; | ||
647 | |||
648 | if (EC_FLAGS_MSI) | ||
649 | acpi_ec_burst_enable(ec); | 646 | acpi_ec_burst_enable(ec); |
650 | 647 | ||
651 | if (function == ACPI_READ) { | 648 | for (i = 0; i < bytes; ++i, ++address, ++value) |
652 | result = acpi_ec_read(ec, address, &temp); | 649 | result = (function == ACPI_READ) ? |
653 | *value = temp; | 650 | acpi_ec_read(ec, address, value) : |
654 | } else { | 651 | acpi_ec_write(ec, address, *value); |
655 | temp = 0xff & (*value); | ||
656 | result = acpi_ec_write(ec, address, temp); | ||
657 | } | ||
658 | |||
659 | for (i = 8; unlikely(bits - i > 0); i += 8) { | ||
660 | ++address; | ||
661 | if (function == ACPI_READ) { | ||
662 | result = acpi_ec_read(ec, address, &temp); | ||
663 | (*value) |= ((u64)temp) << i; | ||
664 | } else { | ||
665 | temp = 0xff & ((*value) >> i); | ||
666 | result = acpi_ec_write(ec, address, temp); | ||
667 | } | ||
668 | } | ||
669 | 652 | ||
670 | if (EC_FLAGS_MSI) | 653 | if (EC_FLAGS_MSI || bits > 8) |
671 | acpi_ec_burst_disable(ec); | 654 | acpi_ec_burst_disable(ec); |
672 | 655 | ||
673 | switch (result) { | 656 | switch (result) { |
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c index b8725461d887..b0337d314604 100644 --- a/drivers/acpi/numa.c +++ b/drivers/acpi/numa.c | |||
@@ -61,8 +61,10 @@ int node_to_pxm(int node) | |||
61 | 61 | ||
62 | void __acpi_map_pxm_to_node(int pxm, int node) | 62 | void __acpi_map_pxm_to_node(int pxm, int node) |
63 | { | 63 | { |
64 | pxm_to_node_map[pxm] = node; | 64 | if (pxm_to_node_map[pxm] == NUMA_NO_NODE || node < pxm_to_node_map[pxm]) |
65 | node_to_pxm_map[node] = pxm; | 65 | pxm_to_node_map[pxm] = node; |
66 | if (node_to_pxm_map[node] == PXM_INVAL || pxm < node_to_pxm_map[node]) | ||
67 | node_to_pxm_map[node] = pxm; | ||
66 | } | 68 | } |
67 | 69 | ||
68 | int acpi_map_pxm_to_node(int pxm) | 70 | int acpi_map_pxm_to_node(int pxm) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 8e6d8665f0ae..7594f65800cf 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -758,7 +758,14 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, | |||
758 | queue = hp ? kacpi_hotplug_wq : | 758 | queue = hp ? kacpi_hotplug_wq : |
759 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); | 759 | (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq); |
760 | dpc->wait = hp ? 1 : 0; | 760 | dpc->wait = hp ? 1 : 0; |
761 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | 761 | |
762 | if (queue == kacpi_hotplug_wq) | ||
763 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
764 | else if (queue == kacpi_notify_wq) | ||
765 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
766 | else | ||
767 | INIT_WORK(&dpc->work, acpi_os_execute_deferred); | ||
768 | |||
762 | ret = queue_work(queue, &dpc->work); | 769 | ret = queue_work(queue, &dpc->work); |
763 | 770 | ||
764 | if (!ret) { | 771 | if (!ret) { |
@@ -1151,16 +1158,10 @@ int acpi_check_resource_conflict(const struct resource *res) | |||
1151 | 1158 | ||
1152 | if (clash) { | 1159 | if (clash) { |
1153 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { | 1160 | if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) { |
1154 | printk("%sACPI: %s resource %s [0x%llx-0x%llx]" | 1161 | printk(KERN_WARNING "ACPI: resource %s %pR" |
1155 | " conflicts with ACPI region %s" | 1162 | " conflicts with ACPI region %s %pR\n", |
1156 | " [0x%llx-0x%llx]\n", | 1163 | res->name, res, res_list_elem->name, |
1157 | acpi_enforce_resources == ENFORCE_RESOURCES_LAX | 1164 | res_list_elem); |
1158 | ? KERN_WARNING : KERN_ERR, | ||
1159 | ioport ? "I/O" : "Memory", res->name, | ||
1160 | (long long) res->start, (long long) res->end, | ||
1161 | res_list_elem->name, | ||
1162 | (long long) res_list_elem->start, | ||
1163 | (long long) res_list_elem->end); | ||
1164 | if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) | 1165 | if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX) |
1165 | printk(KERN_NOTICE "ACPI: This conflict may" | 1166 | printk(KERN_NOTICE "ACPI: This conflict may" |
1166 | " cause random problems and system" | 1167 | " cause random problems and system" |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0261b116d051..0338f513a010 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -1081,12 +1081,6 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
1081 | if (ACPI_IS_ROOT_DEVICE(device)) { | 1081 | if (ACPI_IS_ROOT_DEVICE(device)) { |
1082 | acpi_add_id(device, ACPI_SYSTEM_HID); | 1082 | acpi_add_id(device, ACPI_SYSTEM_HID); |
1083 | break; | 1083 | break; |
1084 | } else if (ACPI_IS_ROOT_DEVICE(device->parent)) { | ||
1085 | /* \_SB_, the only root-level namespace device */ | ||
1086 | acpi_add_id(device, ACPI_BUS_HID); | ||
1087 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | ||
1088 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | ||
1089 | break; | ||
1090 | } | 1084 | } |
1091 | 1085 | ||
1092 | status = acpi_get_object_info(device->handle, &info); | 1086 | status = acpi_get_object_info(device->handle, &info); |
@@ -1121,6 +1115,12 @@ static void acpi_device_set_id(struct acpi_device *device) | |||
1121 | acpi_add_id(device, ACPI_DOCK_HID); | 1115 | acpi_add_id(device, ACPI_DOCK_HID); |
1122 | else if (!acpi_ibm_smbus_match(device)) | 1116 | else if (!acpi_ibm_smbus_match(device)) |
1123 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); | 1117 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); |
1118 | else if (!acpi_device_hid(device) && | ||
1119 | ACPI_IS_ROOT_DEVICE(device->parent)) { | ||
1120 | acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | ||
1121 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | ||
1122 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | ||
1123 | } | ||
1124 | 1124 | ||
1125 | break; | 1125 | break; |
1126 | case ACPI_BUS_TYPE_POWER: | 1126 | case ACPI_BUS_TYPE_POWER: |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 6a0143796772..a0c93b321482 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/dmi.h> | 44 | #include <linux/dmi.h> |
45 | #include <acpi/acpi_bus.h> | 45 | #include <acpi/acpi_bus.h> |
46 | #include <acpi/acpi_drivers.h> | 46 | #include <acpi/acpi_drivers.h> |
47 | #include <linux/suspend.h> | ||
47 | 48 | ||
48 | #define PREFIX "ACPI: " | 49 | #define PREFIX "ACPI: " |
49 | 50 | ||
@@ -89,7 +90,6 @@ module_param(allow_duplicates, bool, 0644); | |||
89 | static int register_count = 0; | 90 | static int register_count = 0; |
90 | static int acpi_video_bus_add(struct acpi_device *device); | 91 | static int acpi_video_bus_add(struct acpi_device *device); |
91 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 92 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
92 | static int acpi_video_resume(struct acpi_device *device); | ||
93 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event); | 93 | static void acpi_video_bus_notify(struct acpi_device *device, u32 event); |
94 | 94 | ||
95 | static const struct acpi_device_id video_device_ids[] = { | 95 | static const struct acpi_device_id video_device_ids[] = { |
@@ -105,7 +105,6 @@ static struct acpi_driver acpi_video_bus = { | |||
105 | .ops = { | 105 | .ops = { |
106 | .add = acpi_video_bus_add, | 106 | .add = acpi_video_bus_add, |
107 | .remove = acpi_video_bus_remove, | 107 | .remove = acpi_video_bus_remove, |
108 | .resume = acpi_video_resume, | ||
109 | .notify = acpi_video_bus_notify, | 108 | .notify = acpi_video_bus_notify, |
110 | }, | 109 | }, |
111 | }; | 110 | }; |
@@ -160,6 +159,7 @@ struct acpi_video_bus { | |||
160 | struct proc_dir_entry *dir; | 159 | struct proc_dir_entry *dir; |
161 | struct input_dev *input; | 160 | struct input_dev *input; |
162 | char phys[32]; /* for input device */ | 161 | char phys[32]; /* for input device */ |
162 | struct notifier_block pm_nb; | ||
163 | }; | 163 | }; |
164 | 164 | ||
165 | struct acpi_video_device_flags { | 165 | struct acpi_video_device_flags { |
@@ -1021,6 +1021,13 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
1021 | if (IS_ERR(device->backlight)) | 1021 | if (IS_ERR(device->backlight)) |
1022 | return; | 1022 | return; |
1023 | 1023 | ||
1024 | /* | ||
1025 | * Save current brightness level in case we have to restore it | ||
1026 | * before acpi_video_device_lcd_set_level() is called next time. | ||
1027 | */ | ||
1028 | device->backlight->props.brightness = | ||
1029 | acpi_video_get_brightness(device->backlight); | ||
1030 | |||
1024 | result = sysfs_create_link(&device->backlight->dev.kobj, | 1031 | result = sysfs_create_link(&device->backlight->dev.kobj, |
1025 | &device->dev->dev.kobj, "device"); | 1032 | &device->dev->dev.kobj, "device"); |
1026 | if (result) | 1033 | if (result) |
@@ -2123,7 +2130,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
2123 | { | 2130 | { |
2124 | struct acpi_video_bus *video = acpi_driver_data(device); | 2131 | struct acpi_video_bus *video = acpi_driver_data(device); |
2125 | struct input_dev *input; | 2132 | struct input_dev *input; |
2126 | int keycode; | 2133 | int keycode = 0; |
2127 | 2134 | ||
2128 | if (!video) | 2135 | if (!video) |
2129 | return; | 2136 | return; |
@@ -2159,17 +2166,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
2159 | break; | 2166 | break; |
2160 | 2167 | ||
2161 | default: | 2168 | default: |
2162 | keycode = KEY_UNKNOWN; | ||
2163 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2169 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
2164 | "Unsupported event [0x%x]\n", event)); | 2170 | "Unsupported event [0x%x]\n", event)); |
2165 | break; | 2171 | break; |
2166 | } | 2172 | } |
2167 | 2173 | ||
2168 | acpi_notifier_call_chain(device, event, 0); | 2174 | acpi_notifier_call_chain(device, event, 0); |
2169 | input_report_key(input, keycode, 1); | 2175 | |
2170 | input_sync(input); | 2176 | if (keycode) { |
2171 | input_report_key(input, keycode, 0); | 2177 | input_report_key(input, keycode, 1); |
2172 | input_sync(input); | 2178 | input_sync(input); |
2179 | input_report_key(input, keycode, 0); | ||
2180 | input_sync(input); | ||
2181 | } | ||
2173 | 2182 | ||
2174 | return; | 2183 | return; |
2175 | } | 2184 | } |
@@ -2180,7 +2189,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
2180 | struct acpi_device *device = NULL; | 2189 | struct acpi_device *device = NULL; |
2181 | struct acpi_video_bus *bus; | 2190 | struct acpi_video_bus *bus; |
2182 | struct input_dev *input; | 2191 | struct input_dev *input; |
2183 | int keycode; | 2192 | int keycode = 0; |
2184 | 2193 | ||
2185 | if (!video_device) | 2194 | if (!video_device) |
2186 | return; | 2195 | return; |
@@ -2221,39 +2230,48 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
2221 | keycode = KEY_DISPLAY_OFF; | 2230 | keycode = KEY_DISPLAY_OFF; |
2222 | break; | 2231 | break; |
2223 | default: | 2232 | default: |
2224 | keycode = KEY_UNKNOWN; | ||
2225 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2233 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
2226 | "Unsupported event [0x%x]\n", event)); | 2234 | "Unsupported event [0x%x]\n", event)); |
2227 | break; | 2235 | break; |
2228 | } | 2236 | } |
2229 | 2237 | ||
2230 | acpi_notifier_call_chain(device, event, 0); | 2238 | acpi_notifier_call_chain(device, event, 0); |
2231 | input_report_key(input, keycode, 1); | 2239 | |
2232 | input_sync(input); | 2240 | if (keycode) { |
2233 | input_report_key(input, keycode, 0); | 2241 | input_report_key(input, keycode, 1); |
2234 | input_sync(input); | 2242 | input_sync(input); |
2243 | input_report_key(input, keycode, 0); | ||
2244 | input_sync(input); | ||
2245 | } | ||
2235 | 2246 | ||
2236 | return; | 2247 | return; |
2237 | } | 2248 | } |
2238 | 2249 | ||
2239 | static int instance; | 2250 | static int acpi_video_resume(struct notifier_block *nb, |
2240 | static int acpi_video_resume(struct acpi_device *device) | 2251 | unsigned long val, void *ign) |
2241 | { | 2252 | { |
2242 | struct acpi_video_bus *video; | 2253 | struct acpi_video_bus *video; |
2243 | struct acpi_video_device *video_device; | 2254 | struct acpi_video_device *video_device; |
2244 | int i; | 2255 | int i; |
2245 | 2256 | ||
2246 | if (!device || !acpi_driver_data(device)) | 2257 | switch (val) { |
2247 | return -EINVAL; | 2258 | case PM_HIBERNATION_PREPARE: |
2259 | case PM_SUSPEND_PREPARE: | ||
2260 | case PM_RESTORE_PREPARE: | ||
2261 | return NOTIFY_DONE; | ||
2262 | } | ||
2248 | 2263 | ||
2249 | video = acpi_driver_data(device); | 2264 | video = container_of(nb, struct acpi_video_bus, pm_nb); |
2265 | |||
2266 | dev_info(&video->device->dev, "Restoring backlight state\n"); | ||
2250 | 2267 | ||
2251 | for (i = 0; i < video->attached_count; i++) { | 2268 | for (i = 0; i < video->attached_count; i++) { |
2252 | video_device = video->attached_array[i].bind_info; | 2269 | video_device = video->attached_array[i].bind_info; |
2253 | if (video_device && video_device->backlight) | 2270 | if (video_device && video_device->backlight) |
2254 | acpi_video_set_brightness(video_device->backlight); | 2271 | acpi_video_set_brightness(video_device->backlight); |
2255 | } | 2272 | } |
2256 | return AE_OK; | 2273 | |
2274 | return NOTIFY_OK; | ||
2257 | } | 2275 | } |
2258 | 2276 | ||
2259 | static acpi_status | 2277 | static acpi_status |
@@ -2277,6 +2295,8 @@ acpi_video_bus_match(acpi_handle handle, u32 level, void *context, | |||
2277 | return AE_OK; | 2295 | return AE_OK; |
2278 | } | 2296 | } |
2279 | 2297 | ||
2298 | static int instance; | ||
2299 | |||
2280 | static int acpi_video_bus_add(struct acpi_device *device) | 2300 | static int acpi_video_bus_add(struct acpi_device *device) |
2281 | { | 2301 | { |
2282 | struct acpi_video_bus *video; | 2302 | struct acpi_video_bus *video; |
@@ -2358,7 +2378,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2358 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); | 2378 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); |
2359 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 2379 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
2360 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 2380 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
2361 | set_bit(KEY_UNKNOWN, input->keybit); | ||
2362 | 2381 | ||
2363 | error = input_register_device(input); | 2382 | error = input_register_device(input); |
2364 | if (error) | 2383 | if (error) |
@@ -2370,6 +2389,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2370 | video->flags.rom ? "yes" : "no", | 2389 | video->flags.rom ? "yes" : "no", |
2371 | video->flags.post ? "yes" : "no"); | 2390 | video->flags.post ? "yes" : "no"); |
2372 | 2391 | ||
2392 | video->pm_nb.notifier_call = acpi_video_resume; | ||
2393 | video->pm_nb.priority = 0; | ||
2394 | register_pm_notifier(&video->pm_nb); | ||
2395 | |||
2373 | return 0; | 2396 | return 0; |
2374 | 2397 | ||
2375 | err_free_input_dev: | 2398 | err_free_input_dev: |
@@ -2396,6 +2419,8 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
2396 | 2419 | ||
2397 | video = acpi_driver_data(device); | 2420 | video = acpi_driver_data(device); |
2398 | 2421 | ||
2422 | unregister_pm_notifier(&video->pm_nb); | ||
2423 | |||
2399 | acpi_video_bus_stop_devices(video); | 2424 | acpi_video_bus_stop_devices(video); |
2400 | acpi_video_bus_put_devices(video); | 2425 | acpi_video_bus_put_devices(video); |
2401 | acpi_video_bus_remove_fs(device); | 2426 | acpi_video_bus_remove_fs(device); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index c6c552f681b7..35bb44af49b3 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -274,12 +274,33 @@ static void pnpacpi_parse_allocated_busresource(struct pnp_dev *dev, | |||
274 | pnp_add_bus_resource(dev, start, end); | 274 | pnp_add_bus_resource(dev, start, end); |
275 | } | 275 | } |
276 | 276 | ||
277 | static u64 addr_space_length(struct pnp_dev *dev, u64 min, u64 max, u64 len) | ||
278 | { | ||
279 | u64 max_len; | ||
280 | |||
281 | max_len = max - min + 1; | ||
282 | if (len <= max_len) | ||
283 | return len; | ||
284 | |||
285 | /* | ||
286 | * Per 6.4.3.5, _LEN cannot exceed _MAX - _MIN + 1, but some BIOSes | ||
287 | * don't do this correctly, e.g., | ||
288 | * https://bugzilla.kernel.org/show_bug.cgi?id=15480 | ||
289 | */ | ||
290 | dev_info(&dev->dev, | ||
291 | "resource length %#llx doesn't fit in %#llx-%#llx, trimming\n", | ||
292 | (unsigned long long) len, (unsigned long long) min, | ||
293 | (unsigned long long) max); | ||
294 | return max_len; | ||
295 | } | ||
296 | |||
277 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | 297 | static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, |
278 | struct acpi_resource *res) | 298 | struct acpi_resource *res) |
279 | { | 299 | { |
280 | struct acpi_resource_address64 addr, *p = &addr; | 300 | struct acpi_resource_address64 addr, *p = &addr; |
281 | acpi_status status; | 301 | acpi_status status; |
282 | int window; | 302 | int window; |
303 | u64 len; | ||
283 | 304 | ||
284 | status = acpi_resource_to_address64(res, p); | 305 | status = acpi_resource_to_address64(res, p); |
285 | if (!ACPI_SUCCESS(status)) { | 306 | if (!ACPI_SUCCESS(status)) { |
@@ -288,20 +309,18 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, | |||
288 | return; | 309 | return; |
289 | } | 310 | } |
290 | 311 | ||
312 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
291 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 313 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
292 | 314 | ||
293 | if (p->resource_type == ACPI_MEMORY_RANGE) | 315 | if (p->resource_type == ACPI_MEMORY_RANGE) |
294 | pnpacpi_parse_allocated_memresource(dev, | 316 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
295 | p->minimum, p->address_length, | ||
296 | p->info.mem.write_protect, window); | 317 | p->info.mem.write_protect, window); |
297 | else if (p->resource_type == ACPI_IO_RANGE) | 318 | else if (p->resource_type == ACPI_IO_RANGE) |
298 | pnpacpi_parse_allocated_ioresource(dev, | 319 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
299 | p->minimum, p->address_length, | ||
300 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 320 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
301 | ACPI_DECODE_16, window); | 321 | ACPI_DECODE_16, window); |
302 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 322 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
303 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 323 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
304 | p->address_length); | ||
305 | } | 324 | } |
306 | 325 | ||
307 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | 326 | static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, |
@@ -309,21 +328,20 @@ static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev, | |||
309 | { | 328 | { |
310 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; | 329 | struct acpi_resource_extended_address64 *p = &res->data.ext_address64; |
311 | int window; | 330 | int window; |
331 | u64 len; | ||
312 | 332 | ||
333 | len = addr_space_length(dev, p->minimum, p->maximum, p->address_length); | ||
313 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; | 334 | window = (p->producer_consumer == ACPI_PRODUCER) ? 1 : 0; |
314 | 335 | ||
315 | if (p->resource_type == ACPI_MEMORY_RANGE) | 336 | if (p->resource_type == ACPI_MEMORY_RANGE) |
316 | pnpacpi_parse_allocated_memresource(dev, | 337 | pnpacpi_parse_allocated_memresource(dev, p->minimum, len, |
317 | p->minimum, p->address_length, | ||
318 | p->info.mem.write_protect, window); | 338 | p->info.mem.write_protect, window); |
319 | else if (p->resource_type == ACPI_IO_RANGE) | 339 | else if (p->resource_type == ACPI_IO_RANGE) |
320 | pnpacpi_parse_allocated_ioresource(dev, | 340 | pnpacpi_parse_allocated_ioresource(dev, p->minimum, len, |
321 | p->minimum, p->address_length, | ||
322 | p->granularity == 0xfff ? ACPI_DECODE_10 : | 341 | p->granularity == 0xfff ? ACPI_DECODE_10 : |
323 | ACPI_DECODE_16, window); | 342 | ACPI_DECODE_16, window); |
324 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) | 343 | else if (p->resource_type == ACPI_BUS_NUMBER_RANGE) |
325 | pnpacpi_parse_allocated_busresource(dev, p->minimum, | 344 | pnpacpi_parse_allocated_busresource(dev, p->minimum, len); |
326 | p->address_length); | ||
327 | } | 345 | } |
328 | 346 | ||
329 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, | 347 | static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, |