Skip to content

Commit

Permalink
treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts
Browse files Browse the repository at this point in the history
With all callbacks converted, and the timer callback prototype
switched over, the TIMER_FUNC_TYPE cast is no longer needed,
so remove it. Conversion was done with the following scripts:

    perl -pi -e 's|\(TIMER_FUNC_TYPE\)||g' \
        $(git grep TIMER_FUNC_TYPE | cut -d: -f1 | sort -u)

    perl -pi -e 's|\(TIMER_DATA_TYPE\)||g' \
        $(git grep TIMER_DATA_TYPE | cut -d: -f1 | sort -u)

The now unused macros are also dropped from include/linux/timer.h.

Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
kees committed Nov 22, 2017
1 parent 919b250 commit 841b86f
Show file tree
Hide file tree
Showing 44 changed files with 84 additions and 87 deletions.
2 changes: 1 addition & 1 deletion drivers/base/power/wakeup.c
Expand Up @@ -481,7 +481,7 @@ static bool wakeup_source_not_registered(struct wakeup_source *ws)
* Use timer struct to check if the given source is initialized
* by wakeup_source_add.
*/
return ws->timer.function != (TIMER_FUNC_TYPE)pm_wakeup_timer_fn;
return ws->timer.function != pm_wakeup_timer_fn;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/aoe/aoecmd.c
Expand Up @@ -1429,7 +1429,7 @@ aoecmd_ata_id(struct aoedev *d)

d->rttavg = RTTAVG_INIT;
d->rttdev = RTTDEV_INIT;
d->timer.function = (TIMER_FUNC_TYPE)rexmit_timer;
d->timer.function = rexmit_timer;

skb = skb_clone(skb, GFP_ATOMIC);
if (skb) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/block/swim3.c
Expand Up @@ -397,7 +397,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
if (fs->timeout_pending)
del_timer(&fs->timeout);
fs->timeout.expires = jiffies + nticks;
fs->timeout.function = (TIMER_FUNC_TYPE)proc;
fs->timeout.function = proc;
add_timer(&fs->timeout);
fs->timeout_pending = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/nes/nes_verbs.c
Expand Up @@ -3819,7 +3819,7 @@ void nes_port_ibevent(struct nes_vnic *nesvnic)
if (!nesvnic->event_timer.function) {
ib_dispatch_event(&event);
nesvnic->last_dispatched_event = event.event;
nesvnic->event_timer.function = (TIMER_FUNC_TYPE)nes_handle_delayed_event;
nesvnic->event_timer.function = nes_handle_delayed_event;
nesvnic->event_timer.expires = jiffies + NES_EVENT_DELAY;
add_timer(&nesvnic->event_timer);
} else {
Expand Down
2 changes: 1 addition & 1 deletion drivers/input/input.c
Expand Up @@ -2047,7 +2047,7 @@ static void devm_input_device_unregister(struct device *dev, void *res)
*/
void input_enable_softrepeat(struct input_dev *dev, int delay, int period)
{
dev->timer.function = (TIMER_FUNC_TYPE)input_repeat_key;
dev->timer.function = input_repeat_key;
dev->rep[REP_DELAY] = delay;
dev->rep[REP_PERIOD] = period;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/common/saa7146/saa7146_vbi.c
Expand Up @@ -402,7 +402,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
sizeof(struct saa7146_buf),
file, &dev->v4l2_lock);

vv->vbi_read_timeout.function = (TIMER_FUNC_TYPE)vbi_read_timeout;
vv->vbi_read_timeout.function = vbi_read_timeout;
vv->vbi_read_timeout_file = file;

/* initialize the brs */
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/ti/tlan.c
Expand Up @@ -254,7 +254,7 @@ tlan_set_timer(struct net_device *dev, u32 ticks, u32 type)
spin_unlock_irqrestore(&priv->lock, flags);
return;
}
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
priv->timer.function = tlan_timer;
if (!in_irq())
spin_unlock_irqrestore(&priv->lock, flags);

