Skip to content

Commit

Permalink
treewide: Switch DEFINE_TIMER callbacks to struct timer_list *
Browse files Browse the repository at this point in the history
This changes all DEFINE_TIMER() callbacks to use a struct timer_list
pointer instead of unsigned long. Since the data argument has already been
removed, none of these callbacks are using their argument currently, so
this renames the argument to "unused".

Done using the following semantic patch:

@match_define_timer@
declarer name DEFINE_TIMER;
identifier _timer, _callback;
@@

 DEFINE_TIMER(_timer, _callback);

@change_callback depends on match_define_timer@
identifier match_define_timer._callback;
type _origtype;
identifier _origarg;
@@

 void
-_callback(_origtype _origarg)
+_callback(struct timer_list *unused)
 { ... }

Signed-off-by: Kees Cook <[email protected]>
  • Loading branch information
kees committed Nov 21, 2017
1 parent 6cc73a0 commit 24ed960
Show file tree
Hide file tree
Showing 39 changed files with 82 additions and 82 deletions.
4 changes: 2 additions & 2 deletions arch/arm/mach-ixp4xx/dsmg600-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ static int power_button_countdown;
/* Must hold the button down for at least this many counts to be processed */
#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */

static void dsmg600_power_handler(unsigned long data);
static void dsmg600_power_handler(struct timer_list *unused);
static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);

static void dsmg600_power_handler(unsigned long data)
static void dsmg600_power_handler(struct timer_list *unused)
{
/* This routine is called twice per second to check the
* state of the power button.
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-ixp4xx/nas100d-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ static int power_button_countdown;
/* Must hold the button down for at least this many counts to be processed */
#define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */

static void nas100d_power_handler(unsigned long data);
static void nas100d_power_handler(struct timer_list *unused);
static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);

static void nas100d_power_handler(unsigned long data)
static void nas100d_power_handler(struct timer_list *unused)
{
/* This routine is called twice per second to check the
* state of the power button.
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/amiga/amisound.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void __init amiga_init_sound(void)
#endif
}

static void nosound( unsigned long ignored );
static void nosound(struct timer_list *unused);
static DEFINE_TIMER(sound_timer, nosound);

void amiga_mksound( unsigned int hz, unsigned int ticks )
Expand Down Expand Up @@ -107,7 +107,7 @@ void amiga_mksound( unsigned int hz, unsigned int ticks )
}


static void nosound( unsigned long ignored )
static void nosound(struct timer_list *unused)
{
/* turn off DMA for audio channel 2 */
custom.dmacon = DMAF_AUD2;
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/mac/macboing.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static unsigned long mac_bell_phasepersample;
* some function protos
*/
static void mac_init_asc( void );
static void mac_nosound( unsigned long );
static void mac_nosound(struct timer_list *);
static void mac_quadra_start_bell( unsigned int, unsigned int, unsigned int );
static void mac_quadra_ring_bell( unsigned long );
static void mac_av_start_bell( unsigned int, unsigned int, unsigned int );
Expand Down Expand Up @@ -216,7 +216,7 @@ void mac_mksound( unsigned int freq, unsigned int length )
/*
* regular ASC: stop whining ..
*/
static void mac_nosound( unsigned long ignored )
static void mac_nosound(struct timer_list *unused)
{
mac_asc_regs[ ASC_ENABLE ] = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/mips/mti-malta/malta-display.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void mips_display_message(const char *str)
}
}

static void scroll_display_message(unsigned long unused);
static void scroll_display_message(struct timer_list *unused);
static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);

