From: Rafael J. Wysocki <[email protected]>
The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().
Modify l2_cache_pmu_probe_cluster() accordingly (no intentional
functional impact).
While at it, rename the ACPI device pointer to adev for more
clarity.
Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/perf/qcom_l2_pmu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Index: linux-pm/drivers/perf/qcom_l2_pmu.c
===================================================================
--- linux-pm.orig/drivers/perf/qcom_l2_pmu.c
+++ linux-pm/drivers/perf/qcom_l2_pmu.c
@@ -840,17 +840,14 @@ static int l2_cache_pmu_probe_cluster(st
{
struct platform_device *pdev = to_platform_device(dev->parent);
struct platform_device *sdev = to_platform_device(dev);
+ struct acpi_device *adev = ACPI_COMPANION(dev);
struct l2cache_pmu *l2cache_pmu = data;
struct cluster_pmu *cluster;
- struct acpi_device *device;
unsigned long fw_cluster_id;
int err;
int irq;
- if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
- return -ENODEV;
-
- if (kstrtoul(device->pnp.unique_id, 10, &fw_cluster_id) < 0) {
+ if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) {
dev_err(&pdev->dev, "unable to read ACPI uid\n");
return -ENODEV;
}
From: Rafael J. Wysocki <[email protected]>
The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().
Modify l2_cache_pmu_probe_cluster() accordingly (no intentional
functional impact).
While at it, rename the ACPI device pointer to adev for more
clarity.
Signed-off-by: Rafael J. Wysocki <[email protected]>
---
v1 -> v2:
* Resend with a different From and S-o-b address. No other changes.
---
drivers/perf/qcom_l2_pmu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
Index: linux-pm/drivers/perf/qcom_l2_pmu.c
===================================================================
--- linux-pm.orig/drivers/perf/qcom_l2_pmu.c
+++ linux-pm/drivers/perf/qcom_l2_pmu.c
@@ -840,17 +840,14 @@ static int l2_cache_pmu_probe_cluster(st
{
struct platform_device *pdev = to_platform_device(dev->parent);
struct platform_device *sdev = to_platform_device(dev);
+ struct acpi_device *adev = ACPI_COMPANION(dev);
struct l2cache_pmu *l2cache_pmu = data;
struct cluster_pmu *cluster;
- struct acpi_device *device;
unsigned long fw_cluster_id;
int err;
int irq;
- if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
- return -ENODEV;
-
- if (kstrtoul(device->pnp.unique_id, 10, &fw_cluster_id) < 0) {
+ if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) {
dev_err(&pdev->dev, "unable to read ACPI uid\n");
return -ENODEV;
}
On Wed, Oct 13, 2021 at 6:16 PM Rafael J. Wysocki <[email protected]> wrote:
>
> From: Rafael J. Wysocki <[email protected]>
>
> The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
> macro and the ACPI handle produced by the former comes from the
> ACPI device object produced by the latter, so it is way more
> straightforward to evaluate the latter directly instead of passing
> the handle produced by the former to acpi_bus_get_device().
>
> Modify l2_cache_pmu_probe_cluster() accordingly (no intentional
> functional impact).
>
> While at it, rename the ACPI device pointer to adev for more
> clarity.
>
> Signed-off-by: Rafael J. Wysocki <[email protected]>
If nobody nas any concerns regarding this patch, I will queue it up
for 5.16 in the ACPI tree, because it is requisite for further
changes.
Thanks!
> ---
>
> v1 -> v2:
> * Resend with a different From and S-o-b address. No other changes.
>
> ---
> drivers/perf/qcom_l2_pmu.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> Index: linux-pm/drivers/perf/qcom_l2_pmu.c
> ===================================================================
> --- linux-pm.orig/drivers/perf/qcom_l2_pmu.c
> +++ linux-pm/drivers/perf/qcom_l2_pmu.c
> @@ -840,17 +840,14 @@ static int l2_cache_pmu_probe_cluster(st
> {
> struct platform_device *pdev = to_platform_device(dev->parent);
> struct platform_device *sdev = to_platform_device(dev);
> + struct acpi_device *adev = ACPI_COMPANION(dev);
> struct l2cache_pmu *l2cache_pmu = data;
> struct cluster_pmu *cluster;
> - struct acpi_device *device;
> unsigned long fw_cluster_id;
> int err;
> int irq;
>
> - if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
> - return -ENODEV;
> -
> - if (kstrtoul(device->pnp.unique_id, 10, &fw_cluster_id) < 0) {
> + if (!adev || kstrtoul(adev->pnp.unique_id, 10, &fw_cluster_id) < 0) {
> dev_err(&pdev->dev, "unable to read ACPI uid\n");
> return -ENODEV;
> }
>
>
>