Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264259
b: refs/heads/master
c: 12d0d0d
h: refs/heads/master
i:
  264257: e708bc9
  264255: 4f6ad57
v: v3
  • Loading branch information
Oliver Hartkopp authored and David S. Miller committed Sep 29, 2011
1 parent a9bb086 commit a438dfd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85a64889492b45f931ddac87ec09d84aa7347ee1
refs/heads/master: 12d0d0d3a7349daa95dbfd5d7df8146255bc7c67
48 changes: 21 additions & 27 deletions trunk/net/can/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,18 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
}
}

static void bcm_tx_start_timer(struct bcm_op *op)
{
if (op->kt_ival1.tv64 && op->count)
hrtimer_start(&op->timer,
ktime_add(ktime_get(), op->kt_ival1),
HRTIMER_MODE_ABS);
else if (op->kt_ival2.tv64)
hrtimer_start(&op->timer,
ktime_add(ktime_get(), op->kt_ival2),
HRTIMER_MODE_ABS);
}

static void bcm_tx_timeout_tsklet(unsigned long data)
{
struct bcm_op *op = (struct bcm_op *)data;
Expand All @@ -365,23 +377,12 @@ static void bcm_tx_timeout_tsklet(unsigned long data)

bcm_send_to_user(op, &msg_head, NULL, 0);
}

/* send (next) frame */
bcm_can_tx(op);
hrtimer_start(&op->timer,
ktime_add(ktime_get(), op->kt_ival1),
HRTIMER_MODE_ABS);

} else {
if (op->kt_ival2.tv64) {
} else if (op->kt_ival2.tv64)
bcm_can_tx(op);

/* send (next) frame */
bcm_can_tx(op);
hrtimer_start(&op->timer,
ktime_add(ktime_get(), op->kt_ival2),
HRTIMER_MODE_ABS);
}
}
bcm_tx_start_timer(op);
}

/*
Expand Down Expand Up @@ -961,28 +962,21 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
hrtimer_cancel(&op->timer);
}

if ((op->flags & STARTTIMER) &&
((op->kt_ival1.tv64 && op->count) || op->kt_ival2.tv64)) {

if (op->flags & STARTTIMER) {
hrtimer_cancel(&op->timer);
/* spec: send can_frame when starting timer */
op->flags |= TX_ANNOUNCE;

/* only start timer when having more frames than sent below */
if (op->kt_ival1.tv64 && (op->count > 1)) {
/* op->count-- is done in bcm_tx_timeout_tsklet */
hrtimer_start(&op->timer, op->kt_ival1,
HRTIMER_MODE_REL);
} else
hrtimer_start(&op->timer, op->kt_ival2,
HRTIMER_MODE_REL);
}

if (op->flags & TX_ANNOUNCE) {
bcm_can_tx(op);
if (op->kt_ival1.tv64 && (op->count > 0))
if (op->count)
op->count--;
}

if (op->flags & STARTTIMER)
bcm_tx_start_timer(op);

return msg_head->nframes * CFSIZ + MHSIZ;
}

Expand Down

0 comments on commit a438dfd

Please sign in to comment.