linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Rename acpi_dev_present()
@ 2016-03-24 12:15 Lukas Wunner
  2016-03-24 12:15 ` [PATCH 3/3] acer-wmi: Use acpi_dev_found() Lukas Wunner
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Lukas Wunner @ 2016-03-24 12:15 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, platform-driver-x86

Hi Rafael,

all users of acpi_dev_present() that I'm aware of have landed in
Linus' tree, so as discussed I'm sending you herewith a patch which
renames acpi_dev_present() to acpi_dev_found(), plus two patches for
drivers/platform/x86 which replace legacy code with acpi_dev_found().
Both were previously acked by Darren:
http://www.spinics.net/lists/linux-acpi/msg61872.html
http://www.spinics.net/lists/linux-acpi/msg61873.html

Best regards,

Lukas


Lukas Wunner (3):
  ACPI / utils: Rename acpi_dev_present()
  eeepc-wmi: Use acpi_dev_found()
  acer-wmi: Use acpi_dev_found()

 drivers/acpi/utils.c                         |  6 +++---
 drivers/platform/x86/acer-wmi.c              | 16 ++++------------
 drivers/platform/x86/eeepc-wmi.c             | 24 ++----------------------
 include/acpi/acpi_bus.h                      |  2 +-
 include/linux/apple-gmux.h                   |  2 +-
 sound/pci/hda/thinkpad_helper.c              |  2 +-
 sound/soc/intel/boards/cht_bsw_max98090_ti.c |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c      |  2 +-
 8 files changed, 14 insertions(+), 42 deletions(-)

-- 
2.8.0.rc3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ACPI / utils: Rename acpi_dev_present()
  2016-03-24 12:15 [PATCH 0/3] Rename acpi_dev_present() Lukas Wunner
  2016-03-24 12:15 ` [PATCH 3/3] acer-wmi: Use acpi_dev_found() Lukas Wunner
  2016-03-24 12:15 ` [PATCH 2/3] eeepc-wmi: " Lukas Wunner
@ 2016-03-24 12:15 ` Lukas Wunner
  2016-04-21  0:20 ` [PATCH 0/3] " Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2016-03-24 12:15 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, platform-driver-x86

acpi_dev_present() was originally named after pci_dev_present()
to signify the similarity of the two functions.

However Rafael J. Wysocki pointed out that the exported function
acpi_dev_present() is easily confused with the non-exported
acpi_device_is_present(). Additionally in ACPI parlance the term
"present" usually refers to the "device is present" bit returned
by the _STA control method, yet acpi_dev_present() merely checks
presence in the namespace. It does not invoke _STA at all, let
alone check the "device is present" bit.

As suggested by Rafael, rename the function to acpi_dev_found()
and adjust all existing call sites.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/acpi/utils.c                         | 6 +++---
 include/acpi/acpi_bus.h                      | 2 +-
 include/linux/apple-gmux.h                   | 2 +-
 sound/pci/hda/thinkpad_helper.c              | 2 +-
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 2 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c      | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index f12a724..70ca1ab 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -707,7 +707,7 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs)
 EXPORT_SYMBOL(acpi_check_dsm);
 
 /**
- * acpi_dev_present - Detect presence of a given ACPI device in the system.
+ * acpi_dev_found - Detect presence of a given ACPI device in the namespace.
  * @hid: Hardware ID of the device.
  *
  * Return %true if the device was present at the moment of invocation.
@@ -719,7 +719,7 @@ EXPORT_SYMBOL(acpi_check_dsm);
  * instead). Calling from module_init() is fine (which is synonymous
  * with device_initcall()).
  */
-bool acpi_dev_present(const char *hid)
+bool acpi_dev_found(const char *hid)
 {
 	struct acpi_device_bus_id *acpi_device_bus_id;
 	bool found = false;
@@ -734,7 +734,7 @@ bool acpi_dev_present(const char *hid)
 
 	return found;
 }
-EXPORT_SYMBOL(acpi_dev_present);
+EXPORT_SYMBOL(acpi_dev_found);
 
 /*
  * acpi_backlight= handling, this is done here rather then in video_detect.c
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 14362a8..a84fd15 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -87,7 +87,7 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func,
 	  .package.elements = (eles)			\
 	}
 
-bool acpi_dev_present(const char *hid);
+bool acpi_dev_found(const char *hid);
 
 #ifdef CONFIG_ACPI
 
diff --git a/include/linux/apple-gmux.h b/include/linux/apple-gmux.h
index b2d32e0..714186d 100644
--- a/include/linux/apple-gmux.h
+++ b/include/linux/apple-gmux.h
@@ -35,7 +35,7 @@
  */
 static inline bool apple_gmux_present(void)
 {
-	return acpi_dev_present(GMUX_ACPI_HID);
+	return acpi_dev_found(GMUX_ACPI_HID);
 }
 
 #else  /* !CONFIG_APPLE_GMUX */
diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c
index 59ab6ce..f0955fd 100644
--- a/sound/pci/hda/thinkpad_helper.c
+++ b/sound/pci/hda/thinkpad_helper.c
@@ -13,7 +13,7 @@ static void (*old_vmaster_hook)(void *, int);
 static bool is_thinkpad(struct hda_codec *codec)
 {
 	return (codec->core.subsystem_id >> 16 == 0x17aa) &&
-	       (acpi_dev_present("LEN0068") || acpi_dev_present("IBM0068"));
+	       (acpi_dev_found("LEN0068") || acpi_dev_found("IBM0068"));
 }
 
 static void update_tpacpi_mute_led(void *private_data, int enabled)
diff --git a/sound/soc/intel/boards/cht_bsw_max98090_ti.c b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
index e609f08..ac60b04 100644
--- a/sound/soc/intel/boards/cht_bsw_max98090_ti.c
+++ b/sound/soc/intel/boards/cht_bsw_max98090_ti.c
@@ -296,7 +296,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	if (!drv)
 		return -ENOMEM;
 
-	drv->ts3a227e_present = acpi_dev_present("104C227E");
+	drv->ts3a227e_present = acpi_dev_found("104C227E");
 	if (!drv->ts3a227e_present) {
 		/* no need probe TI jack detection chip */
 		snd_soc_card_cht.aux_dev = NULL;
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 2a6f808..3f2c1ea 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -357,7 +357,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	for (i = 0; i < ARRAY_SIZE(snd_soc_cards); i++) {
-		if (acpi_dev_present(snd_soc_cards[i].codec_id)) {
+		if (acpi_dev_found(snd_soc_cards[i].codec_id)) {
 			dev_dbg(&pdev->dev,
 				"found codec %s\n", snd_soc_cards[i].codec_id);
 			card = snd_soc_cards[i].soc_card;
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] eeepc-wmi: Use acpi_dev_found()
  2016-03-24 12:15 [PATCH 0/3] Rename acpi_dev_present() Lukas Wunner
  2016-03-24 12:15 ` [PATCH 3/3] acer-wmi: Use acpi_dev_found() Lukas Wunner