Expand Down Expand Up @@ -1425,7 +1425,7 @@ static u32 tlan_handle_tx_eof(struct net_device *dev, u16 host_int)
tlan_dio_write8(dev->base_addr,
TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT);
if (priv->timer.function == NULL) {
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
priv->timer.function = tlan_timer;
priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
priv->timer_set_at = jiffies;
priv->timer_type = TLAN_TIMER_ACTIVITY;
Expand Down Expand Up @@ -1576,7 +1576,7 @@ static u32 tlan_handle_rx_eof(struct net_device *dev, u16 host_int)
tlan_dio_write8(dev->base_addr,
TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT);
if (priv->timer.function == NULL) {
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
priv->timer.function = tlan_timer;
priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
priv->timer_set_at = jiffies;
priv->timer_type = TLAN_TIMER_ACTIVITY;
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/hamradio/scc.c
Expand Up @@ -1005,7 +1005,7 @@ static void __scc_start_tx_timer(struct scc_channel *scc,
} else
if (when != TIMER_OFF)
{
scc->tx_t.function = (TIMER_FUNC_TYPE)handler;
scc->tx_t.function = handler;
scc->tx_t.expires = jiffies + (when*HZ)/100;
add_timer(&scc->tx_t);
}
Expand All @@ -1031,7 +1031,7 @@ static void scc_start_defer(struct scc_channel *scc)

if (scc->kiss.maxdefer != 0 && scc->kiss.maxdefer != TIMER_OFF)
{
scc->tx_wdog.function = (TIMER_FUNC_TYPE)t_busy;
scc->tx_wdog.function = t_busy;
scc->tx_wdog.expires = jiffies + HZ*scc->kiss.maxdefer;
add_timer(&scc->tx_wdog);
}
Expand All @@ -1047,7 +1047,7 @@ static void scc_start_maxkeyup(struct scc_channel *scc)

if (scc->kiss.maxkeyup != 0 && scc->kiss.maxkeyup != TIMER_OFF)
{
scc->tx_wdog.function = (TIMER_FUNC_TYPE)t_maxkeyup;
scc->tx_wdog.function = t_maxkeyup;
scc->tx_wdog.expires = jiffies + HZ*scc->kiss.maxkeyup;
add_timer(&scc->tx_wdog);
}
Expand Down Expand Up @@ -1428,7 +1428,7 @@ scc_start_calibrate(struct scc_channel *scc, int duration, unsigned char pattern

del_timer(&scc->tx_wdog);

scc->tx_wdog.function = (TIMER_FUNC_TYPE)scc_stop_calibrate;
scc->tx_wdog.function = scc_stop_calibrate;
scc->tx_wdog.expires = jiffies + HZ*duration;
add_timer(&scc->tx_wdog);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
Expand Up @@ -554,7 +554,7 @@ qtnf_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
return -EFAULT;
}

mac->scan_timeout.function = (TIMER_FUNC_TYPE)qtnf_scan_timeout;
mac->scan_timeout.function = qtnf_scan_timeout;
mod_timer(&mac->scan_timeout,
jiffies + QTNF_SCAN_TIMEOUT_SEC * HZ);

Expand Down
12 changes: 6 additions & 6 deletions drivers/net/wireless/ray_cs.c
Expand Up @@ -569,7 +569,7 @@ static int dl_startup_params(struct net_device *dev)
local->card_status = CARD_DL_PARAM;
/* Start kernel timer to wait for dl startup to complete. */
local->timer.expires = jiffies + HZ / 2;
local->timer.function = (TIMER_FUNC_TYPE)verify_dl_startup;
local->timer.function = verify_dl_startup;
add_timer(&local->timer);
dev_dbg(&link->dev,
"ray_cs dl_startup_params started timer for verify_dl_startup\n");
Expand Down Expand Up @@ -1947,12 +1947,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" start failed\n",
memtmp);
local->timer.function = (TIMER_FUNC_TYPE)start_net;
local->timer.function = start_net;
} else {
dev_dbg(&link->dev,
"ray_cs interrupt network \"%s\" join failed\n",
memtmp);
local->timer.function = (TIMER_FUNC_TYPE)join_net;
local->timer.function = join_net;
}
add_timer(&local->timer);
}
Expand Down Expand Up @@ -2417,9 +2417,9 @@ static void authenticate(ray_dev_t *local)

