public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
@ 2025-02-05 10:45 Nam Cao
  2025-02-05 10:45 ` [PATCH v2 01/45] USB: chipidea: Switch to use hrtimer_setup() Nam Cao
                   ` (45 more replies)
  0 siblings, 46 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alexander Shishkin, Alex Deucher,
	Jani Nikula, Rob Clark, Lucas De Marchi, Zack Rusin,
	Michael S. Tsirkin, Jason Gunthorpe, Uwe Kleine-König,
	Takashi Iwai

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


^ permalink raw reply	[flat|nested] 60+ messages in thread

* [PATCH v2 01/45] USB: chipidea: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 02/45] usb: dwc2: " Nam Cao
                   ` (44 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/chipidea/otg_fsm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index c17516c29b63..a093544482d5 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -424,8 +424,7 @@ static enum hrtimer_restart ci_otg_hrtimer_func(struct hrtimer *t)
 /* Initialize timers */
 static int ci_otg_init_timers(struct ci_hdrc *ci)
 {
-	hrtimer_init(&ci->otg_fsm_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	ci->otg_fsm_hrtimer.function = ci_otg_hrtimer_func;
+	hrtimer_setup(&ci->otg_fsm_hrtimer, ci_otg_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 	return 0;
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 02/45] usb: dwc2: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
  2025-02-05 10:45 ` [PATCH v2 01/45] USB: chipidea: Switch to use hrtimer_setup() Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 03/45] usb: fotg210-hcd: " Nam Cao
                   ` (43 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/dwc2/hcd_queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c
index 238c6fd50e75..2a542a99ec44 100644
--- a/drivers/usb/dwc2/hcd_queue.c
+++ b/drivers/usb/dwc2/hcd_queue.c
@@ -1459,8 +1459,7 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
 	/* Initialize QH */
 	qh->hsotg = hsotg;
 	timer_setup(&qh->unreserve_timer, dwc2_unreserve_timer_fn, 0);
-	hrtimer_init(&qh->wait_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	qh->wait_timer.function = &dwc2_wait_timer_fn;
+	hrtimer_setup(&qh->wait_timer, &dwc2_wait_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	qh->ep_type = ep_type;
 	qh->ep_is_in = ep_is_in;
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 03/45] usb: fotg210-hcd: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
  2025-02-05 10:45 ` [PATCH v2 01/45] USB: chipidea: Switch to use hrtimer_setup() Nam Cao
  2025-02-05 10:45 ` [PATCH v2 02/45] usb: dwc2: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 04/45] usb: gadget: " Nam Cao
                   ` (42 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/fotg210/fotg210-hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index 3d404d19a205..64c4965a160f 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -4901,8 +4901,7 @@ static int hcd_fotg210_init(struct usb_hcd *hcd)
 	 */
 	fotg210->need_io_watchdog = 1;
 
-	hrtimer_init(&fotg210->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	fotg210->hrtimer.function = fotg210_hrtimer_func;
+	hrtimer_setup(&fotg210->hrtimer, fotg210_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	fotg210->next_hrtimer_event = FOTG210_HRTIMER_NO_EVENT;
 
 	hcc_params = fotg210_readl(fotg210, &fotg210->caps->hcc_params);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 04/45] usb: gadget: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (2 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 03/45] usb: fotg210-hcd: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 05/45] usb: ehci: " Nam Cao
                   ` (41 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/gadget/function/f_ncm.c | 3 +--
 drivers/usb/gadget/udc/dummy_hcd.c  | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c
index f60576a65ca6..58b0dd575af3 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1559,8 +1559,7 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
 	ncm->port.open = ncm_open;
 	ncm->port.close = ncm_close;
 
-	hrtimer_init(&ncm->task_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	ncm->task_timer.function = ncm_tx_timeout;
+	hrtimer_setup(&ncm->task_timer, ncm_tx_timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 
 	DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
 			ncm->port.in_ep->name, ncm->port.out_ep->name,
diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
index bda08c5ba7c0..4f1b5db51dda 100644
--- a/drivers/usb/gadget/udc/dummy_hcd.c
+++ b/drivers/usb/gadget/udc/dummy_hcd.c
@@ -2479,8 +2479,7 @@ static DEVICE_ATTR_RO(urbs);
 
 static int dummy_start_ss(struct dummy_hcd *dum_hcd)
 {
-	hrtimer_init(&dum_hcd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	dum_hcd->timer.function = dummy_timer;
+	hrtimer_setup(&dum_hcd->timer, dummy_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 	dum_hcd->rh_state = DUMMY_RH_RUNNING;
 	dum_hcd->stream_en_ep = 0;
 	INIT_LIST_HEAD(&dum_hcd->urbp_list);
@@ -2509,8 +2508,7 @@ static int dummy_start(struct usb_hcd *hcd)
 		return dummy_start_ss(dum_hcd);
 
 	spin_lock_init(&dum_hcd->dum->lock);
-	hrtimer_init(&dum_hcd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	dum_hcd->timer.function = dummy_timer;
+	hrtimer_setup(&dum_hcd->timer, dummy_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 	dum_hcd->rh_state = DUMMY_RH_RUNNING;
 
 	INIT_LIST_HEAD(&dum_hcd->urbp_list);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 05/45] usb: ehci: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (3 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 04/45] usb: gadget: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 06/45] usb: musb: cppi41: " Nam Cao
                   ` (40 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/ehci-hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 6de79ac5e6a4..6d1d190c914d 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -466,8 +466,7 @@ static int ehci_init(struct usb_hcd *hcd)
 	 */
 	ehci->need_io_watchdog = 1;
 
-	hrtimer_init(&ehci->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	ehci->hrtimer.function = ehci_hrtimer_func;
+	hrtimer_setup(&ehci->hrtimer, ehci_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	ehci->next_hrtimer_event = EHCI_HRTIMER_NO_EVENT;
 
 	hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 06/45] usb: musb: cppi41: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (4 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 05/45] usb: ehci: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 07/45] usb: typec: tcpm: " Nam Cao
                   ` (39 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/musb/musb_cppi41.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
index 9589243e8951..4cde3abb7006 100644
--- a/drivers/usb/musb/musb_cppi41.c
+++ b/drivers/usb/musb/musb_cppi41.c
@@ -760,8 +760,8 @@ cppi41_dma_controller_create(struct musb *musb, void __iomem *base)
 	if (!controller)
 		goto kzalloc_fail;
 
-	hrtimer_init(&controller->early_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	controller->early_tx.function = cppi41_recheck_tx_req;
+	hrtimer_setup(&controller->early_tx, cppi41_recheck_tx_req, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	INIT_LIST_HEAD(&controller->early_tx_list);
 
 	controller->controller.channel_alloc = cppi41_dma_channel_allocate;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 07/45] usb: typec: tcpm: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (5 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 06/45] usb: musb: cppi41: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 08/45] serial: 8250: " Nam Cao
                   ` (38 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/typec/tcpm/tcpm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 47be450d2be3..ebe076f01675 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -7722,14 +7722,14 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
 	kthread_init_work(&port->event_work, tcpm_pd_event_handler);
 	kthread_init_work(&port->enable_frs, tcpm_enable_frs_work);
 	kthread_init_work(&port->send_discover_work, tcpm_send_discover_work);
-	hrtimer_init(&port->state_machine_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->state_machine_timer.function = state_machine_timer_handler;
-	hrtimer_init(&port->vdm_state_machine_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->vdm_state_machine_timer.function = vdm_state_machine_timer_handler;
-	hrtimer_init(&port->enable_frs_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->enable_frs_timer.function = enable_frs_timer_handler;
-	hrtimer_init(&port->send_discover_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	port->send_discover_timer.function = send_discover_timer_handler;
+	hrtimer_setup(&port->state_machine_timer, state_machine_timer_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
+	hrtimer_setup(&port->vdm_state_machine_timer, vdm_state_machine_timer_handler,
+		      CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	hrtimer_setup(&port->enable_frs_timer, enable_frs_timer_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
+	hrtimer_setup(&port->send_discover_timer, send_discover_timer_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	spin_lock_init(&port->pd_event_lock);
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 08/45] serial: 8250: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (6 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 07/45] usb: typec: tcpm: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 09/45] serial: amba-pl011: " Nam Cao
                   ` (37 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/8250/8250_bcm7271.c |  3 +--
 drivers/tty/serial/8250/8250_port.c    | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/8250/8250_bcm7271.c
index d0b18358859e..742004d63c6f 100644
--- a/drivers/tty/serial/8250/8250_bcm7271.c
+++ b/drivers/tty/serial/8250/8250_bcm7271.c
@@ -1056,8 +1056,7 @@ static int brcmuart_probe(struct platform_device *pdev)
 	}
 
 	/* setup HR timer */
-	hrtimer_init(&priv->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	priv->hrt.function = brcmuart_hrtimer_func;
+	hrtimer_setup(&priv->hrt, brcmuart_hrtimer_func, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 	up.port.shutdown = brcmuart_shutdown;
 	up.port.startup = brcmuart_startup;
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index d7976a21cca9..253bf5c756de 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -566,12 +566,10 @@ static int serial8250_em485_init(struct uart_8250_port *p)
 	if (!p->em485)
 		return -ENOMEM;
 
-	hrtimer_init(&p->em485->stop_tx_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	hrtimer_init(&p->em485->start_tx_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL);
-	p->em485->stop_tx_timer.function = &serial8250_em485_handle_stop_tx;
-	p->em485->start_tx_timer.function = &serial8250_em485_handle_start_tx;
+	hrtimer_setup(&p->em485->stop_tx_timer, &serial8250_em485_handle_stop_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
+	hrtimer_setup(&p->em485->start_tx_timer, &serial8250_em485_handle_start_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	p->em485->port = p;
 	p->em485->active_timer = NULL;
 	p->em485->tx_stopped = true;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 09/45] serial: amba-pl011: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (7 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 08/45] serial: 8250: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 10/45] serial: imx: " Nam Cao
                   ` (36 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman

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>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/amba-pl011.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 04212c823a91..98f178bdbcbe 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2867,11 +2867,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
 			return -EINVAL;
 		}
 	}
-
-	hrtimer_init(&uap->trigger_start_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hrtimer_init(&uap->trigger_stop_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	uap->trigger_start_tx.function = pl011_trigger_start_tx;
-	uap->trigger_stop_tx.function = pl011_trigger_stop_tx;
+	hrtimer_setup(&uap->trigger_start_tx, pl011_trigger_start_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
+	hrtimer_setup(&uap->trigger_stop_tx, pl011_trigger_stop_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	ret = pl011_setup_port(&dev->dev, uap, &dev->res, portnr);
 	if (ret)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 10/45] serial: imx: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (8 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 09/45] serial: amba-pl011: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:45 ` [PATCH v2 11/45] serial: sh-sci: " Nam Cao
                   ` (35 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/imx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 9c59ec128bb4..9a1afe409b98 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2582,10 +2582,10 @@ static int imx_uart_probe(struct platform_device *pdev)
 		imx_uart_writel(sport, ucr3, UCR3);
 	}
 
-	hrtimer_init(&sport->trigger_start_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	hrtimer_init(&sport->trigger_stop_tx, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	sport->trigger_start_tx.function = imx_trigger_start_tx;
-	sport->trigger_stop_tx.function = imx_trigger_stop_tx;
+	hrtimer_setup(&sport->trigger_start_tx, imx_trigger_start_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
+	hrtimer_setup(&sport->trigger_stop_tx, imx_trigger_stop_tx, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	/*
 	 * Allocate the IRQ(s) i.MX1 has three interrupts whereas later
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 11/45] serial: sh-sci: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (9 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 10/45] serial: imx: " Nam Cao
@ 2025-02-05 10:45 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 12/45] serial: xilinx_uartps: " Nam Cao
                   ` (34 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:45 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/sh-sci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index b1ea48f38248..b72c3bc19bfa 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1702,8 +1702,7 @@ static void sci_request_dma(struct uart_port *port)
 			dma += s->buf_len_rx;
 		}
 
-		hrtimer_init(&s->rx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		s->rx_timer.function = sci_dma_rx_timer_fn;
+		hrtimer_setup(&s->rx_timer, sci_dma_rx_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 		s->chan_rx_saved = s->chan_rx = chan;
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 12/45] serial: xilinx_uartps: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (10 preceding siblings ...)
  2025-02-05 10:45 ` [PATCH v2 11/45] serial: sh-sci: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 13/45] scsi: " Nam Cao
                   ` (33 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serial/xilinx_uartps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index 92ec51870d1d..efb124a19c01 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1626,8 +1626,8 @@ static int cdns_rs485_config(struct uart_port *port, struct ktermios *termios,
 		writel(val, port->membase + CDNS_UART_MODEMCR);
 
 		/* Timer setup */
-		hrtimer_init(&cdns_uart->tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		cdns_uart->tx_timer.function = &cdns_rs485_tx_callback;
+		hrtimer_setup(&cdns_uart->tx_timer, &cdns_rs485_tx_callback, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL);
 
 		/* Disable transmitter and make Rx setup*/
 		cdns_uart_stop_tx(port);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 13/45] scsi: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (11 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 12/45] serial: xilinx_uartps: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 14/45] rtc: class: " Nam Cao
                   ` (32 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Martin K. Petersen

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 4 +---
 drivers/scsi/lpfc/lpfc_init.c            | 7 +++----
 drivers/scsi/scsi_debug.c                | 4 ++--
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index 16d085d56e9d..9e42230e42b8 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -2922,9 +2922,7 @@ static long ibmvscsis_alloctimer(struct scsi_info *vscsi)
 	struct timer_cb *p_timer;
 
 	p_timer = &vscsi->rsp_q_timer;
-	hrtimer_init(&p_timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-
-	p_timer->timer.function = ibmvscsis_service_wait_q;
+	hrtimer_setup(&p_timer->timer, ibmvscsis_service_wait_q, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	p_timer->started = false;
 	p_timer->timer_pops = 0;
 
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index bcadf11414c8..d1ac1d1cec3c 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -7952,11 +7952,10 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
 	timer_setup(&phba->fcf.redisc_wait, lpfc_sli4_fcf_redisc_wait_tmo, 0);
 
 	/* CMF congestion timer */
-	hrtimer_init(&phba->cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	phba->cmf_timer.function = lpfc_cmf_timer;
+	hrtimer_setup(&phba->cmf_timer, lpfc_cmf_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	/* CMF 1 minute stats collection timer */
-	hrtimer_init(&phba->cmf_stats_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	phba->cmf_stats_timer.function = lpfc_cmf_stats_timer;
+	hrtimer_setup(&phba->cmf_stats_timer, lpfc_cmf_stats_timer, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	/*
 	 * Control structure for handling external multi-buffer mailbox
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 5ceaa4665e5d..fe5c30bb2639 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -6384,8 +6384,8 @@ static struct sdebug_queued_cmd *sdebug_alloc_queued_cmd(struct scsi_cmnd *scmd)
 
 	sd_dp = &sqcp->sd_dp;
 
-	hrtimer_init(&sd_dp->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-	sd_dp->hrt.function = sdebug_q_cmd_hrt_complete;
+	hrtimer_setup(&sd_dp->hrt, sdebug_q_cmd_hrt_complete, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_PINNED);
 	INIT_WORK(&sd_dp->ew.work, sdebug_q_cmd_wq_complete);
 
 	sqcp->scmd = scmd;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 14/45] rtc: class: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (12 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 13/45] scsi: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 11:36   ` Alexandre Belloni
  2025-02-05 10:46 ` [PATCH v2 15/45] pps: generators: pps_gen_parport: " Nam Cao
                   ` (31 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Alexandre Belloni

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/class.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index e31fa0ad127e..b88cd4fb295b 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -240,8 +240,7 @@ static struct rtc_device *rtc_allocate_device(void)
 	/* Init uie timer */
 	rtc_timer_init(&rtc->uie_rtctimer, rtc_uie_update_irq, rtc);
 	/* Init pie timer */
-	hrtimer_init(&rtc->pie_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	rtc->pie_timer.function = rtc_pie_update_irq;
+	hrtimer_setup(&rtc->pie_timer, rtc_pie_update_irq, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	rtc->pie_enabled = 0;
 
 	set_bit(RTC_FEATURE_ALARM, rtc->features);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 15/45] pps: generators: pps_gen_parport: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (13 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 14/45] rtc: class: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 16/45] powercap: " Nam Cao
                   ` (30 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pps/generators/pps_gen_parport.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
index d46eed159495..f5eeb4dd01ad 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -208,8 +208,7 @@ static void parport_attach(struct parport *port)
 
 	calibrate_port(&device);
 
-	hrtimer_init(&device.timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
-	device.timer.function = hrtimer_event;
+	hrtimer_setup(&device.timer, hrtimer_event, CLOCK_REALTIME, HRTIMER_MODE_ABS);
 	hrtimer_start(&device.timer, next_intr_time(&device), HRTIMER_MODE_ABS);
 
 	return;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 16/45] powercap: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (14 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 15/45] pps: generators: pps_gen_parport: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 17/45] power: supply: ab8500_chargalg: " Nam Cao
                   ` (29 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Rafael J . Wysocki, Zack Rusin

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.

Acked-by: Rafael J. Wysocki <rafael@kernel.org>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/powercap/idle_inject.c       | 3 +--
 drivers/powercap/intel_rapl_common.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/powercap/idle_inject.c b/drivers/powercap/idle_inject.c
index 04c212953ded..5ad7cc438068 100644
--- a/drivers/powercap/idle_inject.c
+++ b/drivers/powercap/idle_inject.c
@@ -339,8 +339,7 @@ struct idle_inject_device *idle_inject_register_full(struct cpumask *cpumask,
 		return NULL;
 
 	cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask);
-	hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	ii_dev->timer.function = idle_inject_timer_fn;
+	hrtimer_setup(&ii_dev->timer, idle_inject_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	ii_dev->latency_us = UINT_MAX;
 	ii_dev->update = update;
 
diff --git a/drivers/powercap/intel_rapl_common.c b/drivers/powercap/intel_rapl_common.c
index 77d75e1f14a9..cf3d806284c4 100644
--- a/drivers/powercap/intel_rapl_common.c
+++ b/drivers/powercap/intel_rapl_common.c
@@ -2064,8 +2064,7 @@ int rapl_package_add_pmu(struct rapl_package *rp)
 	raw_spin_lock_init(&data->lock);
 	INIT_LIST_HEAD(&data->active_list);
 	data->timer_interval = ms_to_ktime(rapl_pmu.timer_ms);
-	hrtimer_init(&data->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	data->hrtimer.function = rapl_hrtimer_handle;
+	hrtimer_setup(&data->hrtimer, rapl_hrtimer_handle, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	return rapl_pmu_update(rp);
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 17/45] power: supply: ab8500_chargalg: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (15 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 16/45] powercap: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-08 17:42   ` Sebastian Reichel
  2025-02-05 10:46 ` [PATCH v2 18/45] power: reset: ltc2952-poweroff: " Nam Cao
                   ` (28 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Linus Walleij, Zack Rusin

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.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/power/supply/ab8500_chargalg.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c
index 7a8d1feb8e90..dc6c8b0dd1cf 100644
--- a/drivers/power/supply/ab8500_chargalg.c
+++ b/drivers/power/supply/ab8500_chargalg.c
@@ -1787,13 +1787,12 @@ static int ab8500_chargalg_probe(struct platform_device *pdev)
 	psy_cfg.drv_data = di;
 
 	/* Initilialize safety timer */
-	hrtimer_init(&di->safety_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	di->safety_timer.function = ab8500_chargalg_safety_timer_expired;
+	hrtimer_setup(&di->safety_timer, ab8500_chargalg_safety_timer_expired, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	/* Initilialize maintenance timer */
-	hrtimer_init(&di->maintenance_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	di->maintenance_timer.function =
-		ab8500_chargalg_maintenance_timer_expired;
+	hrtimer_setup(&di->maintenance_timer, ab8500_chargalg_maintenance_timer_expired,
+		      CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	/* Init work for chargalg */
 	INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work,
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 18/45] power: reset: ltc2952-poweroff: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (16 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 17/45] power: supply: ab8500_chargalg: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-08 17:42   ` Sebastian Reichel
  2025-02-05 10:46 ` [PATCH v2 19/45] drivers: perf: " Nam Cao
                   ` (27 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Sebastian Reichel

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Sebastian Reichel <sre@kernel.org>
---
 drivers/power/reset/ltc2952-poweroff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
index 1a6fc8d38e20..90c664d344d0 100644
--- a/drivers/power/reset/ltc2952-poweroff.c
+++ b/drivers/power/reset/ltc2952-poweroff.c
@@ -162,11 +162,11 @@ static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
 	data->wde_interval = 300L * NSEC_PER_MSEC;
 	data->trigger_delay = ktime_set(2, 500L * NSEC_PER_MSEC);
 
-	hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	data->timer_trigger.function = ltc2952_poweroff_timer_trigger;
+	hrtimer_setup(&data->timer_trigger, ltc2952_poweroff_timer_trigger, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
-	hrtimer_init(&data->timer_wde, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	data->timer_wde.function = ltc2952_poweroff_timer_wde;
+	hrtimer_setup(&data->timer_wde, ltc2952_poweroff_timer_wde, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 }
 
 static int ltc2952_poweroff_init(struct platform_device *pdev)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 19/45] drivers: perf: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (17 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 18/45] power: reset: ltc2952-poweroff: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 20/45] ntb: ntb_pingpong: " Nam Cao
                   ` (26 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Will Deacon

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Will Deacon <will@kernel.org>
---
 drivers/perf/arm-ccn.c               | 5 ++---
 drivers/perf/marvell_cn10k_ddr_pmu.c | 4 ++--
 drivers/perf/thunderx2_pmu.c         | 5 ++---
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/perf/arm-ccn.c b/drivers/perf/arm-ccn.c
index d5fcea3d4328..1a0d0e1a2263 100644
--- a/drivers/perf/arm-ccn.c
+++ b/drivers/perf/arm-ccn.c
@@ -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... */
diff --git a/drivers/perf/marvell_cn10k_ddr_pmu.c b/drivers/perf/marvell_cn10k_ddr_pmu.c
index 039feded9152..72ac17efd846 100644
--- a/drivers/perf/marvell_cn10k_ddr_pmu.c
+++ b/drivers/perf/marvell_cn10k_ddr_pmu.c
@@ -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,
diff --git a/drivers/perf/thunderx2_pmu.c b/drivers/perf/thunderx2_pmu.c
index cadd60221b8f..6ed4707bd6bb 100644
--- a/drivers/perf/thunderx2_pmu.c
+++ b/drivers/perf/thunderx2_pmu.c
@@ -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);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 20/45] ntb: ntb_pingpong: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (18 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 19/45] drivers: perf: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 21/45] mmc: dw_mmc: " Nam Cao
                   ` (25 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jon Mason

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Jon Mason <jdmason@kudzu.us>
---
 drivers/ntb/test/ntb_pingpong.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/ntb/test/ntb_pingpong.c b/drivers/ntb/test/ntb_pingpong.c
index 8aeca7914050..1c1c74f4ff2d 100644
--- a/drivers/ntb/test/ntb_pingpong.c
+++ b/drivers/ntb/test/ntb_pingpong.c
@@ -284,8 +284,7 @@ static struct pp_ctx *pp_create_data(struct ntb_dev *ntb)
 	pp->ntb = ntb;
 	atomic_set(&pp->count, 0);
 	spin_lock_init(&pp->lock);
-	hrtimer_init(&pp->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	pp->timer.function = pp_timer_func;
+	hrtimer_setup(&pp->timer, pp_timer_func, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	return pp;
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 21/45] mmc: dw_mmc: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (19 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 20/45] ntb: ntb_pingpong: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 22/45] misc: vcpu_stall_detector: " Nam Cao
                   ` (24 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jaehoon Chung

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 3cbda98d08d2..31f40c04afda 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1875,8 +1875,7 @@ static void dw_mci_init_fault(struct dw_mci *host)
 {
 	host->fail_data_crc = (struct fault_attr) FAULT_ATTR_INITIALIZER;
 
-	hrtimer_init(&host->fault_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	host->fault_timer.function = dw_mci_fault_timer;
+	hrtimer_setup(&host->fault_timer, dw_mci_fault_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 }
 #else
 static void dw_mci_init_fault(struct dw_mci *host)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 22/45] misc: vcpu_stall_detector: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (20 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 21/45] mmc: dw_mmc: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 23/45] media: " Nam Cao
                   ` (23 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Greg Kroah-Hartman

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/misc/vcpu_stall_detector.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/vcpu_stall_detector.c b/drivers/misc/vcpu_stall_detector.c
index f0b1fc87490e..26166357b255 100644
--- a/drivers/misc/vcpu_stall_detector.c
+++ b/drivers/misc/vcpu_stall_detector.c
@@ -111,8 +111,7 @@ static int start_stall_detector_cpu(unsigned int cpu)
 	ping_timeout_ms = vcpu_stall_config.stall_timeout_sec *
 			  MSEC_PER_SEC / 2;
 
-	hrtimer_init(vcpu_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	vcpu_hrtimer->function = vcpu_stall_detect_timer_fn;
+	hrtimer_setup(vcpu_hrtimer, vcpu_stall_detect_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	vcpu_stall_detector->is_initialized = true;
 
 	hrtimer_start(vcpu_hrtimer, ms_to_ktime(ping_timeout_ms),
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 23/45] media: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (21 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 22/45] misc: vcpu_stall_detector: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 24/45] mailbox: " Nam Cao
                   ` (22 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Hans Verkuil, Zack Rusin

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.

Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
 drivers/media/cec/core/cec-pin.c                     | 3 +--
 drivers/media/pci/cx88/cx88-input.c                  | 3 +--
 drivers/media/platform/chips-media/wave5/wave5-vpu.c | 4 ++--
 drivers/media/rc/pwm-ir-tx.c                         | 3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/media/cec/core/cec-pin.c b/drivers/media/cec/core/cec-pin.c
index a70451d99ebc..bebaa40e0eb5 100644
--- a/drivers/media/cec/core/cec-pin.c
+++ b/drivers/media/cec/core/cec-pin.c
@@ -1346,9 +1346,8 @@ struct cec_adapter *cec_pin_allocate_adapter(const struct cec_pin_ops *pin_ops,
 	if (pin == NULL)
 		return ERR_PTR(-ENOMEM);
 	pin->ops = pin_ops;
-	hrtimer_init(&pin->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	atomic_set(&pin->work_pin_num_events, 0);
-	pin->timer.function = cec_pin_timer;
+	hrtimer_setup(&pin->timer, cec_pin_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	init_waitqueue_head(&pin->kthread_waitq);
 	pin->tx_custom_low_usecs = CEC_TIM_CUSTOM_DEFAULT;
 	pin->tx_custom_high_usecs = CEC_TIM_CUSTOM_DEFAULT;
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index a04a1d33fadb..b9f2c14d62b4 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -190,8 +190,7 @@ static int __cx88_ir_start(void *priv)
 	ir = core->ir;
 
 	if (ir->polling) {
-		hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		ir->timer.function = cx88_ir_work;
+		hrtimer_setup(&ir->timer, cx88_ir_work, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		hrtimer_start(&ir->timer,
 			      ktime_set(0, ir->polling * 1000000),
 			      HRTIMER_MODE_REL);
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu.c b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
index d1320298a0f7..8479dc9c9a8f 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu.c
@@ -269,8 +269,8 @@ static int wave5_vpu_probe(struct platform_device *pdev)
 	dev->irq = platform_get_irq(pdev, 0);
 	if (dev->irq < 0) {
 		dev_err(&pdev->dev, "failed to get irq resource, falling back to polling\n");
-		hrtimer_init(&dev->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
-		dev->hrtimer.function = &wave5_vpu_timer_callback;
+		hrtimer_setup(&dev->hrtimer, &wave5_vpu_timer_callback, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL_PINNED);
 		dev->worker = kthread_run_worker(0, "vpu_irq_thread");
 		if (IS_ERR(dev->worker)) {
 			dev_err(&pdev->dev, "failed to create vpu irq worker\n");
diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c
index fe368aebbc13..84533fdd61aa 100644
--- a/drivers/media/rc/pwm-ir-tx.c
+++ b/drivers/media/rc/pwm-ir-tx.c
@@ -172,8 +172,7 @@ static int pwm_ir_probe(struct platform_device *pdev)
 		rcdev->tx_ir = pwm_ir_tx_sleep;
 	} else {
 		init_completion(&pwm_ir->tx_done);
-		hrtimer_init(&pwm_ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-		pwm_ir->timer.function = pwm_ir_timer;
+		hrtimer_setup(&pwm_ir->timer, pwm_ir_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		rcdev->tx_ir = pwm_ir_tx_atomic;
 	}
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (22 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 23/45] media: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-03-01 16:43   ` Jassi Brar
  2025-02-05 10:46 ` [PATCH v2 25/45] leds: trigger: pattern: " Nam Cao
                   ` (21 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jassi Brar

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
---
 drivers/mailbox/mailbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index d3d26a2c9895..118beaf447aa 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -534,9 +534,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
 			return -EINVAL;
 		}
 
-		hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL);
-		mbox->poll_hrt.function = txdone_hrtimer;
+		hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 		spin_lock_init(&mbox->poll_hrt_lock);
 	}
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 25/45] leds: trigger: pattern: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (23 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 24/45] mailbox: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 26/45] Input: " Nam Cao
                   ` (20 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Pavel Machek

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Pavel Machek <pavel@ucw.cz>
---
 drivers/leds/trigger/ledtrig-pattern.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/trigger/ledtrig-pattern.c b/drivers/leds/trigger/ledtrig-pattern.c
index aad48c2540fc..a594bd5e2233 100644
--- a/drivers/leds/trigger/ledtrig-pattern.c
+++ b/drivers/leds/trigger/ledtrig-pattern.c
@@ -483,8 +483,8 @@ static int pattern_trig_activate(struct led_classdev *led_cdev)
 	data->led_cdev = led_cdev;
 	led_set_trigger_data(led_cdev, data);
 	timer_setup(&data->timer, pattern_trig_timer_function, 0);
-	hrtimer_init(&data->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	data->hrtimer.function = pattern_trig_hrtimer_function;
+	hrtimer_setup(&data->hrtimer, pattern_trig_hrtimer_function, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	led_cdev->activated = true;
 
 	if (led_cdev->flags & LED_INIT_DEFAULT_TRIGGER) {
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 26/45] Input: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (24 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 25/45] leds: trigger: pattern: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 15:30   ` Dmitry Torokhov
  2025-02-05 10:46 ` [PATCH v2 27/45] iio: " Nam Cao
                   ` (19 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Dmitry Torokhov

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/joystick/walkera0701.c |  3 +--
 drivers/input/keyboard/gpio_keys.c   | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c
index 59eea813f258..15370fb82317 100644
--- a/drivers/input/joystick/walkera0701.c
+++ b/drivers/input/joystick/walkera0701.c
@@ -232,8 +232,7 @@ static void walkera0701_attach(struct parport *pp)
 		goto err_unregister_device;
 	}
 
-	hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	w->timer.function = timer_handler;
+	hrtimer_setup(&w->timer, timer_handler, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	w->input_dev = input_allocate_device();
 	if (!w->input_dev) {
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 5eef66516e37..166cfc67d98b 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -590,9 +590,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 
 		INIT_DELAYED_WORK(&bdata->work, gpio_keys_gpio_work_func);
 
-		hrtimer_init(&bdata->debounce_timer,
-			     CLOCK_REALTIME, HRTIMER_MODE_REL);
-		bdata->debounce_timer.function = gpio_keys_debounce_timer;
+		hrtimer_setup(&bdata->debounce_timer, gpio_keys_debounce_timer, CLOCK_REALTIME,
+			      HRTIMER_MODE_REL);
 
 		isr = gpio_keys_gpio_isr;
 		irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING;
@@ -628,9 +627,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 		}
 
 		bdata->release_delay = button->debounce_interval;
-		hrtimer_init(&bdata->release_timer,
-			     CLOCK_REALTIME, HRTIMER_MODE_REL_HARD);
-		bdata->release_timer.function = gpio_keys_irq_timer;
+		hrtimer_setup(&bdata->release_timer, gpio_keys_irq_timer, CLOCK_REALTIME,
+			      HRTIMER_MODE_REL_HARD);
 
 		isr = gpio_keys_irq_isr;
 		irqflags = 0;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 27/45] iio: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (25 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 26/45] Input: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 16:21   ` Jonathan Cameron
  2025-02-05 10:46 ` [PATCH v2 28/45] i2c: " Nam Cao
                   ` (18 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Jonathan Cameron, Zack Rusin

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.

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/iio/adc/ti-tsc2046.c           | 4 +---
 drivers/iio/trigger/iio-trig-hrtimer.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
index 7dde5713973f..49560059f4b7 100644
--- a/drivers/iio/adc/ti-tsc2046.c
+++ b/drivers/iio/adc/ti-tsc2046.c
@@ -812,9 +812,7 @@ static int tsc2046_adc_probe(struct spi_device *spi)
 
 	spin_lock_init(&priv->state_lock);
 	priv->state = TSC2046_STATE_SHUTDOWN;
-	hrtimer_init(&priv->trig_timer, CLOCK_MONOTONIC,
-		     HRTIMER_MODE_REL_SOFT);
-	priv->trig_timer.function = tsc2046_adc_timer;
+	hrtimer_setup(&priv->trig_timer, tsc2046_adc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 
 	ret = devm_iio_trigger_register(dev, trig);
 	if (ret) {
diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c
index 716c795d08fb..82c72baccb62 100644
--- a/drivers/iio/trigger/iio-trig-hrtimer.c
+++ b/drivers/iio/trigger/iio-trig-hrtimer.c
@@ -145,8 +145,8 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name)
 	trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops;
 	trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups;
 
-	hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
-	trig_info->timer.function = iio_hrtimer_trig_handler;
+	hrtimer_setup(&trig_info->timer, iio_hrtimer_trig_handler, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL_HARD);
 
 	trig_info->sampling_frequency[0] = HRTIMER_DEFAULT_SAMPLING_FREQUENCY;
 	trig_info->period = NSEC_PER_SEC / trig_info->sampling_frequency[0];
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 28/45] i2c: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (26 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 27/45] iio: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 29/45] stm class: heartbeat: " Nam Cao
                   ` (17 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Andi Shyti

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Andi Shyti <andi.shyti@kernel.org>
---
 drivers/i2c/busses/i2c-imx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index ee0d25b498cb..9e5d454d8318 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1723,8 +1723,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	spin_lock_init(&i2c_imx->slave_lock);
-	hrtimer_init(&i2c_imx->slave_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	i2c_imx->slave_timer.function = i2c_imx_slave_timeout;
+	hrtimer_setup(&i2c_imx->slave_timer, i2c_imx_slave_timeout, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_ABS);
 
 	match = device_get_match_data(&pdev->dev);
 	if (match)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 29/45] stm class: heartbeat: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (27 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 28/45] i2c: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 30/45] drm/amdgpu: " Nam Cao
                   ` (16 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Alexander Shishkin

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
---
 drivers/hwtracing/stm/heartbeat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/hwtracing/stm/heartbeat.c b/drivers/hwtracing/stm/heartbeat.c
index e9496fe97baa..495eb1dc8ac5 100644
--- a/drivers/hwtracing/stm/heartbeat.c
+++ b/drivers/hwtracing/stm/heartbeat.c
@@ -81,10 +81,8 @@ static int stm_heartbeat_init(void)
 		stm_heartbeat[i].data.type	= STM_USER;
 		stm_heartbeat[i].data.link	= stm_heartbeat_link;
 		stm_heartbeat[i].data.unlink	= stm_heartbeat_unlink;
-		hrtimer_init(&stm_heartbeat[i].hrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_ABS);
-		stm_heartbeat[i].hrtimer.function =
-			stm_heartbeat_hrtimer_handler;
+		hrtimer_setup(&stm_heartbeat[i].hrtimer, stm_heartbeat_hrtimer_handler,
+			      CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 		ret = stm_source_register_device(NULL, &stm_heartbeat[i].data);
 		if (ret)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 30/45] drm/amdgpu: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (28 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 29/45] stm class: heartbeat: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 31/45] drm/i915/huc: " Nam Cao
                   ` (15 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Alex Deucher

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
index 03308261f894..7507d9443028 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c
@@ -188,8 +188,8 @@ static int amdgpu_vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 	amdgpu_crtc->connector = NULL;
 	amdgpu_crtc->vsync_timer_enabled = AMDGPU_IRQ_STATE_DISABLE;
 
-	hrtimer_init(&amdgpu_crtc->vblank_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	amdgpu_crtc->vblank_timer.function = &amdgpu_vkms_vblank_simulate;
+	hrtimer_setup(&amdgpu_crtc->vblank_timer, &amdgpu_vkms_vblank_simulate, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 
 	return ret;
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 31/45] drm/i915/huc: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (29 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 30/45] drm/amdgpu: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 32/45] drm/i915/gvt: " Nam Cao
                   ` (14 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/gt/uc/intel_huc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_huc.c b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
index b3cbf85c00cb..00d00c480cc5 100644
--- a/drivers/gpu/drm/i915/gt/uc/intel_huc.c
+++ b/drivers/gpu/drm/i915/gt/uc/intel_huc.c
@@ -231,8 +231,8 @@ static void delayed_huc_load_init(struct intel_huc *huc)
 			   sw_fence_dummy_notify);
 	i915_sw_fence_commit(&huc->delayed_load.fence);
 
-	hrtimer_init(&huc->delayed_load.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	huc->delayed_load.timer.function = huc_delayed_load_timer_callback;
+	hrtimer_setup(&huc->delayed_load.timer, huc_delayed_load_timer_callback, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 }
 
 static void delayed_huc_load_fini(struct intel_huc *huc)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 32/45] drm/i915/gvt: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (30 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 31/45] drm/i915/huc: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 33/45] drm/i915/perf: " Nam Cao
                   ` (13 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/gvt/display.c      | 3 +--
 drivers/gpu/drm/i915/gvt/sched_policy.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/display.c b/drivers/gpu/drm/i915/gvt/display.c
index 95570cabdf27..f668cd9487f1 100644
--- a/drivers/gpu/drm/i915/gvt/display.c
+++ b/drivers/gpu/drm/i915/gvt/display.c
@@ -581,8 +581,7 @@ static int setup_virtual_dp_monitor(struct intel_vgpu *vgpu, int port_num,
 	vgpu->display.port_num = port_num;
 
 	/* Init hrtimer based on default refresh rate */
-	hrtimer_init(&vblank_timer->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	vblank_timer->timer.function = vblank_timer_fn;
+	hrtimer_setup(&vblank_timer->timer, vblank_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	vblank_timer->vrefresh_k = port->vrefresh_k;
 	vblank_timer->period = DIV64_U64_ROUND_CLOSEST(NSEC_PER_SEC * MSEC_PER_SEC, vblank_timer->vrefresh_k);
 
diff --git a/drivers/gpu/drm/i915/gvt/sched_policy.c b/drivers/gpu/drm/i915/gvt/sched_policy.c
index c077fb4674f0..9f97f743aa71 100644
--- a/drivers/gpu/drm/i915/gvt/sched_policy.c
+++ b/drivers/gpu/drm/i915/gvt/sched_policy.c
@@ -286,8 +286,7 @@ static int tbs_sched_init(struct intel_gvt *gvt)
 		return -ENOMEM;
 
 	INIT_LIST_HEAD(&data->lru_runq_head);
-	hrtimer_init(&data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	data->timer.function = tbs_timer_fn;
+	hrtimer_setup(&data->timer, tbs_timer_fn, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 	data->period = GVT_DEFAULT_TIME_SLICE;
 	data->gvt = gvt;
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 33/45] drm/i915/perf: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (31 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 32/45] drm/i915/gvt: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 34/45] drm/i915/pmu: " Nam Cao
                   ` (12 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/i915_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 5384d1bb4923..279e266b4b06 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -3359,9 +3359,8 @@ static int i915_oa_stream_init(struct i915_perf_stream *stream,
 		"opening stream oa config uuid=%s\n",
 		  stream->oa_config->uuid);
 
-	hrtimer_init(&stream->poll_check_timer,
-		     CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	stream->poll_check_timer.function = oa_poll_check_timer_cb;
+	hrtimer_setup(&stream->poll_check_timer, oa_poll_check_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	init_waitqueue_head(&stream->poll_wq);
 	spin_lock_init(&stream->oa_buffer.ptr_lock);
 	mutex_init(&stream->lock);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 34/45] drm/i915/pmu: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (32 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 33/45] drm/i915/perf: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 35/45] drm/i915/uncore: " Nam Cao
                   ` (11 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/i915_pmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index e55db036be1b..0ce87f188d11 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -1264,8 +1264,7 @@ void i915_pmu_register(struct drm_i915_private *i915)
 	int ret = -ENOMEM;
 
 	spin_lock_init(&pmu->lock);
-	hrtimer_init(&pmu->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	pmu->timer.function = i915_sample;
+	hrtimer_setup(&pmu->timer, i915_sample, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	pmu->cpuhp.cpu = -1;
 	init_rc6(pmu);
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 35/45] drm/i915/uncore: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (33 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 34/45] drm/i915/pmu: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 36/45] drm/i915/request: " Nam Cao
                   ` (10 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index eed4937c3ff3..bdcfcae83b52 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -2103,8 +2103,7 @@ static int __fw_domain_init(struct intel_uncore *uncore,
 
 	d->mask = BIT(domain_id);
 
-	hrtimer_init(&d->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	d->timer.function = intel_uncore_fw_release_timer;
+	hrtimer_setup(&d->timer, intel_uncore_fw_release_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	uncore->fw_domains |= BIT(domain_id);
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 36/45] drm/i915/request: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (34 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 35/45] drm/i915/uncore: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 37/45] drm/msm: " Nam Cao
                   ` (9 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jani Nikula

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/i915/i915_request.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
index 8f62cfa23fb7..ea0b8e7e4828 100644
--- a/drivers/gpu/drm/i915/i915_request.c
+++ b/drivers/gpu/drm/i915/i915_request.c
@@ -293,8 +293,7 @@ static void __rq_init_watchdog(struct i915_request *rq)
 {
 	struct i915_request_watchdog *wdg = &rq->watchdog;
 
-	hrtimer_init(&wdg->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	wdg->timer.function = __rq_watchdog_expired;
+	hrtimer_setup(&wdg->timer, __rq_watchdog_expired, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 }
 
 static void __rq_arm_watchdog(struct i915_request *rq)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 37/45] drm/msm: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (35 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 36/45] drm/i915/request: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 38/45] drm/vkms: " Nam Cao
                   ` (8 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Rob Clark

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Rob Clark <robdclark@gmail.com>
---
 drivers/gpu/drm/msm/msm_fence.c    | 3 +--
 drivers/gpu/drm/msm/msm_io_utils.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c
index 1a5d4f1c8b42..d41e5a6bbee0 100644
--- a/drivers/gpu/drm/msm/msm_fence.c
+++ b/drivers/gpu/drm/msm/msm_fence.c
@@ -65,8 +65,7 @@ msm_fence_context_alloc(struct drm_device *dev, volatile uint32_t *fenceptr,
 	fctx->completed_fence = fctx->last_fence;
 	*fctx->fenceptr = fctx->last_fence;
 
-	hrtimer_init(&fctx->deadline_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
-	fctx->deadline_timer.function = deadline_timer;
+	hrtimer_setup(&fctx->deadline_timer, deadline_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 	kthread_init_work(&fctx->deadline_work, deadline_work);
 
diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c
index afedd61c3e28..a6efe1eac271 100644
--- a/drivers/gpu/drm/msm/msm_io_utils.c
+++ b/drivers/gpu/drm/msm/msm_io_utils.c
@@ -135,8 +135,7 @@ void msm_hrtimer_work_init(struct msm_hrtimer_work *work,
 			   clockid_t clock_id,
 			   enum hrtimer_mode mode)
 {
-	hrtimer_init(&work->timer, clock_id, mode);
-	work->timer.function = msm_hrtimer_worktimer;
+	hrtimer_setup(&work->timer, msm_hrtimer_worktimer, clock_id, mode);
 	work->worker = worker;
 	kthread_init_work(&work->work, fn);
 }
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 38/45] drm/vkms: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (36 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 37/45] drm/msm: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 39/45] drm/xe/oa: " Nam Cao
                   ` (7 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Rodrigo Siqueira

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 28a57ae109fc..ae4e36bc337c 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -64,8 +64,8 @@ static int vkms_enable_vblank(struct drm_crtc *crtc)
 	struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
 	struct vkms_output *out = drm_crtc_to_vkms_output(crtc);
 
-	hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	out->vblank_hrtimer.function = &vkms_vblank_simulate;
+	hrtimer_setup(&out->vblank_hrtimer, &vkms_vblank_simulate, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	out->period_ns = ktime_set(0, vblank->framedur_ns);
 	hrtimer_start(&out->vblank_hrtimer, out->period_ns, HRTIMER_MODE_REL);
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 39/45] drm/xe/oa: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (37 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 38/45] drm/vkms: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 40/45] drm/vmwgfx: " Nam Cao
                   ` (6 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Lucas De Marchi, Zack Rusin

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.

Acked-by: Lucas De Marchi <lucas.demarchi@intel.com>
Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/xe/xe_oa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
index eeb96b5f49e2..7fbedd83ccfd 100644
--- a/drivers/gpu/drm/xe/xe_oa.c
+++ b/drivers/gpu/drm/xe/xe_oa.c
@@ -1763,8 +1763,8 @@ static int xe_oa_stream_init(struct xe_oa_stream *stream,
 
 	WRITE_ONCE(u->exclusive_stream, stream);
 
-	hrtimer_init(&stream->poll_check_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	stream->poll_check_timer.function = xe_oa_poll_check_timer_cb;
+	hrtimer_setup(&stream->poll_check_timer, xe_oa_poll_check_timer_cb, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	init_waitqueue_head(&stream->poll_wq);
 
 	spin_lock_init(&stream->oa_buffer.ptr_lock);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 40/45] drm/vmwgfx: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (38 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 39/45] drm/xe/oa: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 41/45] virtio: mem: " Nam Cao
                   ` (5 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c
index 8651b788e98b..aec774fa4d7b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c
@@ -290,8 +290,8 @@ vmw_vkms_enable_vblank(struct drm_crtc *crtc)
 
 	drm_calc_timestamping_constants(crtc, &crtc->mode);
 
-	hrtimer_init(&du->vkms.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	du->vkms.timer.function = &vmw_vkms_vblank_simulate;
+	hrtimer_setup(&du->vkms.timer, &vmw_vkms_vblank_simulate, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	du->vkms.period_ns = ktime_set(0, vblank->framedur_ns);
 	hrtimer_start(&du->vkms.timer, du->vkms.period_ns, HRTIMER_MODE_REL);
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 41/45] virtio: mem: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (39 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 40/45] drm/vmwgfx: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 42/45] RDMA: " Nam Cao
                   ` (4 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Michael S. Tsirkin

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
---
 drivers/virtio/virtio_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 8a294b9cbcf6..56d0dbe62163 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -2950,8 +2950,8 @@ static int virtio_mem_probe(struct virtio_device *vdev)
 	mutex_init(&vm->hotplug_mutex);
 	INIT_LIST_HEAD(&vm->next);
 	spin_lock_init(&vm->removal_lock);
-	hrtimer_init(&vm->retry_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	vm->retry_timer.function = virtio_mem_timer_expired;
+	hrtimer_setup(&vm->retry_timer, virtio_mem_timer_expired, CLOCK_MONOTONIC,
+		      HRTIMER_MODE_REL);
 	vm->retry_timer_ms = VIRTIO_MEM_RETRY_TIMER_MIN_MS;
 	vm->in_kdump = is_kdump_kernel();
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 42/45] RDMA: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (40 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 41/45] virtio: mem: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-05 10:46 ` [PATCH v2 43/45] pwm: gpio: " Nam Cao
                   ` (3 subsequent siblings)
  45 siblings, 0 replies; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Jason Gunthorpe

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
---
 drivers/infiniband/hw/hfi1/init.c | 5 ++---
 drivers/infiniband/sw/rdmavt/qp.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index cbac4a442d9e..d6fbd9c2b8b4 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -635,12 +635,11 @@ void hfi1_init_pportdata(struct pci_dev *pdev, struct hfi1_pportdata *ppd,
 	spin_lock_init(&ppd->cca_timer_lock);
 
 	for (i = 0; i < OPA_MAX_SLS; i++) {
-		hrtimer_init(&ppd->cca_timer[i].hrtimer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL);
 		ppd->cca_timer[i].ppd = ppd;
 		ppd->cca_timer[i].sl = i;
 		ppd->cca_timer[i].ccti = 0;
-		ppd->cca_timer[i].hrtimer.function = cca_timer_fn;
+		hrtimer_setup(&ppd->cca_timer[i].hrtimer, cca_timer_fn, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL);
 	}
 
 	ppd->cc_max_table_entries = IB_CC_TABLE_CAP_DEFAULT;
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index e6203e26cc06..614009fb9632 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -1107,9 +1107,8 @@ int rvt_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init_attr,
 		}
 		/* initialize timers needed for rc qp */
 		timer_setup(&qp->s_timer, rvt_rc_timeout, 0);
-		hrtimer_init(&qp->s_rnr_timer, CLOCK_MONOTONIC,
-			     HRTIMER_MODE_REL);
-		qp->s_rnr_timer.function = rvt_rc_rnr_retry;
+		hrtimer_setup(&qp->s_rnr_timer, rvt_rc_rnr_retry, CLOCK_MONOTONIC,
+			      HRTIMER_MODE_REL);
 
 		/*
 		 * Driver needs to set up it's private QP structure and do any
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 43/45] pwm: gpio: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (41 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 42/45] RDMA: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-07 15:44   ` Uwe Kleine-König
  2025-02-05 10:46 ` [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: " Nam Cao
                   ` (2 subsequent siblings)
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Uwe Kleine-König

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: "Uwe Kleine-König" <ukleinek@kernel.org>
---
 drivers/pwm/pwm-gpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-gpio.c b/drivers/pwm/pwm-gpio.c
index 9f8884ac7504..5f4edeb394a9 100644
--- a/drivers/pwm/pwm-gpio.c
+++ b/drivers/pwm/pwm-gpio.c
@@ -207,13 +207,12 @@ static int pwm_gpio_probe(struct platform_device *pdev)
 	chip->ops = &pwm_gpio_ops;
 	chip->atomic = true;
 
-	hrtimer_init(&gpwm->gpio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+	hrtimer_setup(&gpwm->gpio_timer, pwm_gpio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+
 	ret = devm_add_action_or_reset(dev, pwm_gpio_disable_hrtimer, gpwm);
 	if (ret)
 		return ret;
 
-	gpwm->gpio_timer.function = pwm_gpio_timer;
-
 	ret = pwmchip_add(chip);
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "could not add pwmchip\n");
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (42 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 43/45] pwm: gpio: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-10  8:28   ` Takashi Iwai
  2025-02-05 10:46 ` [PATCH v2 45/45] ALSA: " Nam Cao
  2025-02-06  9:56 ` [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Alexander Shishkin
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Takashi Iwai

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Takashi Iwai <tiwai@suse.com>
---
 sound/soc/fsl/imx-pcm-fiq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 3391430e4253..83de3ae33691 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -185,8 +185,7 @@ static int snd_imx_open(struct snd_soc_component *component,
 
 	atomic_set(&iprtd->playing, 0);
 	atomic_set(&iprtd->capturing, 0);
-	hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	iprtd->hrt.function = snd_hrtimer_callback;
+	hrtimer_setup(&iprtd->hrt, snd_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	ret = snd_pcm_hw_constraint_integer(substream->runtime,
 			SNDRV_PCM_HW_PARAM_PERIODS);
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* [PATCH v2 45/45] ALSA: Switch to use hrtimer_setup()
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (43 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: " Nam Cao
@ 2025-02-05 10:46 ` Nam Cao
  2025-02-10  8:29   ` Takashi Iwai
  2025-02-06  9:56 ` [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Alexander Shishkin
  45 siblings, 1 reply; 60+ messages in thread
From: Nam Cao @ 2025-02-05 10:46 UTC (permalink / raw)
  To: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Zack Rusin, Takashi Iwai

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.

Acked-by: Zack Rusin <zack.rusin@broadcom.com>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Cc: Takashi Iwai <tiwai@suse.com>
---
 sound/core/hrtimer.c      | 3 +--
 sound/drivers/dummy.c     | 3 +--
 sound/drivers/pcsp/pcsp.c | 3 +--
 sound/sh/sh_dac_audio.c   | 3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index 147c1fea4708..e9c60dce59fb 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -66,9 +66,8 @@ static int snd_hrtimer_open(struct snd_timer *t)
 	stime = kzalloc(sizeof(*stime), GFP_KERNEL);
 	if (!stime)
 		return -ENOMEM;
-	hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	stime->timer = t;
-	stime->hrt.function = snd_hrtimer_callback;
+	hrtimer_setup(&stime->hrt, snd_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	t->private_data = stime;
 	return 0;
 }
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 8f5df9b3aaaa..c1a3efb633c5 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -457,8 +457,7 @@ static int dummy_hrtimer_create(struct snd_pcm_substream *substream)
 	if (!dpcm)
 		return -ENOMEM;
 	substream->runtime->private_data = dpcm;
-	hrtimer_init(&dpcm->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
-	dpcm->timer.function = dummy_hrtimer_callback;
+	hrtimer_setup(&dpcm->timer, dummy_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
 	dpcm->substream = substream;
 	atomic_set(&dpcm->running, 0);
 	return 0;
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 78c9b1c7590f..e8482c2290c3 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -103,8 +103,7 @@ static int snd_card_pcsp_probe(int devnum, struct device *dev)
 	if (devnum != 0)
 		return -EINVAL;
 
-	hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	pcsp_chip.timer.function = pcsp_do_timer;
+	hrtimer_setup(&pcsp_chip.timer, pcsp_do_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	err = snd_devm_card_new(dev, index, id, THIS_MODULE, 0, &card);
 	if (err < 0)
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index 3f5422145c5e..84a4b17a0cc2 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -312,8 +312,7 @@ static int snd_sh_dac_create(struct snd_card *card,
 
 	chip->card = card;
 
-	hrtimer_init(&chip->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	chip->hrtimer.function = sh_dac_audio_timer;
+	hrtimer_setup(&chip->hrtimer, sh_dac_audio_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 
 	dac_audio_reset(chip);
 	chip->rate = 8000;
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 14/45] rtc: class: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 14/45] rtc: class: " Nam Cao
@ 2025-02-05 11:36   ` Alexandre Belloni
  0 siblings, 0 replies; 60+ messages in thread
From: Alexandre Belloni @ 2025-02-05 11:36 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin

On 05/02/2025 11:46:02+0100, Nam Cao wrote:
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>

Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/rtc/class.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index e31fa0ad127e..b88cd4fb295b 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c
> @@ -240,8 +240,7 @@ static struct rtc_device *rtc_allocate_device(void)
>  	/* Init uie timer */
>  	rtc_timer_init(&rtc->uie_rtctimer, rtc_uie_update_irq, rtc);
>  	/* Init pie timer */
> -	hrtimer_init(&rtc->pie_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	rtc->pie_timer.function = rtc_pie_update_irq;
> +	hrtimer_setup(&rtc->pie_timer, rtc_pie_update_irq, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>  	rtc->pie_enabled = 0;
>  
>  	set_bit(RTC_FEATURE_ALARM, rtc->features);
> -- 
> 2.39.5
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 26/45] Input: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 26/45] Input: " Nam Cao
@ 2025-02-05 15:30   ` Dmitry Torokhov
  0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Torokhov @ 2025-02-05 15:30 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin

On Wed, Feb 05, 2025 at 11:46:14AM +0100, Nam Cao wrote:
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 27/45] iio: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 27/45] iio: " Nam Cao
@ 2025-02-05 16:21   ` Jonathan Cameron
  0 siblings, 0 replies; 60+ messages in thread
From: Jonathan Cameron @ 2025-02-05 16:21 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin, linux-iio

On Wed,  5 Feb 2025 11:46:15 +0100
Nam Cao <namcao@linutronix.de> wrote:

> 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.
> 
> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>

+CC linux-iio

> ---
>  drivers/iio/adc/ti-tsc2046.c           | 4 +---
>  drivers/iio/trigger/iio-trig-hrtimer.c | 4 ++--
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/adc/ti-tsc2046.c b/drivers/iio/adc/ti-tsc2046.c
> index 7dde5713973f..49560059f4b7 100644
> --- a/drivers/iio/adc/ti-tsc2046.c
> +++ b/drivers/iio/adc/ti-tsc2046.c
> @@ -812,9 +812,7 @@ static int tsc2046_adc_probe(struct spi_device *spi)
>  
>  	spin_lock_init(&priv->state_lock);
>  	priv->state = TSC2046_STATE_SHUTDOWN;
> -	hrtimer_init(&priv->trig_timer, CLOCK_MONOTONIC,
> -		     HRTIMER_MODE_REL_SOFT);
> -	priv->trig_timer.function = tsc2046_adc_timer;
> +	hrtimer_setup(&priv->trig_timer, tsc2046_adc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
>  
>  	ret = devm_iio_trigger_register(dev, trig);
>  	if (ret) {
> diff --git a/drivers/iio/trigger/iio-trig-hrtimer.c b/drivers/iio/trigger/iio-trig-hrtimer.c
> index 716c795d08fb..82c72baccb62 100644
> --- a/drivers/iio/trigger/iio-trig-hrtimer.c
> +++ b/drivers/iio/trigger/iio-trig-hrtimer.c
> @@ -145,8 +145,8 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name)
>  	trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops;
>  	trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups;
>  
> -	hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
> -	trig_info->timer.function = iio_hrtimer_trig_handler;
> +	hrtimer_setup(&trig_info->timer, iio_hrtimer_trig_handler, CLOCK_MONOTONIC,
> +		      HRTIMER_MODE_REL_HARD);
>  
>  	trig_info->sampling_frequency[0] = HRTIMER_DEFAULT_SAMPLING_FREQUENCY;
>  	trig_info->period = NSEC_PER_SEC / trig_info->sampling_frequency[0];


^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
  2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
                   ` (44 preceding siblings ...)
  2025-02-05 10:46 ` [PATCH v2 45/45] ALSA: " Nam Cao
@ 2025-02-06  9:56 ` Alexander Shishkin
  2025-02-06 16:32   ` Thomas Gleixner
  45 siblings, 1 reply; 60+ messages in thread
From: Alexander Shishkin @ 2025-02-06  9:56 UTC (permalink / raw)
  To: Nam Cao, Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alex Deucher, Jani Nikula,
	Rob Clark, Lucas De Marchi, Zack Rusin, Michael S. Tsirkin,
	Jason Gunthorpe, Uwe Kleine-König, Takashi Iwai,
	alexander.shishkin

Nam Cao <namcao@linutronix.de> writes:

> 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

Link to v2 of part 1 is missing. It's also somehow not in my notmuch
datadase (looked for "hrtimers: Switch to new hrtimer interface
functions" -- took a guess based on v1) and is not googleable. It's kind
of important for reviewing this one. v1 did have the links to the other
parts, at least.

Anyway, sorry for being that guy, but can you fix this?

Thanks,
--
Alex

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
  2025-02-06  9:56 ` [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Alexander Shishkin
@ 2025-02-06 16:32   ` Thomas Gleixner
  2025-02-07 11:08     ` Alexander Shishkin
  0 siblings, 1 reply; 60+ messages in thread
From: Thomas Gleixner @ 2025-02-06 16:32 UTC (permalink / raw)
  To: Alexander Shishkin, Nam Cao, Anna-Maria Behnsen,
	Frederic Weisbecker, linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alex Deucher, Jani Nikula,
	Rob Clark, Lucas De Marchi, Zack Rusin, Michael S. Tsirkin,
	Jason Gunthorpe, Uwe Kleine-König, Takashi Iwai,
	alexander.shishkin

On Thu, Feb 06 2025 at 11:56, Alexander Shishkin wrote:
> Nam Cao <namcao@linutronix.de> writes:
>
>> 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
>
> Link to v2 of part 1 is missing. It's also somehow not in my notmuch
> datadase (looked for "hrtimers: Switch to new hrtimer interface
> functions" -- took a guess based on v1) and is not googleable. It's kind
> of important for reviewing this one. v1 did have the links to the other
> parts, at least.

It's archived and searchable on lore:

  https://lore.kernel.org/all/?q=hrtimers%3A+Consolidate+hrtimer+initialization+-+Part+1

and the third google result points to:

https://patchwork.kernel.org/project/linux-wireless/patch/20241031-hrtimer_setup_p1_v2-v2-0-23400656575a@linutronix.de/

That part 1 series has been applied and is in mainline already.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
  2025-02-06 16:32   ` Thomas Gleixner
@ 2025-02-07 11:08     ` Alexander Shishkin
  2025-02-07 12:58       ` Thomas Gleixner
  0 siblings, 1 reply; 60+ messages in thread
From: Alexander Shishkin @ 2025-02-07 11:08 UTC (permalink / raw)
  To: Thomas Gleixner, Nam Cao, Anna-Maria Behnsen, Frederic Weisbecker,
	linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alex Deucher, Jani Nikula,
	Rob Clark, Lucas De Marchi, Zack Rusin, Michael S. Tsirkin,
	Jason Gunthorpe, Uwe Kleine-König, Takashi Iwai,
	alexander.shishkin

Thomas Gleixner <tglx@linutronix.de> writes:

> On Thu, Feb 06 2025 at 11:56, Alexander Shishkin wrote:
>> Nam Cao <namcao@linutronix.de> writes:
>>
>>> 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
>>
>> Link to v2 of part 1 is missing. It's also somehow not in my notmuch
>> datadase (looked for "hrtimers: Switch to new hrtimer interface
>> functions" -- took a guess based on v1) and is not googleable. It's kind
>> of important for reviewing this one. v1 did have the links to the other
>> parts, at least.
>
> It's archived and searchable on lore:
>
>   https://lore.kernel.org/all/?q=hrtimers%3A+Consolidate+hrtimer+initialization+-+Part+1
>
> and the third google result points to:
>
> https://patchwork.kernel.org/project/linux-wireless/patch/20241031-hrtimer_setup_p1_v2-v2-0-23400656575a@linutronix.de/

In the only other version that I was CC'd on, Part 1's subject line was:
"hrtimers: Switch to new hrtimer interface functions", hence the
confusion.

> That part 1 series has been applied and is in mainline already.

Yes, I was grepping for the function that got removed. Low caffeine
level in the bloodstream or something.

But now that it's in mainline, I can pick up the patch intended for me
or just ack it. Any preferences?

Thanks,
--
Alex

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
  2025-02-07 11:08     ` Alexander Shishkin
@ 2025-02-07 12:58       ` Thomas Gleixner
  2025-02-07 13:13         ` Alexander Shishkin
  0 siblings, 1 reply; 60+ messages in thread
From: Thomas Gleixner @ 2025-02-07 12:58 UTC (permalink / raw)
  To: Alexander Shishkin, Nam Cao, Anna-Maria Behnsen,
	Frederic Weisbecker, linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alex Deucher, Jani Nikula,
	Rob Clark, Lucas De Marchi, Zack Rusin, Michael S. Tsirkin,
	Jason Gunthorpe, Uwe Kleine-König, Takashi Iwai,
	alexander.shishkin

On Fri, Feb 07 2025 at 13:08, Alexander Shishkin wrote:
> Thomas Gleixner <tglx@linutronix.de> writes:
>> That part 1 series has been applied and is in mainline already.
>
> Yes, I was grepping for the function that got removed. Low caffeine
> level in the bloodstream or something.
>
> But now that it's in mainline, I can pick up the patch intended for me
> or just ack it. Any preferences?

Just pick it up through your tree. I'm only going to collect the
leftovers.

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4
  2025-02-07 12:58       ` Thomas Gleixner
@ 2025-02-07 13:13         ` Alexander Shishkin
  0 siblings, 0 replies; 60+ messages in thread
From: Alexander Shishkin @ 2025-02-07 13:13 UTC (permalink / raw)
  To: Thomas Gleixner, Nam Cao, Anna-Maria Behnsen, Frederic Weisbecker,
	linux-kernel
  Cc: Nam Cao, Greg Kroah-Hartman, Martin K. Petersen,
	Alexandre Belloni, Rafael J. Wysocki, Linus Walleij,
	Sebastian Reichel, Will Deacon, Jon Mason, Jaehoon Chung,
	Hans Verkuil, Jassi Brar, Pavel Machek, Dmitry Torokhov,
	Jonathan Cameron, Andi Shyti, Alex Deucher, Jani Nikula,
	Rob Clark, Lucas De Marchi, Zack Rusin, Michael S. Tsirkin,
	Jason Gunthorpe, Uwe Kleine-König, Takashi Iwai,
	alexander.shishkin

Thomas Gleixner <tglx@linutronix.de> writes:

> On Fri, Feb 07 2025 at 13:08, Alexander Shishkin wrote:
>> Thomas Gleixner <tglx@linutronix.de> writes:
>>> That part 1 series has been applied and is in mainline already.
>>
>> Yes, I was grepping for the function that got removed. Low caffeine
>> level in the bloodstream or something.
>>
>> But now that it's in mainline, I can pick up the patch intended for me
>> or just ack it. Any preferences?
>
> Just pick it up through your tree. I'm only going to collect the
> leftovers.

Wilco.

Thanks,
--
Alex

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 43/45] pwm: gpio: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 43/45] pwm: gpio: " Nam Cao
@ 2025-02-07 15:44   ` Uwe Kleine-König
  0 siblings, 0 replies; 60+ messages in thread
From: Uwe Kleine-König @ 2025-02-07 15:44 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin

[-- Attachment #1: Type: text/plain, Size: 558 bytes --]

Hello,

On Wed, Feb 05, 2025 at 11:46:31AM +0100, Nam Cao wrote:
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: "Uwe Kleine-König" <ukleinek@kernel.org>

Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
.

Thanks
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 17/45] power: supply: ab8500_chargalg: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 17/45] power: supply: ab8500_chargalg: " Nam Cao
@ 2025-02-08 17:42   ` Sebastian Reichel
  0 siblings, 0 replies; 60+ messages in thread
From: Sebastian Reichel @ 2025-02-08 17:42 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Linus Walleij, Zack Rusin

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

Hi,

On Wed, Feb 05, 2025 at 11:46:05AM +0100, Nam Cao wrote:
> 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.
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  drivers/power/supply/ab8500_chargalg.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/ab8500_chargalg.c b/drivers/power/supply/ab8500_chargalg.c
> index 7a8d1feb8e90..dc6c8b0dd1cf 100644
> --- a/drivers/power/supply/ab8500_chargalg.c
> +++ b/drivers/power/supply/ab8500_chargalg.c
> @@ -1787,13 +1787,12 @@ static int ab8500_chargalg_probe(struct platform_device *pdev)
>  	psy_cfg.drv_data = di;
>  
>  	/* Initilialize safety timer */
> -	hrtimer_init(&di->safety_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	di->safety_timer.function = ab8500_chargalg_safety_timer_expired;
> +	hrtimer_setup(&di->safety_timer, ab8500_chargalg_safety_timer_expired, CLOCK_MONOTONIC,
> +		      HRTIMER_MODE_REL);
>  
>  	/* Initilialize maintenance timer */
> -	hrtimer_init(&di->maintenance_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	di->maintenance_timer.function =
> -		ab8500_chargalg_maintenance_timer_expired;
> +	hrtimer_setup(&di->maintenance_timer, ab8500_chargalg_maintenance_timer_expired,
> +		      CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>  
>  	/* Init work for chargalg */
>  	INIT_DEFERRABLE_WORK(&di->chargalg_periodic_work,
> -- 
> 2.39.5
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 18/45] power: reset: ltc2952-poweroff: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 18/45] power: reset: ltc2952-poweroff: " Nam Cao
@ 2025-02-08 17:42   ` Sebastian Reichel
  0 siblings, 0 replies; 60+ messages in thread
From: Sebastian Reichel @ 2025-02-08 17:42 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

Hi,

On Wed, Feb 05, 2025 at 11:46:06AM +0100, Nam Cao wrote:
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Sebastian Reichel <sre@kernel.org>

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>

Greetings,

-- Sebastian

> ---
>  drivers/power/reset/ltc2952-poweroff.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/reset/ltc2952-poweroff.c b/drivers/power/reset/ltc2952-poweroff.c
> index 1a6fc8d38e20..90c664d344d0 100644
> --- a/drivers/power/reset/ltc2952-poweroff.c
> +++ b/drivers/power/reset/ltc2952-poweroff.c
> @@ -162,11 +162,11 @@ static void ltc2952_poweroff_default(struct ltc2952_poweroff *data)
>  	data->wde_interval = 300L * NSEC_PER_MSEC;
>  	data->trigger_delay = ktime_set(2, 500L * NSEC_PER_MSEC);
>  
> -	hrtimer_init(&data->timer_trigger, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	data->timer_trigger.function = ltc2952_poweroff_timer_trigger;
> +	hrtimer_setup(&data->timer_trigger, ltc2952_poweroff_timer_trigger, CLOCK_MONOTONIC,
> +		      HRTIMER_MODE_REL);
>  
> -	hrtimer_init(&data->timer_wde, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	data->timer_wde.function = ltc2952_poweroff_timer_wde;
> +	hrtimer_setup(&data->timer_wde, ltc2952_poweroff_timer_wde, CLOCK_MONOTONIC,
> +		      HRTIMER_MODE_REL);
>  }
>  
>  static int ltc2952_poweroff_init(struct platform_device *pdev)
> -- 
> 2.39.5
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: " Nam Cao
@ 2025-02-10  8:28   ` Takashi Iwai
  0 siblings, 0 replies; 60+ messages in thread
From: Takashi Iwai @ 2025-02-10  8:28 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin, Takashi Iwai, Mark Brown

On Wed, 05 Feb 2025 11:46:32 +0100,
Nam Cao wrote:
> 
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Takashi Iwai <tiwai@suse.com>

Adding Mark to Cc, as ASoC is managed by him primarily.


thanks,

Takashi

> ---
>  sound/soc/fsl/imx-pcm-fiq.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
> index 3391430e4253..83de3ae33691 100644
> --- a/sound/soc/fsl/imx-pcm-fiq.c
> +++ b/sound/soc/fsl/imx-pcm-fiq.c
> @@ -185,8 +185,7 @@ static int snd_imx_open(struct snd_soc_component *component,
>  
>  	atomic_set(&iprtd->playing, 0);
>  	atomic_set(&iprtd->capturing, 0);
> -	hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> -	iprtd->hrt.function = snd_hrtimer_callback;
> +	hrtimer_setup(&iprtd->hrt, snd_hrtimer_callback, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>  
>  	ret = snd_pcm_hw_constraint_integer(substream->runtime,
>  			SNDRV_PCM_HW_PARAM_PERIODS);
> -- 
> 2.39.5
> 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 45/45] ALSA: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 45/45] ALSA: " Nam Cao
@ 2025-02-10  8:29   ` Takashi Iwai
  0 siblings, 0 replies; 60+ messages in thread
From: Takashi Iwai @ 2025-02-10  8:29 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin, Takashi Iwai

On Wed, 05 Feb 2025 11:46:33 +0100,
Nam Cao wrote:
> 
> 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.
> 
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Takashi Iwai <tiwai@suse.com>

Applied now to for-linus branch of sound.git tree.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: [PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()
  2025-02-05 10:46 ` [PATCH v2 24/45] mailbox: " Nam Cao
@ 2025-03-01 16:43   ` Jassi Brar
  0 siblings, 0 replies; 60+ messages in thread
From: Jassi Brar @ 2025-03-01 16:43 UTC (permalink / raw)
  To: Nam Cao
  Cc: Anna-Maria Behnsen, Frederic Weisbecker, Thomas Gleixner,
	linux-kernel, Zack Rusin

On Wed, Feb 5, 2025 at 4:47 AM Nam Cao <namcao@linutronix.de> wrote:
>
> 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.
>
> Acked-by: Zack Rusin <zack.rusin@broadcom.com>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> Cc: Jassi Brar <jassisinghbrar@gmail.com>
> ---
>  drivers/mailbox/mailbox.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
> index d3d26a2c9895..118beaf447aa 100644
> --- a/drivers/mailbox/mailbox.c
> +++ b/drivers/mailbox/mailbox.c
> @@ -534,9 +534,7 @@ int mbox_controller_register(struct mbox_controller *mbox)
>                         return -EINVAL;
>                 }
>
> -               hrtimer_init(&mbox->poll_hrt, CLOCK_MONOTONIC,
> -                            HRTIMER_MODE_REL);
> -               mbox->poll_hrt.function = txdone_hrtimer;
> +               hrtimer_setup(&mbox->poll_hrt, txdone_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>                 spin_lock_init(&mbox->poll_hrt_lock);
>         }
>
Applied. Thanks.

^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2025-03-01 16:43 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-05 10:45 [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Nam Cao
2025-02-05 10:45 ` [PATCH v2 01/45] USB: chipidea: Switch to use hrtimer_setup() Nam Cao
2025-02-05 10:45 ` [PATCH v2 02/45] usb: dwc2: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 03/45] usb: fotg210-hcd: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 04/45] usb: gadget: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 05/45] usb: ehci: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 06/45] usb: musb: cppi41: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 07/45] usb: typec: tcpm: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 08/45] serial: 8250: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 09/45] serial: amba-pl011: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 10/45] serial: imx: " Nam Cao
2025-02-05 10:45 ` [PATCH v2 11/45] serial: sh-sci: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 12/45] serial: xilinx_uartps: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 13/45] scsi: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 14/45] rtc: class: " Nam Cao
2025-02-05 11:36   ` Alexandre Belloni
2025-02-05 10:46 ` [PATCH v2 15/45] pps: generators: pps_gen_parport: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 16/45] powercap: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 17/45] power: supply: ab8500_chargalg: " Nam Cao
2025-02-08 17:42   ` Sebastian Reichel
2025-02-05 10:46 ` [PATCH v2 18/45] power: reset: ltc2952-poweroff: " Nam Cao
2025-02-08 17:42   ` Sebastian Reichel
2025-02-05 10:46 ` [PATCH v2 19/45] drivers: perf: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 20/45] ntb: ntb_pingpong: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 21/45] mmc: dw_mmc: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 22/45] misc: vcpu_stall_detector: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 23/45] media: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 24/45] mailbox: " Nam Cao
2025-03-01 16:43   ` Jassi Brar
2025-02-05 10:46 ` [PATCH v2 25/45] leds: trigger: pattern: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 26/45] Input: " Nam Cao
2025-02-05 15:30   ` Dmitry Torokhov
2025-02-05 10:46 ` [PATCH v2 27/45] iio: " Nam Cao
2025-02-05 16:21   ` Jonathan Cameron
2025-02-05 10:46 ` [PATCH v2 28/45] i2c: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 29/45] stm class: heartbeat: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 30/45] drm/amdgpu: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 31/45] drm/i915/huc: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 32/45] drm/i915/gvt: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 33/45] drm/i915/perf: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 34/45] drm/i915/pmu: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 35/45] drm/i915/uncore: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 36/45] drm/i915/request: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 37/45] drm/msm: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 38/45] drm/vkms: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 39/45] drm/xe/oa: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 40/45] drm/vmwgfx: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 41/45] virtio: mem: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 42/45] RDMA: " Nam Cao
2025-02-05 10:46 ` [PATCH v2 43/45] pwm: gpio: " Nam Cao
2025-02-07 15:44   ` Uwe Kleine-König
2025-02-05 10:46 ` [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: " Nam Cao
2025-02-10  8:28   ` Takashi Iwai
2025-02-05 10:46 ` [PATCH v2 45/45] ALSA: " Nam Cao
2025-02-10  8:29   ` Takashi Iwai
2025-02-06  9:56 ` [PATCH v2 00/45] Consolidate hrtimer initialization - Part 4 Alexander Shishkin
2025-02-06 16:32   ` Thomas Gleixner
2025-02-07 11:08     ` Alexander Shishkin
2025-02-07 12:58       ` Thomas Gleixner
2025-02-07 13:13         ` Alexander Shishkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox