[PATCH v2 00/45] Consolidate hrtimer initialization - Part 4

Nam Cao
2025-02-05T10:46:54Z

hrtimers is initialized with hrtimer_init(), and after that the timer's
callback function is setup separately. This separate initialization is
error prone and awkward to use.

hrtimer_setup() combines the initialization and is simpler to use.

Switch to use the new setup function. Most conversions were done with
Coccinelle, see the sematic patch below.

This series is intended to be applied to the tip tree

v1 -> v2 https://lore.kernel.org/lkml/cover.1729865485.git.namcao@linutronix.de
- rebase onto v6.14-rc1
---
virtual patch
@@ expression timer, clock, mode, func; @@
- hrtimer_init(timer, clock, mode);
...
- timer->function = func;
+ hrtimer_setup(timer, func, clock, mode);

@@ expression timer, clock, mode, func; @@
- hrtimer_init(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup(&timer, func, clock, mode);

@@ expression timer, clock, mode, func; @@
- hrtimer_init_on_stack(&timer, clock, mode);
...
- timer.function = func;
+ hrtimer_setup_on_stack(&timer, func, clock, mode);

@@ expression timer, clock, mode; @@
- hrtimer_init_sleeper_on_stack(timer, clock, mode);
+ hrtimer_setup_sleeper_on_stack(timer, clock, mode);

---
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Andi Shyti <andi.shyti@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Zack Rusin <zack.rusin@broadcom.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>
Cc: Takashi Iwai <tiwai@suse.com>
---

drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 ++--
drivers/gpu/drm/i915/gt/uc/intel_huc.c | 4 ++--
drivers/gpu/drm/i915/gvt/display.c | 3 +--
drivers/gpu/drm/i915/gvt/sched_policy.c | 3 +--
drivers/gpu/drm/i915/i915_perf.c | 5 ++---
drivers/gpu/drm/i915/i915_pmu.c | 3 +--
drivers/gpu/drm/i915/i915_request.c | 3 +--
drivers/gpu/drm/i915/intel_uncore.c | 3 +--
drivers/gpu/drm/msm/msm_fence.c | 3 +--
drivers/gpu/drm/msm/msm_io_utils.c | 3 +--
drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++--
drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 4 ++--
drivers/gpu/drm/xe/xe_oa.c | 4 ++--
drivers/hwtracing/stm/heartbeat.c | 6 ++----
drivers/i2c/busses/i2c-imx.c | 4 ++--
drivers/iio/adc/ti-tsc2046.c | 4 +---
drivers/iio/trigger/iio-trig-hrtimer.c | 4 ++--
drivers/infiniband/hw/hfi1/init.c | 5 ++---
drivers/infiniband/sw/rdmavt/qp.c | 5 ++---
drivers/input/joystick/walkera0701.c | 3 +--
drivers/input/keyboard/gpio_keys.c | 10 ++++------
drivers/leds/trigger/ledtrig-pattern.c | 4 ++--
drivers/mailbox/mailbox.c | 4 +---
drivers/media/cec/core/cec-pin.c | 3 +--
drivers/media/pci/cx88/cx88-input.c | 3 +--
.../media/platform/chips-media/wave5/wave5-vpu.c | 4 ++--
drivers/media/rc/pwm-ir-tx.c | 3 +--
drivers/misc/vcpu_stall_detector.c | 3 +--
drivers/mmc/host/dw_mmc.c | 3 +--
drivers/ntb/test/ntb_pingpong.c | 3 +--
drivers/perf/arm-ccn.c | 5 ++---
drivers/perf/marvell_cn10k_ddr_pmu.c | 4 ++--
drivers/perf/thunderx2_pmu.c | 5 ++---
drivers/power/reset/ltc2952-poweroff.c | 8 ++++----
drivers/power/supply/ab8500_chargalg.c | 9 ++++-----
drivers/powercap/idle_inject.c | 3 +--
drivers/powercap/intel_rapl_common.c | 3 +--
drivers/pps/generators/pps_gen_parport.c | 3 +--
drivers/pwm/pwm-gpio.c | 5 ++---
drivers/rtc/class.c | 3 +--
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 4 +---
drivers/scsi/lpfc/lpfc_init.c | 7 +++----
drivers/scsi/scsi_debug.c | 4 ++--
drivers/tty/serial/8250/8250_bcm7271.c | 3 +--
drivers/tty/serial/8250/8250_port.c | 10 ++++------
drivers/tty/serial/amba-pl011.c | 9 ++++-----
drivers/tty/serial/imx.c | 8 ++++----
drivers/tty/serial/sh-sci.c | 3 +--
drivers/tty/serial/xilinx_uartps.c | 4 ++--
drivers/usb/chipidea/otg_fsm.c | 3 +--
drivers/usb/dwc2/hcd_queue.c | 3 +--
drivers/usb/fotg210/fotg210-hcd.c | 3 +--
drivers/usb/gadget/function/f_ncm.c | 3 +--
drivers/usb/gadget/udc/dummy_hcd.c | 6 ++----
drivers/usb/host/ehci-hcd.c | 3 +--
drivers/usb/musb/musb_cppi41.c | 4 ++--
drivers/usb/typec/tcpm/tcpm.c | 16 ++++++++--------
drivers/virtio/virtio_mem.c | 4 ++--
sound/core/hrtimer.c | 3 +--
sound/drivers/dummy.c | 3 +--
sound/drivers/pcsp/pcsp.c | 3 +--
sound/sh/sh_dac_audio.c | 3 +--
sound/soc/fsl/imx-pcm-fiq.c | 3 +--
63 files changed, 112 insertions(+), 165 deletions(-)

--
2.39.5