Skip to content

Commit 841b86f

Browse files
committed
treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE casts
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>
1 parent 919b250 commit 841b86f

44 files changed

Lines changed: 84 additions & 87 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/base/power/wakeup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static bool wakeup_source_not_registered(struct wakeup_source *ws)
481481
* Use timer struct to check if the given source is initialized
482482
* by wakeup_source_add.
483483
*/
484-
return ws->timer.function != (TIMER_FUNC_TYPE)pm_wakeup_timer_fn;
484+
return ws->timer.function != pm_wakeup_timer_fn;
485485
}
486486

487487
/*

‎drivers/block/aoe/aoecmd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ aoecmd_ata_id(struct aoedev *d)
14291429

14301430
d->rttavg = RTTAVG_INIT;
14311431
d->rttdev = RTTDEV_INIT;
1432-
d->timer.function = (TIMER_FUNC_TYPE)rexmit_timer;
1432+
d->timer.function = rexmit_timer;
14331433

14341434
skb = skb_clone(skb, GFP_ATOMIC);
14351435
if (skb) {

‎drivers/block/swim3.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
397397
if (fs->timeout_pending)
398398
del_timer(&fs->timeout);
399399
fs->timeout.expires = jiffies + nticks;
400-
fs->timeout.function = (TIMER_FUNC_TYPE)proc;
400+
fs->timeout.function = proc;
401401
add_timer(&fs->timeout);
402402
fs->timeout_pending = 1;
403403
}

‎drivers/infiniband/hw/nes/nes_verbs.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3819,7 +3819,7 @@ void nes_port_ibevent(struct nes_vnic *nesvnic)
38193819
if (!nesvnic->event_timer.function) {
38203820
ib_dispatch_event(&event);
38213821
nesvnic->last_dispatched_event = event.event;
3822-
nesvnic->event_timer.function = (TIMER_FUNC_TYPE)nes_handle_delayed_event;
3822+
nesvnic->event_timer.function = nes_handle_delayed_event;
38233823
nesvnic->event_timer.expires = jiffies + NES_EVENT_DELAY;
38243824
add_timer(&nesvnic->event_timer);
38253825
} else {

‎drivers/input/input.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2047,7 +2047,7 @@ static void devm_input_device_unregister(struct device *dev, void *res)
20472047
*/
20482048
void input_enable_softrepeat(struct input_dev *dev, int delay, int period)
20492049
{
2050-
dev->timer.function = (TIMER_FUNC_TYPE)input_repeat_key;
2050+
dev->timer.function = input_repeat_key;
20512051
dev->rep[REP_DELAY] = delay;
20522052
dev->rep[REP_PERIOD] = period;
20532053
}

‎drivers/media/common/saa7146/saa7146_vbi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
402402
sizeof(struct saa7146_buf),
403403
file, &dev->v4l2_lock);
404404

405-
vv->vbi_read_timeout.function = (TIMER_FUNC_TYPE)vbi_read_timeout;
405+
vv->vbi_read_timeout.function = vbi_read_timeout;
406406
vv->vbi_read_timeout_file = file;
407407

408408
/* initialize the brs */

‎drivers/net/ethernet/ti/tlan.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ tlan_set_timer(struct net_device *dev, u32 ticks, u32 type)
254254
spin_unlock_irqrestore(&priv->lock, flags);
255255
return;
256256
}
257-
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
257+
priv->timer.function = tlan_timer;
258258
if (!in_irq())
259259
spin_unlock_irqrestore(&priv->lock, flags);
260260

