From 72d7f7e046f2c30151e7a15f61308082b1ce26e8 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Fri, 13 Feb 2004 23:50:11 +0000 Subject: [PATCH] fix compilation with kernels using dynamic hz patch --- comedi/drivers/das16.c | 13 ++++++++----- comedi/drivers/ni_mio_common.c | 6 +++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/comedi/drivers/das16.c b/comedi/drivers/das16.c index 9b09a997..d211d10e 100644 --- a/comedi/drivers/das16.c +++ b/comedi/drivers/das16.c @@ -708,9 +708,12 @@ static comedi_driver driver_das16={ #define DAS16_TIMEOUT 1000 -/* period for timer interrupt in jiffies */ -static const int timer_period = HZ / 20; - +/* Period for timer interrupt in jiffies. It's a function + * to deal with possibility of dynamic HZ patches */ +static inline int timer_period(void) +{ + return HZ / 20; +} struct das16_private_struct { unsigned int ai_unipolar; // unipolar flag @@ -967,7 +970,7 @@ static int das16_cmd_exec(comedi_device *dev,comedi_subdevice *s) if( devpriv->timer_mode ) { devpriv->timer_running = 1; - devpriv->timer.expires = jiffies + timer_period; + devpriv->timer.expires = jiffies + timer_period(); add_timer(&devpriv->timer); devpriv->control_state &= ~DAS16_INTE; }else @@ -1165,7 +1168,7 @@ static void das16_timer_interrupt(unsigned long arg) das16_interrupt(dev); if(devpriv->timer_running) - mod_timer(&devpriv->timer, jiffies + timer_period); + mod_timer(&devpriv->timer, jiffies + timer_period()); } static void das16_interrupt( comedi_device *dev ) diff --git a/comedi/drivers/ni_mio_common.c b/comedi/drivers/ni_mio_common.c index 5718e852..bdd580c7 100644 --- a/comedi/drivers/ni_mio_common.c +++ b/comedi/drivers/ni_mio_common.c @@ -3732,7 +3732,7 @@ static void cs5529_config_write(comedi_device *dev, unsigned int value, unsigned { int i; unsigned short status; - static const int timeout = HZ; + int timeout = HZ; ni_ao_win_outw(dev, ((value >> 16) & 0xff), CAL_ADC_Config_Data_High_Word_67xx); ni_ao_win_outw(dev, (value & 0xffff), CAL_ADC_Config_Data_Low_Word_67xx); @@ -3761,7 +3761,7 @@ static unsigned int cs5529_config_read(comedi_device *dev, unsigned int reg_sele int i; unsigned short status; unsigned int value; - static const int timeout = HZ; + int timeout = HZ; reg_select_bits &= CSCMD_REGISTER_SELECT_MASK; cs5529_command(dev, CSCMD_COMMAND | CSCMD_READ | reg_select_bits); @@ -3788,7 +3788,7 @@ static unsigned int cs5529_config_read(comedi_device *dev, unsigned int reg_sele static int cs5529_do_conversion(comedi_device *dev, unsigned short *data) { int i; - static const int timeout = HZ; + int timeout = HZ; unsigned int status; cs5529_command(dev, CSCMD_COMMAND | CSCMD_SINGLE_CONVERSION); -- 2.26.2