mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH v3 5/7] ACPI / osi: Cleanup OSI handling code to use bool
Date: Tue,  3 May 2016 16:48:46 +0800	[thread overview]
Message-ID: <c256aba425ef80d1c6ce4eb59fbcafadbde35ab9.1462263979.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1462263979.git.lv.zheng@intel.com>

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>
---
 drivers/acpi/blacklist.c |    4 ++--
 drivers/acpi/osl.c       |   36 +++++++++++++-----------------------
 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 45390a9..d7d498a 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 5dd2a79..105f473 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1511,11 +1511,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");
@@ -1525,7 +1523,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;
@@ -1535,13 +1533,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);
@@ -1549,12 +1544,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");
@@ -1562,7 +1555,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;
@@ -1572,13 +1565,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);
@@ -1633,13 +1623,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);
 
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 8fd3a82..1455919 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -353,8 +353,8 @@ extern bool wmi_has_guid(const char *guid);
 extern char acpi_video_backlight_string[];
 extern long acpi_is_video_device(acpi_handle handle);
 extern int acpi_blacklisted(void);
-extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
-extern void acpi_dmi_osi_darwin(int enable, const struct dmi_system_id *d);
+extern void acpi_dmi_osi_linux(bool enable, const struct dmi_system_id *d);
+extern void acpi_dmi_osi_darwin(bool enable, const struct dmi_system_id *d);
 extern void acpi_osi_setup(char *str);
 extern bool acpi_osi_is_win8(void);
 
-- 
1.7.10

  parent reply	other threads:[~2016-05-03  8:48 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26  7:39 [PATCH 0/4] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-04-26  7:40 ` [PATCH 1/4] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Lv Zheng
2016-04-26  7:40 ` [PATCH 2/4] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-04-26 20:10   ` Rafael J. Wysocki
2016-04-27  2:00     ` Zheng, Lv
2016-04-26  7:40 ` [PATCH 3/4] ACPI / osi: Change default _OSI(Darwin) support Lv Zheng
2016-04-26 20:13   ` Rafael J. Wysocki
2016-04-27  2:01     ` Zheng, Lv
2016-04-26  7:40 ` [PATCH 4/4] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-04-27  8:54 ` [PATCH v2 0/6] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-04-27  8:54   ` [PATCH v2 1/6] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Lv Zheng
2016-04-27  8:54   ` [PATCH v2 2/6] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-04-27  8:54   ` [PATCH v2 3/6] ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! Lv Zheng
2016-04-27  8:54   ` [PATCH v2 4/6] ACPI / osi: Fix default _OSI(Darwin) support Lv Zheng
2016-04-27  9:45     ` Chen, Yu C
2016-04-27 21:24       ` Rafael J. Wysocki
2016-04-28  2:30         ` Zheng, Lv
2016-04-29  2:07           ` Zheng, Lv
2016-04-29 13:01             ` Lukas Wunner
2016-05-03  1:56               ` Zheng, Lv
2016-04-28  7:54         ` Chen, Yu C
2016-04-27  8:54   ` [PATCH v2 5/6] ACPI / osi: Cleanup coding style issues before creating a separate OSI source file Lv Zheng
2016-04-27  8:54   ` [PATCH v2 6/6] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-05-03  8:48 ` [PATCH v3 0/7] ACPI / osi: Fix several issues in _OSI handling Lv Zheng
2016-05-03  8:48   ` [PATCH v3 1/7] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Lv Zheng
2016-05-03  8:48   ` [PATCH v3 2/7] ACPI / osi: Cleanup _OSI("Linux") related code before introducing new support Lv Zheng
2016-05-03  8:48   ` [PATCH v3 3/7] ACPI / osi: Add acpi_osi=!! to allow reverting acpi_osi=! Lv Zheng
2016-05-03  8:48   ` [PATCH v3 4/7] ACPI / osi: Fix default _OSI(Darwin) support Lv Zheng
2016-05-03  8:48   ` Lv Zheng [this message]
2016-05-03  8:48   ` [PATCH v3 6/7] ACPI / osi: Cleanup coding style issues before creating a separate OSI source file Lv Zheng
2016-05-03  8:49   ` [PATCH v3 7/7] ACPI / osi: Collect _OSI handling into one single file Lv Zheng
2016-05-05 23:41   ` [PATCH v3 0/7] ACPI / osi: Fix several issues in _OSI handling Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c256aba425ef80d1c6ce4eb59fbcafadbde35ab9.1462263979.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rjw@rjwysocki.net \
    --cc=zetalog@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®