]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: can: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Tue, 17 Oct 2017 00:29:06 +0000 (17:29 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 11:39:38 +0000 (12:39 +0100)
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 <socketcan@hartkopp.net>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-can@vger.kernel.org
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/can/af_can.c
net/can/af_can.h
net/can/proc.c

index 88edac0f3e366398d0c1e0de023b90b0669498f9..1f75e11ac35ae288a59897ebed1b966fc3656802 100644 (file)
@@ -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));
                }
index d0ef45bb2a72748e95f4ed0c0156e723ea01b7a3..eca6463c6213fdeb3bc964713d244e3f0ca25ad1 100644 (file)
@@ -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 */
index 83045f00c63c147dd4664c76b17a98a9e040c45e..d979b3dc49a6b9a2ef9e1ee9c262c9bb9bd9f253 100644 (file)
@@ -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 */
 
@@ -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);
 
@@ -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 {