Skip to contentSkip to conversation

ACPI / utils: Replace leaky function

PATCH Applied Andy Shevchenko 8 participants 27 messages Mar 28, 2019 – Apr 2, 2019

Subsystems (11)
Sound ACPI ASoC GPIO +7 more subsystems
lore
Share & tools
lore
#0 lore raw

v3 cover ACPI / utils: Replace leaky function

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

 drivers/acpi/utils.c                    | 16 ++++++++++------
 drivers/extcon/extcon-axp288.c          |  9 +++++----
 drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
 include/acpi/acpi_bus.h                 |  4 ++--
 include/linux/acpi.h                    |  4 ++--
 sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
 sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
 sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
 sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
 sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
 sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
 11 files changed, 66 insertions(+), 45 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH v3 1/10 ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API. And then remove the old one.

---
 drivers/acpi/utils.c    | 24 ++++++++++++++++++++++--
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
drivers/acpi/utils.c +22 -2
index c4b06cc075f9..5a2bae2b6c3a 100644
@@ -739,6 +739,7 @@ EXPORT_SYMBOL(acpi_dev_found);
 
 struct acpi_dev_match_info {
 	const char *dev_name;
+	struct acpi_device *adev;
 	struct acpi_device_id hid[2];
 	const char *uid;
 	s64 hrv;
@@ -759,6 +760,7 @@ static int acpi_dev_match_cb(struct device *dev, void *data)
 		return 0;
 
 	match->dev_name = acpi_dev_name(adev);
+	match->adev = adev;
 
 	if (match->hrv == -1)
 		return 1;
@@ -806,16 +808,34 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 EXPORT_SYMBOL(acpi_dev_present);
 
 /**
- * acpi_dev_get_first_match_name - Return name of first match of ACPI device
+ * acpi_dev_get_first_match_dev - Return the first match of ACPI device
  * @hid: Hardware ID of the device.
  * @uid: Unique ID of the device, pass NULL to not check _UID
  * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
  *
- * Return device name if a matching device was present
+ * Return the first match of ACPI device if a matching device was present
  * at the moment of invocation, or NULL otherwise.
  *
+ * The caller is responsible to call put_device() on the returned device.
+ *
  * See additional information in acpi_dev_present() as well.
  */
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+	struct acpi_dev_match_info match = {};
+	struct device *dev;
+
+	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
+	match.uid = uid;
+	match.hrv = hrv;
+
+	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
+	return dev ? match.adev : NULL;
+}
+EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
+
+/* DEPRECATED, use acpi_dev_get_first_match_dev() instead */
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
include/acpi/acpi_bus.h +3 -0
index 0300374101cd..2063e9e2f384 100644
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
+
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
 
include/linux/acpi.h +6 -0
index d5dcebd7aad3..3e1d16b00513 100644
@@ -669,6 +669,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 	return false;
 }
 
+static inline struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+	return NULL;
+}
+
 static inline const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v3 01/10] ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper

Quoted 9 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API. And then remove the old one.

Any differences between this and the previous one? I've queued up that one already.

