Skip to content

Commit 1fccb56

Browse files
keesdavem330
authored andcommitted
net: can: 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: Oliver Hartkopp <[email protected]> Cc: Marc Kleine-Budde <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a8c22a2 commit 1fccb56

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

net/can/af_can.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,8 +882,8 @@ static int can_pernet_init(struct net *net)
882882
if (IS_ENABLED(CONFIG_PROC_FS)) {
883883
/* the statistics are updated every second (timer triggered) */
884884
if (stats_timer) {
885-
setup_timer(&net->can.can_stattimer, can_stat_update,
886-
(unsigned long)net);
885+
timer_setup(&net->can.can_stattimer, can_stat_update,
886+
0);
887887
mod_timer(&net->can.can_stattimer,
888888
round_jiffies(jiffies + HZ));
889889
}

net/can/af_can.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,6 @@ struct s_pstats {
113113
/* function prototypes for the CAN networklayer procfs (proc.c) */
114114
void can_init_proc(struct net *net);
115115
void can_remove_proc(struct net *net);
116-
void can_stat_update(unsigned long data);
116+
void can_stat_update(struct timer_list *t);
117117

118118
#endif /* AF_CAN_H */

net/can/proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
115115
return rate;
116116
}
117117

118-
void can_stat_update(unsigned long data)
118+
void can_stat_update(struct timer_list *t)
119119
{
120-
struct net *net = (struct net *)data;
120+
struct net *net = from_timer(net, t, can.can_stattimer);
121121
struct s_stats *can_stats = net->can.can_stats;
122122
unsigned long j = jiffies; /* snapshot */
123123

@@ -221,7 +221,7 @@ static int can_stats_proc_show(struct seq_file *m, void *v)
221221

222222
seq_putc(m, '\n');
223223

224-
if (net->can.can_stattimer.function == can_stat_update) {
224+
if (net->can.can_stattimer.function == (TIMER_FUNC_TYPE)can_stat_update) {
225225
seq_printf(m, " %8ld %% total match ratio (RXMR)\n",
226226
can_stats->total_rx_match_ratio);
227227

@@ -291,7 +291,7 @@ static int can_reset_stats_proc_show(struct seq_file *m, void *v)
291291

292292
user_reset = 1;
293293

294-
if (net->can.can_stattimer.function == can_stat_update) {
294+
if (net->can.can_stattimer.function == (TIMER_FUNC_TYPE)can_stat_update) {
295295
seq_printf(m, "Scheduled statistic reset #%ld.\n",
296296
can_pstats->stats_reset + 1);
297297
} else {

0 commit comments

Comments
 (0)