summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2016-05-03 16:48:46 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-05-05 00:13:52 +0200
commitdc45eb20a83d11ed649169fbe9159ed6bf586c88 (patch)
treec91ce06cf9ec105408d24c2c612f751b8926294a /drivers/acpi
parente10cfdc33a0f23dc8449be7267f0a642e96a2a24 (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>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/blacklist.c4
-rw-r--r--drivers/acpi/osl.c36
2 files changed, 15 insertions, 25 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)
#ifdef CONFIG_DMI
static int __init dmi_enable_osi_darwin(const struct dmi_system_id *d)
{
- acpi_dmi_osi_darwin(1, d); /* enable */
+ acpi_dmi_osi_darwin(true, d); /* enable */
return 0;
}
static int __init dmi_enable_osi_linux(const struct dmi_system_id *d)
{
- acpi_dmi_osi_linux(1, d); /* enable */
+ acpi_dmi_osi_linux(true, d); /* enable */
return 0;
}
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)
}
}
-static void __init set_osi_darwin(unsigned int enable)
+static void __init set_osi_darwin(bool enable)
{
- if (osi_config.darwin_enable != enable)
- osi_config.darwin_enable = enable;
-
+ osi_config.darwin_enable = !!enable;
if (enable) {
acpi_osi_setup("!");
acpi_osi_setup("Darwin");
@@ -1799,7 +1797,7 @@ static void __init set_osi_darwin(unsigned int enable)
}
}
-static void __init acpi_cmdline_osi_darwin(unsigned int enable)
+static void __init acpi_cmdline_osi_darwin(bool enable)
{
/* cmdline set the default and override DMI */
osi_config.darwin_cmdline = 1;
@@ -1809,13 +1807,10 @@ static void __init acpi_cmdline_osi_darwin(unsigned int enable)
return;
}
-void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d)
+void __init acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d)
{
printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
- if (enable == -1)
- return;
-
/* DMI knows that this box asks OSI(Darwin) */
osi_config.darwin_dmi = 1;
set_osi_darwin(enable);
@@ -1823,12 +1818,10 @@ void __init acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d)
return;
}
-static void __init set_osi_linux(unsigned int enable)
+static void __init set_osi_linux(bool enable)
{
- if (osi_config.linux_enable != enable)
- osi_config.linux_enable = enable;
-
- if (osi_config.linux_enable)
+ osi_config.linux_enable = !!enable;
+ if (enable)
acpi_osi_setup("Linux");
else
acpi_osi_setup("!Linux");
@@ -1836,7 +1829,7 @@ static void __init set_osi_linux(unsigned int enable)
return;
}
-static void __init acpi_cmdline_osi_linux(unsigned int enable)
+static void __init acpi_cmdline_osi_linux(bool enable)
{
/* cmdline set the default and override DMI */
osi_config.linux_cmdline = 1;
@@ -1846,13 +1839,10 @@ static void __init acpi_cmdline_osi_linux(unsigned int enable)
return;
}
-void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
+void __init acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d)
{
printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
- if (enable == -1)
- return;
-
/* DMI knows that this box asks OSI(Linux) */
osi_config.linux_dmi = 1;
set_osi_linux(enable);
@@ -1907,13 +1897,13 @@ static void __init acpi_osi_setup_late(void)
static int __init osi_setup(char *str)
{
if (str && !strcmp("Linux", str))
- acpi_cmdline_osi_linux(1);
+ acpi_cmdline_osi_linux(true);
else if (str && !strcmp("!Linux", str))
- acpi_cmdline_osi_linux(0);
+ acpi_cmdline_osi_linux(false);
else if (str && !strcmp("Darwin", str))
- acpi_cmdline_osi_darwin(1);
+ acpi_cmdline_osi_darwin(true);
else if (str && !strcmp("!Darwin", str))
- acpi_cmdline_osi_darwin(0);
+ acpi_cmdline_osi_darwin(false);
else
acpi_osi_setup(str);