Skip to content

Commit

Permalink
net: can: Convert timers to use timer_setup()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kees authored and davem330 committed Oct 18, 2017
1 parent a8c22a2 commit 1fccb56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions net/can/af_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,8 @@ static int can_pernet_init(struct net *net)
if (IS_ENABLED(CONFIG_PROC_FS)) {
/* the statistics are updated every second (timer triggered) */
if (stats_timer) {
setup_timer(&net->can.can_stattimer, can_stat_update,
(unsigned long)net);
timer_setup(&net->can.can_stattimer, can_stat_update,
0);
mod_timer(&net->can.can_stattimer,
round_jiffies(jiffies + HZ));
}
Expand Down
2 changes: 1 addition & 1 deletion net/can/af_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ struct s_pstats {
/* function prototypes for the CAN networklayer procfs (proc.c) */
void can_init_proc(struct net *net);
void can_remove_proc(struct net *net);
void can_stat_update(unsigned long data);
void can_stat_update(struct timer_list *t);

#endif /* AF_CAN_H */
8 changes: 4 additions & 4 deletions net/can/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ static unsigned long calc_rate(unsigned long oldjif, unsigned long newjif,
return rate;
}

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

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

seq_putc(m, '\n');

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

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

user_reset = 1;

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

0 comments on commit 1fccb56

Please sign in to comment.