Quoted 97 lines
---
 drivers/acpi/utils.c    | 24 ++++++++++++++++++++++--
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
drivers/acpi/utils.c +22 -2
index c4b06cc075f9..5a2bae2b6c3a 100644
@@ -739,6 +739,7 @@ EXPORT_SYMBOL(acpi_dev_found);
 
 struct acpi_dev_match_info {
        const char *dev_name;
+       struct acpi_device *adev;
        struct acpi_device_id hid[2];
        const char *uid;
        s64 hrv;
@@ -759,6 +760,7 @@ static int acpi_dev_match_cb(struct device *dev, void *data)
                return 0;
 
        match->dev_name = acpi_dev_name(adev);
+       match->adev = adev;
 
        if (match->hrv == -1)
                return 1;
@@ -806,16 +808,34 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 EXPORT_SYMBOL(acpi_dev_present);
 
 /**
- * acpi_dev_get_first_match_name - Return name of first match of ACPI device
+ * acpi_dev_get_first_match_dev - Return the first match of ACPI device
  * @hid: Hardware ID of the device.
  * @uid: Unique ID of the device, pass NULL to not check _UID
  * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
  *
- * Return device name if a matching device was present
+ * Return the first match of ACPI device if a matching device was present
  * at the moment of invocation, or NULL otherwise.
  *
+ * The caller is responsible to call put_device() on the returned device.
+ *
  * See additional information in acpi_dev_present() as well.
  */
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+       struct acpi_dev_match_info match = {};
+       struct device *dev;
+
+       strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
+       match.uid = uid;
+       match.hrv = hrv;
+
+       dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
+       return dev ? match.adev : NULL;
+}
+EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
+
+/* DEPRECATED, use acpi_dev_get_first_match_dev() instead */
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
include/acpi/acpi_bus.h +3 -0
index 0300374101cd..2063e9e2f384 100644
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
+
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
 
include/linux/acpi.h +6 -1
index d5dcebd7aad3..3e1d16b00513 100644
@@ -669,6 +669,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
        return false;
 }
 
+static inline struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+       return NULL;
+}
+
 static inline const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
--

2.20.1

#3 lore raw

Re: [PATCH v3 01/10] ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper

Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

Quoted 8 lines
Quoted 5 lines

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API. And then remove the old one.

Any differences between this and the previous one? I've queued up that one already.

Not a single bit. Just Hans' tag is added.

Quoted 98 lines
Quoted 98 lines
---
 drivers/acpi/utils.c    | 24 ++++++++++++++++++++++--
 include/acpi/acpi_bus.h |  3 +++
 include/linux/acpi.h    |  6 ++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
drivers/acpi/utils.c +22 -2
index c4b06cc075f9..5a2bae2b6c3a 100644
@@ -739,6 +739,7 @@ EXPORT_SYMBOL(acpi_dev_found);
 
 struct acpi_dev_match_info {
        const char *dev_name;
+       struct acpi_device *adev;
        struct acpi_device_id hid[2];
        const char *uid;
        s64 hrv;
@@ -759,6 +760,7 @@ static int acpi_dev_match_cb(struct device *dev, void *data)
                return 0;
 
        match->dev_name = acpi_dev_name(adev);
+       match->adev = adev;
 
        if (match->hrv == -1)
                return 1;
@@ -806,16 +808,34 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
 EXPORT_SYMBOL(acpi_dev_present);
 
 /**
- * acpi_dev_get_first_match_name - Return name of first match of ACPI device
+ * acpi_dev_get_first_match_dev - Return the first match of ACPI device
  * @hid: Hardware ID of the device.
  * @uid: Unique ID of the device, pass NULL to not check _UID
  * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
  *
- * Return device name if a matching device was present
+ * Return the first match of ACPI device if a matching device was present
  * at the moment of invocation, or NULL otherwise.
  *
+ * The caller is responsible to call put_device() on the returned device.
+ *
  * See additional information in acpi_dev_present() as well.
  */
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+       struct acpi_dev_match_info match = {};
+       struct device *dev;
+
+       strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
+       match.uid = uid;
+       match.hrv = hrv;
+
+       dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
+       return dev ? match.adev : NULL;
+}
+EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
+
+/* DEPRECATED, use acpi_dev_get_first_match_dev() instead */
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
include/acpi/acpi_bus.h +3 -0
index 0300374101cd..2063e9e2f384 100644
@@ -91,6 +91,9 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
 bool acpi_dev_found(const char *hid);
 bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 
+struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
+
 const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
 
include/linux/acpi.h +6 -1
index d5dcebd7aad3..3e1d16b00513 100644
@@ -669,6 +669,12 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
        return false;
 }
 
