Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'acpi-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
"These fix a system resume regression from the 4.13 cycle, clean up
device table handling in the ACPI core, update sysfs ABI documentation
of a couple of drivers and add an expected switch fall-through marker
to the SPCR table parsing code.

Specifics:

- Revert a problematic EC driver change from the 4.13 cycle that
introduced a system resume regression on Thinkpad X240 (Rafael
Wysocki).

- Clean up device tables handling in the ACPI core and the related
part of the device properties framework (Andy Shevchenko).

- Update the sysfs ABI documentatio of the dock and the INT3407
special device drivers (Aishwarya Pant).

- Add an expected switch fall-through marker to the SPCR table
parsing code (Gustavo Silva)"

* tag 'acpi-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
ACPI: dock: document sysfs interface
ACPI / DPTF: Document dptf_power sysfs atttributes
device property: Constify device_get_match_data()
ACPI / bus: Rename acpi_get_match_data() to acpi_device_get_match_data()
ACPI / bus: Remove checks in acpi_get_match_data()
ACPI / bus: Do not traverse through non-existed device table
ACPI: SPCR: Mark expected switch fall-through in acpi_parse_spcr
ACPI / EC: Restore polling during noirq suspend/resume phases

+138 -46
+39
Documentation/ABI/testing/sysfs-devices-platform-dock
··· 1 + What: /sys/devices/platform/dock.N/docked 2 + Date: Dec, 2006 3 + KernelVersion: 2.6.19 4 + Contact: linux-acpi@vger.kernel.org 5 + Description: 6 + (RO) Value 1 or 0 indicates whether the software believes the 7 + laptop is docked in a docking station. 8 + 9 + What: /sys/devices/platform/dock.N/undock 10 + Date: Dec, 2006 11 + KernelVersion: 2.6.19 12 + Contact: linux-acpi@vger.kernel.org 13 + Description: 14 + (WO) Writing to this file causes the software to initiate an 15 + undock request to the firmware. 16 + 17 + What: /sys/devices/platform/dock.N/uid 18 + Date: Feb, 2007 19 + KernelVersion: v2.6.21 20 + Contact: linux-acpi@vger.kernel.org 21 + Description: 22 + (RO) Displays the docking station the laptop is docked to. 23 + 24 + What: /sys/devices/platform/dock.N/flags 25 + Date: May, 2007 26 + KernelVersion: v2.6.21 27 + Contact: linux-acpi@vger.kernel.org 28 + Description: 29 + (RO) Show dock station flags, useful for checking if undock 30 + request has been made by the user (from the immediate_undock 31 + option). 32 + 33 + What: /sys/devices/platform/dock.N/type 34 + Date: Aug, 2008 35 + KernelVersion: v2.6.27 36 + Contact: linux-acpi@vger.kernel.org 37 + Description: 38 + (RO) Display the dock station type- dock_station, ata_bay or 39 + battery_bay.
+40
Documentation/ABI/testing/sysfs-platform-dptf
··· 1 + What: /sys/bus/platform/devices/INT3407:00/dptf_power/charger_type 2 + Date: Jul, 2016 3 + KernelVersion: v4.10 4 + Contact: linux-acpi@vger.kernel.org 5 + Description: 6 + (RO) The charger type - Traditional, Hybrid or NVDC. 7 + 8 + What: /sys/bus/platform/devices/INT3407:00/dptf_power/adapter_rating_mw 9 + Date: Jul, 2016 10 + KernelVersion: v4.10 11 + Contact: linux-acpi@vger.kernel.org 12 + Description: 13 + (RO) Adapter rating in milliwatts (the maximum Adapter power). 14 + Must be 0 if no AC Adaptor is plugged in. 15 + 16 + What: /sys/bus/platform/devices/INT3407:00/dptf_power/max_platform_power_mw 17 + Date: Jul, 2016 18 + KernelVersion: v4.10 19 + Contact: linux-acpi@vger.kernel.org 20 + Description: 21 + (RO) Maximum platform power that can be supported by the battery 22 + in milliwatts. 23 + 24 + What: /sys/bus/platform/devices/INT3407:00/dptf_power/platform_power_source 25 + Date: Jul, 2016 26 + KernelVersion: v4.10 27 + Contact: linux-acpi@vger.kernel.org 28 + Description: 29 + (RO) Display the platform power source 30 + 0x00 = DC 31 + 0x01 = AC 32 + 0x02 = USB 33 + 0x03 = Wireless Charger 34 + 35 + What: /sys/bus/platform/devices/INT3407:00/dptf_power/battery_steady_power 36 + Date: Jul, 2016 37 + KernelVersion: v4.10 38 + Contact: linux-acpi@vger.kernel.org 39 + Description: 40 + (RO) The maximum sustained power for battery in milliwatts.
+41 -34
drivers/acpi/bus.c
··· 660 660 * acpi_of_match_device - Match device object using the "compatible" property. 661 661 * @adev: ACPI device object to match. 662 662 * @of_match_table: List of device IDs to match against. 663 + * @of_id: OF ID if matched 663 664 * 664 665 * If @dev has an ACPI companion which has ACPI_DT_NAMESPACE_HID in its list of 665 666 * identifiers and a _DSD object with the "compatible" property, use that 666 667 * property to match against the given list of identifiers. 667 668 */ 668 669 static bool acpi_of_match_device(struct acpi_device *adev, 669 - const struct of_device_id *of_match_table) 670 + const struct of_device_id *of_match_table, 671 + const struct of_device_id **of_id) 670 672 { 671 673 const union acpi_object *of_compatible, *obj; 672 674 int i, nval; ··· 692 690 const struct of_device_id *id; 693 691 694 692 for (id = of_match_table; id->compatible[0]; id++) 695 - if (!strcasecmp(obj->string.pointer, id->compatible)) 693 + if (!strcasecmp(obj->string.pointer, id->compatible)) { 694 + if (of_id) 695 + *of_id = id; 696 696 return true; 697 + } 697 698 } 698 699 699 700 return false; ··· 767 762 return true; 768 763 } 769 764 770 - static const struct acpi_device_id *__acpi_match_device( 771 - struct acpi_device *device, 772 - const struct acpi_device_id *ids, 773 - const struct of_device_id *of_ids) 765 + static bool __acpi_match_device(struct acpi_device *device, 766 + const struct acpi_device_id *acpi_ids, 767 + const struct of_device_id *of_ids, 768 + const struct acpi_device_id **acpi_id, 769 + const struct of_device_id **of_id) 774 770 { 775 771 const struct acpi_device_id *id; 776 772 struct acpi_hardware_id *hwid; ··· 781 775 * driver for it. 782 776 */ 783 777 if (!device || !device->status.present) 784 - return NULL; 778 + return false; 785 779 786 780 list_for_each_entry(hwid, &device->pnp.ids, list) { 787 781 /* First, check the ACPI/PNP IDs provided by the caller. */ 788 - for (id = ids; id->id[0] || id->cls; id++) { 789 - if (id->id[0] && !strcmp((char *) id->id, hwid->id)) 790 - return id; 791 - else if (id->cls && __acpi_match_device_cls(id, hwid)) 792 - return id; 782 + if (acpi_ids) { 783 + for (id = acpi_ids; id->id[0] || id->cls; id++) { 784 + if (id->id[0] && !strcmp((char *)id->id, hwid->id)) 785 + goto out_acpi_match; 786 + if (id->cls && __acpi_match_device_cls(id, hwid)) 787 + goto out_acpi_match; 788 + } 793 789 } 794 790 795 791 /* 796 792 * Next, check ACPI_DT_NAMESPACE_HID and try to match the 797 793 * "compatible" property if found. 798 - * 799 - * The id returned by the below is not valid, but the only 800 - * caller passing non-NULL of_ids here is only interested in 801 - * whether or not the return value is NULL. 802 794 */ 803 - if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id) 804 - && acpi_of_match_device(device, of_ids)) 805 - return id; 795 + if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id)) 796 + return acpi_of_match_device(device, of_ids, of_id); 806 797 } 807 - return NULL; 798 + return false; 799 + 800 + out_acpi_match: 801 + if (acpi_id) 802 + *acpi_id = id; 803 + return true; 808 804 } 809 805 810 806 /** ··· 823 815 const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, 824 816 const struct device *dev) 825 817 { 826 - return __acpi_match_device(acpi_companion_match(dev), ids, NULL); 818 + const struct acpi_device_id *id = NULL; 819 + 820 + __acpi_match_device(acpi_companion_match(dev), ids, NULL, &id, NULL); 821 + return id; 827 822 } 828 823 EXPORT_SYMBOL_GPL(acpi_match_device); 829 824 830 - void *acpi_get_match_data(const struct device *dev) 825 + const void *acpi_device_get_match_data(const struct device *dev) 831 826 { 832 827 const struct acpi_device_id *match; 833 - 834 - if (!dev->driver) 835 - return NULL; 836 - 837 - if (!dev->driver->acpi_match_table) 838 - return NULL; 839 828 840 829 match = acpi_match_device(dev->driver->acpi_match_table, dev); 841 830 if (!match) 842 831 return NULL; 843 832 844 - return (void *)match->driver_data; 833 + return (const void *)match->driver_data; 845 834 } 846 - EXPORT_SYMBOL_GPL(acpi_get_match_data); 835 + EXPORT_SYMBOL_GPL(acpi_device_get_match_data); 847 836 848 837 int acpi_match_device_ids(struct acpi_device *device, 849 838 const struct acpi_device_id *ids) 850 839 { 851 - return __acpi_match_device(device, ids, NULL) ? 0 : -ENOENT; 840 + return __acpi_match_device(device, ids, NULL, NULL, NULL) ? 0 : -ENOENT; 852 841 } 853 842 EXPORT_SYMBOL(acpi_match_device_ids); 854 843 ··· 854 849 { 855 850 if (!drv->acpi_match_table) 856 851 return acpi_of_match_device(ACPI_COMPANION(dev), 857 - drv->of_match_table); 852 + drv->of_match_table, 853 + NULL); 858 854 859 - return !!__acpi_match_device(acpi_companion_match(dev), 860 - drv->acpi_match_table, drv->of_match_table); 855 + return __acpi_match_device(acpi_companion_match(dev), 856 + drv->acpi_match_table, drv->of_match_table, 857 + NULL, NULL); 861 858 } 862 859 EXPORT_SYMBOL_GPL(acpi_driver_match_device); 863 860
+6
drivers/acpi/ec.c
··· 1927 1927 ec->reference_count >= 1) 1928 1928 acpi_set_gpe(NULL, ec->gpe, ACPI_GPE_DISABLE); 1929 1929 1930 + if (acpi_sleep_no_ec_events()) 1931 + acpi_ec_enter_noirq(ec); 1932 + 1930 1933 return 0; 1931 1934 } 1932 1935 1933 1936 static int acpi_ec_resume_noirq(struct device *dev) 1934 1937 { 1935 1938 struct acpi_ec *ec = acpi_driver_data(to_acpi_device(dev)); 1939 + 1940 + if (acpi_sleep_no_ec_events()) 1941 + acpi_ec_leave_noirq(ec); 1936 1942 1937 1943 if (ec_no_wakeup && test_bit(EC_FLAGS_STARTED, &ec->flags) && 1938 1944 ec->reference_count >= 1)
+2 -2
drivers/acpi/property.c
··· 1271 1271 return 0; 1272 1272 } 1273 1273 1274 - static void * 1274 + static const void * 1275 1275 acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, 1276 1276 const struct device *dev) 1277 1277 { 1278 - return acpi_get_match_data(dev); 1278 + return acpi_device_get_match_data(dev); 1279 1279 } 1280 1280 1281 1281 #define DECLARE_ACPI_FWNODE_OPS(ops) \
+1
drivers/acpi/spcr.c
··· 115 115 table->serial_port.access_width))) { 116 116 default: 117 117 pr_err("Unexpected SPCR Access Width. Defaulting to byte size\n"); 118 + /* fall through */ 118 119 case 8: 119 120 iotype = "mmio"; 120 121 break;
+2 -3
drivers/base/property.c
··· 1410 1410 } 1411 1411 EXPORT_SYMBOL(fwnode_graph_parse_endpoint); 1412 1412 1413 - void *device_get_match_data(struct device *dev) 1413 + const void *device_get_match_data(struct device *dev) 1414 1414 { 1415 - return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, 1416 - dev); 1415 + return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); 1417 1416 } 1418 1417 EXPORT_SYMBOL_GPL(device_get_match_data);
+2 -2
drivers/of/property.c
··· 977 977 return 0; 978 978 } 979 979 980 - static void * 980 + static const void * 981 981 of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, 982 982 const struct device *dev) 983 983 { 984 - return (void *)of_device_get_match_data(dev); 984 + return of_device_get_match_data(dev); 985 985 } 986 986 987 987 const struct fwnode_operations of_fwnode_ops = {
+2 -2
include/linux/acpi.h
··· 587 587 const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, 588 588 const struct device *dev); 589 589 590 - void *acpi_get_match_data(const struct device *dev); 590 + const void *acpi_device_get_match_data(const struct device *dev); 591 591 extern bool acpi_driver_match_device(struct device *dev, 592 592 const struct device_driver *drv); 593 593 int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); ··· 766 766 return NULL; 767 767 } 768 768 769 - static inline void *acpi_get_match_data(const struct device *dev) 769 + static inline const void *acpi_device_get_match_data(const struct device *dev) 770 770 { 771 771 return NULL; 772 772 }
+2 -2
include/linux/fwnode.h
··· 73 73 struct fwnode_handle *(*get)(struct fwnode_handle *fwnode); 74 74 void (*put)(struct fwnode_handle *fwnode); 75 75 bool (*device_is_available)(const struct fwnode_handle *fwnode); 76 - void *(*device_get_match_data)(const struct fwnode_handle *fwnode, 77 - const struct device *dev); 76 + const void *(*device_get_match_data)(const struct fwnode_handle *fwnode, 77 + const struct device *dev); 78 78 bool (*property_present)(const struct fwnode_handle *fwnode, 79 79 const char *propname); 80 80 int (*property_read_int_array)(const struct fwnode_handle *fwnode,
+1 -1
include/linux/property.h
··· 283 283 284 284 enum dev_dma_attr device_get_dma_attr(struct device *dev); 285 285 286 - void *device_get_match_data(struct device *dev); 286 + const void *device_get_match_data(struct device *dev); 287 287 288 288 int device_get_phy_mode(struct device *dev); 289 289