Skip to contentSkip to conversation

Consolidate hrtimer initialization - Part 4

PATCH Applied Nam Cao 10 participants 60 messages Feb 5, 2025 – Mar 1, 2025

Subsystems (61)
DRM drivers Media (V4L/DVB) SCSI USB +57 more subsystems
lore
Share & tools
lore

Nam Cao

author
#0 lore raw

v2 cover Consolidate hrtimer initialization - Part 4

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/[email protected]
- 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 <[email protected]>
Cc: "Martin K. Petersen" <[email protected]>
Cc: Alexandre Belloni <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Sebastian Reichel <[email protected]>
Cc: Will Deacon <[email protected]>
Cc: Jon Mason <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Hans Verkuil <[email protected]>
Cc: Jassi Brar <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Dmitry Torokhov <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: Andi Shyti <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Alex Deucher <[email protected]>
Cc: Jani Nikula <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Lucas De Marchi <[email protected]>
Cc: Zack Rusin <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Takashi Iwai <[email protected]>
---

 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(-)
Signature · 1 line
2.39.5
author
#1 lore raw

PATCH v2 1/45 USB: chipidea: Switch to use hrtimer_setup()

hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.

Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

---
 drivers/usb/chipidea/otg_fsm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/chipidea/otg_fsm.c +1 -2
index c17516c29b63..a093544482d5 100644
@@ -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;
 }
Signature · 1 line
2.39.5
author
#2 lore raw

PATCH v2 2/45 usb: dwc2: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/dwc2/hcd_queue.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/dwc2/hcd_queue.c +1 -2
index 238c6fd50e75..2a542a99ec44 100644
@@ -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;
 
Signature · 1 line
2.39.5
author
#3 lore raw

PATCH v2 3/45 usb: fotg210-hcd: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/fotg210/fotg210-hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/fotg210/fotg210-hcd.c +1 -2
index 3d404d19a205..64c4965a160f 100644
@@ -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);
Signature · 1 line
2.39.5
author
#4 lore raw

PATCH v2 4/45 usb: gadget: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/gadget/function/f_ncm.c | 3 +--
 drivers/usb/gadget/udc/dummy_hcd.c  | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/usb/gadget/function/f_ncm.c +1 -2
index f60576a65ca6..58b0dd575af3 100644
@@ -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,
drivers/usb/gadget/udc/dummy_hcd.c +2 -4
index bda08c5ba7c0..4f1b5db51dda 100644
@@ -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);
Signature · 1 line
2.39.5
author
#5 lore raw

PATCH v2 5/45 usb: ehci: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/host/ehci-hcd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/host/ehci-hcd.c +1 -2
index 6de79ac5e6a4..6d1d190c914d 100644
@@ -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);
Signature · 1 line
2.39.5
author
#6 lore raw

PATCH v2 6/45 usb: musb: cppi41: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/musb/musb_cppi41.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_cppi41.c +2 -2
index 9589243e8951..4cde3abb7006 100644
@@ -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;
Signature · 1 line
2.39.5
author
#7 lore raw

PATCH v2 7/45 usb: typec: tcpm: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/usb/typec/tcpm/tcpm.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +8 -8
index 47be450d2be3..ebe076f01675 100644
@@ -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);
 
Signature · 1 line
2.39.5
author
#8 lore raw

PATCH v2 8/45 serial: 8250: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/tty/serial/8250/8250_bcm7271.c |  3 +--
 drivers/tty/serial/8250/8250_port.c    | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_bcm7271.c +1 -2
index d0b18358859e..742004d63c6f 100644
@@ -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;
drivers/tty/serial/8250/8250_port.c +4 -6
index d7976a21cca9..253bf5c756de 100644
@@ -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;
Signature · 1 line
2.39.5
author
#9 lore raw

PATCH v2 9/45 serial: amba-pl011: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/tty/serial/amba-pl011.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/tty/serial/amba-pl011.c +4 -5
index 04212c823a91..98f178bdbcbe 100644
@@ -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)
Signature · 1 line
2.39.5
author
#10 lore raw

PATCH v2 10/45 serial: imx: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/tty/serial/imx.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/imx.c +4 -4
index 9c59ec128bb4..9a1afe409b98 100644
@@ -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
Signature · 1 line
2.39.5
author
#11 lore raw

