linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/8] ACPI: unify _UID handling as integer
@ 2022-09-07 16:45 Andy Shevchenko
  2022-09-07 16:45 ` [PATCH v1 1/8] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID " Andy Shevchenko
                   ` (8 more replies)
  0 siblings, 9 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:45 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

This series is about unification on how we handle ACPI _UID when
it's known to be an integer-in-the-string.

The idea of merging either all via ACPI tree, or (which I prefer)
taking ACPI stuff for v6.1 while the rest may be picked up later
on by respective maintainers separately.

Partially compile-tested (x86-64).

Andy Shevchenko (8):
  ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID as
    integer
  ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
  ACPI: x86: Refactor _UID handling to use acpi_dev_uid_to_integer()
  i2c: amd-mp2-plat: Refactor _UID handling to use
    acpi_dev_uid_to_integer()
  i2c: mlxbf: Refactor _UID handling to use acpi_dev_uid_to_integer()
  perf: qcom_l2_pmu: Refactor _UID handling to use
    acpi_dev_uid_to_integer()
  spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer()
  efi/dev-path-parser: Refactor _UID handling to use
    acpi_dev_uid_to_integer()

 drivers/acpi/acpi_lpss.c               | 15 ++++++------
 drivers/acpi/utils.c                   | 24 ++++++++++++++++++
 drivers/acpi/x86/utils.c               | 14 ++++++++---
 drivers/firmware/efi/dev-path-parser.c | 10 +++++---
 drivers/i2c/busses/i2c-amd-mp2-plat.c  | 27 +++++++-------------
 drivers/i2c/busses/i2c-mlxbf.c         | 19 +++++---------
 drivers/perf/qcom_l2_pmu.c             |  7 +++---
 drivers/spi/spi-pxa2xx.c               | 34 +++++++-------------------
 include/acpi/acpi_bus.h                |  1 +
 include/linux/acpi.h                   |  5 ++++
 10 files changed, 81 insertions(+), 75 deletions(-)

-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 1/8] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID as integer
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
@ 2022-09-07 16:45 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 2/8] ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer() Andy Shevchenko
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:45 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

Some users interpret _UID only as integer and for them it's easier to
have an integer representation of _UID. Add respective helper for that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/utils.c    | 24 ++++++++++++++++++++++++
 include/acpi/acpi_bus.h |  1 +
 include/linux/acpi.h    |  5 +++++
 3 files changed, 30 insertions(+)

diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 4acd6f7d1395..2ea14648a661 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -793,6 +793,30 @@ bool acpi_dev_hid_uid_match(struct acpi_device *adev,
 }
 EXPORT_SYMBOL(acpi_dev_hid_uid_match);
 
+/**
+ * acpi_dev_uid_to_integer - treat ACPI device _UID as integer
+ * @adev: ACPI device to get _UID from
+ * @integer: output buffer for integer
+ *
+ * Considers _UID as integer and converts it to @integer.
+ *
+ * Returns 0 on success, or negative error code otherwise.
+ */
+int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer)
+{
+	const char *uid;
+
+	if (!adev)
+		return -ENODEV;
+
+	uid = acpi_device_uid(adev);
+	if (!uid)
+		return -ENODATA;
+
+	return kstrtou64(uid, 0, integer);
+}
+EXPORT_SYMBOL(acpi_dev_uid_to_integer);
+
 /**
  * acpi_dev_found - Detect presence of a given ACPI device in the namespace.
  * @hid: Hardware ID of the device.
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 42f76f2c2d49..1804d7a70918 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -739,6 +739,7 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
 }
 
 bool acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *uid2);
+int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer);
 
 void acpi_dev_clear_dependencies(struct acpi_device *supplier);
 bool acpi_dev_ready_for_enumeration(const struct acpi_device *device);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ed4aa395cc49..619b2b1e4fb4 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -799,6 +799,11 @@ acpi_dev_hid_uid_match(struct acpi_device *adev, const char *hid2, const char *u
 	return false;
 }
 
+static inline int acpi_dev_uid_to_integer(struct acpi_device *adev, u64 *integer)
+{
+	return -ENODEV;
+}
+
 static inline struct acpi_device *
 acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
 {
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 2/8] ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
  2022-09-07 16:45 ` [PATCH v1 1/8] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 3/8] ACPI: x86: " Andy Shevchenko
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/acpi_lpss.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 4f6cba8fe8de..9dc7defcc425 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -167,10 +167,10 @@ static struct pwm_lookup byt_pwm_lookup[] = {
 
 static void byt_pwm_setup(struct lpss_private_data *pdata)
 {
-	struct acpi_device *adev = pdata->adev;
+	u64 uid;
 
 	/* Only call pwm_add_table for the first PWM controller */