del_timer(&local->timer);
if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
local->timer.function = (TIMER_FUNC_TYPE)join_net;
local->timer.function = join_net;
} else {
local->timer.function = (TIMER_FUNC_TYPE)authenticate_timeout;
local->timer.function = authenticate_timeout;
}
local->timer.expires = jiffies + HZ * 2;
add_timer(&local->timer);
Expand Down Expand Up @@ -2502,7 +2502,7 @@ static void associate(ray_dev_t *local)

del_timer(&local->timer);
local->timer.expires = jiffies + HZ * 2;
local->timer.function = (TIMER_FUNC_TYPE)join_net;
local->timer.function = join_net;
add_timer(&local->timer);
local->card_status = CARD_ASSOC_FAILED;
return;
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/char/sclp.c
Expand Up @@ -158,7 +158,7 @@ static inline void
__sclp_set_request_timer(unsigned long time, void (*cb)(struct timer_list *))
{
del_timer(&sclp_request_timer);
sclp_request_timer.function = (TIMER_FUNC_TYPE)cb;
sclp_request_timer.function = cb;
sclp_request_timer.expires = jiffies + time;
add_timer(&sclp_request_timer);
}
Expand Down Expand Up @@ -566,7 +566,7 @@ sclp_sync_wait(void)
if (timer_pending(&sclp_request_timer) &&
get_tod_clock_fast() > timeout &&
del_timer(&sclp_request_timer))
sclp_request_timer.function((TIMER_DATA_TYPE)&sclp_request_timer);
sclp_request_timer.function(&sclp_request_timer);
cpu_relax();
}
local_irq_disable();
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/scsi/zfcp_fsf.c
Expand Up @@ -34,15 +34,15 @@ static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
static void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req,
unsigned long timeout)
{
fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_fsf_request_timeout_handler;
fsf_req->timer.function = zfcp_fsf_request_timeout_handler;
fsf_req->timer.expires = jiffies + timeout;
add_timer(&fsf_req->timer);
}