+static inline struct acpi_device *
+acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
+{
+       return NULL;
+}
+
 static inline const char *
 acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
 {
--

2.20.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Acked-by on v3 1/10
#4 lore raw

Re: [PATCH v3 01/10] ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper

In reply to Andy Shevchenko
Quoted 5 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API. And then remove the old one.

#5 lore raw

PATCH v3 2/10 extcon: axp288: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/extcon/extcon-axp288.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +5 -4
index a983708b77a6..50f9402fb325 100644
@@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	struct axp288_extcon_info *info;
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 	struct device *dev = &pdev->dev;
-	const char *name;
+	struct acpi_device *adev;
 	int ret, i, pirq;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 		if (ret)
 			return ret;
 
-		name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
-		if (name) {
-			info->id_extcon = extcon_get_extcon_dev(name);
+		adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
+		if (adev) {
+			info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
+			put_device(&adev->dev);
 			if (!info->id_extcon)
 				return -EPROBE_DEFER;
 
Signature · 1 line
2.20.1
maintainer Applied
#6 lore raw

Re: [PATCH v3 02/10] extcon: axp288: Convert to use acpi_dev_get_first_match_dev()

Hi Andy,

Quoted 31 lines · Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/extcon/extcon-axp288.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +1 -1
index a983708b77a6..50f9402fb325 100644
@@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	struct axp288_extcon_info *info;
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 	struct device *dev = &pdev->dev;
-	const char *name;
+	struct acpi_device *adev;
 	int ret, i, pirq;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 		if (ret)
 			return ret;
 

drivers/extcon/extcon-axp288.c static int axp288_extcon_probe(struct platform_device *pdev) · line 366

Quoted 10 lines
drivers/extcon/extcon-axp288.c +4 -3
-		name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
-		if (name) {
-			info->id_extcon = extcon_get_extcon_dev(name);
+		adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
+		if (adev) {
+			info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
+			put_device(&adev->dev);
 			if (!info->id_extcon)
 				return -EPROBE_DEFER;
 

Applied it. Thanks.

Signature · 7 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#7 lore raw

Re: [PATCH v3 02/10] extcon: axp288: Convert to use acpi_dev_get_first_match_dev()

Quoted 33 lines · CET Chanwoo Choi

Hi Andy,

Quoted 30 lines · Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/extcon/extcon-axp288.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +1 -1
index a983708b77a6..50f9402fb325 100644
@@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	struct axp288_extcon_info *info;
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 	struct device *dev = &pdev->dev;
-	const char *name;
+	struct acpi_device *adev;
 	int ret, i, pirq;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 		if (ret)
 			return ret;
 
Quoted 15 lines

drivers/extcon/extcon-axp288.c static int axp288_extcon_probe(struct platform_device *pdev) · line 366

Quoted 11 lines
drivers/extcon/extcon-axp288.c +4 -3
-		name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
-		if (name) {
-			info->id_extcon = extcon_get_extcon_dev(name);
+		adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
+		if (adev) {
+			info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
+			put_device(&adev->dev);
 			if (!info->id_extcon)
 				return -EPROBE_DEFER;
 

Applied it. Thanks.

But it won't build without the first patch I suppose?

ACK, please?

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer Acked-by
#8 lore raw

Re: [PATCH v3 02/10] extcon: axp288: Convert to use acpi_dev_get_first_match_dev()

Hi Rafael,

Quoted 50 lines · Rafael J. Wysocki
Quoted 33 lines · CET Chanwoo Choi

Hi Andy,

Quoted 30 lines · Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

Cc Chanwoo Choi <[email protected]>
Cc MyungJoo Ham <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 drivers/extcon/extcon-axp288.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-axp288.c +1 -1
index a983708b77a6..50f9402fb325 100644
@@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 	struct axp288_extcon_info *info;
 	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
 	struct device *dev = &pdev->dev;
-	const char *name;
+	struct acpi_device *adev;
 	int ret, i, pirq;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
 		if (ret)
 			return ret;
 
Quoted 15 lines

drivers/extcon/extcon-axp288.c static int axp288_extcon_probe(struct platform_device *pdev) · line 366

Quoted 11 lines
drivers/extcon/extcon-axp288.c +4 -3
-		name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
-		if (name) {
-			info->id_extcon = extcon_get_extcon_dev(name);
+		adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
+		if (adev) {
+			info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
+			put_device(&adev->dev);
 			if (!info->id_extcon)
 				return -EPROBE_DEFER;
 

Applied it. Thanks.

Quoted 3 lines

But it won't build without the first patch I suppose?

ACK, please?

It is my fault. I'll drop it from extcon.git.

Quoted 4 lines
Signature · 7 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#9 lore raw

PATCH v3 3/10 gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 drivers/gpio/gpio-merrifield.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/gpio/gpio-merrifield.c +14 -4
index 7c659fdaa6d5..2383dc78b123 100644
@@ -377,10 +377,20 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
 	}
 }
 
-static const char *mrfld_gpio_get_pinctrl_dev_name(void)
+static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
 {
-	const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1);
-	return dev_name ? dev_name : "pinctrl-merrifield";
+	struct acpi_device *adev;
+	const char *name;
+
+	adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
+	if (adev) {
+		name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
+		put_device(&adev->dev);
+	} else {
+		name = "pinctrl-merrifield";
+	}
+
+	return name;
 }
 
 static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -441,7 +451,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
 		return retval;
 	}
 
-	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name();
+	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv);
 	for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
 		range = &mrfld_gpio_ranges[i];
 		retval = gpiochip_add_pin_range(&priv->chip,
Signature · 1 line
2.20.1
#10 lore raw

PATCH v3 4/10 ASoC: Intel: bytcht_da7213: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/bytcht_da7213.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/boards/bytcht_da7213.c +5 -4
index b8e884803777..4decba338156 100644
@@ -226,7 +226,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
 	struct snd_soc_card *card;
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
-	const char *i2c_name = NULL;
+	struct acpi_device *adev;
 	int dai_index = 0;
 	int ret_val = 0;
 	int i;
@@ -244,10 +244,11 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
 		snprintf(codec_name, sizeof(codec_name),
-			"%s%s", "i2c-", i2c_name);
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
 		dailink[dai_index].codec_name = codec_name;
 	}
 
Signature · 1 line
2.20.1
#11 lore raw

PATCH v3 5/10 ASoC: Intel: bytcht_es8316: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/bytcht_es8316.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/boards/bytcht_es8316.c +5 -4
index d2a7e6ba11ae..6937c00cf63d 100644
@@ -442,7 +442,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
-	const char *i2c_name = NULL;
+	struct acpi_device *adev;
 	struct device *codec_dev;
 	int dai_index = 0;
 	int i;
@@ -463,10 +463,11 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
 		snprintf(codec_name, sizeof(codec_name),
-			"%s%s", "i2c-", i2c_name);
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
 		byt_cht_es8316_dais[dai_index].codec_name = codec_name;
 	}
 
Signature · 1 line
2.20.1
#12 lore raw

PATCH v3 6/10 ASoC: Intel: bytcr_rt5640: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/bytcr_rt5640.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +5 -5
index 940eb27158da..f9175cf6747e 100644
@@ -1154,7 +1154,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	struct byt_rt5640_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
-	const char *i2c_name = NULL;
+	struct acpi_device *adev;
 	int ret_val = 0;
 	int dai_index = 0;
 	int i;
@@ -1178,11 +1178,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
 		snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
-			"%s%s", "i2c-", i2c_name);
-
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
 		byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
 	}
 
Signature · 1 line
2.20.1
#13 lore raw

PATCH v3 7/10 ASoC: Intel: bytcr_rt5651: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/bytcr_rt5651.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
sound/soc/intel/boards/bytcr_rt5651.c +8 -6
index b0a4d297176e..b744add01d12 100644
@@ -867,8 +867,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	struct byt_rt5651_private *priv;
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
+	struct acpi_device *adev;
 	struct device *codec_dev;
-	const char *i2c_name = NULL;
 	const char *hp_swapped;
 	bool is_bytcr = false;
 	int ret_val = 0;
@@ -894,14 +894,16 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	}
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (!i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
+		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
+		byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
+	} else {
 		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
 		return -ENODEV;
 	}