@@ -1425,7 +1425,7 @@ static u32 tlan_handle_tx_eof(struct net_device *dev, u16 host_int)
14251425
tlan_dio_write8(dev->base_addr,
14261426
TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT);
14271427
if (priv->timer.function == NULL) {
1428-
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
1428+
priv->timer.function = tlan_timer;
14291429
priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
14301430
priv->timer_set_at = jiffies;
14311431
priv->timer_type = TLAN_TIMER_ACTIVITY;
@@ -1576,7 +1576,7 @@ static u32 tlan_handle_rx_eof(struct net_device *dev, u16 host_int)
15761576
tlan_dio_write8(dev->base_addr,
15771577
TLAN_LED_REG, TLAN_LED_LINK | TLAN_LED_ACT);
15781578
if (priv->timer.function == NULL) {
1579-
priv->timer.function = (TIMER_FUNC_TYPE)tlan_timer;
1579+
priv->timer.function = tlan_timer;
15801580
priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY;
15811581
priv->timer_set_at = jiffies;
15821582
priv->timer_type = TLAN_TIMER_ACTIVITY;

‎drivers/net/hamradio/scc.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ static void __scc_start_tx_timer(struct scc_channel *scc,
10051005
} else
10061006
if (when != TIMER_OFF)
10071007
{
1008-
scc->tx_t.function = (TIMER_FUNC_TYPE)handler;
1008+
scc->tx_t.function = handler;
10091009
scc->tx_t.expires = jiffies + (when*HZ)/100;
10101010
add_timer(&scc->tx_t);
10111011
}
@@ -1031,7 +1031,7 @@ static void scc_start_defer(struct scc_channel *scc)
10311031

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

10481048
if (scc->kiss.maxkeyup != 0 && scc->kiss.maxkeyup != TIMER_OFF)
10491049
{
1050-
scc->tx_wdog.function = (TIMER_FUNC_TYPE)t_maxkeyup;
1050+
scc->tx_wdog.function = t_maxkeyup;
10511051
scc->tx_wdog.expires = jiffies + HZ*scc->kiss.maxkeyup;
10521052
add_timer(&scc->tx_wdog);
10531053
}
@@ -1428,7 +1428,7 @@ scc_start_calibrate(struct scc_channel *scc, int duration, unsigned char pattern
14281428

14291429
del_timer(&scc->tx_wdog);
14301430

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

‎drivers/net/wireless/quantenna/qtnfmac/cfg80211.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ qtnf_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
554554
return -EFAULT;
555555
}
556556

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

‎drivers/net/wireless/ray_cs.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ static int dl_startup_params(struct net_device *dev)
569569
local->card_status = CARD_DL_PARAM;
570570
/* Start kernel timer to wait for dl startup to complete. */
571571
local->timer.expires = jiffies + HZ / 2;
572-
local->timer.function = (TIMER_FUNC_TYPE)verify_dl_startup;
572+
local->timer.function = verify_dl_startup;
573573
add_timer(&local->timer);
574574
dev_dbg(&link->dev,
575575
"ray_cs dl_startup_params started timer for verify_dl_startup\n");
@@ -1947,12 +1947,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id)
19471947
dev_dbg(&link->dev,
19481948
"ray_cs interrupt network \"%s\" start failed\n",
19491949
memtmp);
1950-
local->timer.function = (TIMER_FUNC_TYPE)start_net;
1950+
local->timer.function = start_net;
19511951
} else {
19521952
dev_dbg(&link->dev,
19531953
"ray_cs interrupt network \"%s\" join failed\n",
19541954
memtmp);
1955-
local->timer.function = (TIMER_FUNC_TYPE)join_net;
1955+
local->timer.function = join_net;
19561956
}
19571957
add_timer(&local->timer);
19581958
}
@@ -2417,9 +2417,9 @@ static void authenticate(ray_dev_t *local)
24172417

24182418
del_timer(&local->timer);
24192419
if (build_auth_frame(local, local->bss_id, OPEN_AUTH_REQUEST)) {
2420-
local->timer.function = (TIMER_FUNC_TYPE)join_net;
2420+
local->timer.function = join_net;
24212421
} else {
2422-
local->timer.function = (TIMER_FUNC_TYPE)authenticate_timeout;
2422+
local->timer.function = authenticate_timeout;
24232423
}
24242424
local->timer.expires = jiffies + HZ * 2;
24252425
add_timer(&local->timer);
@@ -2502,7 +2502,7 @@ static void associate(ray_dev_t *local)
25022502

25032503
del_timer(&local->timer);
25042504
local->timer.expires = jiffies + HZ * 2;
2505-
local->timer.function = (TIMER_FUNC_TYPE)join_net;
2505+
local->timer.function = join_net;
25062506
add_timer(&local->timer);
25072507
local->card_status = CARD_ASSOC_FAILED;
25082508
return;

0 commit comments

Comments
 (0)