drivers/perf: arm_pmu: define armpmu_init_fn
authorMark Rutland <mark.rutland@arm.com>
Tue, 11 Apr 2017 08:39:45 +0000 (09:39 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 11 Apr 2017 15:29:53 +0000 (16:29 +0100)
We expect an ARM PMU's init function to have a particular prototype,
which we open-code in a few places. This is less than ideal, considering
that we cast a void value to this type in one location, and a mismatch
could easily be missed.

Add a typedef so that we can ensure this is consistent.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Jeremy Linton <jeremy.linton@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
drivers/perf/arm_pmu.c
include/linux/perf/arm_pmu.h

index 316c4dcc9856c603f50227c7c1c9a286ea3facd2..71a825df47ed74d32e69f94e7b9ad1e44b3edd1d 100644 (file)
@@ -989,7 +989,7 @@ int arm_pmu_device_probe(struct platform_device *pdev,
                         const struct pmu_probe_info *probe_table)
 {
        const struct of_device_id *of_id;
-       const int (*init_fn)(struct arm_pmu *);
+       armpmu_init_fn init_fn;
        struct device_node *node = pdev->dev.of_node;
        struct arm_pmu *pmu;
        int ret = -ENODEV;
index 44f43fcf25242e5f6a91ec863a59f3ed5e21e69c..4249914315a4df9757906440e239d7c0d6a52a2e 100644 (file)
@@ -132,10 +132,12 @@ int armpmu_map_event(struct perf_event *event,
                                                [PERF_COUNT_HW_CACHE_RESULT_MAX],
                     u32 raw_event_mask);
 
+typedef int (*armpmu_init_fn)(struct arm_pmu *);
+
 struct pmu_probe_info {
        unsigned int cpuid;
        unsigned int mask;
-       int (*init)(struct arm_pmu *);
+       armpmu_init_fn init;
 };
 
 #define PMU_PROBE(_cpuid, _mask, _fn)  \