-	snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
-		"%s%s", "i2c-", i2c_name);
-	byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
 
 	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
 					    byt_rt5651_codec_name);
Signature · 1 line
2.20.1
#14 lore raw

PATCH v3 8/10 ASoC: Intel: cht_bsw_rt5645: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/cht_bsw_rt5645.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/boards/cht_bsw_rt5645.c +5 -4
index cbc2d458483f..32dbeaf1ab94 100644
@@ -532,7 +532,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
 	struct cht_mc_private *drv;
-	const char *i2c_name = NULL;
+	struct acpi_device *adev;
 	bool found = false;
 	bool is_bytcr = false;
 	int dai_index = 0;
@@ -573,10 +573,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		}
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
 		snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
-			"%s%s", "i2c-", i2c_name);
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
 		cht_dailink[dai_index].codec_name = cht_rt5645_codec_name;
 	}
 
Signature · 1 line
2.20.1
#15 lore raw

PATCH v3 9/10 ASoC: Intel: cht_bsw_rt5672: Convert to use acpi_dev_get_first_match_dev()

In reply to Andy Shevchenko

acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference.

Convert the driver to use acpi_dev_get_first_match_dev() instead.

---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/intel/boards/cht_bsw_rt5672.c +5 -4
index 3d5a2b3a06f0..0f7770822388 100644
@@ -401,7 +401,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	struct cht_mc_private *drv;
 	struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
 	const char *platform_name;
