diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-05-03 04:48:27 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-04 18:13:51 -0400 |
commit | dbee890bf69ad62c021e299e24881fdcd1f2c481 (patch) | |
tree | 9071fea266e1cfb113afb54000af52a817bb7a49 | |
parent | 30c9bb0d7603e7b3f4d6a0ea231e1cddae020c32 (diff) |
ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support
This patch cleans up OSI code in osl.c to make osi_linux work for OSI
strings other than "Linux", so it can be re-used for other purposes.
Tested-by: Lukas Wunner <lukas@wunner.de>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/osl.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index f03677588b9d..9f59dd1a0af7 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -131,12 +131,12 @@ static void __init acpi_osi_setup_late(void); | |||
131 | * or boot with "acpi_osi=Linux" | 131 | * or boot with "acpi_osi=Linux" |
132 | */ | 132 | */ |
133 | 133 | ||
134 | static struct osi_linux { | 134 | static struct acpi_osi_config { |
135 | unsigned int enable:1; | 135 | unsigned int linux_enable:1; |
136 | unsigned int dmi:1; | 136 | unsigned int linux_dmi:1; |
137 | unsigned int cmdline:1; | 137 | unsigned int linux_cmdline:1; |
138 | u8 default_disabling; | 138 | u8 default_disabling; |
139 | } osi_linux = {0, 0, 0, 0}; | 139 | } osi_config = {0, 0, 0, 0}; |
140 | 140 | ||
141 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) | 141 | static u32 acpi_osi_handler(acpi_string interface, u32 supported) |
142 | { | 142 | { |
@@ -144,9 +144,9 @@ static u32 acpi_osi_handler(acpi_string interface, u32 supported) | |||
144 | 144 | ||
145 | printk_once(KERN_NOTICE FW_BUG PREFIX | 145 | printk_once(KERN_NOTICE FW_BUG PREFIX |
146 | "BIOS _OSI(Linux) query %s%s\n", | 146 | "BIOS _OSI(Linux) query %s%s\n", |
147 | osi_linux.enable ? "honored" : "ignored", | 147 | osi_config.linux_enable ? "honored" : "ignored", |
148 | osi_linux.cmdline ? " via cmdline" : | 148 | osi_config.linux_cmdline ? " via cmdline" : |
149 | osi_linux.dmi ? " via DMI" : ""); | 149 | osi_config.linux_dmi ? " via DMI" : ""); |
150 | } | 150 | } |
151 | 151 | ||
152 | if (!strcmp("Darwin", interface)) { | 152 | if (!strcmp("Darwin", interface)) { |
@@ -1752,12 +1752,12 @@ void __init acpi_osi_setup(char *str) | |||
1752 | str++; | 1752 | str++; |
1753 | if (*str == '\0') { | 1753 | if (*str == '\0') { |
1754 | /* Do not override acpi_osi=!* */ | 1754 | /* Do not override acpi_osi=!* */ |
1755 | if (!osi_linux.default_disabling) | 1755 | if (!osi_config.default_disabling) |
1756 | osi_linux.default_disabling = | 1756 | osi_config.default_disabling = |
1757 | ACPI_DISABLE_ALL_VENDOR_STRINGS; | 1757 | ACPI_DISABLE_ALL_VENDOR_STRINGS; |
1758 | return; | 1758 | return; |
1759 | } else if (*str == '*') { | 1759 | } else if (*str == '*') { |
1760 | osi_linux.default_disabling = ACPI_DISABLE_ALL_STRINGS; | 1760 | osi_config.default_disabling = ACPI_DISABLE_ALL_STRINGS; |
1761 | for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { | 1761 | for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) { |
1762 | osi = &osi_setup_entries[i]; | 1762 | osi = &osi_setup_entries[i]; |
1763 | osi->enable = false; | 1763 | osi->enable = false; |
@@ -1782,10 +1782,10 @@ void __init acpi_osi_setup(char *str) | |||
1782 | 1782 | ||
1783 | static void __init set_osi_linux(unsigned int enable) | 1783 | static void __init set_osi_linux(unsigned int enable) |
1784 | { | 1784 | { |
1785 | if (osi_linux.enable != enable) | 1785 | if (osi_config.linux_enable != enable) |
1786 | osi_linux.enable = enable; | 1786 | osi_config.linux_enable = enable; |
1787 | 1787 | ||
1788 | if (osi_linux.enable) | 1788 | if (osi_config.linux_enable) |
1789 | acpi_osi_setup("Linux"); | 1789 | acpi_osi_setup("Linux"); |
1790 | else | 1790 | else |
1791 | acpi_osi_setup("!Linux"); | 1791 | acpi_osi_setup("!Linux"); |
@@ -1795,8 +1795,9 @@ static void __init set_osi_linux(unsigned int enable) | |||
1795 | 1795 | ||
1796 | static void __init acpi_cmdline_osi_linux(unsigned int enable) | 1796 | static void __init acpi_cmdline_osi_linux(unsigned int enable) |
1797 | { | 1797 | { |
1798 | osi_linux.cmdline = 1; /* cmdline set the default and override DMI */ | 1798 | /* cmdline set the default and override DMI */ |
1799 | osi_linux.dmi = 0; | 1799 | osi_config.linux_cmdline = 1; |
1800 | osi_config.linux_dmi = 0; | ||
1800 | set_osi_linux(enable); | 1801 | set_osi_linux(enable); |
1801 | 1802 | ||
1802 | return; | 1803 | return; |
@@ -1809,7 +1810,8 @@ void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | |||
1809 | if (enable == -1) | 1810 | if (enable == -1) |
1810 | return; | 1811 | return; |
1811 | 1812 | ||
1812 | osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */ | 1813 | /* DMI knows that this box asks OSI(Linux) */ |
1814 | osi_config.linux_dmi = 1; | ||
1813 | set_osi_linux(enable); | 1815 | set_osi_linux(enable); |
1814 | 1816 | ||
1815 | return; | 1817 | return; |
@@ -1829,12 +1831,12 @@ static void __init acpi_osi_setup_late(void) | |||
1829 | int i; | 1831 | int i; |
1830 | acpi_status status; | 1832 | acpi_status status; |
1831 | 1833 | ||
1832 | if (osi_linux.default_disabling) { | 1834 | if (osi_config.default_disabling) { |
1833 | status = acpi_update_interfaces(osi_linux.default_disabling); | 1835 | status = acpi_update_interfaces(osi_config.default_disabling); |
1834 | 1836 | ||
1835 | if (ACPI_SUCCESS(status)) | 1837 | if (ACPI_SUCCESS(status)) |
1836 | printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", | 1838 | printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n", |
1837 | osi_linux.default_disabling == | 1839 | osi_config.default_disabling == |
1838 | ACPI_DISABLE_ALL_STRINGS ? | 1840 | ACPI_DISABLE_ALL_STRINGS ? |
1839 | " and feature groups" : ""); | 1841 | " and feature groups" : ""); |
1840 | } | 1842 | } |