static void zfcp_fsf_start_erp_timer(struct zfcp_fsf_req *fsf_req)
{
BUG_ON(!fsf_req->erp_action);
fsf_req->timer.function = (TIMER_FUNC_TYPE)zfcp_erp_timeout_handler;
fsf_req->timer.function = zfcp_erp_timeout_handler;
fsf_req->timer.expires = jiffies + 30 * HZ;
add_timer(&fsf_req->timer);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/aic94xx/aic94xx_hwi.c
Expand Up @@ -1175,7 +1175,7 @@ static void asd_start_scb_timers(struct list_head *list)
struct asd_ascb *ascb;
list_for_each_entry(ascb, list, list) {
if (!ascb->uldd_timer) {
ascb->timer.function = (TIMER_FUNC_TYPE)asd_ascb_timedout;
ascb->timer.function = asd_ascb_timedout;
ascb->timer.expires = jiffies + AIC94XX_SCB_TIMEOUT;
add_timer(&ascb->timer);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/aic94xx/aic94xx_tmf.c
Expand Up @@ -42,7 +42,7 @@ static int asd_enqueue_internal(struct asd_ascb *ascb,
ascb->tasklet_complete = tasklet_complete;
ascb->uldd_timer = 1;

ascb->timer.function = (TIMER_FUNC_TYPE)timed_out;
ascb->timer.function = timed_out;
ascb->timer.expires = jiffies + AIC94XX_SCB_TIMEOUT;

add_timer(&ascb->timer);
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/be2iscsi/be_main.c
Expand Up @@ -5279,7 +5279,7 @@ static void beiscsi_hw_health_check(struct timer_list *t)
if (!test_bit(BEISCSI_HBA_UER_SUPP, &phba->state))
return;
/* modify this timer to check TPE */
phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_tpe_check;
phba->hw_check.function = beiscsi_hw_tpe_check;
}

mod_timer(&phba->hw_check,
Expand Down Expand Up @@ -5367,7 +5367,7 @@ static int beiscsi_enable_port(struct beiscsi_hba *phba)
* Timer function gets modified for TPE detection.
* Always reinit to do health check first.
*/
phba->hw_check.function = (TIMER_FUNC_TYPE)beiscsi_hw_health_check;
phba->hw_check.function = beiscsi_hw_health_check;
mod_timer(&phba->hw_check,
jiffies + msecs_to_jiffies(BEISCSI_UE_DETECT_INTERVAL));
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
Expand Up @@ -586,8 +586,8 @@ static int do_act_open_rpl(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
cxgbi_sock_get(csk);
spin_lock_bh(&csk->lock);
if (rpl->status == CPL_ERR_CONN_EXIST &&
csk->retry_timer.function != (TIMER_FUNC_TYPE)act_open_retry_timer) {
csk->retry_timer.function = (TIMER_FUNC_TYPE)act_open_retry_timer;
csk->retry_timer.function != act_open_retry_timer) {
csk->retry_timer.function = act_open_retry_timer;
mod_timer(&csk->retry_timer, jiffies + HZ / 2);
} else
cxgbi_sock_fail_act_open(csk,
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
Expand Up @@ -963,8 +963,8 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, struct sk_buff *skb)
spin_lock_bh(&csk->lock);

if (status == CPL_ERR_CONN_EXIST &&
csk->retry_timer.function != (TIMER_FUNC_TYPE)csk_act_open_retry_timer) {
csk->retry_timer.function = (TIMER_FUNC_TYPE)csk_act_open_retry_timer;
csk->retry_timer.function != csk_act_open_retry_timer) {
csk->retry_timer.function = csk_act_open_retry_timer;
mod_timer(&csk->retry_timer, jiffies + HZ / 2);
} else
cxgbi_sock_fail_act_open(csk,
Expand Down
4 changes: 2 additions & 2 deletions drivers/scsi/hisi_sas/hisi_sas_main.c
Expand Up @@ -839,7 +839,7 @@ static int hisi_sas_exec_internal_tmf_task(struct domain_device *device,
}
task->task_done = hisi_sas_task_done;

task->slow_task->timer.function = (TIMER_FUNC_TYPE)hisi_sas_tmf_timedout;
task->slow_task->timer.function = hisi_sas_tmf_timedout;
task->slow_task->timer.expires = jiffies + TASK_TIMEOUT*HZ;
add_timer(&task->slow_task->timer);

Expand Down Expand Up @@ -1451,7 +1451,7 @@ hisi_sas_internal_task_abort(struct hisi_hba *hisi_hba,
task->dev = device;
task->task_proto = device->tproto;
task->task_done = hisi_sas_task_done;
task->slow_task->timer.function = (TIMER_FUNC_TYPE)hisi_sas_tmf_timedout;
task->slow_task->timer.function = hisi_sas_tmf_timedout;
task->slow_task->timer.expires = jiffies + msecs_to_jiffies(110);
add_timer(&task->slow_task->timer);

Expand Down
6 changes: 3 additions & 3 deletions drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
Expand Up @@ -1268,7 +1268,7 @@ static void link_timeout_enable_link(struct timer_list *t)
}
}

hisi_hba->timer.function = (TIMER_FUNC_TYPE)link_timeout_disable_link;
hisi_hba->timer.function = link_timeout_disable_link;
mod_timer(&hisi_hba->timer, jiffies + msecs_to_jiffies(900));
}

Expand All @@ -1289,13 +1289,13 @@ static void link_timeout_disable_link(struct timer_list *t)
}
}

hisi_hba->timer.function = (TIMER_FUNC_TYPE)link_timeout_enable_link;
hisi_hba->timer.function = link_timeout_enable_link;
mod_timer(&hisi_hba->timer, jiffies + msecs_to_jiffies(100));
}

static void set_link_timer_quirk(struct hisi_hba *hisi_hba)
{
hisi_hba->timer.function = (TIMER_FUNC_TYPE)link_timeout_disable_link;
hisi_hba->timer.function = link_timeout_disable_link;
hisi_hba->timer.expires = jiffies + msecs_to_jiffies(1000);
add_timer(&hisi_hba->timer);
}
Expand Down
8 changes: 4 additions & 4 deletions drivers/scsi/ipr.c
Expand Up @@ -997,7 +997,7 @@ static void ipr_do_req(struct ipr_cmnd *ipr_cmd,
ipr_cmd->done = done;

ipr_cmd->timer.expires = jiffies + timeout;
ipr_cmd->timer.function = (TIMER_FUNC_TYPE)timeout_func;
ipr_cmd->timer.function = timeout_func;

add_timer(&ipr_cmd->timer);

Expand Down Expand Up @@ -8312,7 +8312,7 @@ static void ipr_reset_start_timer(struct ipr_cmnd *ipr_cmd,
ipr_cmd->done = ipr_reset_ioa_job;

ipr_cmd->timer.expires = jiffies + timeout;
ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_reset_timer_done;
ipr_cmd->timer.function = ipr_reset_timer_done;
add_timer(&ipr_cmd->timer);
}

Expand Down Expand Up @@ -8397,7 +8397,7 @@ static int ipr_reset_next_stage(struct ipr_cmnd *ipr_cmd)
}

ipr_cmd->timer.expires = jiffies + stage_time * HZ;
ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_oper_timeout;
ipr_cmd->timer.function = ipr_oper_timeout;
ipr_cmd->done = ipr_reset_ioa_job;
add_timer(&ipr_cmd->timer);

Expand Down Expand Up @@ -8468,7 +8468,7 @@ static int ipr_reset_enable_ioa(struct ipr_cmnd *ipr_cmd)
}