-	const char *i2c_name;
+	struct acpi_device *adev;
 	int i;
 
 	drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
@@ -411,10 +411,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
 
 	/* fixup codec name based on HID */
-	i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
-	if (i2c_name) {
+	adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
+	if (adev) {
 		snprintf(drv->codec_name, sizeof(drv->codec_name),
-			 "i2c-%s", i2c_name);
+			 "i2c-%s", acpi_dev_name(adev));
+		put_device(&adev->dev);
 		for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
 			if (!strcmp(cht_dailink[i].codec_name,
 				RT5672_I2C_DEFAULT)) {
Signature · 1 line
2.20.1
#16 lore raw

PATCH v3 10/10 ACPI / utils: Remove deprecated function since no user left

In reply to Andy Shevchenko

There is no more user of acpi_dev_get_first_match_name(), which is deprecated and has no user left, so, remove it for good.

---
 drivers/acpi/utils.c    | 16 ----------------
 include/acpi/acpi_bus.h |  3 ---
 include/linux/acpi.h    |  6 ------
 3 files changed, 25 deletions(-)
drivers/acpi/utils.c +0 -16
index 5a2bae2b6c3a..89363b245489 100644
@@ -835,22 +835,6 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
 }
 EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
 
-/* DEPRECATED, use acpi_dev_get_first_match_dev() instead */
-const char *
-acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
-{
-	struct acpi_dev_match_info match = {};
-	struct device *dev;
-
-	strlcpy(match.hid[0].id, hid, sizeof(match.hid[0].id));
-	match.uid = uid;
-	match.hrv = hrv;
-
-	dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
-	return dev ? match.dev_name : NULL;
-}
-EXPORT_SYMBOL(acpi_dev_get_first_match_name);
-
 /*
  * acpi_backlight= handling, this is done here rather then in video_detect.c
  * because __setup cannot be used in modules.
include/acpi/acpi_bus.h +0 -3
index 2063e9e2f384..f7981751ac77 100644
@@ -94,9 +94,6 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
 struct acpi_device *
 acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
 
-const char *
-acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
-
 #ifdef CONFIG_ACPI
 
 #include <linux/proc_fs.h>
include/linux/acpi.h +0 -6
index 3e1d16b00513..392413075cc0 100644
@@ -675,12 +675,6 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
 	return NULL;
 }
 
-static inline const char *
-acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
-{
-	return NULL;
-}
-
 static inline bool is_acpi_node(struct fwnode_handle *fwnode)
 {
 	return false;
Signature · 1 line
2.20.1
Acked-by on the v3 series
#17 lore raw
In reply to Andy Shevchenko
Quoted 10 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Quoted 5 lines
Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

Patches 4..9 for the Intel machine drivers:

Is this going to be merged through the ACPI or ASoC tree? The changes will conflict with cleanups I started to use the 'modern' dailinks (codec_name -> codecs[0].name), so some level of coordination is needed.

Quoted 32 lines

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

  drivers/acpi/utils.c                    | 16 ++++++++++------
  drivers/extcon/extcon-axp288.c          |  9 +++++----
  drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
  include/acpi/acpi_bus.h                 |  4 ++--
  include/linux/acpi.h                    |  4 ++--
  sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
  sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
  sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
  sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
  sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
  sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
  11 files changed, 66 insertions(+), 45 deletions(-)
#18 lore raw
Quoted 17 lines · Pierre-Louis Bossart
Quoted 10 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Quoted 5 lines
Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Quoted 3 lines

Patches 4..9 for the Intel machine drivers:

Thank you!

Quoted 3 lines

Is this going to be merged through the ACPI or ASoC tree? The changes will conflict with cleanups I started to use the 'modern' dailinks (codec_name -> codecs[0].name), so some level of coordination is needed.

I suppose via ACPI.

Quoted 34 lines
Quoted 33 lines

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

  drivers/acpi/utils.c                    | 16 ++++++++++------
  drivers/extcon/extcon-axp288.c          |  9 +++++----
  drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
  include/acpi/acpi_bus.h                 |  4 ++--
  include/linux/acpi.h                    |  4 ++--
  sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
  sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
  sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
  sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
  sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
  sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
  11 files changed, 66 insertions(+), 45 deletions(-)
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#19 lore raw
Quoted 23 lines · Andy Shevchenko
Quoted 17 lines · Pierre-Louis Bossart
Quoted 10 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Quoted 5 lines
Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Quoted 3 lines

Patches 4..9 for the Intel machine drivers:

Quoted 7 lines

Thank you!

Quoted 3 lines

Is this going to be merged through the ACPI or ASoC tree? The changes will conflict with cleanups I started to use the 'modern' dailinks (codec_name -> codecs[0].name), so some level of coordination is needed.

I suppose via ACPI.

I can expose a non-volatile branch with this material, would that work?

maintainer
#20 lore raw
Quoted 9 lines · Rafael J. Wysocki

On Thu, Mar 28, 2019 at 10:40 PM Andy Shevchenko

Quoted 5 lines
Quoted 3 lines

Is this going to be merged through the ACPI or ASoC tree? The changes will conflict with cleanups I started to use the 'modern' dailinks (codec_name -> codecs[0].name), so some level of coordination is needed.

I suppose via ACPI.

I can expose a non-volatile branch with this material, would that work?

That would be very helpful, please - there's a lot of work going on with the ASoC Intel drivers in order to add SoF support so there's likely to be some kind of overlaps.

#21 lore raw
Quoted 12 lines · CEST Mark Brown

--cYtjc4pxslFTELvY
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Quoted 5 lines · Rafael J. Wysocki

On Thu, Mar 28, 2019 at 10:40 PM Andy Shevchenko

Quoted 3 lines
Quoted 3 lines

Is this going to be merged through the ACPI or ASoC tree? The changes will conflict with cleanups I started to use the 'modern' dailinks (codec_name -> codecs[0].name), so some level of coordination is needed.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I suppose via ACPI.

I can expose a non-volatile branch with this material, would that work?

That would be very helpful, please - there's a lot of work going on with the ASoC Intel drivers in order to add SoF support so there's likely to be some kind of overlaps.

The series is available for pulling in the git branch at

git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \
acpi-utils

on top of 5.1-rc3 with top-most commit 257f9053c0204ea47491aa236004fd1226f75fa8

ACPI / utils: Remove deprecated function since no user left

Thanks!

Reviewed-by on the v3 series
#22 lore raw
In reply to Andy Shevchenko

Hi,

Quoted 25 lines · Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use

Quoted 8 lines

acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

The entire series looks good to me:

For the entire series.

Regards,

Hans

Quoted 14 lines
  drivers/acpi/utils.c                    | 16 ++++++++++------
  drivers/extcon/extcon-axp288.c          |  9 +++++----
  drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
  include/acpi/acpi_bus.h                 |  4 ++--
  include/linux/acpi.h                    |  4 ++--
  sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
  sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
  sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
  sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
  sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
  sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
  11 files changed, 66 insertions(+), 45 deletions(-)
#24 lore raw
In reply to Andy Shevchenko
Quoted 34 lines · CEST Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

Quoted 14 lines
 drivers/acpi/utils.c                    | 16 ++++++++++------
 drivers/extcon/extcon-axp288.c          |  9 +++++----
 drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
 include/acpi/acpi_bus.h                 |  4 ++--
 include/linux/acpi.h                    |  4 ++--
 sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
 sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
 sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
 sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
 sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
 sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
 11 files changed, 66 insertions(+), 45 deletions(-)

All applied (with the tags selected so far), thanks!

#25 lore raw
Quoted 51 lines · Rafael J. Wysocki
Quoted 34 lines · CEST Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Cc MyungJoo Ham <[email protected]>
Cc Chanwoo Choi <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

Andy Shevchenko (10):
ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper
extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_da7213: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcht_es8316: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5640: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: bytcr_rt5651: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5645: Convert to use
acpi_dev_get_first_match_dev()
ASoC: Intel: cht_bsw_rt5672: Convert to use
acpi_dev_get_first_match_dev()
ACPI / utils: Remove deprecated function since no user left

Quoted 14 lines
 drivers/acpi/utils.c                    | 16 ++++++++++------
 drivers/extcon/extcon-axp288.c          |  9 +++++----
 drivers/gpio/gpio-merrifield.c          | 18 ++++++++++++++----
 include/acpi/acpi_bus.h                 |  4 ++--
 include/linux/acpi.h                    |  4 ++--
 sound/soc/intel/boards/bytcht_da7213.c  |  9 +++++----
 sound/soc/intel/boards/bytcht_es8316.c  |  9 +++++----
 sound/soc/intel/boards/bytcr_rt5640.c   | 10 +++++-----
 sound/soc/intel/boards/bytcr_rt5651.c   | 14 ++++++++------
 sound/soc/intel/boards/cht_bsw_rt5645.c |  9 +++++----
 sound/soc/intel/boards/cht_bsw_rt5672.c |  9 +++++----
 11 files changed, 66 insertions(+), 45 deletions(-)
Quoted 1 line

All applied (with the tags selected so far), thanks!

s/selected/collected/

Strange ...

#26 lore raw
Quoted 13 lines · Rafael J. Wysocki
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · CEST Andy Shevchenko

The acpi_dev_get_first_match_name() is missing put_device() call and thus keeping reference counting unbalanced.

In order to fix the issue introduce a new helper to convert existing users one-by-one to a better API.

Since v3:
- convert all existing users and drop old API (Mika)
- add Hans' tag

Quoted 5 lines
Quoted 1 line

All applied (with the tags selected so far), thanks!

s/selected/collected/

Strange ...

Thank you, Rafael!

Signature · 2 lines
With Best Regards,
Andy Shevchenko