PATCH v2 11/45 serial: sh-sci: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/tty/serial/sh-sci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/sh-sci.c +1 -2
index b1ea48f38248..b72c3bc19bfa 100644
@@ -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;
 
Signature · 1 line
2.39.5
author
#12 lore raw

PATCH v2 12/45 serial: xilinx_uartps: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/tty/serial/xilinx_uartps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/xilinx_uartps.c +2 -2
index 92ec51870d1d..efb124a19c01 100644
@@ -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);
Signature · 1 line
2.39.5
author
#13 lore raw

PATCH v2 13/45 scsi: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 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(-)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +1 -3
index 16d085d56e9d..9e42230e42b8 100644
@@ -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;
 
drivers/scsi/lpfc/lpfc_init.c +3 -4
index bcadf11414c8..d1ac1d1cec3c 100644
@@ -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
drivers/scsi/scsi_debug.c +2 -2
index 5ceaa4665e5d..fe5c30bb2639 100644
@@ -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;
Signature · 1 line
2.39.5
author
#14 lore raw

PATCH v2 14/45 rtc: class: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/rtc/class.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/class.c +1 -2
index e31fa0ad127e..b88cd4fb295b 100644
@@ -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);
Signature · 1 line
2.39.5
maintainer Acked-by on v2 14/45
#15 lore raw

Re: [PATCH v2 14/45] rtc: class: Switch to use hrtimer_setup()

Quoted 11 lines · Nam Cao

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.

Quoted 21 lines
---
 drivers/rtc/class.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/class.c +1 -2
index e31fa0ad127e..b88cd4fb295b 100644
@@ -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);
Signature · 1 line
2.39.5
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
author
#16 lore raw

PATCH v2 15/45 pps: generators: pps_gen_parport: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/pps/generators/pps_gen_parport.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pps/generators/pps_gen_parport.c +1 -2
index d46eed159495..f5eeb4dd01ad 100644
@@ -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;
Signature · 1 line
2.39.5
author
#17 lore raw

PATCH v2 16/45 powercap: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/powercap/idle_inject.c       | 3 +--
 drivers/powercap/intel_rapl_common.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/powercap/idle_inject.c +1 -2
index 04c212953ded..5ad7cc438068 100644
@@ -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;
 
drivers/powercap/intel_rapl_common.c +1 -2
index 77d75e1f14a9..cf3d806284c4 100644
@@ -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);
 }
Signature · 1 line
2.39.5
author
#18 lore raw

PATCH v2 17/45 power: supply: ab8500_chargalg: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/power/supply/ab8500_chargalg.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/power/supply/ab8500_chargalg.c +4 -5
index 7a8d1feb8e90..dc6c8b0dd1cf 100644
@@ -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,
Signature · 1 line
2.39.5
Acked-by on v2 17/45
#19 lore raw

Re: [PATCH v2 17/45] power: supply: ab8500_chargalg: Switch to use hrtimer_setup()

Hi,

Quoted 6 lines · Nam Cao

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.

Quoted 6 lines

Patch was created by using Coccinelle.

---

-- Sebastian

Quoted 29 lines
 drivers/power/supply/ab8500_chargalg.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/power/supply/ab8500_chargalg.c +4 -5
index 7a8d1feb8e90..dc6c8b0dd1cf 100644
@@ -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,
Signature · 1 line
2.39.5
author
#20 lore raw

PATCH v2 18/45 power: reset: ltc2952-poweroff: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/power/reset/ltc2952-poweroff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/power/reset/ltc2952-poweroff.c +4 -4
index 1a6fc8d38e20..90c664d344d0 100644
@@ -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)
Signature · 1 line
2.39.5
Acked-by on v2 18/45
#21 lore raw

Re: [PATCH v2 18/45] power: reset: ltc2952-poweroff: Switch to use hrtimer_setup()

Hi,

Quoted 11 lines · Nam Cao

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.

Greetings,

-- Sebastian

Quoted 27 lines
---
 drivers/power/reset/ltc2952-poweroff.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/power/reset/ltc2952-poweroff.c +4 -4
index 1a6fc8d38e20..90c664d344d0 100644
@@ -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)
Signature · 1 line
2.39.5
author
#22 lore raw