static void scroll_display_message(unsigned long unused)
static void scroll_display_message(struct timer_list *unused)
{
mips_display_message(&display_string[display_count++]);
if (display_count == max_display_count)
Expand Down
4 changes: 2 additions & 2 deletions arch/parisc/kernel/pdc_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static int pdc_console_setup(struct console *co, char *options)

#define PDC_CONS_POLL_DELAY (30 * HZ / 1000)

static void pdc_console_poll(unsigned long unused);
static void pdc_console_poll(struct timer_list *unused);
static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
static struct tty_port tty_port;

Expand Down Expand Up @@ -135,7 +135,7 @@ static const struct tty_operations pdc_console_tty_ops = {
.chars_in_buffer = pdc_console_tty_chars_in_buffer,
};

static void pdc_console_poll(unsigned long unused)
static void pdc_console_poll(struct timer_list *unused)
{
int data, count = 0;

Expand Down
8 changes: 4 additions & 4 deletions drivers/atm/idt77105.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ static DEFINE_SPINLOCK(idt77105_priv_lock);
#define PUT(val,reg) dev->ops->phy_put(dev,val,IDT77105_##reg)
#define GET(reg) dev->ops->phy_get(dev,IDT77105_##reg)

static void idt77105_stats_timer_func(unsigned long);
static void idt77105_restart_timer_func(unsigned long);
static void idt77105_stats_timer_func(struct timer_list *);
static void idt77105_restart_timer_func(struct timer_list *);


static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
Expand Down Expand Up @@ -80,7 +80,7 @@ static u16 get_counter(struct atm_dev *dev, int counter)
* a separate copy of the stats allows implementation of
* an ioctl which gathers the stats *without* zero'ing them.
*/
static void idt77105_stats_timer_func(unsigned long dummy)
static void idt77105_stats_timer_func(struct timer_list *unused)
{
struct idt77105_priv *walk;
struct atm_dev *dev;
Expand Down Expand Up @@ -109,7 +109,7 @@ static void idt77105_stats_timer_func(unsigned long dummy)
* interrupts need to be disabled when the cable is pulled out
* to avoid lots of spurious cell error interrupts.
*/
static void idt77105_restart_timer_func(unsigned long dummy)
static void idt77105_restart_timer_func(struct timer_list *unused)
{
struct idt77105_priv *walk;
struct atm_dev *dev;
Expand Down
4 changes: 2 additions & 2 deletions drivers/atm/iphase.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void desc_dbg(IADEV *iadev);
static IADEV *ia_dev[8];
static struct atm_dev *_ia_dev[8];
static int iadev_count;
static void ia_led_timer(unsigned long arg);
static void ia_led_timer(struct timer_list *unused);
static DEFINE_TIMER(ia_timer, ia_led_timer);
static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
Expand Down Expand Up @@ -2432,7 +2432,7 @@ static void ia_update_stats(IADEV *iadev) {
return;
}

static void ia_led_timer(unsigned long arg) {
static void ia_led_timer(struct timer_list *unused) {
unsigned long flags;
static u_char blinking[8] = {0, 0, 0, 0, 0, 0, 0, 0};
u_char i;
Expand Down
16 changes: 8 additions & 8 deletions drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ static int NeedSeek = 0;
static void fd_select_side( int side );
static void fd_select_drive( int drive );
static void fd_deselect( void );
static void fd_motor_off_timer( unsigned long dummy );
static void check_change( unsigned long dummy );
static void fd_motor_off_timer(struct timer_list *unused);
static void check_change(struct timer_list *unused);
static irqreturn_t floppy_irq (int irq, void *dummy);
static void fd_error( void );
static int do_format(int drive, int type, struct atari_format_descr *desc);
Expand All @@ -353,12 +353,12 @@ static void fd_calibrate_done( int status );
static void fd_seek( void );
static void fd_seek_done( int status );
static void fd_rwsec( void );
static void fd_readtrack_check( unsigned long dummy );
static void fd_readtrack_check(struct timer_list *unused);
static void fd_rwsec_done( int status );
static void fd_rwsec_done1(int status);
static void fd_writetrack( void );
static void fd_writetrack_done( int status );
static void fd_times_out( unsigned long dummy );
static void fd_times_out(struct timer_list *unused);
static void finish_fdc( void );
static void finish_fdc_done( int dummy );
static void setup_req_params( int drive );
Expand Down Expand Up @@ -479,7 +479,7 @@ static void fd_deselect( void )
* counts the index signals, which arrive only if one drive is selected.
*/

static void fd_motor_off_timer( unsigned long dummy )
static void fd_motor_off_timer(struct timer_list *unused)
{
unsigned char status;

Expand Down Expand Up @@ -515,7 +515,7 @@ static void fd_motor_off_timer( unsigned long dummy )
* as possible) and keep track of the current state of the write protection.
*/

static void check_change( unsigned long dummy )
static void check_change(struct timer_list *unused)
{
static int drive = 0;

Expand Down Expand Up @@ -966,7 +966,7 @@ static void fd_rwsec( void )
}


static void fd_readtrack_check( unsigned long dummy )
static void fd_readtrack_check(struct timer_list *unused)
{
unsigned long flags, addr, addr2;

Expand Down Expand Up @@ -1237,7 +1237,7 @@ static void fd_writetrack_done( int status )
fd_error();
}

static void fd_times_out( unsigned long dummy )
static void fd_times_out(struct timer_list *unused)
{
atari_disable_irq( IRQ_MFP_FDC );
if (!FloppyIRQHandler) goto end; /* int occurred after timer was fired, but
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/dtlk.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#endif /* TRACING */

static DEFINE_MUTEX(dtlk_mutex);
static void dtlk_timer_tick(unsigned long data);
static void dtlk_timer_tick(struct timer_list *unused);

static int dtlk_major;
static int dtlk_port_lpc;
Expand Down Expand Up @@ -259,7 +259,7 @@ static unsigned int dtlk_poll(struct file *file, poll_table * wait)
return mask;
}

static void dtlk_timer_tick(unsigned long data)
static void dtlk_timer_tick(struct timer_list *unused)
{
TRACE_TEXT(" dtlk_timer_tick");
wake_up_interruptible(&dtlk_process_list);
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/hangcheck-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ __setup("hcheck_dump_tasks", hangcheck_parse_dump_tasks);
/* Last time scheduled */
static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;

static void hangcheck_fire(unsigned long);
static void hangcheck_fire(struct timer_list *);

static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);

static void hangcheck_fire(unsigned long data)
static void hangcheck_fire(struct timer_list *unused)
{
unsigned long long cur_tsc, tsc_diff;

Expand Down
4 changes: 2 additions & 2 deletions drivers/char/nwbutton.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#define __NWBUTTON_C /* Tell the header file who we are */
#include "nwbutton.h"

static void button_sequence_finished (unsigned long parameters);
static void button_sequence_finished(struct timer_list *unused);

static int button_press_count; /* The count of button presses */
/* Times for the end of a sequence */
Expand Down Expand Up @@ -127,7 +127,7 @@ static void button_consume_callbacks (int bpcount)
* any matching registered function callbacks, initiate reboot, etc.).
*/

static void button_sequence_finished (unsigned long parameters)
static void button_sequence_finished(struct timer_list *unused)
{
if (IS_ENABLED(CONFIG_NWBUTTON_REBOOT) &&
button_press_count == reboot_count)
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/nwbutton.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct button_callback {

/* Function prototypes: */

static void button_sequence_finished (unsigned long parameters);
static void button_sequence_finished(struct timer_list *unused);
static irqreturn_t button_handler (int irq, void *dev_id);
int button_init (void);
int button_add_callback (void (*callback) (void), int count);
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static struct fasync_struct *rtc_async_queue;
static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);

#ifdef RTC_IRQ
static void rtc_dropped_irq(unsigned long data);
static void rtc_dropped_irq(struct timer_list *unused);

static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
#endif
Expand Down Expand Up @@ -1171,7 +1171,7 @@ module_exit(rtc_exit);
* for something that requires a steady > 1KHz signal anyways.)
*/

static void rtc_dropped_irq(unsigned long data)
static void rtc_dropped_irq(struct timer_list *unused)
{
unsigned long freq;

Expand Down
2 changes: 1 addition & 1 deletion drivers/input/touchscreen/s3c2410_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static inline bool get_down(unsigned long data0, unsigned long data1)
!(data1 & S3C2410_ADCDAT0_UPDOWN));
}

static void touch_timer_fire(unsigned long data)
static void touch_timer_fire(struct timer_list *unused)
{
unsigned long data0;
unsigned long data1;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/atmel/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,

/* LED trigger */
static int tx_activity;
static void at76_ledtrig_tx_timerfunc(unsigned long data);
static void at76_ledtrig_tx_timerfunc(struct timer_list *unused);
static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
DEFINE_LED_TRIGGER(ledtrig_tx);

static void at76_ledtrig_tx_timerfunc(unsigned long data)
static void at76_ledtrig_tx_timerfunc(struct timer_list *unused)
{
static int tx_lastactivity;

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/speakup/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ static void spkup_write(const u16 *in_buf, int count)
static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);

static void read_all_doc(struct vc_data *vc);
static void cursor_done(u_long data);
static void cursor_done(struct timer_list *unused);
static DEFINE_TIMER(cursor_timer, cursor_done);

static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
Expand Down Expand Up @@ -1682,7 +1682,7 @@ static int speak_highlight(struct vc_data *vc)
return 0;
}

static void cursor_done(u_long data)
static void cursor_done(struct timer_list *unused)
{
struct vc_data *vc = vc_cons[cursor_con].d;
unsigned long flags;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/speakup/synth.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int spk_synth_is_alive_restart(struct spk_synth *synth)
}
EXPORT_SYMBOL_GPL(spk_synth_is_alive_restart);

static void thread_wake_up(u_long data)
static void thread_wake_up(struct timer_list *unused)
{
wake_up_interruptible_all(&speakup_event);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static unsigned detect_isa_irq(void __iomem *);
#endif /* CONFIG_ISA */

#ifndef CONFIG_CYZ_INTR
static void cyz_poll(unsigned long);
static void cyz_poll(struct timer_list *);

/* The Cyclades-Z polling cycle is defined by this variable */
static long cyz_polling_cycle = CZ_DEF_POLL;
Expand Down Expand Up @@ -1214,7 +1214,7 @@ static void cyz_rx_restart(struct timer_list *t)

#else /* CONFIG_CYZ_INTR */

static void cyz_poll(unsigned long arg)
static void cyz_poll(struct timer_list *unused)
{
struct cyclades_card *cinfo;
struct cyclades_port *info;
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/isicom.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ static struct pci_driver isicom_driver = {
static int prev_card = 3; /* start servicing isi_card[0] */
static struct tty_driver *isicom_normal;

static void isicom_tx(unsigned long _data);
static void isicom_tx(struct timer_list *unused);
static void isicom_start(struct tty_struct *tty);

static DEFINE_TIMER(tx, isicom_tx);
Expand Down Expand Up @@ -394,7 +394,7 @@ static inline int __isicom_paranoia_check(struct isi_port const *port,
* will do the rest of the work for us.
*/

static void isicom_tx(unsigned long _data)
static void isicom_tx(struct timer_list *unused)
{
unsigned long flags, base;
unsigned int retries;
Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/moxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void moxa_hangup(struct tty_struct *);
static int moxa_tiocmget(struct tty_struct *tty);
static int moxa_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear);
static void moxa_poll(unsigned long);
static void moxa_poll(struct timer_list *);
static void moxa_set_tty_param(struct tty_struct *, struct ktermios *);
static void moxa_shutdown(struct tty_port *);
static int moxa_carrier_raised(struct tty_port *);
Expand Down Expand Up @@ -1429,7 +1429,7 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle,
return 0;
}

static void moxa_poll(unsigned long ignored)
static void moxa_poll(struct timer_list *unused)
{
struct moxa_board_conf *brd;
u16 __iomem *ip;
Expand Down
Loading

0 comments on commit 24ed960

Please sign in to comment.