forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] [mkl: gs_usb: keep struct gs_host_frame::can_dlc as is] Signed-off-by: Marc Kleine-Budde <[email protected]>
- Loading branch information
1 parent
cd1124e
commit c7b7496
Showing
40 changed files
with
228 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,10 @@ MODULE_AUTHOR("Wolfgang Grandegger <[email protected]>"); | |
static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, | ||
8, 12, 16, 20, 24, 32, 48, 64}; | ||
|
||
/* get data length from can_dlc with sanitized can_dlc */ | ||
u8 can_dlc2len(u8 can_dlc) | ||
/* get data length from raw data length code (DLC) */ | ||
u8 can_dlc2len(u8 dlc) | ||
{ | ||
return dlc2len[can_dlc & 0x0F]; | ||
return dlc2len[dlc & 0x0F]; | ||
} | ||
EXPORT_SYMBOL_GPL(can_dlc2len); | ||
|
||
|
@@ -595,7 +595,7 @@ static void can_restart(struct net_device *dev) | |
netif_rx_ni(skb); | ||
|
||
stats->rx_packets++; | ||
stats->rx_bytes += cf->can_dlc; | ||
stats->rx_bytes += cf->len; | ||
|
||
restart: | ||
netdev_dbg(dev, "restarted\n"); | ||
|
@@ -737,7 +737,7 @@ struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) | |
return NULL; | ||
|
||
(*cf)->can_id = CAN_ERR_FLAG; | ||
(*cf)->can_dlc = CAN_ERR_DLC; | ||
(*cf)->len = CAN_ERR_DLC; | ||
|
||
return skb; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.