char: pcmcia: Convert timers to use timer_setup()
PATCH 1/1 char: pcmcia: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly.
Cc Harald Welte <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Jarod Wilson <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Johannes Berg <[email protected]>
Signed-off-by Kees Cook <[email protected]>
--- drivers/char/pcmcia/cm4000_cs.c | 6 +++--- drivers/char/pcmcia/cm4040_cs.c | 7 +++---- drivers/char/pcmcia/synclink_cs.c | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-)
drivers/char/pcmcia/cm4000_cs.c +3 -3
@@ -659,9 +659,9 @@ static void terminate_monitor(struct cm4000_dev *dev)* is already doing that for you. */ -static void monitor_card (unsigned long p) +static void monitor_card (struct timer_list *t) { -struct cm4000_dev *dev = (struct cm4000_dev *) p; +struct cm4000_dev *dev =from_timer (dev, t, timer);unsigned int iobase = dev->p_dev->resource[0 ]->start;unsigned short s;struct ptsreq ptsreq;
@@ -1374,7 +1374,7 @@ static void start_monitor(struct cm4000_dev *dev)DEBUGP (3 , dev,"-> start_monitor\n" );if (!dev->monitor_running) {DEBUGP (5 , dev,"create, init and add timer\n" ); -setup_timer (&dev->timer, monitor_card, (unsigned long )dev); +timer_setup (&dev->timer, monitor_card,0 ); dev->monitor_running =1 ;mod_timer (&dev->timer, jiffies); }else
drivers/char/pcmcia/cm4040_cs.c +3 -4
@@ -104,9 +104,9 @@ static inline unsigned char xinb(unsigned short port)/* poll the device fifo status register. not to be confused with * the poll syscall. */ -static void cm4040_do_poll (unsigned long dummy) +static void cm4040_do_poll (struct timer_list *t) { -struct reader_dev *dev = (struct reader_dev *) dummy; +struct reader_dev *dev =from_timer (dev, t, poll_timer);unsigned int obs =xinb (dev->p_dev->resource[0 ]->start +REG_OFFSET_BUFFER_STATUS );
@@ -465,7 +465,6 @@ static int cm4040_open(struct inode *inode, struct file *filp) link->open =1 ; - dev->poll_timer.data = (unsigned long ) dev;mod_timer (&dev->poll_timer, jiffies +POLL_PERIOD );DEBUGP (2 , dev,"<- cm4040_open (successfully)\n" );
@@ -585,7 +584,7 @@ static int reader_probe(struct pcmcia_device *link)init_waitqueue_head (&dev->poll_wait);init_waitqueue_head (&dev->read_wait);init_waitqueue_head (&dev->write_wait); -setup_timer (&dev->poll_timer, cm4040_do_poll,0 ); +timer_setup (&dev->poll_timer, cm4040_do_poll,0 ); ret =reader_config (link, i);if (ret) {
drivers/char/pcmcia/synclink_cs.c +4 -4
@@ -375,7 +375,7 @@ static void reset_device(MGSLPC_INFO *info);static void hdlc_mode (MGSLPC_INFO *info);static void async_mode (MGSLPC_INFO *info); -static void tx_timeout (unsigned long context); +static void tx_timeout (struct timer_list *t);static int carrier_raised (struct tty_port *port);static void dtr_rts (struct tty_port *port,int onoff);
@@ -1289,7 +1289,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)memset (&info->icount,0 ,sizeof (info->icount)); -setup_timer (&info->tx_timer, tx_timeout, (unsigned long )info); +timer_setup (&info->tx_timer, tx_timeout,0 );/* Allocate and claim adapter resources */ retval =claim_resources (info);
@@ -3846,9 +3846,9 @@ static void trace_block(MGSLPC_INFO *info,const char* data, int count, int xmit)/* HDLC frame time out * update stats and do tx completion processing */ -static void tx_timeout (unsigned long context) +static void tx_timeout (struct timer_list *t) { -MGSLPC_INFO *info = (MGSLPC_INFO *)context; +MGSLPC_INFO *info =from_timer (info, t, tx_timer);unsigned long flags;if (debug_level >=DEBUG_LEVEL_INFO )
Signature · 6 lines
2.7.4 -- Kees Cook Pixel Security