diff options
author | David S. Miller <davem@davemloft.net> | 2011-10-07 13:38:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-07 13:38:43 -0400 |
commit | 88c5100c28b02c4b2b2c6f6fafbbd76d90f698b9 (patch) | |
tree | 08c4399e0341f7eb0ccb24e15f2cab687275c2a4 /net/can | |
parent | 8083f0fc969d9b5353061a7a6f963405057e26b1 (diff) | |
parent | 3ee72ca99288f1de95ec9c570e43f531c8799f06 (diff) |
Merge branch 'master' of github.com:davem330/net
Conflicts:
net/batman-adv/soft-interface.c
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/bcm.c | 53 |
1 files changed, 24 insertions, 29 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c index d6c8ae5b2e6a..c84963d2dee6 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -344,6 +344,18 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, | |||
344 | } | 344 | } |
345 | } | 345 | } |
346 | 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 | |||
347 | static void bcm_tx_timeout_tsklet(unsigned long data) | 359 | static void bcm_tx_timeout_tsklet(unsigned long data) |
348 | { | 360 | { |
349 | struct bcm_op *op = (struct bcm_op *)data; | 361 | struct bcm_op *op = (struct bcm_op *)data; |
@@ -365,26 +377,12 @@ static void bcm_tx_timeout_tsklet(unsigned long data) | |||
365 | 377 | ||
366 | bcm_send_to_user(op, &msg_head, NULL, 0); | 378 | bcm_send_to_user(op, &msg_head, NULL, 0); |
367 | } | 379 | } |
368 | } | ||
369 | |||
370 | if (op->kt_ival1.tv64 && (op->count > 0)) { | ||
371 | |||
372 | /* send (next) frame */ | ||
373 | bcm_can_tx(op); | 380 | bcm_can_tx(op); |
374 | hrtimer_start(&op->timer, | ||
375 | ktime_add(ktime_get(), op->kt_ival1), | ||
376 | HRTIMER_MODE_ABS); | ||
377 | 381 | ||
378 | } else { | 382 | } else if (op->kt_ival2.tv64) |
379 | if (op->kt_ival2.tv64) { | 383 | bcm_can_tx(op); |
380 | 384 | ||
381 | /* send (next) frame */ | 385 | bcm_tx_start_timer(op); |
382 | bcm_can_tx(op); | ||
383 | hrtimer_start(&op->timer, | ||
384 | ktime_add(ktime_get(), op->kt_ival2), | ||
385 | HRTIMER_MODE_ABS); | ||
386 | } | ||
387 | } | ||
388 | } | 386 | } |
389 | 387 | ||
390 | /* | 388 | /* |
@@ -964,23 +962,20 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, | |||
964 | hrtimer_cancel(&op->timer); | 962 | hrtimer_cancel(&op->timer); |
965 | } | 963 | } |
966 | 964 | ||
967 | if ((op->flags & STARTTIMER) && | 965 | if (op->flags & STARTTIMER) { |
968 | ((op->kt_ival1.tv64 && op->count) || op->kt_ival2.tv64)) { | 966 | hrtimer_cancel(&op->timer); |
969 | |||
970 | /* spec: send can_frame when starting timer */ | 967 | /* spec: send can_frame when starting timer */ |
971 | op->flags |= TX_ANNOUNCE; | 968 | op->flags |= TX_ANNOUNCE; |
972 | |||
973 | if (op->kt_ival1.tv64 && (op->count > 0)) { | ||
974 | /* op->count-- is done in bcm_tx_timeout_handler */ | ||
975 | hrtimer_start(&op->timer, op->kt_ival1, | ||
976 | HRTIMER_MODE_REL); | ||
977 | } else | ||
978 | hrtimer_start(&op->timer, op->kt_ival2, | ||
979 | HRTIMER_MODE_REL); | ||
980 | } | 969 | } |
981 | 970 | ||
982 | if (op->flags & TX_ANNOUNCE) | 971 | if (op->flags & TX_ANNOUNCE) { |
983 | 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); | ||
984 | 979 | ||
985 | return msg_head->nframes * CFSIZ + MHSIZ; | 980 | return msg_head->nframes * CFSIZ + MHSIZ; |
986 | } | 981 | } |