diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2020-11-20 11:04:44 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-11-20 12:04:12 +0100 |
commit | c7b74967799b1af52b3045d69d4c26836b2d41de (patch) | |
tree | 8ea93c983077794b4ea8825facfd35c3208da9cb /net/can | |
parent | cd1124e76d740327be5d8f9ce3785ce1119daf4b (diff) |
can: replace can_dlc as variable/element for payload length
The naming of can_dlc as element of struct can_frame and also as variable
name is misleading as it claims to be a 'data length CODE' but in reality
it always was a plain data length.
With the indroduction of a new 'len' element in struct can_frame we can now
remove can_dlc as name and make clear which of the former uses was a plain
length (-> 'len') or a data length code (-> 'dlc') value.
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201120100444.3199-1-socketcan@hartkopp.net
[mkl: gs_usb: keep struct gs_host_frame::can_dlc as is]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can')
-rw-r--r-- | net/can/af_can.c | 2 | ||||
-rw-r--r-- | net/can/gw.c | 2 | ||||
-rw-r--r-- | net/can/j1939/main.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/net/can/af_can.c b/net/can/af_can.c index 5d124c155904..963bd7145517 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -888,7 +888,7 @@ static __init int can_init(void) int err; /* check for correct padding to be able to use the structs similarly */ - BUILD_BUG_ON(offsetof(struct can_frame, can_dlc) != + BUILD_BUG_ON(offsetof(struct can_frame, len) != offsetof(struct canfd_frame, len) || offsetof(struct can_frame, data) != offsetof(struct canfd_frame, data)); diff --git a/net/can/gw.c b/net/can/gw.c index 6b790b6ff8d2..de5e8859ec9b 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -207,7 +207,7 @@ static void canframecpy(struct canfd_frame *dst, struct can_frame *src) */ dst->can_id = src->can_id; - dst->len = src->can_dlc; + dst->len = src->len; *(u64 *)dst->data = *(u64 *)src->data; } diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c index 137054bff9ec..bb914d8b4216 100644 --- a/net/can/j1939/main.c +++ b/net/can/j1939/main.c @@ -62,7 +62,7 @@ static void j1939_can_recv(struct sk_buff *iskb, void *data) skb_pull(skb, J1939_CAN_HDR); /* fix length, set to dlc, with 8 maximum */ - skb_trim(skb, min_t(uint8_t, cf->can_dlc, 8)); + skb_trim(skb, min_t(uint8_t, cf->len, 8)); /* set addr */ skcb = j1939_skb_to_cb(skb); @@ -335,7 +335,7 @@ int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb) canid |= skcb->addr.da << 8; cf->can_id = canid; - cf->can_dlc = dlc; + cf->len = dlc; return can_send(skb, 1); |