ipr_cmd->timer.expires = jiffies + (ioa_cfg->transop_timeout * HZ);
ipr_cmd->timer.function = (TIMER_FUNC_TYPE)ipr_oper_timeout;
ipr_cmd->timer.function = ipr_oper_timeout;
ipr_cmd->done = ipr_reset_ioa_job;
add_timer(&ipr_cmd->timer);
list_add_tail(&ipr_cmd->queue, &ipr_cmd->hrrq->hrrq_pending_q);
Expand Down
6 changes: 3 additions & 3 deletions drivers/scsi/libfc/fc_fcp.c
Expand Up @@ -1214,7 +1214,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
fsp->seq_ptr = seq;
fc_fcp_pkt_hold(fsp); /* hold for fc_fcp_pkt_destroy */

fsp->timer.function = (TIMER_FUNC_TYPE)fc_fcp_timeout;
fsp->timer.function = fc_fcp_timeout;
if (rpriv->flags & FC_RP_FLAGS_REC_SUPPORTED)
fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp));

Expand Down Expand Up @@ -1307,7 +1307,7 @@ static void fc_lun_reset_send(struct timer_list *t)
return;
if (fc_fcp_lock_pkt(fsp))
return;
fsp->timer.function = (TIMER_FUNC_TYPE)fc_lun_reset_send;
fsp->timer.function = fc_lun_reset_send;
fc_fcp_timer_set(fsp, get_fsp_rec_tov(fsp));
fc_fcp_unlock_pkt(fsp);
}
Expand Down Expand Up @@ -1445,7 +1445,7 @@ static void fc_fcp_timeout(struct timer_list *t)
if (fsp->lp->qfull) {
FC_FCP_DBG(fsp, "fcp timeout, resetting timer delay %d\n",
fsp->timer_delay);
fsp->timer.function = (TIMER_FUNC_TYPE)fc_fcp_timeout;
fsp->timer.function = fc_fcp_timeout;
fc_fcp_timer_set(fsp, fsp->timer_delay);
goto unlock;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libsas/sas_expander.c
Expand Up @@ -92,7 +92,7 @@ static int smp_execute_task_sg(struct domain_device *dev,

task->task_done = smp_task_done;

task->slow_task->timer.function = (TIMER_FUNC_TYPE)smp_task_timedout;
task->slow_task->timer.function = smp_task_timedout;
task->slow_task->timer.expires = jiffies + SMP_TIMEOUT*HZ;
add_timer(&task->slow_task->timer);

Expand Down
2 changes: 1 addition & 1 deletion drivers/scsi/libsas/sas_scsi_host.c
Expand Up @@ -919,7 +919,7 @@ void sas_task_abort(struct sas_task *task)
return;
if (!del_timer(&slow->timer))
return;
slow->timer.function((TIMER_DATA_TYPE)&slow->timer);
slow->timer.function(&slow->timer);
return;
}

Expand Down

0 comments on commit 841b86f

Please sign in to comment.