diff options
author | Lv Zheng <lv.zheng@intel.com> | 2016-05-03 04:48:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-04 18:13:52 -0400 |
commit | dc45eb20a83d11ed649169fbe9159ed6bf586c88 (patch) | |
tree | c91ce06cf9ec105408d24c2c612f751b8926294a | |
parent | e10cfdc33a0f23dc8449be7267f0a642e96a2a24 (diff) |
ACPI / osi: Cleanup OSI handling code to use bool
This patch changes "int/unsigned int" to "bool" to simplify the code.
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/blacklist.c | 4 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 36 | ||||
-rw-r--r-- | include/linux/acpi.h | 4 |
3 files changed, 17 insertions, 27 deletions
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index 45390a953fb2..d7d498abc5d3 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -135,12 +135,12 @@ int __init acpi_blacklisted(void) | |||
135 | #ifdef CONFIG_DMI | 135 | #ifdef CONFIG_DMI |
136 | static int __init dmi_enable_osi_darwin(const struct dmi_system_id *d) | 136 | static int __init dmi_enable_osi_darwin(const struct dmi_system_id *d) |
137 | { | 137 | { |
138 | acpi_dmi_osi_darwin(1, d); /* enable */ | 138 | acpi_dmi_osi_darwin(true, d); /* enable */ |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | static int __init dmi_enable_osi_linux(const struct dmi_system_id *d) | 141 | static int __init dmi_enable_osi_linux(const struct dmi_system_id *d) |
142 | { | 142 | { |
143 | acpi_dmi_osi_linux(1, d); /* enable */ | 143 | acpi_dmi_osi_linux(true, d); /* enable */ |
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) | 146 | static int __init dmi_disable_osi_vista(const struct dmi_system_id *d) |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 1b84e4635ae0..e30f3251fd14 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -1785,11 +1785,9 @@ void __init acpi_osi_setup(char *str) | |||
1785 | } | 1785 | } |
1786 | } | 1786 | } |
1787 | 1787 | ||
1788 | static void __init set_osi_darwin(unsigned int enable) | 1788 | static void __init set_osi_darwin(bool enable) |
1789 | { | 1789 | { |
1790 | if (osi_config.darwin_enable != enable) | 1790 | osi_config.darwin_enable = !!enable; |
1791 | osi_config.darwin_enable = enable; | ||
1792 | |||
1793 | if (enable) { | 1791 | if (enable) { |
1794 | acpi_osi_setup("!"); | 1792 | acpi_osi_setup("!"); |
1795 | acpi_osi_setup("Darwin"); | 1793 | acpi_osi_setup("Darwin"); |
@@ -1799,7 +1797,7 @@ static void __init set_osi_darwin(unsigned int enable) | |||
1799 | } | 1797 | } |
1800 | } | 1798 | } |
1801 | 1799 | ||
1802 | static void __init acpi_cmdline_osi_darwin(unsigned int enable) | 1800 | static void __init acpi_cmdline_osi_darwin(bool enable) |
1803 | { | 1801 | { |
1804 | /* cmdline set the default and override DMI */ | 1802 | /* cmdline set the default and override DMI */ |
1805 | osi_config.darwin_cmdline = 1; | 1803 | osi_config.darwin_cmdline = 1; |
@@ -1809,13 +1807,10 @@ static void __init acpi_cmdline_osi_darwin(unsigned int enable) | |||
1809 | return; | 1807 | return; |
1810 | } | 1808 | } |
1811 | 1809 | ||
1812 | void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d) | 1810 | void __init acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d) |
1813 | { | 1811 | { |
1814 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | 1812 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
1815 | 1813 | ||
1816 | if (enable == -1) | ||
1817 | return; | ||
1818 | |||
1819 | /* DMI knows that this box asks OSI(Darwin) */ | 1814 | /* DMI knows that this box asks OSI(Darwin) */ |
1820 | osi_config.darwin_dmi = 1; | 1815 | osi_config.darwin_dmi = 1; |
1821 | set_osi_darwin(enable); | 1816 | set_osi_darwin(enable); |
@@ -1823,12 +1818,10 @@ void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d) | |||
1823 | return; | 1818 | return; |
1824 | } | 1819 | } |
1825 | 1820 | ||
1826 | static void __init set_osi_linux(unsigned int enable) | 1821 | static void __init set_osi_linux(bool enable) |
1827 | { | 1822 | { |
1828 | if (osi_config.linux_enable != enable) | 1823 | osi_config.linux_enable = !!enable; |
1829 | osi_config.linux_enable = enable; | 1824 | if (enable) |
1830 | |||
1831 | if (osi_config.linux_enable) | ||
1832 | acpi_osi_setup("Linux"); | 1825 | acpi_osi_setup("Linux"); |
1833 | else | 1826 | else |
1834 | acpi_osi_setup("!Linux"); | 1827 | acpi_osi_setup("!Linux"); |
@@ -1836,7 +1829,7 @@ static void __init set_osi_linux(unsigned int enable) | |||
1836 | return; | 1829 | return; |
1837 | } | 1830 | } |
1838 | 1831 | ||
1839 | static void __init acpi_cmdline_osi_linux(unsigned int enable) | 1832 | static void __init acpi_cmdline_osi_linux(bool enable) |
1840 | { | 1833 | { |
1841 | /* cmdline set the default and override DMI */ | 1834 | /* cmdline set the default and override DMI */ |
1842 | osi_config.linux_cmdline = 1; | 1835 | osi_config.linux_cmdline = 1; |
@@ -1846,13 +1839,10 @@ static void __init acpi_cmdline_osi_linux(unsigned int enable) | |||
1846 | return; | 1839 | return; |
1847 | } | 1840 | } |
1848 | 1841 | ||
1849 | void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d) | 1842 | void __init acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d) |
1850 | { | 1843 | { |
1851 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); | 1844 | printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident); |
1852 | 1845 | ||
1853 | if (enable == -1) | ||
1854 | return; | ||
1855 | |||
1856 | /* DMI knows that this box asks OSI(Linux) */ | 1846 | /* DMI knows that this box asks OSI(Linux) */ |
1857 | osi_config.linux_dmi = 1; | 1847 | osi_config.linux_dmi = 1; |
1858 | set_osi_linux(enable); | 1848 | set_osi_linux(enable); |
@@ -1907,13 +1897,13 @@ static void __init acpi_osi_setup_late(void) | |||
1907 | static int __init osi_setup(char *str) | 1897 | static int __init osi_setup(char *str) |
1908 | { | 1898 | { |
1909 | if (str && !strcmp("Linux", str)) | 1899 | if (str && !strcmp("Linux", str)) |
1910 | acpi_cmdline_osi_linux(1); | 1900 | acpi_cmdline_osi_linux(true); |
1911 | else if (str && !strcmp("!Linux", str)) | 1901 | else if (str && !strcmp("!Linux", str)) |
1912 | acpi_cmdline_osi_linux(0); | 1902 | acpi_cmdline_osi_linux(false); |
1913 | else if (str && !strcmp("Darwin", str)) | 1903 | else if (str && !strcmp("Darwin", str)) |
1914 | acpi_cmdline_osi_darwin(1); | 1904 | acpi_cmdline_osi_darwin(true); |
1915 | else if (str && !strcmp("!Darwin", str)) | 1905 | else if (str && !strcmp("!Darwin", str)) |
1916 | acpi_cmdline_osi_darwin(0); | 1906 | acpi_cmdline_osi_darwin(false); |
1917 | else | 1907 | else |
1918 | acpi_osi_setup(str); | 1908 | acpi_osi_setup(str); |
1919 | 1909 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 6c7176efd543..0ccfeba71fcf 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -359,8 +359,8 @@ extern bool wmi_has_guid(const char *guid); | |||
359 | extern char acpi_video_backlight_string[]; | 359 | extern char acpi_video_backlight_string[]; |
360 | extern long acpi_is_video_device(acpi_handle handle); | 360 | extern long acpi_is_video_device(acpi_handle handle); |
361 | extern int acpi_blacklisted(void); | 361 | extern int acpi_blacklisted(void); |
362 | extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); | 362 | extern void acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d); |
363 | extern void acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d); | 363 | extern void acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d); |
364 | extern void acpi_osi_setup(char *str); | 364 | extern void acpi_osi_setup(char *str); |
365 | extern bool acpi_osi_is_win8(void); | 365 | extern bool acpi_osi_is_win8(void); |
366 | 366 | ||