* [PATCH v2 1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device()
@ 2024-04-04 16:59 Andy Shevchenko
2024-04-09 16:59 ` Will Deacon
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2024-04-04 16:59 UTC (permalink / raw)
To: Andy Shevchenko, linux-arm-kernel, linux-kernel; +Cc: Will Deacon, Mark Rutland
Replace open coded acpi_match_acpi_device() in get_tx2_pmu_type().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2:
switched to acpi_match_acpi_device() which is newer API suitable for this case
drivers/perf/thunderx2_pmu.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index e16d10c763de..f03aa85072ec 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -504,24 +504,19 @@ static void tx2_uncore_event_update(struct perf_event *event)
static enum tx2_uncore_type get_tx2_pmu_type(struct acpi_device *adev)
{
- int i = 0;
- struct acpi_tx2_pmu_device {
- __u8 id[ACPI_ID_LEN];
- enum tx2_uncore_type type;
- } devices[] = {
+ struct acpi_device_id devices[] = {
{"CAV901D", PMU_TYPE_L3C},
{"CAV901F", PMU_TYPE_DMC},
{"CAV901E", PMU_TYPE_CCPI2},
- {"", PMU_TYPE_INVALID}
+ {}
};
+ const struct acpi_device_id *id;
- while (devices[i].type != PMU_TYPE_INVALID) {
- if (!strcmp(acpi_device_hid(adev), devices[i].id))
- break;
- i++;
- }
+ id = acpi_match_acpi_device(devices, adev);
+ if (!id)
+ return PMU_TYPE_INVALID;
- return devices[i].type;
+ return (enum tx2_uncore_type)id->driver_data;
}
static bool tx2_uncore_validate_event(struct pmu *pmu,
--
2.43.0.rc1.1.gbec44491f096
_______________________________________________
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] 2+ messages in thread* Re: [PATCH v2 1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device()
2024-04-04 16:59 [PATCH v2 1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device() Andy Shevchenko
@ 2024-04-09 16:59 ` Will Deacon
0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2024-04-09 16:59 UTC (permalink / raw)
To: linux-arm-kernel, linux-kernel, Andy Shevchenko
Cc: catalin.marinas, kernel-team, Will Deacon, Mark Rutland
On Thu, 04 Apr 2024 19:59:23 +0300, Andy Shevchenko wrote:
> Replace open coded acpi_match_acpi_device() in get_tx2_pmu_type().
>
>
Applied to will (for-next/perf), thanks!
[1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device()
https://git.kernel.org/will/c/105350fe0786
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2024-04-09 16:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-04 16:59 [PATCH v2 1/1] drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device() Andy Shevchenko
2024-04-09 16:59 ` Will Deacon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox