]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drivers: perf: Switch to use hrtimer_setup()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:46:07 +0000 (11:46 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 Feb 2025 10:19:04 +0000 (11:19 +0100)
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 <namcao@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://lore.kernel.org/all/471ea3b829d14a4b4c3c7814dbe1ed13b15d47b8.1738746904.git.namcao@linutronix.de
drivers/perf/arm-ccn.c
drivers/perf/marvell_cn10k_ddr_pmu.c
drivers/perf/thunderx2_pmu.c

index d5fcea3d4328bedbd1077127d5f577efcbc81266..1a0d0e1a226334b79b853970b74c1a1086465713 100644 (file)
@@ -1273,9 +1273,8 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn)
        /* No overflow interrupt? Have to use a timer instead. */
        if (!ccn->irq) {
                dev_info(ccn->dev, "No access to interrupts, using timer.\n");
-               hrtimer_init(&ccn->dt.hrtimer, CLOCK_MONOTONIC,
-                               HRTIMER_MODE_REL);
-               ccn->dt.hrtimer.function = arm_ccn_pmu_timer_handler;
+               hrtimer_setup(&ccn->dt.hrtimer, arm_ccn_pmu_timer_handler, CLOCK_MONOTONIC,
+                             HRTIMER_MODE_REL);
        }
 
        /* Pick one CPU which we will use to collect data from CCN... */
index 039feded91527236b427d7d0ba55131848c686ac..72ac17efd846a627135a41772fb452d772ed755a 100644 (file)
@@ -1064,8 +1064,8 @@ static int cn10k_ddr_perf_probe(struct platform_device *pdev)
        if (!name)
                return -ENOMEM;
 
-       hrtimer_init(&ddr_pmu->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-       ddr_pmu->hrtimer.function = cn10k_ddr_pmu_timer_handler;
+       hrtimer_setup(&ddr_pmu->hrtimer, cn10k_ddr_pmu_timer_handler, CLOCK_MONOTONIC,
+                     HRTIMER_MODE_REL);
 
        cpuhp_state_add_instance_nocalls(
                                CPUHP_AP_PERF_ARM_MARVELL_CN10K_DDR_ONLINE,
index cadd60221b8f76740df5f115b258faabb2a71aa1..6ed4707bd6bb5d4be705361dd4b1047212b0b0cd 100644 (file)
@@ -752,9 +752,8 @@ static int tx2_uncore_pmu_add_dev(struct tx2_uncore_pmu *tx2_pmu)
        tx2_pmu->cpu = cpu;
 
        if (tx2_pmu->hrtimer_callback) {
-               hrtimer_init(&tx2_pmu->hrtimer,
-                               CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-               tx2_pmu->hrtimer.function = tx2_pmu->hrtimer_callback;
+               hrtimer_setup(&tx2_pmu->hrtimer, tx2_pmu->hrtimer_callback, CLOCK_MONOTONIC,
+                             HRTIMER_MODE_REL);
        }
 
        ret = tx2_uncore_pmu_register(tx2_pmu);