PATCH v2 19/45 drivers: perf: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 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(-)
drivers/perf/arm-ccn.c +2 -3
index d5fcea3d4328..1a0d0e1a2263 100644
@@ -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... */
drivers/perf/marvell_cn10k_ddr_pmu.c +2 -2
index 039feded9152..72ac17efd846 100644
@@ -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,
drivers/perf/thunderx2_pmu.c +2 -3
index cadd60221b8f..6ed4707bd6bb 100644
@@ -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);
Signature · 1 line
2.39.5
author
#23 lore raw

PATCH v2 20/45 ntb: ntb_pingpong: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/ntb/test/ntb_pingpong.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/ntb/test/ntb_pingpong.c +1 -2
index 8aeca7914050..1c1c74f4ff2d 100644
@@ -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;
 }
Signature · 1 line
2.39.5
author
#24 lore raw

PATCH v2 21/45 mmc: dw_mmc: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/mmc/host/dw_mmc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/host/dw_mmc.c +1 -2
index 3cbda98d08d2..31f40c04afda 100644
@@ -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)
Signature · 1 line
2.39.5
author
#25 lore raw

PATCH v2 22/45 misc: vcpu_stall_detector: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/misc/vcpu_stall_detector.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/misc/vcpu_stall_detector.c +1 -2
index f0b1fc87490e..26166357b255 100644
@@ -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),
Signature · 1 line
2.39.5
author
#26 lore raw

PATCH v2 23/45 media: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 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(-)
drivers/media/cec/core/cec-pin.c +1 -2
index a70451d99ebc..bebaa40e0eb5 100644
@@ -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;
drivers/media/pci/cx88/cx88-input.c +1 -2
index a04a1d33fadb..b9f2c14d62b4 100644
@@ -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);
drivers/media/platform/chips-media/wave5/wave5-vpu.c +2 -2
index d1320298a0f7..8479dc9c9a8f 100644
@@ -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");
drivers/media/rc/pwm-ir-tx.c +1 -2
index fe368aebbc13..84533fdd61aa 100644
@@ -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;
 	}
 
Signature · 1 line
2.39.5
author
#27 lore raw

PATCH v2 24/45 mailbox: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/mailbox/mailbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mailbox/mailbox.c +1 -3
index d3d26a2c9895..118beaf447aa 100644
@@ -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);
 	}
 
Signature · 1 line
2.39.5
maintainer Applied
#28 lore raw

Re: [PATCH v2 24/45] mailbox: Switch to use hrtimer_setup()

Quoted 21 lines · Nam Cao

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.

---
 drivers/mailbox/mailbox.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mailbox/mailbox.c +0 -0
index d3d26a2c9895..118beaf447aa 100644

drivers/mailbox/mailbox.c int mbox_controller_register(struct mbox_controller *mbox) · line 540

Quoted 10 lines
drivers/mailbox/mailbox.c +1 -3
@@ -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.

author
#29 lore raw

PATCH v2 25/45 leds: trigger: pattern: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/leds/trigger/ledtrig-pattern.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/trigger/ledtrig-pattern.c +2 -2
index aad48c2540fc..a594bd5e2233 100644
@@ -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) {
Signature · 1 line
2.39.5
author
#30 lore raw

PATCH v2 26/45 Input: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/input/joystick/walkera0701.c |  3 +--
 drivers/input/keyboard/gpio_keys.c   | 10 ++++------
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/input/joystick/walkera0701.c +1 -2
index 59eea813f258..15370fb82317 100644
@@ -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) {
drivers/input/keyboard/gpio_keys.c +4 -6
index 5eef66516e37..166cfc67d98b 100644
@@ -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;
Signature · 1 line
2.39.5
maintainer Applied
#31 lore raw

Re: [PATCH v2 26/45] Input: Switch to use hrtimer_setup()

Quoted 11 lines · Nam Cao

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.

Applied, thank you.

Signature · 1 line
Dmitry
author
#32 lore raw

PATCH v2 27/45 iio: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/iio/adc/ti-tsc2046.c           | 4 +---
 drivers/iio/trigger/iio-trig-hrtimer.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/ti-tsc2046.c +1 -3
index 7dde5713973f..49560059f4b7 100644
@@ -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) {
drivers/iio/trigger/iio-trig-hrtimer.c +2 -2
index 716c795d08fb..82c72baccb62 100644
@@ -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];
Signature · 1 line
2.39.5
#33 lore raw

Re: [PATCH v2 27/45] iio: Switch to use hrtimer_setup()

