From: Mark Rutland <mark.rutland@arm.com>
To: Rob Herring <robh@kernel.org>
Cc: Khuong Dinh <khuong@os.amperecomputing.com>,
Will Deacon <will@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/perf: xgene: Use device_get_match_data()
Date: Fri, 13 Oct 2023 14:28:33 +0100 [thread overview]
Message-ID: <ZSlGASa6sn57b6Me@FVFF77S0Q05N.cambridge.arm.com> (raw)
In-Reply-To: <20231009172923.2457844-14-robh@kernel.org>
On Mon, Oct 09, 2023 at 12:29:09PM -0500, Rob Herring wrote:
> Use preferred device_get_match_data() instead of of_match_device() and
> acpi_match_device() to get the driver match data. With this, adjust the
> includes to explicitly include the correct headers.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
I assume that Will can pick this up.
Mark.
> ---
> drivers/perf/xgene_pmu.c | 37 +++++++++++++------------------------
> 1 file changed, 13 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c
> index 9972bfc11a5c..7ce344248dda 100644
> --- a/drivers/perf/xgene_pmu.c
> +++ b/drivers/perf/xgene_pmu.c
> @@ -16,11 +16,9 @@
> #include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> -#include <linux/of_fdt.h>
> -#include <linux/of_irq.h>
> -#include <linux/of_platform.h>
> #include <linux/perf_event.h>
> #include <linux/platform_device.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/slab.h>
>
> @@ -1731,6 +1729,12 @@ static const struct xgene_pmu_data xgene_pmu_v2_data = {
> .id = PCP_PMU_V2,
> };
>
> +#ifdef CONFIG_ACPI
> +static const struct xgene_pmu_data xgene_pmu_v3_data = {
> + .id = PCP_PMU_V3,
> +};
> +#endif
> +
> static const struct xgene_pmu_ops xgene_pmu_ops = {
> .mask_int = xgene_pmu_mask_int,
> .unmask_int = xgene_pmu_unmask_int,
> @@ -1773,9 +1777,9 @@ static const struct of_device_id xgene_pmu_of_match[] = {
> MODULE_DEVICE_TABLE(of, xgene_pmu_of_match);
> #ifdef CONFIG_ACPI
> static const struct acpi_device_id xgene_pmu_acpi_match[] = {
> - {"APMC0D5B", PCP_PMU_V1},
> - {"APMC0D5C", PCP_PMU_V2},
> - {"APMC0D83", PCP_PMU_V3},
> + {"APMC0D5B", (kernel_ulong_t)&xgene_pmu_data},
> + {"APMC0D5C", (kernel_ulong_t)&xgene_pmu_v2_data},
> + {"APMC0D83", (kernel_ulong_t)&xgene_pmu_v3_data},
> {},
> };
> MODULE_DEVICE_TABLE(acpi, xgene_pmu_acpi_match);
> @@ -1831,7 +1835,6 @@ static int xgene_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
> static int xgene_pmu_probe(struct platform_device *pdev)
> {
> const struct xgene_pmu_data *dev_data;
> - const struct of_device_id *of_id;
> struct xgene_pmu *xgene_pmu;
> int irq, rc;
> int version;
> @@ -1850,24 +1853,10 @@ static int xgene_pmu_probe(struct platform_device *pdev)
> xgene_pmu->dev = &pdev->dev;
> platform_set_drvdata(pdev, xgene_pmu);
>
> - version = -EINVAL;
> - of_id = of_match_device(xgene_pmu_of_match, &pdev->dev);
> - if (of_id) {
> - dev_data = (const struct xgene_pmu_data *) of_id->data;
> - version = dev_data->id;
> - }
> -
> -#ifdef CONFIG_ACPI
> - if (ACPI_COMPANION(&pdev->dev)) {
> - const struct acpi_device_id *acpi_id;
> -
> - acpi_id = acpi_match_device(xgene_pmu_acpi_match, &pdev->dev);
> - if (acpi_id)
> - version = (int) acpi_id->driver_data;
> - }
> -#endif
> - if (version < 0)
> + dev_data = device_get_match_data(&pdev->dev);
> + if (!dev_data)
> return -ENODEV;
> + version = dev_data->id;
>
> if (version == PCP_PMU_V3)
> xgene_pmu->ops = &xgene_pmu_v3_ops;
> --
> 2.42.0
>
next prev parent reply other threads:[~2023-10-13 13:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 17:29 Rob Herring
2023-10-13 13:28 ` Mark Rutland [this message]
2023-10-17 13:11 ` Will Deacon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZSlGASa6sn57b6Me@FVFF77S0Q05N.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=khuong@os.amperecomputing.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®