drivers/perf: thunderx2_pmu: Replace open coded acpi_match_acpi_device()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 4 Apr 2024 16:59:23 +0000 (19:59 +0300)
committerWill Deacon <will@kernel.org>
Tue, 9 Apr 2024 15:44:15 +0000 (16:44 +0100)
Replace open coded acpi_match_acpi_device() in get_tx2_pmu_type().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240404170016.2466898-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>
drivers/perf/thunderx2_pmu.c

index e16d10c763de193d5ef77949c8836d62c0358b44..f03aa85072ec339f1ba9f74849033b525556c8c2 100644 (file)
@@ -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,