@ 2016-03-24 12:15 ` Lukas Wunner
  2016-03-24 12:15 ` [PATCH 1/3] ACPI / utils: Rename acpi_dev_present() Lukas Wunner
  2016-04-21  0:20 ` [PATCH 0/3] " Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2016-03-24 12:15 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, platform-driver-x86

Use shiny new acpi_dev_found() and remove all the boilerplate
to search for a particular ACPI device. No functional change.

Cc: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Darren Hart <dvhart@linux.intel.com>
---
 drivers/platform/x86/eeepc-wmi.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 14fd2ec..17b365f 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -204,30 +204,10 @@ static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
 	}
 }
 
-static acpi_status eeepc_wmi_parse_device(acpi_handle handle, u32 level,
-						 void *context, void **retval)
-{
-	pr_warn("Found legacy ATKD device (%s)\n", EEEPC_ACPI_HID);
-	*(bool *)context = true;
-	return AE_CTRL_TERMINATE;
-}
-
-static int eeepc_wmi_check_atkd(void)
-{
-	acpi_status status;
-	bool found = false;
-
-	status = acpi_get_devices(EEEPC_ACPI_HID, eeepc_wmi_parse_device,
-				  &found, NULL);
-
-	if (ACPI_FAILURE(status) || !found)
-		return 0;
-	return -1;
-}
-
 static int eeepc_wmi_probe(struct platform_device *pdev)
 {
-	if (eeepc_wmi_check_atkd()) {
+	if (acpi_dev_found(EEEPC_ACPI_HID)) {
+		pr_warn("Found legacy ATKD device (%s)\n", EEEPC_ACPI_HID);
 		pr_warn("WMI device present, but legacy ATKD device is also "
 			"present and enabled\n");
 		pr_warn("You probably booted with acpi_osi=\"Linux\" or "
-- 
2.8.0.rc3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] acer-wmi: Use acpi_dev_found()
  2016-03-24 12:15 [PATCH 0/3] Rename acpi_dev_present() Lukas Wunner
@ 2016-03-24 12:15 ` Lukas Wunner
  2016-03-24 12:15 ` [PATCH 2/3] eeepc-wmi: " Lukas Wunner
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2016-03-24 12:15 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-acpi, platform-driver-x86

Use shiny new acpi_dev_found() and remove all the boilerplate
to search for a particular ACPI device. No functional change.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Lee, Chun-Yi <jlee@suse.com>
Acked-by: Darren Hart <dvhart@linux.intel.com>
---
 drivers/platform/x86/acer-wmi.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 1062fa4..79d64ea 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -793,15 +793,6 @@ static acpi_status __init AMW0_find_mailled(void)
 	return AE_OK;
 }
 
-static int AMW0_set_cap_acpi_check_device_found __initdata;
-
-static acpi_status __init AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
-	u32 level, void *context, void **retval)
-{
-	AMW0_set_cap_acpi_check_device_found = 1;
-	return AE_OK;
-}
-
 static const struct acpi_device_id norfkill_ids[] __initconst = {
 	{ "VPC2004", 0},
 	{ "IBM0068", 0},
@@ -816,9 +807,10 @@ static int __init AMW0_set_cap_acpi_check_device(void)
 	const struct acpi_device_id *id;
 
 	for (id = norfkill_ids; id->id[0]; id++)
-		acpi_get_devices(id->id, AMW0_set_cap_acpi_check_device_cb,
-				NULL, NULL);
-	return AMW0_set_cap_acpi_check_device_found;
+		if (acpi_dev_found(id->id))
+			return true;
+
+	return false;
 }
 
 static acpi_status __init AMW0_set_capabilities(void)
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] Rename acpi_dev_present()
  2016-03-24 12:15 [PATCH 0/3] Rename acpi_dev_present() Lukas Wunner
                   ` (2 preceding siblings ...)
  2016-03-24 12:15 ` [PATCH 1/3] ACPI / utils: Rename acpi_dev_present() Lukas Wunner
@ 2016-04-21  0:20 ` Rafael J. Wysocki
  3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2016-04-21  0:20 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: linux-acpi, platform-driver-x86

On Thursday, March 24, 2016 01:15:20 PM Lukas Wunner wrote:
> Hi Rafael,
> 
> all users of acpi_dev_present() that I'm aware of have landed in
> Linus' tree, so as discussed I'm sending you herewith a patch which
> renames acpi_dev_present() to acpi_dev_found(), plus two patches for
> drivers/platform/x86 which replace legacy code with acpi_dev_found().
> Both were previously acked by Darren:
> http://www.spinics.net/lists/linux-acpi/msg61872.html
> http://www.spinics.net/lists/linux-acpi/msg61873.html
> 
> Best regards,
> 
> Lukas
> 
> 
> Lukas Wunner (3):
>   ACPI / utils: Rename acpi_dev_present()
>   eeepc-wmi: Use acpi_dev_found()
>   acer-wmi: Use acpi_dev_found()
> 
>  drivers/acpi/utils.c                         |  6 +++---
>  drivers/platform/x86/acer-wmi.c              | 16 ++++------------
>  drivers/platform/x86/eeepc-wmi.c             | 24 ++----------------------
>  include/acpi/acpi_bus.h                      |  2 +-
>  include/linux/apple-gmux.h                   |  2 +-
>  sound/pci/hda/thinkpad_helper.c              |  2 +-
>  sound/soc/intel/boards/cht_bsw_max98090_ti.c |  2 +-
>  sound/soc/intel/boards/cht_bsw_rt5645.c      |  2 +-
>  8 files changed, 14 insertions(+), 42 deletions(-)

All [1-3/3] applied, thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-21  0:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 12:15 [PATCH 0/3] Rename acpi_dev_present() Lukas Wunner
2016-03-24 12:15 ` [PATCH 3/3] acer-wmi: Use acpi_dev_found() Lukas Wunner
2016-03-24 12:15 ` [PATCH 2/3] eeepc-wmi: " Lukas Wunner
2016-03-24 12:15 ` [PATCH 1/3] ACPI / utils: Rename acpi_dev_present() Lukas Wunner
2016-04-21  0:20 ` [PATCH 0/3] " Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).