Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266202
b: refs/heads/master
c: 2e11437
h: refs/heads/master
v: v3
  • Loading branch information
Oliver Hartkopp authored and David S. Miller committed Sep 28, 2011
1 parent 242fd5f commit 053788f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 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: d4fa0e35fdbd54acf791fa3793d6d17f7795f7ae
refs/heads/master: 2e1143742789463c00ed5e7f9bf471f2b707b493
14 changes: 13 additions & 1 deletion trunk/drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,19 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
bt->prop_seg = tseg1 / 2;
bt->phase_seg1 = tseg1 - bt->prop_seg;
bt->phase_seg2 = tseg2;
bt->sjw = 1;

/* check for sjw user settings */
if (!bt->sjw || !btc->sjw_max)
bt->sjw = 1;
else {
/* bt->sjw is at least 1 -> sanitize upper bound to sjw_max */
if (bt->sjw > btc->sjw_max)
bt->sjw = btc->sjw_max;
/* bt->sjw must not be higher than tseg2 */
if (tseg2 < bt->sjw)
bt->sjw = tseg2;
}

bt->brp = best_brp;
/* real bit-rate */
bt->bitrate = priv->clock.freq / (bt->brp * (tseg1 + tseg2 + 1));
Expand Down

0 comments on commit 053788f

Please sign in to comment.