Quoted 11 lines · On Wed, 5 Feb 2025 11:46:15 +0100 Nam Cao <[email protected]> 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.

+CC linux-iio

Quoted 35 lines
---
 drivers/iio/adc/ti-tsc2046.c           | 4 +---
 drivers/iio/trigger/iio-trig-hrtimer.c | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/iio/adc/ti-tsc2046.c +1 -3
index 7dde5713973f..49560059f4b7 100644
@@ -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) {
drivers/iio/trigger/iio-trig-hrtimer.c +2 -2
index 716c795d08fb..82c72baccb62 100644
@@ -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];
author
#34 lore raw

PATCH v2 28/45 i2c: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/i2c/busses/i2c-imx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-imx.c +2 -2
index ee0d25b498cb..9e5d454d8318 100644
@@ -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)
Signature · 1 line
2.39.5
author
#35 lore raw

PATCH v2 29/45 stm class: heartbeat: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/hwtracing/stm/heartbeat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/hwtracing/stm/heartbeat.c +2 -4
index e9496fe97baa..495eb1dc8ac5 100644
@@ -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)
Signature · 1 line
2.39.5
author
#36 lore raw

PATCH v2 30/45 drm/amdgpu: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +2 -2
index 03308261f894..7507d9443028 100644
@@ -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;
 }
Signature · 1 line
2.39.5
author
#37 lore raw

PATCH v2 31/45 drm/i915/huc: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/gt/uc/intel_huc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_huc.c +2 -2
index b3cbf85c00cb..00d00c480cc5 100644
@@ -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)
Signature · 1 line
2.39.5
author
#38 lore raw

PATCH v2 32/45 drm/i915/gvt: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/gvt/display.c      | 3 +--
 drivers/gpu/drm/i915/gvt/sched_policy.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gvt/display.c +1 -2
index 95570cabdf27..f668cd9487f1 100644
@@ -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);
 
drivers/gpu/drm/i915/gvt/sched_policy.c +1 -2
index c077fb4674f0..9f97f743aa71 100644
@@ -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;
 
Signature · 1 line
2.39.5
author
#39 lore raw

PATCH v2 33/45 drm/i915/perf: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/i915_perf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_perf.c +2 -3
index 5384d1bb4923..279e266b4b06 100644
@@ -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);
Signature · 1 line
2.39.5
author
#40 lore raw

PATCH v2 34/45 drm/i915/pmu: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/i915_pmu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_pmu.c +1 -2
index e55db036be1b..0ce87f188d11 100644
@@ -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);
 
Signature · 1 line
2.39.5
author
#41 lore raw

PATCH v2 35/45 drm/i915/uncore: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/intel_uncore.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +1 -2
index eed4937c3ff3..bdcfcae83b52 100644
@@ -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);
 
Signature · 1 line
2.39.5
author
#42 lore raw

PATCH v2 36/45 drm/i915/request: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/i915/i915_request.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_request.c +1 -2
index 8f62cfa23fb7..ea0b8e7e4828 100644
@@ -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)
Signature · 1 line
2.39.5
author
#43 lore raw

PATCH v2 37/45 drm/msm: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/msm/msm_fence.c    | 3 +--
 drivers/gpu/drm/msm/msm_io_utils.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_fence.c +1 -2
index 1a5d4f1c8b42..d41e5a6bbee0 100644
@@ -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);
 
drivers/gpu/drm/msm/msm_io_utils.c +1 -2
index afedd61c3e28..a6efe1eac271 100644
@@ -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);
 }
Signature · 1 line
2.39.5
author
#44 lore raw

PATCH v2 38/45 drm/vkms: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/vkms/vkms_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_crtc.c +2 -2
index 28a57ae109fc..ae4e36bc337c 100644
@@ -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);
 
Signature · 1 line
2.39.5
author
#45 lore raw

PATCH v2 39/45 drm/xe/oa: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/xe/xe_oa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_oa.c +2 -2
index eeb96b5f49e2..7fbedd83ccfd 100644
@@ -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);
Signature · 1 line
2.39.5
author
#46 lore raw

PATCH v2 40/45 drm/vmwgfx: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_vkms.c +2 -2
index 8651b788e98b..aec774fa4d7b 100644
@@ -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);
 
Signature · 1 line
2.39.5
author
#47 lore raw

