diff options
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/af_can.c | 7 | ||||
-rw-r--r-- | net/can/bcm.c | 54 |
2 files changed, 29 insertions, 32 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 094fc5332d4..9b0c32a2690 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/skbuff.h> | 58 | #include <linux/skbuff.h> |
59 | #include <linux/can.h> | 59 | #include <linux/can.h> |
60 | #include <linux/can/core.h> | 60 | #include <linux/can/core.h> |
61 | #include <linux/ratelimit.h> | ||
61 | #include <net/net_namespace.h> | 62 | #include <net/net_namespace.h> |
62 | #include <net/sock.h> | 63 | #include <net/sock.h> |
63 | 64 | ||
@@ -161,8 +162,8 @@ static int can_create(struct net *net, struct socket *sock, int protocol, | |||
161 | * return the error code immediately. Below we will | 162 | * return the error code immediately. Below we will |
162 | * return -EPROTONOSUPPORT | 163 | * return -EPROTONOSUPPORT |
163 | */ | 164 | */ |
164 | if (err && printk_ratelimit()) | 165 | if (err) |
165 | printk(KERN_ERR "can: request_module " | 166 | printk_ratelimited(KERN_ERR "can: request_module " |
166 | "(can-proto-%d) failed.\n", protocol); | 167 | "(can-proto-%d) failed.\n", protocol); |
167 | 168 | ||
168 | cp = can_get_proto(protocol); | 169 | cp = can_get_proto(protocol); |
@@ -856,7 +857,7 @@ static __exit void can_exit(void) | |||
856 | struct net_device *dev; | 857 | struct net_device *dev; |
857 | 858 | ||
858 | if (stats_timer) | 859 | if (stats_timer) |
859 | del_timer(&can_stattimer); | 860 | del_timer_sync(&can_stattimer); |
860 | 861 | ||
861 | can_remove_proc(); | 862 | can_remove_proc(); |
862 | 863 | ||
diff --git a/net/can/bcm.c b/net/can/bcm.c index 184a6572b67..c84963d2dee 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -43,6 +43,7 @@ | |||
43 | 43 | ||
44 | #include <linux/module.h> | 44 | #include <linux/module.h> |
45 | #include <linux/init.h> | 45 | #include <linux/init.h> |
46 | #include <linux/interrupt.h> | ||
46 | #include <linux/hrtimer.h> | 47 | #include <linux/hrtimer.h> |
47 | #include <linux/list.h> | 48 | #include <linux/list.h> |
48 | #include <linux/proc_fs.h> | 49 | #include <linux/proc_fs.h> |
@@ -343,6 +344,18 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, | |||
343 | } | 344 | } |
344 | } | 345 | } |
345 | 346 | ||
347 | static void bcm_tx_start_timer(struct bcm_op *op) | ||
348 | { | ||
349 | if (op->kt_ival1.tv64 && op->count) | ||
350 | hrtimer_start(&op->timer, | ||
351 | ktime_add(ktime_get(), op->kt_ival1), | ||
352 | HRTIMER_MODE_ABS); | ||
353 | else if (op->kt_ival2.tv64) | ||
354 | hrtimer_start(&op->timer, | ||
355 | ktime_add(ktime_get(), op->kt_ival2), | ||
356 | HRTIMER_MODE_ABS); | ||
357 | } | ||
358 | |||
346 | static void bcm_tx_timeout_tsklet(unsigned long data) | 359 | static void bcm_tx_timeout_tsklet(unsigned long data) |
347 | { | 360 | { |
348 | struct bcm_op *op = (struct bcm_op *)data; | 361 | struct bcm_op *op = (struct bcm_op *)data; |
@@ -364,26 +377,12 @@ static void bcm_tx_timeout_tsklet(unsigned long data) | |||
364 | 377 | ||
365 | bcm_send_to_user(op, &msg_head, NULL, 0); | 378 | bcm_send_to_user(op, &msg_head, NULL, 0); |
366 | } | 379 | } |
367 | } | ||
368 | |||
369 | if (op->kt_ival1.tv64 && (op->count > 0)) { | ||
370 | |||
371 | /* send (next) frame */ | ||
372 | bcm_can_tx(op); | 380 | bcm_can_tx(op); |
373 | hrtimer_start(&op->timer, | ||
374 | ktime_add(ktime_get(), op->kt_ival1), | ||
375 | HRTIMER_MODE_ABS); | ||
376 | 381 | ||
377 | } else { | 382 | } else if (op->kt_ival2.tv64) |
378 | if (op->kt_ival2.tv64) { | 383 | bcm_can_tx(op); |
379 | 384 | ||
380 | /* send (next) frame */ | 385 | bcm_tx_start_timer(op); |
381 | bcm_can_tx(op); | ||
382 | hrtimer_start(&op->timer, | ||
383 | ktime_add(ktime_get(), op->kt_ival2), | ||
384 | HRTIMER_MODE_ABS); | ||
385 | } | ||
386 | } | ||
387 | } | 386 | } |
388 | 387 | ||
389 | /* | 388 | /* |
@@ -963,23 +962,20 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, | |||
963 | hrtimer_cancel(&op->timer); | 962 | hrtimer_cancel(&op->timer); |
964 | } | 963 | } |
965 | 964 | ||
966 | if ((op->flags & STARTTIMER) && | 965 | if (op->flags & STARTTIMER) { |
967 | ((op->kt_ival1.tv64 && op->count) || op->kt_ival2.tv64)) { | 966 | hrtimer_cancel(&op->timer); |
968 | |||
969 | /* spec: send can_frame when starting timer */ | 967 | /* spec: send can_frame when starting timer */ |
970 | op->flags |= TX_ANNOUNCE; | 968 | op->flags |= TX_ANNOUNCE; |
971 | |||
972 | if (op->kt_ival1.tv64 && (op->count > 0)) { | ||
973 | /* op->count-- is done in bcm_tx_timeout_handler */ | ||
974 | hrtimer_start(&op->timer, op->kt_ival1, | ||
975 | HRTIMER_MODE_REL); | ||
976 | } else | ||
977 | hrtimer_start(&op->timer, op->kt_ival2, | ||
978 | HRTIMER_MODE_REL); | ||
979 | } | 969 | } |
980 | 970 | ||
981 | if (op->flags & TX_ANNOUNCE) | 971 | if (op->flags & TX_ANNOUNCE) { |
982 | bcm_can_tx(op); | 972 | bcm_can_tx(op); |
973 | if (op->count) | ||
974 | op->count--; | ||
975 | } | ||
976 | |||
977 | if (op->flags & STARTTIMER) | ||
978 | bcm_tx_start_timer(op); | ||
983 | 979 | ||
984 | return msg_head->nframes * CFSIZ + MHSIZ; | 980 | return msg_head->nframes * CFSIZ + MHSIZ; |
985 | } | 981 | } |