-	if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
+	if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
 		return;
 
 	pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
@@ -180,14 +180,13 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)
 
 static void byt_i2c_setup(struct lpss_private_data *pdata)
 {
-	const char *uid_str = acpi_device_uid(pdata->adev);
 	acpi_handle handle = pdata->adev->handle;
 	unsigned long long shared_host = 0;
 	acpi_status status;
-	long uid = 0;
+	u64 uid;
 
-	/* Expected to always be true, but better safe then sorry */
-	if (uid_str && !kstrtol(uid_str, 10, &uid) && uid) {
+	/* Expected to always be successfull, but better safe then sorry */
+	if (!acpi_dev_uid_to_integer(pdata->adev, &uid) && uid) {
 		/* Detect I2C bus shared with PUNIT and ignore its d3 status */
 		status = acpi_evaluate_integer(handle, "_SEM", NULL, &shared_host);
 		if (ACPI_SUCCESS(status) && shared_host)
@@ -211,10 +210,10 @@ static struct pwm_lookup bsw_pwm_lookup[] = {
 
 static void bsw_pwm_setup(struct lpss_private_data *pdata)
 {
-	struct acpi_device *adev = pdata->adev;
+	u64 uid;
 
 	/* Only call pwm_add_table for the first PWM controller */
-	if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
+	if (acpi_dev_uid_to_integer(pdata->adev, &uid) || uid != 1)
 		return;
 
 	pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 3/8] ACPI: x86: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
  2022-09-07 16:45 ` [PATCH v1 1/8] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID " Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 2/8] ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer() Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 4/8] i2c: amd-mp2-plat: " Andy Shevchenko
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/x86/utils.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
index 664070fc8349..2764b4778ce7 100644
--- a/drivers/acpi/x86/utils.c
+++ b/drivers/acpi/x86/utils.c
@@ -351,11 +351,17 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 	struct acpi_device *adev = ACPI_COMPANION(controller_parent);
 	const struct dmi_system_id *dmi_id;
 	long quirks = 0;
+	u64 uid;
+	int ret;
 
 	*skip = false;
 
-	/* !dev_is_platform() to not match on PNP enumerated debug UARTs */
-	if (!adev || !adev->pnp.unique_id || !dev_is_platform(controller_parent))
+	ret = acpi_dev_uid_to_integer(adev, &uid);
+	if (ret)
+		return 0;
+
+	/* to not match on PNP enumerated debug UARTs */
+	if (!dev_is_platform(controller_parent))
 		return 0;
 
 	dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids);
@@ -363,10 +369,10 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 		quirks = (unsigned long)dmi_id->driver_data;
 
 	if (quirks & ACPI_QUIRK_UART1_TTY_UART2_SKIP) {
-		if (!strcmp(adev->pnp.unique_id, "1"))
+		if (uid == 1)
 			return -ENODEV; /* Create tty cdev instead of serdev */
 
-		if (!strcmp(adev->pnp.unique_id, "2"))
+		if (uid == 2)
 			*skip = true;
 	}
 
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 4/8] i2c: amd-mp2-plat: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (2 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 3/8] ACPI: x86: " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 5/8] i2c: mlxbf: " Andy Shevchenko
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-amd-mp2-plat.c | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/i2c/busses/i2c-amd-mp2-plat.c b/drivers/i2c/busses/i2c-amd-mp2-plat.c
index 84b7e6cbc67b..423fe0c8a471 100644
--- a/drivers/i2c/busses/i2c-amd-mp2-plat.c
+++ b/drivers/i2c/busses/i2c-amd-mp2-plat.c
@@ -244,14 +244,18 @@ static const struct i2c_adapter_quirks amd_i2c_dev_quirks = {
 
 static int i2c_amd_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	int ret;
 	struct amd_i2c_dev *i2c_dev;
-	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
 	struct amd_mp2_dev *mp2_dev;
-	const char *uid;
+	u64 uid;
 
-	if (!adev)
-		return -ENODEV;
+	ret = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid);
+	if (ret)
+		return dev_err_probe(dev, ret, "missing UID/bus id!\n");
+	if (uid >= 2)
+		return dev_err_probe(dev, -EINVAL, "incorrect UID/bus id \"%llu\"!\n", uid);
+	dev_dbg(dev, "bus id is %llu\n", uid);
 
 	/* The ACPI namespace doesn't contain information about which MP2 PCI
 	 * device an AMDI0011 ACPI device is related to, so assume that there's
@@ -266,6 +270,7 @@ static int i2c_amd_probe(struct platform_device *pdev)
 	if (!i2c_dev)
 		return -ENOMEM;
 
+	i2c_dev->common.bus_id = uid;
 	i2c_dev->common.mp2_dev = mp2_dev;
 	i2c_dev->pdev = pdev;
 	platform_set_drvdata(pdev, i2c_dev);
@@ -276,20 +281,6 @@ static int i2c_amd_probe(struct platform_device *pdev)
 	i2c_dev->common.resume = &i2c_amd_resume;
 #endif
 
-	uid = adev->pnp.unique_id;
-	if (!uid) {
-		dev_err(&pdev->dev, "missing UID/bus id!\n");
-		return -EINVAL;
-	} else if (strcmp(uid, "0") == 0) {
-		i2c_dev->common.bus_id = 0;
-	} else if (strcmp(uid, "1") == 0) {
-		i2c_dev->common.bus_id = 1;
-	} else {
-		dev_err(&pdev->dev, "incorrect UID/bus id \"%s\"!\n", uid);
-		return -EINVAL;
-	}
-	dev_dbg(&pdev->dev, "bus id is %u\n", i2c_dev->common.bus_id);
-
 	/* Register the adapter */
 	amd_mp2_pm_runtime_get(mp2_dev);
 
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 5/8] i2c: mlxbf: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (3 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 4/8] i2c: amd-mp2-plat: " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 6/8] perf: qcom_l2_pmu: " Andy Shevchenko
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index 8716032f030a..4fd4b3799596 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -2230,34 +2230,27 @@ static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
 {
 	const struct acpi_device_id *aid;
 	struct acpi_device *adev;
-	unsigned long bus_id = 0;
-	const char *uid;
+	u64 bus_id;
 	int ret;
 
 	if (acpi_disabled)
 		return -ENOENT;
 
-	adev = ACPI_COMPANION(dev);
-	if (!adev)
-		return -ENXIO;
-
 	aid = acpi_match_device(mlxbf_i2c_acpi_ids, dev);
 	if (!aid)
 		return -ENODEV;
 
 	priv->chip = (struct mlxbf_i2c_chip_info *)aid->driver_data;
 
-	uid = acpi_device_uid(adev);
-	if (!uid || !(*uid)) {
+	ret = acpi_dev_uid_to_integer(adev, &bus_id);
+	if (ret) {
 		dev_err(dev, "Cannot retrieve UID\n");
-		return -ENODEV;
+		return ret;
 	}
 
-	ret = kstrtoul(uid, 0, &bus_id);
-	if (!ret)
-		priv->bus = bus_id;
+	priv->bus = bus_id;
 
-	return ret;
+	return 0;
 }
 #else
 static int mlxbf_i2c_acpi_probe(struct device *dev, struct mlxbf_i2c_priv *priv)
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 6/8] perf: qcom_l2_pmu: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (4 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 5/8] i2c: mlxbf: " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 16:46 ` [PATCH v1 7/8] spi: pxa2xx: " Andy Shevchenko
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/perf/qcom_l2_pmu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/qcom_l2_pmu.c b/drivers/perf/qcom_l2_pmu.c
index 30234c261b05..aa68e230e020 100644
--- a/drivers/perf/qcom_l2_pmu.c
+++ b/drivers/perf/qcom_l2_pmu.c
@@ -843,13 +843,14 @@ static int l2_cache_pmu_probe_cluster(struct device *dev, void *data)
 	struct acpi_device *adev = ACPI_COMPANION(dev);
 	struct l2cache_pmu *l2cache_pmu = data;
 	struct cluster_pmu *cluster;
-	unsigned long fw_cluster_id;
+	u64 fw_cluster_id;
 	int err;
 	int irq;
 
-	if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) {
+	err = acpi_dev_uid_to_integer(adev, &fw_cluster_id);
+	if (err) {
 		dev_err(&pdev->dev, "unable to read ACPI uid\n");
-		return -ENODEV;
+		return err;
 	}
 
 	cluster = devm_kzalloc(&pdev->dev, sizeof(*cluster), GFP_KERNEL);
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 7/8] spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (5 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 6/8] perf: qcom_l2_pmu: " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-07 17:06   ` Mark Brown
  2022-09-07 16:46 ` [PATCH v1 8/8] efi/dev-path-parser: " Andy Shevchenko
  2022-09-08  9:28 ` [PATCH v1 0/8] ACPI: unify _UID handling as integer Hans de Goede
  8 siblings, 1 reply; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-pxa2xx.c | 34 +++++++++-------------------------
 1 file changed, 9 insertions(+), 25 deletions(-)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 4749dd598ec2..01a513d6c6b0 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1321,30 +1321,6 @@ static void cleanup(struct spi_device *spi)
 	kfree(chip);
 }
 
-#ifdef CONFIG_ACPI
-
-static int pxa2xx_spi_get_port_id(struct device *dev)
-{
-	struct acpi_device *adev;
-	unsigned int devid;
-	int port_id = -1;
-
-	adev = ACPI_COMPANION(dev);
-	if (adev && adev->pnp.unique_id &&
-	    !kstrtouint(adev->pnp.unique_id, 0, &devid))
-		port_id = devid;
-	return port_id;
-}
-
-#else /* !CONFIG_ACPI */
-
-static int pxa2xx_spi_get_port_id(struct device *dev)
-{
-	return -1;
-}
-
-#endif /* CONFIG_ACPI */
-
 static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param)
 {
 	return param == chan->device->dev;
@@ -1354,12 +1330,15 @@ static struct pxa2xx_spi_controller *
 pxa2xx_spi_init_pdata(struct platform_device *pdev)
 {
 	struct pxa2xx_spi_controller *pdata;
+	struct device *dev = &pdev->dev;
 	struct ssp_device *ssp;
 	struct resource *res;
 	struct device *parent = pdev->dev.parent;
 	u32 value = SSP_UNDEFINED;
 	enum pxa_ssp_type type;
 	const void *match;
+	int status;
+	u64 uid;
 
 	/* Always try to read property */
 	device_property_read_u32(&pdev->dev, "intel,spi-pxa2xx-type", &value);
@@ -1402,7 +1381,12 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
 
 	ssp->type = type;
 	ssp->dev = &pdev->dev;
-	ssp->port_id = pxa2xx_spi_get_port_id(&pdev->dev);
+
+	status = acpi_dev_uid_to_integer(ACPI_COMPANION(dev), &uid);
+	if (status)
+		ssp->port_id = -1;
+	else
+		ssp->port_id = uid;
 
 	pdata->is_slave = device_property_read_bool(&pdev->dev, "spi-slave");
 	pdata->num_chipselect = 1;
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (6 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 7/8] spi: pxa2xx: " Andy Shevchenko
@ 2022-09-07 16:46 ` Andy Shevchenko
  2022-09-08  8:20   ` Ard Biesheuvel
  2022-09-08  9:29   ` Hans de Goede
  2022-09-08  9:28 ` [PATCH v1 0/8] ACPI: unify _UID handling as integer Hans de Goede
  8 siblings, 2 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-07 16:46 UTC (permalink / raw)
  To: Rafael J. Wysocki, Andy Shevchenko, Wolfram Sang, Hans de Goede,
	linux-acpi, linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
an integer. Use it instead of custom approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/firmware/efi/dev-path-parser.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c
index eb9c65f97841..113b3ca1bd76 100644
--- a/drivers/firmware/efi/dev-path-parser.c
+++ b/drivers/firmware/efi/dev-path-parser.c
@@ -15,9 +15,11 @@
 static long __init parse_acpi_path(const struct efi_dev_path *node,
 				   struct device *parent, struct device **child)
 {
-	char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
 	struct acpi_device *adev;
 	struct device *phys_dev;
+	char hid[ACPI_ID_LEN];
+	long ret;
+	u64 uid;
 
 	if (node->header.length != 12)
 		return -EINVAL;
@@ -27,12 +29,12 @@ static long __init parse_acpi_path(const struct efi_dev_path *node,
 		'A' + ((node->acpi.hid >>  5) & 0x1f) - 1,
 		'A' + ((node->acpi.hid >>  0) & 0x1f) - 1,
 			node->acpi.hid >> 16);
-	sprintf(uid, "%u", node->acpi.uid);
 
 	for_each_acpi_dev_match(adev, hid, NULL, -1) {
-		if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
+		ret = acpi_dev_uid_to_integer(adev, &uid);
+		if (ret == -ENODATA && node->acpi.uid == 0)
 			break;
-		if (!adev->pnp.unique_id && node->acpi.uid == 0)
+		if (ret == 0 && node->acpi.uid == uid)
 			break;
 	}
 	if (!adev)
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 7/8] spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:46 ` [PATCH v1 7/8] spi: pxa2xx: " Andy Shevchenko
@ 2022-09-07 17:06   ` Mark Brown
  0 siblings, 0 replies; 16+ messages in thread
From: Mark Brown @ 2022-09-07 17:06 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, Wolfram Sang, Hans de Goede, linux-acpi,
	linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel, Rafael J. Wysocki, Len Brown,
	Ard Biesheuvel, Elie Morisse, Nehal Shah, Shyam Sundar S K,
	Khalil Blaiech, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Will Deacon, Mark Rutland, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, Robert Moore, Wolfram Sang


[-- Attachment #1.1: Type: text/plain, Size: 230 bytes --]

On Wed, Sep 07, 2022 at 07:46:05PM +0300, Andy Shevchenko wrote:
> ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
> an integer. Use it instead of custom approach.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:46 ` [PATCH v1 8/8] efi/dev-path-parser: " Andy Shevchenko
@ 2022-09-08  8:20   ` Ard Biesheuvel
  2022-09-08 10:06     ` Andy Shevchenko
  2022-09-08  9:29   ` Hans de Goede
  1 sibling, 1 reply; 16+ messages in thread
From: Ard Biesheuvel @ 2022-09-08  8:20 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, Wolfram Sang, Hans de Goede, linux-acpi,
	linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel, Rafael J. Wysocki, Len Brown,
	Elie Morisse, Nehal Shah, Shyam Sundar S K, Khalil Blaiech,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Will Deacon,
	Mark Rutland, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Mark Brown, Robert Moore, Wolfram Sang

On Wed, 7 Sept 2022 at 18:57, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
> an integer. Use it instead of custom approach.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/firmware/efi/dev-path-parser.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c
> index eb9c65f97841..113b3ca1bd76 100644
> --- a/drivers/firmware/efi/dev-path-parser.c
> +++ b/drivers/firmware/efi/dev-path-parser.c
> @@ -15,9 +15,11 @@
>  static long __init parse_acpi_path(const struct efi_dev_path *node,
>                                    struct device *parent, struct device **child)
>  {
> -       char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
>         struct acpi_device *adev;
>         struct device *phys_dev;
> +       char hid[ACPI_ID_LEN];
> +       long ret;
> +       u64 uid;
>
>         if (node->header.length != 12)
>                 return -EINVAL;
> @@ -27,12 +29,12 @@ static long __init parse_acpi_path(const struct efi_dev_path *node,
>                 'A' + ((node->acpi.hid >>  5) & 0x1f) - 1,
>                 'A' + ((node->acpi.hid >>  0) & 0x1f) - 1,
>                         node->acpi.hid >> 16);
> -       sprintf(uid, "%u", node->acpi.uid);
>
>         for_each_acpi_dev_match(adev, hid, NULL, -1) {
> -               if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
> +               ret = acpi_dev_uid_to_integer(adev, &uid);
> +               if (ret == -ENODATA && node->acpi.uid == 0)
>                         break;
> -               if (!adev->pnp.unique_id && node->acpi.uid == 0)
> +               if (ret == 0 && node->acpi.uid == uid)

Is it necessary to reorder the conditions here? I.e., why not

> +               ret = acpi_dev_uid_to_integer(adev, &uid);
> +               if (ret == 0 && node->acpi.uid == uid)
>                         break;
> +               if (ret == -ENODATA && node->acpi.uid == 0)
>                         break;

?

With that fixed,

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 0/8] ACPI: unify _UID handling as integer
  2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
                   ` (7 preceding siblings ...)
  2022-09-07 16:46 ` [PATCH v1 8/8] efi/dev-path-parser: " Andy Shevchenko
@ 2022-09-08  9:28 ` Hans de Goede
  2022-09-08 10:06   ` Andy Shevchenko
  8 siblings, 1 reply; 16+ messages in thread
From: Hans de Goede @ 2022-09-08  9:28 UTC (permalink / raw)
  To: Andy Shevchenko, Rafael J. Wysocki, Wolfram Sang, linux-acpi,
	linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

Hi,

On 9/7/22 18:45, Andy Shevchenko wrote:
> This series is about unification on how we handle ACPI _UID when
> it's known to be an integer-in-the-string.
> 
> The idea of merging either all via ACPI tree, or (which I prefer)
> taking ACPI stuff for v6.1 while the rest may be picked up later
> on by respective maintainers separately.
> 
> Partially compile-tested (x86-64).
> 
> Andy Shevchenko (8):
>   ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID as
>     integer
>   ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
>   ACPI: x86: Refactor _UID handling to use acpi_dev_uid_to_integer()
>   i2c: amd-mp2-plat: Refactor _UID handling to use
>     acpi_dev_uid_to_integer()
>   i2c: mlxbf: Refactor _UID handling to use acpi_dev_uid_to_integer()
>   perf: qcom_l2_pmu: Refactor _UID handling to use
>     acpi_dev_uid_to_integer()
>   spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer()
>   efi/dev-path-parser: Refactor _UID handling to use
>     acpi_dev_uid_to_integer()
> 
>  drivers/acpi/acpi_lpss.c               | 15 ++++++------
>  drivers/acpi/utils.c                   | 24 ++++++++++++++++++
>  drivers/acpi/x86/utils.c               | 14 ++++++++---
>  drivers/firmware/efi/dev-path-parser.c | 10 +++++---
>  drivers/i2c/busses/i2c-amd-mp2-plat.c  | 27 +++++++-------------
>  drivers/i2c/busses/i2c-mlxbf.c         | 19 +++++---------
>  drivers/perf/qcom_l2_pmu.c             |  7 +++---
>  drivers/spi/spi-pxa2xx.c               | 34 +++++++-------------------
>  include/acpi/acpi_bus.h                |  1 +
>  include/linux/acpi.h                   |  5 ++++
>  10 files changed, 81 insertions(+), 75 deletions(-)
> 

Thanks, patches 1-7 look good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for patches 1-7.

I have one small remark for patch 8, which I will send in
a reply to patch 8.

Regards,

Hans


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-07 16:46 ` [PATCH v1 8/8] efi/dev-path-parser: " Andy Shevchenko
  2022-09-08  8:20   ` Ard Biesheuvel
@ 2022-09-08  9:29   ` Hans de Goede
  2022-09-08 10:04     ` Andy Shevchenko
  1 sibling, 1 reply; 16+ messages in thread
From: Hans de Goede @ 2022-09-08  9:29 UTC (permalink / raw)
  To: Andy Shevchenko, Rafael J. Wysocki, Wolfram Sang, linux-acpi,
	linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel
  Cc: Rafael J. Wysocki, Len Brown, Ard Biesheuvel, Elie Morisse,
	Nehal Shah, Shyam Sundar S K, Khalil Blaiech, Andy Gross,
	Bjorn Andersson, Konrad Dybcio, Will Deacon, Mark Rutland,
	Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	Robert Moore, Wolfram Sang

Hi,

On 9/7/22 18:46, Andy Shevchenko wrote:
> ACPI utils provide acpi_dev_uid_to_integer() helper to extract _UID as
> an integer. Use it instead of custom approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/firmware/efi/dev-path-parser.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/firmware/efi/dev-path-parser.c b/drivers/firmware/efi/dev-path-parser.c
> index eb9c65f97841..113b3ca1bd76 100644
> --- a/drivers/firmware/efi/dev-path-parser.c
> +++ b/drivers/firmware/efi/dev-path-parser.c
> @@ -15,9 +15,11 @@
>  static long __init parse_acpi_path(const struct efi_dev_path *node,
>  				   struct device *parent, struct device **child)
>  {
> -	char hid[ACPI_ID_LEN], uid[11]; /* UINT_MAX + null byte */
>  	struct acpi_device *adev;
>  	struct device *phys_dev;
> +	char hid[ACPI_ID_LEN];
> +	long ret;

"long ret" should be "int ret" here since that is what acpi_dev_uid_to_integer()
returns.

Regards,

Hans


> +	u64 uid;
>  
>  	if (node->header.length != 12)
>  		return -EINVAL;
> @@ -27,12 +29,12 @@ static long __init parse_acpi_path(const struct efi_dev_path *node,
>  		'A' + ((node->acpi.hid >>  5) & 0x1f) - 1,
>  		'A' + ((node->acpi.hid >>  0) & 0x1f) - 1,
>  			node->acpi.hid >> 16);
> -	sprintf(uid, "%u", node->acpi.uid);
>  
>  	for_each_acpi_dev_match(adev, hid, NULL, -1) {
> -		if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
> +		ret = acpi_dev_uid_to_integer(adev, &uid);
> +		if (ret == -ENODATA && node->acpi.uid == 0)
>  			break;
> -		if (!adev->pnp.unique_id && node->acpi.uid == 0)
> +		if (ret == 0 && node->acpi.uid == uid)
>  			break;
>  	}
>  	if (!adev)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-08  9:29   ` Hans de Goede
@ 2022-09-08 10:04     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-08 10:04 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Rafael J. Wysocki, Wolfram Sang, linux-acpi, linux-kernel,
	linux-efi, linux-i2c, linux-arm-msm, linux-arm-kernel, linux-spi,
	devel, Rafael J. Wysocki, Len Brown, Ard Biesheuvel,
	Elie Morisse, Nehal Shah, Shyam Sundar S K, Khalil Blaiech,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Will Deacon,
	Mark Rutland, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Mark Brown, Robert Moore, Wolfram Sang

On Thu, Sep 08, 2022 at 11:29:22AM +0200, Hans de Goede wrote:
> On 9/7/22 18:46, Andy Shevchenko wrote:

...

> > +	long ret;
> 
> "long ret" should be "int ret" here since that is what acpi_dev_uid_to_integer()
> returns.

I put it long since the efi_get_device_by_path() uses long ret (for the sake of
consistency with the existing code), but I have no objections to move it to
int.

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 8/8] efi/dev-path-parser: Refactor _UID handling to use acpi_dev_uid_to_integer()
  2022-09-08  8:20   ` Ard Biesheuvel
@ 2022-09-08 10:06     ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-08 10:06 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Rafael J. Wysocki, Wolfram Sang, Hans de Goede, linux-acpi,
	linux-kernel, linux-efi, linux-i2c, linux-arm-msm,
	linux-arm-kernel, linux-spi, devel, Rafael J. Wysocki, Len Brown,
	Elie Morisse, Nehal Shah, Shyam Sundar S K, Khalil Blaiech,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Will Deacon,
	Mark Rutland, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Mark Brown, Robert Moore, Wolfram Sang

On Thu, Sep 08, 2022 at 10:20:47AM +0200, Ard Biesheuvel wrote:
> On Wed, 7 Sept 2022 at 18:57, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

...

> >         for_each_acpi_dev_match(adev, hid, NULL, -1) {
> > -               if (adev->pnp.unique_id && !strcmp(adev->pnp.unique_id, uid))
> > +               ret = acpi_dev_uid_to_integer(adev, &uid);
> > +               if (ret == -ENODATA && node->acpi.uid == 0)
> >                         break;
> > -               if (!adev->pnp.unique_id && node->acpi.uid == 0)
> > +               if (ret == 0 && node->acpi.uid == uid)
> 
> Is it necessary to reorder the conditions here? I.e., why not

Code-wise there should be not much difference which does not affect the flow,
I think I moved it to be closer to the pattern "let's handle errors first",
but in this case I'm fine with your proposal.

> > +               ret = acpi_dev_uid_to_integer(adev, &uid);
> > +               if (ret == 0 && node->acpi.uid == uid)
> >                         break;
> > +               if (ret == -ENODATA && node->acpi.uid == 0)
> >                         break;
> 
> ?
> 
> With that fixed,
> 
> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

Thanks!

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v1 0/8] ACPI: unify _UID handling as integer
  2022-09-08  9:28 ` [PATCH v1 0/8] ACPI: unify _UID handling as integer Hans de Goede
@ 2022-09-08 10:06   ` Andy Shevchenko
  0 siblings, 0 replies; 16+ messages in thread
From: Andy Shevchenko @ 2022-09-08 10:06 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Rafael J. Wysocki, Wolfram Sang, linux-acpi, linux-kernel,
	linux-efi, linux-i2c, linux-arm-msm, linux-arm-kernel, linux-spi,
	devel, Rafael J. Wysocki, Len Brown, Ard Biesheuvel,
	Elie Morisse, Nehal Shah, Shyam Sundar S K, Khalil Blaiech,
	Andy Gross, Bjorn Andersson, Konrad Dybcio, Will Deacon,
	Mark Rutland, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Mark Brown, Robert Moore, Wolfram Sang

On Thu, Sep 08, 2022 at 11:28:48AM +0200, Hans de Goede wrote:
> On 9/7/22 18:45, Andy Shevchenko wrote:
> > This series is about unification on how we handle ACPI _UID when
> > it's known to be an integer-in-the-string.
> > 
> > The idea of merging either all via ACPI tree, or (which I prefer)
> > taking ACPI stuff for v6.1 while the rest may be picked up later
> > on by respective maintainers separately.
> > 
> > Partially compile-tested (x86-64).
> > 
> > Andy Shevchenko (8):
> >   ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID as
> >     integer
> >   ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer()
> >   ACPI: x86: Refactor _UID handling to use acpi_dev_uid_to_integer()
> >   i2c: amd-mp2-plat: Refactor _UID handling to use
> >     acpi_dev_uid_to_integer()
> >   i2c: mlxbf: Refactor _UID handling to use acpi_dev_uid_to_integer()
> >   perf: qcom_l2_pmu: Refactor _UID handling to use
> >     acpi_dev_uid_to_integer()
> >   spi: pxa2xx: Refactor _UID handling to use acpi_dev_uid_to_integer()
> >   efi/dev-path-parser: Refactor _UID handling to use
> >     acpi_dev_uid_to_integer()
> > 
> >  drivers/acpi/acpi_lpss.c               | 15 ++++++------
> >  drivers/acpi/utils.c                   | 24 ++++++++++++++++++
> >  drivers/acpi/x86/utils.c               | 14 ++++++++---
> >  drivers/firmware/efi/dev-path-parser.c | 10 +++++---
> >  drivers/i2c/busses/i2c-amd-mp2-plat.c  | 27 +++++++-------------
> >  drivers/i2c/busses/i2c-mlxbf.c         | 19 +++++---------
> >  drivers/perf/qcom_l2_pmu.c             |  7 +++---
> >  drivers/spi/spi-pxa2xx.c               | 34 +++++++-------------------
> >  include/acpi/acpi_bus.h                |  1 +
> >  include/linux/acpi.h                   |  5 ++++
> >  10 files changed, 81 insertions(+), 75 deletions(-)
> > 
> 
> Thanks, patches 1-7 look good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> for patches 1-7.
> 
> I have one small remark for patch 8, which I will send in
> a reply to patch 8.

Thanks for review!

-- 
With Best Regards,
Andy Shevchenko



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-09-08 10:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 16:45 [PATCH v1 0/8] ACPI: unify _UID handling as integer Andy Shevchenko
2022-09-07 16:45 ` [PATCH v1 1/8] ACPI: utils: Add acpi_dev_uid_to_integer() helper to get _UID " Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 2/8] ACPI: LPSS: Refactor _UID handling to use acpi_dev_uid_to_integer() Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 3/8] ACPI: x86: " Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 4/8] i2c: amd-mp2-plat: " Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 5/8] i2c: mlxbf: " Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 6/8] perf: qcom_l2_pmu: " Andy Shevchenko
2022-09-07 16:46 ` [PATCH v1 7/8] spi: pxa2xx: " Andy Shevchenko
2022-09-07 17:06   ` Mark Brown
2022-09-07 16:46 ` [PATCH v1 8/8] efi/dev-path-parser: " Andy Shevchenko
2022-09-08  8:20   ` Ard Biesheuvel
2022-09-08 10:06     ` Andy Shevchenko
2022-09-08  9:29   ` Hans de Goede
2022-09-08 10:04     ` Andy Shevchenko
2022-09-08  9:28 ` [PATCH v1 0/8] ACPI: unify _UID handling as integer Hans de Goede
2022-09-08 10:06   ` Andy Shevchenko

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).