Commit b3da3919 authored by Vaibhav Gupta's avatar Vaibhav Gupta

kernel: spec_core: Update API setup_timer() to timer_setup()

The API was modified in linux-v4.14 at

commit e99e88a9d2b067465adaa9c111ada99a041bef9a ("treewide:
setup_timer() -> timer_setup()")

In software/kernel:
- in 'fd-irq.c', the function fd_tlet() was used for both timer and
  interrupt-tasklet.
- this function  was of type: void (func)(unsigned long).
- both setup_timer() and tasklet_init() use this function-type as one
  of their arguments.
- setup_timer() was updated to timer_setup() which now accepts a
  function of type void (func)(struct timer_list*).

Thus,:
- define fd_tlet_interrupt() of type void (func)(unsigned long).
- define fd_tlet_timer() of type void (func)(struct timer_list*).
- Update fd_tlet() to type void (func)(struct fd_dev*)

After completing their specific jobs, fd_tlet_interrupt() and fd_tlet_timer()
call fd_tlet() to execute the codes common to both.
Signed-off-by: 's avatarVaibhav Gupta <vaibhav.gupta@cern.ch>
parent 4350e3c7
......@@ -388,7 +388,11 @@ int fd_acam_init(struct fd_dev *fd)
fd->temp_ready = 0;
/* Prepare the timely recalibration */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
setup_timer(&fd->temp_timer, fd_update_calibration, (unsigned long)fd);
#else
timer_setup(&fd->temp_timer, fd_update_calibration, 0);
#endif
if (fd_calib_period_s)
mod_timer(&fd->temp_timer, jiffies + HZ * fd_calib_period_s);
......
......@@ -218,9 +218,15 @@ int fd_calibrate_outputs(struct fd_dev *fd)
* Called from a timer any few seconds. It updates the Delay line tap
* according to the measured temperature
*/
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
void fd_update_calibration(unsigned long arg)
{
struct fd_dev *fd = (void *)arg;
#else
void fd_update_calibration(struct timer_list *arg)
{
struct fd_dev *fd = from_timer(fd, arg, temp_timer);
#endif
int ch, fitted, new;
fd_read_temp(fd, 0 /* not verbose */);
......
......@@ -231,10 +231,9 @@ module_param_named(timer_ms, fd_timer_period_ms, int, 0444);
static int fd_timer_period_jiffies; /* converted from ms at init time */
/* This acts as either a timer or an interrupt tasklet */
static void fd_tlet(unsigned long arg)
/* This is an interrupt tasklet but can act as a timer */
static void fd_tlet(struct fd_dev *fd)
{
struct fd_dev *fd = (void *)arg;
struct zio_device *zdev = fd->zdev;
struct zio_channel *chan = zdev->cset[0].chan;
......@@ -256,6 +255,20 @@ static void fd_tlet(unsigned long arg)
}
}
static void fd_tlet_interrupt(unsigned long arg)
{
struct fd_dev *fd = (void *)arg;
fd_tlet(fd);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
static void fd_tlet_timer(struct timer_list *arg)
{
struct fd_dev *fd = from_timer(fd, arg, fifo_timer);
fd_tlet(fd);
}
#endif
/*
* fd_irq_handler
* NOTE: TS_BUF_NOTEMPTY interrupt is level sensitive, it is cleared when
......@@ -305,7 +318,11 @@ int fd_irq_init(struct fd_dev *fd)
* or a custom tasklet (newer). Init both anyways, no harm is done.
*/
if (fd_timer_period_ms) {
setup_timer(&fd->fifo_timer, fd_tlet, (unsigned long)fd);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
setup_timer(&fd->fifo_timer, fd_tlet_interrupt, (unsigned long)fd);
#else
timer_setup(&fd->fifo_timer, fd_tlet_timer, 0);
#endif
fd_timer_period_jiffies = msecs_to_jiffies(fd_timer_period_ms);
dev_dbg(&fd->pdev->dev,"Using a timer for input (%i ms)\n",
jiffies_to_msecs(fd_timer_period_jiffies));
......@@ -316,7 +333,7 @@ int fd_irq_init(struct fd_dev *fd)
/* Disable interrupts */
fd_writel(fd, ~0, FD_REG_EIC_IDR);
tasklet_init(&fd->tlet, fd_tlet, (unsigned long)fd);
tasklet_init(&fd->tlet, fd_tlet_interrupt, (unsigned long)fd);
r = platform_get_resource(fd->pdev, IORESOURCE_IRQ, FD_IRQ);
rv = request_any_context_irq(r->start, fd_irq_handler, 0,
r->name, fd);
......
......@@ -385,7 +385,7 @@ extern void acam_writel(struct fd_dev *fd, int val, int reg);
/* Functions exported by calibrate.c, called within acam.c */
extern int fd_calibrate_outputs(struct fd_dev *fd);
extern void fd_update_calibration(unsigned long arg);
extern void fd_update_calibration(struct timer_list *arg);
extern int fd_calib_period_s;
/* Functions exported by gpio.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment