Skip to content

Commit c69da17

Browse files
covanamKAGA-KOKO
authored andcommitted
iio: 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. Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Acked-by: Zack Rusin <[email protected]> Link: https://lore.kernel.org/all/570792e31b28a94a511c19c6789f2171a6745685.1738746904.git.namcao@linutronix.de
1 parent a9d0ac7 commit c69da17

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/iio/adc/ti-tsc2046.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,9 +812,7 @@ static int tsc2046_adc_probe(struct spi_device *spi)
812812

813813
spin_lock_init(&priv->state_lock);
814814
priv->state = TSC2046_STATE_SHUTDOWN;
815-
hrtimer_init(&priv->trig_timer, CLOCK_MONOTONIC,
816-
HRTIMER_MODE_REL_SOFT);
817-
priv->trig_timer.function = tsc2046_adc_timer;
815+
hrtimer_setup(&priv->trig_timer, tsc2046_adc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
818816

819817
ret = devm_iio_trigger_register(dev, trig);
820818
if (ret) {

drivers/iio/trigger/iio-trig-hrtimer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ static struct iio_sw_trigger *iio_trig_hrtimer_probe(const char *name)
145145
trig_info->swt.trigger->ops = &iio_hrtimer_trigger_ops;
146146
trig_info->swt.trigger->dev.groups = iio_hrtimer_attr_groups;
147147

148-
hrtimer_init(&trig_info->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
149-
trig_info->timer.function = iio_hrtimer_trig_handler;
148+
hrtimer_setup(&trig_info->timer, iio_hrtimer_trig_handler, CLOCK_MONOTONIC,
149+
HRTIMER_MODE_REL_HARD);
150150

151151
trig_info->sampling_frequency[0] = HRTIMER_DEFAULT_SAMPLING_FREQUENCY;
152152
trig_info->period = NSEC_PER_SEC / trig_info->sampling_frequency[0];

0 commit comments

Comments
 (0)