Merge tag 'timers-cleanups-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Mar 2025 17:54:15 +0000 (10:54 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 Mar 2025 17:54:15 +0000 (10:54 -0700)
Pull timer cleanups from Thomas Gleixner:
 "A treewide hrtimer timer cleanup

  hrtimers are initialized with hrtimer_init() and a subsequent store to
  the callback pointer. This turned out to be suboptimal for the
  upcoming Rust integration and is obviously a silly implementation to
  begin with.

  This cleanup replaces the hrtimer_init(T); T->function = cb; sequence
  with hrtimer_setup(T, cb);

  The conversion was done with Coccinelle and a few manual fixups.

  Once the conversion has completely landed in mainline, hrtimer_init()
  will be removed and the hrtimer::function becomes a private member"

* tag 'timers-cleanups-2025-03-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
  wifi: rt2x00: Switch to use hrtimer_update_function()
  io_uring: Use helper function hrtimer_update_function()
  serial: xilinx_uartps: Use helper function hrtimer_update_function()
  ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()
  RDMA: Switch to use hrtimer_setup()
  virtio: mem: Switch to use hrtimer_setup()
  drm/vmwgfx: Switch to use hrtimer_setup()
  drm/xe/oa: Switch to use hrtimer_setup()
  drm/vkms: Switch to use hrtimer_setup()
  drm/msm: Switch to use hrtimer_setup()
  drm/i915/request: Switch to use hrtimer_setup()
  drm/i915/uncore: Switch to use hrtimer_setup()
  drm/i915/pmu: Switch to use hrtimer_setup()
  drm/i915/perf: Switch to use hrtimer_setup()
  drm/i915/gvt: Switch to use hrtimer_setup()
  drm/i915/huc: Switch to use hrtimer_setup()
  drm/amdgpu: Switch to use hrtimer_setup()
  stm class: heartbeat: Switch to use hrtimer_setup()
  i2c: Switch to use hrtimer_setup()
  iio: Switch to use hrtimer_setup()
  ...

27 files changed:
1  2 
arch/loongarch/kvm/vcpu.c
arch/s390/kvm/kvm-s390.c
arch/x86/events/rapl.c
arch/x86/kvm/vmx/nested.c
drivers/block/null_blk/main.c
drivers/gpu/drm/xe/xe_oa.c
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/icssg/icssg_prueth.c
drivers/powercap/intel_rapl_common.c
drivers/scsi/lpfc/lpfc_init.c
drivers/usb/typec/tcpm/tcpm.c
fs/timerfd.c
include/linux/hrtimer.h
io_uring/io_uring.c
kernel/events/core.c
kernel/fork.c
kernel/sched/core.c
kernel/sched/deadline.c
kernel/sched/fair.c
kernel/sched/rt.c
kernel/time/hrtimer.c
kernel/time/posix-timers.c
kernel/trace/trace_osnoise.c
kernel/watchdog.c
mm/slab_common.c
net/core/dev.c
net/sched/sch_api.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index bef734c6e5c2b36751a8178161d158ab893df4de,361169db4befb16019c4796c680ddebd2a40649c..4a8e6b9413e34d032e1a90c75f7d6bddc4472c7d
@@@ -2310,14 -2309,11 +2310,14 @@@ static int am65_cpsw_nuss_ndev_add_tx_n
        int i, ret = 0;
  
        for (i = 0; i < common->tx_ch_num; i++) {
 -              struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i];
 +              tx_chn = &common->tx_chns[i];
  
-               hrtimer_init(&tx_chn->tx_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-               tx_chn->tx_hrtimer.function = &am65_cpsw_nuss_tx_timer_callback;
+               hrtimer_setup(&tx_chn->tx_hrtimer, &am65_cpsw_nuss_tx_timer_callback,
+                             CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
  
 +              netif_napi_add_tx(common->dma_ndev, &tx_chn->napi_tx,
 +                                am65_cpsw_nuss_tx_poll);
 +
                ret = devm_request_irq(dev, tx_chn->irq,
                                       am65_cpsw_nuss_tx_irq,
                                       IRQF_TRIGGER_HIGH,
@@@ -2566,13 -2565,9 +2566,12 @@@ static int am65_cpsw_nuss_init_rx_chns(
                snprintf(flow->name,
                         sizeof(flow->name), "%s-rx%d",
                         dev_name(dev), i);
-               hrtimer_init(&flow->rx_hrtimer, CLOCK_MONOTONIC,
-                            HRTIMER_MODE_REL_PINNED);
-               flow->rx_hrtimer.function = &am65_cpsw_nuss_rx_timer_callback;
+               hrtimer_setup(&flow->rx_hrtimer, &am65_cpsw_nuss_rx_timer_callback, CLOCK_MONOTONIC,
+                             HRTIMER_MODE_REL_PINNED);
  
 +              netif_napi_add(common->dma_ndev, &flow->napi_rx,
 +                             am65_cpsw_nuss_rx_poll);
 +
                ret = devm_request_irq(dev, flow->irq,
                                       am65_cpsw_nuss_rx_irq,
                                       IRQF_TRIGGER_HIGH,
Simple merge
Simple merge
Simple merge
diff --cc fs/timerfd.c
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc kernel/fork.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 453dc76c934848f877e56d4e57cbbb3c812d769f,47df6f50e12cfd32b3d653c76ecff01109f5554f..22376a1a75b9f0e19d98ba58b4c9da21ba38d6d7
@@@ -1577,26 -1587,16 +1577,21 @@@ u64 hrtimer_next_event_without(const st
  
  static inline int hrtimer_clockid_to_base(clockid_t clock_id)
  {
 -      if (likely(clock_id < MAX_CLOCKS)) {
 -              int base = hrtimer_clock_to_base_table[clock_id];
 -
 -              if (likely(base != HRTIMER_MAX_CLOCK_BASES))
 -                      return base;
 +      switch (clock_id) {
 +      case CLOCK_REALTIME:
 +              return HRTIMER_BASE_REALTIME;
 +      case CLOCK_MONOTONIC:
 +              return HRTIMER_BASE_MONOTONIC;
 +      case CLOCK_BOOTTIME:
 +              return HRTIMER_BASE_BOOTTIME;
 +      case CLOCK_TAI:
 +              return HRTIMER_BASE_TAI;
 +      default:
 +              WARN(1, "Invalid clockid %d. Using MONOTONIC\n", clock_id);
 +              return HRTIMER_BASE_MONOTONIC;
        }
 -      WARN(1, "Invalid clockid %d. Using MONOTONIC\n", clock_id);
 -      return HRTIMER_BASE_MONOTONIC;
  }
  
- static enum hrtimer_restart hrtimer_dummy_timeout(struct hrtimer *unused)
- {
-       return HRTIMER_NORESTART;
- }
  static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
                           enum hrtimer_mode mode)
  {
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc net/core/dev.c
Simple merge
Simple merge