Skip to content

Commit 5f8401c

Browse files
covanamKAGA-KOKO
authored andcommitted
drivers: perf: Switch to use hrtimer_setup()
hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely. Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism. Patch was created by using Coccinelle. Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Zack Rusin <[email protected]> Link: https://lore.kernel.org/all/471ea3b829d14a4b4c3c7814dbe1ed13b15d47b8.1738746904.git.namcao@linutronix.de
1 parent 563608c commit 5f8401c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

drivers/perf/arm-ccn.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,8 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
12731273
/* No overflow interrupt? Have to use a timer instead. */
12741274
if (!ccn->irq) {
12751275
dev_info(ccn->dev, "No access to interrupts, using timer.\n");
1276-
hrtimer_init(&ccn->dt.hrtimer, CLOCK_MONOTONIC,
1277-
HRTIMER_MODE_REL);
1278-
ccn->dt.hrtimer.function = arm_ccn_pmu_timer_handler;
1276+
hrtimer_setup(&ccn->dt.hrtimer, arm_ccn_pmu_timer_handler, CLOCK_MONOTONIC,
1277+
HRTIMER_MODE_REL);
12791278
}
12801279

12811280
/* Pick one CPU which we will use to collect data from CCN... */

drivers/perf/marvell_cn10k_ddr_pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,8 +1064,8 @@ static int cn10k_ddr_perf_probe(struct platform_device *pdev)
10641064
if (!name)
10651065
return -ENOMEM;
10661066

1067-
hrtimer_init(&ddr_pmu->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1068-
ddr_pmu->hrtimer.function = cn10k_ddr_pmu_timer_handler;
1067+
hrtimer_setup(&ddr_pmu->hrtimer, cn10k_ddr_pmu_timer_handler, CLOCK_MONOTONIC,
1068+
HRTIMER_MODE_REL);
10691069

10701070
cpuhp_state_add_instance_nocalls(
10711071
CPUHP_AP_PERF_ARM_MARVELL_CN10K_DDR_ONLINE,

drivers/perf/thunderx2_pmu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,9 +752,8 @@ static int tx2_uncore_pmu_add_dev(struct tx2_uncore_pmu *tx2_pmu)
752752
tx2_pmu->cpu = cpu;
753753

754754
if (tx2_pmu->hrtimer_callback) {
755-
hrtimer_init(&tx2_pmu->hrtimer,
756-
CLOCK_MONOTONIC, HRTIMER_MODE_REL);
757-
tx2_pmu->hrtimer.function = tx2_pmu->hrtimer_callback;
755+
hrtimer_setup(&tx2_pmu->hrtimer, tx2_pmu->hrtimer_callback, CLOCK_MONOTONIC,
756+
HRTIMER_MODE_REL);
758757
}
759758

760759
ret = tx2_uncore_pmu_register(tx2_pmu);

0 commit comments

Comments
 (0)