PATCH v2 41/45 virtio: mem: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/virtio/virtio_mem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/virtio/virtio_mem.c +2 -2
index 8a294b9cbcf6..56d0dbe62163 100644
@@ -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();
 
Signature · 1 line
2.39.5
author
#48 lore raw

PATCH v2 42/45 RDMA: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/infiniband/hw/hfi1/init.c | 5 ++---
 drivers/infiniband/sw/rdmavt/qp.c | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/infiniband/hw/hfi1/init.c +2 -3
index cbac4a442d9e..d6fbd9c2b8b4 100644
@@ -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;
drivers/infiniband/sw/rdmavt/qp.c +2 -3
index e6203e26cc06..614009fb9632 100644
@@ -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
Signature · 1 line
2.39.5
author
#49 lore raw

PATCH v2 43/45 pwm: gpio: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 drivers/pwm/pwm-gpio.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pwm/pwm-gpio.c +2 -3
index 9f8884ac7504..5f4edeb394a9 100644
@@ -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");
Signature · 1 line
2.39.5
#50 lore raw

Re: [PATCH v2 43/45] pwm: gpio: Switch to use hrtimer_setup()

Hello,

Quoted 9 lines · Nam Cao

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.

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

Thanks
Uwe

author
#51 lore raw

PATCH v2 44/45 ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 sound/soc/fsl/imx-pcm-fiq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/imx-pcm-fiq.c +1 -2
index 3391430e4253..83de3ae33691 100644
@@ -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);
Signature · 1 line
2.39.5
#52 lore raw

Re: [PATCH v2 44/45] ASoC: fsl: imx-pcm-fiq: Switch to use hrtimer_setup()

Quoted 4 lines · Nam Cao

hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.

Quoted 8 lines

Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

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

thanks,

Takashi

Quoted 21 lines
---
 sound/soc/fsl/imx-pcm-fiq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/imx-pcm-fiq.c +1 -2
index 3391430e4253..83de3ae33691 100644
@@ -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);
Signature · 1 line
2.39.5
author
#53 lore raw

PATCH v2 45/45 ALSA: Switch to use hrtimer_setup()

In reply to Nam Cao

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.

---
 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(-)
sound/core/hrtimer.c +1 -2
index 147c1fea4708..e9c60dce59fb 100644
@@ -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;
 }
sound/drivers/dummy.c +1 -2
index 8f5df9b3aaaa..c1a3efb633c5 100644
@@ -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;
sound/drivers/pcsp/pcsp.c +1 -2
index 78c9b1c7590f..e8482c2290c3 100644
@@ -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)
sound/sh/sh_dac_audio.c +1 -2
index 3f5422145c5e..84a4b17a0cc2 100644
@@ -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;
Signature · 1 line
2.39.5
#54 lore raw

Re: [PATCH v2 45/45] ALSA: Switch to use hrtimer_setup()

Quoted 4 lines · Nam Cao

hrtimer_setup() takes the callback function pointer as argument and initializes the timer completely.

Quoted 8 lines

Replace hrtimer_init() and the open coded initialization of hrtimer::function with the new setup mechanism.

Patch was created by using Coccinelle.

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

thanks,

Takashi

#55 lore raw
In reply to Nam Cao
Quoted 6 lines · Nam Cao

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.

Quoted 7 lines

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/[email protected]
- 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

#56 lore raw
Quoted 13 lines · Alexander Shishkin
Quoted 11 lines · Nam Cao

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

Quoted 8 lines
Quoted 2 lines

v1 -> v2 https://lore.kernel.org/lkml/[email protected]
- 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/[email protected]/

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

Thanks,

tglx

#57 lore raw
Quoted 23 lines · Thomas Gleixner
Quoted 13 lines · Alexander Shishkin
Quoted 11 lines · Nam Cao

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

Quoted 8 lines
Quoted 2 lines

v1 -> v2 https://lore.kernel.org/lkml/[email protected]
- 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.

Quoted 7 lines

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/[email protected]/

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.

Quoted 1 line

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

#58 lore raw
Quoted 8 lines · Alexander Shishkin
Quoted 1 line · Thomas Gleixner

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

#59 lore raw
Quoted 4 lines · Thomas Gleixner
Quoted 3 lines · Alexander Shishkin
Quoted 1 line · Thomas Gleixner

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

Quoted 8 lines
Quoted 5 lines

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