can_frame is the name of the struct can_frame which is not meant in the corrected comments.
Unified · Split
| @@ -84,7 +84,7 @@ MODULE_LICENSE("Dual BSD/GPL"); · 83 unmodified lines | |||
| 84 | MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>"); | 84 | MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>"); |
| 85 | MODULE_ALIAS("can-proto-2"); | 85 | MODULE_ALIAS("can-proto-2"); |
| 86 | 86 | ||
| 87 | /* easy access to can_frame payload */ | 87 | /* easy access to CAN frame payload */ |
| 88 | static inline u64 GET_U64(const struct can_frame *cp) | 88 | static inline u64 GET_U64(const struct can_frame *cp) |
| 89 | { | 89 | { |
| 90 | return *(u64 *)cp->data; | 90 | return *(u64 *)cp->data; |
| @@ -305,13 +305,13 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, · 214 unmodified lines | |||
| 305 | memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head)); | 305 | memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head)); |
| 306 | 306 | ||
| 307 | if (head->nframes) { | 307 | if (head->nframes) { |
| 308 | /* can_frames starting here */ | 308 | /* CAN frames starting here */ |
| 309 | firstframe = (struct can_frame *)skb_tail_pointer(skb); | 309 | firstframe = (struct can_frame *)skb_tail_pointer(skb); |
| 310 | 310 | ||
| 311 | memcpy(skb_put(skb, datalen), frames, datalen); | 311 | memcpy(skb_put(skb, datalen), frames, datalen); |
| 312 | 312 | ||
| 313 | /* | 313 | /* |
| 314 | * the BCM uses the can_dlc-element of the can_frame | 314 | * the BCM uses the can_dlc-element of the CAN frame |
| 315 | * structure for internal purposes. This is only | 315 | * structure for internal purposes. This is only |
| 316 | * relevant for updates that are generated by the | 316 | * relevant for updates that are generated by the |
| 317 | * BCM, where nframes is 1 | 317 | * BCM, where nframes is 1 |
| @@ -492,7 +492,7 @@ static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index, · 174 unmodified lines | |||
| 492 | return; | 492 | return; |
| 493 | } | 493 | } |
| 494 | 494 | ||
| 495 | /* do a real check in can_frame data section */ | 495 | /* do a real check in CAN frame data section */ |
| 496 | 496 | ||
| 497 | if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) != | 497 | if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) != |
| 498 | (GET_U64(&op->frames[index]) & GET_U64(&op->last_frames[index]))) { | 498 | (GET_U64(&op->frames[index]) & GET_U64(&op->last_frames[index]))) { |
| @@ -501,7 +501,7 @@ static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index, · 2 unmodified lines | |||
| 501 | } | 501 | } |
| 502 | 502 | ||
| 503 | if (op->flags & RX_CHECK_DLC) { | 503 | if (op->flags & RX_CHECK_DLC) { |
| 504 | /* do a real check in can_frame dlc */ | 504 | /* do a real check in CAN frame dlc */ |
| 505 | if (rxdata->can_dlc != (op->last_frames[index].can_dlc & | 505 | if (rxdata->can_dlc != (op->last_frames[index].can_dlc & |
| 506 | BCM_CAN_DLC_MASK)) { | 506 | BCM_CAN_DLC_MASK)) { |
| 507 | bcm_rx_update_and_send(op, &op->last_frames[index], | 507 | bcm_rx_update_and_send(op, &op->last_frames[index], |
| @@ -554,7 +554,7 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer) · 46 unmodified lines | |||
| 554 | 554 | ||
| 555 | /* if user wants to be informed, when cyclic CAN-Messages come back */ | 555 | /* if user wants to be informed, when cyclic CAN-Messages come back */ |
| 556 | if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { | 556 | if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { |
| 557 | /* clear received can_frames to indicate 'nothing received' */ | 557 | /* clear received CAN frames to indicate 'nothing received' */ |
| 558 | memset(op->last_frames, 0, op->nframes * CFSIZ); | 558 | memset(op->last_frames, 0, op->nframes * CFSIZ); |
| 559 | } | 559 | } |
| 560 | 560 | ||
| @@ -840,7 +840,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 279 unmodified lines | |||
| 840 | if (!ifindex) | 840 | if (!ifindex) |
| 841 | return -ENODEV; | 841 | return -ENODEV; |
| 842 | 842 | ||
| 843 | /* check nframes boundaries - we need at least one can_frame */ | 843 | /* check nframes boundaries - we need at least one CAN frame */ |
| 844 | if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES) | 844 | if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES) |
| 845 | return -EINVAL; | 845 | return -EINVAL; |
| 846 | 846 | ||
| @@ -851,14 +851,14 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 4 unmodified lines | |||
| 851 | /* update existing BCM operation */ | 851 | /* update existing BCM operation */ |
| 852 | 852 | ||
| 853 | /* | 853 | /* |
| 854 | * Do we need more space for the can_frames than currently | 854 | * Do we need more space for the CAN frames than currently |
| 855 | * allocated? -> This is a _really_ unusual use-case and | 855 | * allocated? -> This is a _really_ unusual use-case and |
| 856 | * therefore (complexity / locking) it is not supported. | 856 | * therefore (complexity / locking) it is not supported. |
| 857 | */ | 857 | */ |
| 858 | if (msg_head->nframes > op->nframes) | 858 | if (msg_head->nframes > op->nframes) |
| 859 | return -E2BIG; | 859 | return -E2BIG; |
| 860 | 860 | ||
| 861 | /* update can_frames content */ | 861 | /* update CAN frames content */ |
| 862 | for (i = 0; i < msg_head->nframes; i++) { | 862 | for (i = 0; i < msg_head->nframes; i++) { |
| 863 | err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ); | 863 | err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ); |
| 864 | 864 | ||
| @@ -883,7 +883,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 18 unmodified lines | |||
| 883 | 883 | ||
| 884 | op->can_id = msg_head->can_id; | 884 | op->can_id = msg_head->can_id; |
| 885 | 885 | ||
| 886 | /* create array for can_frames and copy the data */ | 886 | /* create array for CAN frames and copy the data */ |
| 887 | if (msg_head->nframes > 1) { | 887 | if (msg_head->nframes > 1) { |
| 888 | op->frames = kmalloc(msg_head->nframes * CFSIZ, | 888 | op->frames = kmalloc(msg_head->nframes * CFSIZ, |
| 889 | GFP_KERNEL); | 889 | GFP_KERNEL); |
| @@ -966,7 +966,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 76 unmodified lines | |||
| 966 | 966 | ||
| 967 | if (op->flags & STARTTIMER) { | 967 | if (op->flags & STARTTIMER) { |
| 968 | hrtimer_cancel(&op->timer); | 968 | hrtimer_cancel(&op->timer); |
| 969 | /* spec: send can_frame when starting timer */ | 969 | /* spec: send CAN frame when starting timer */ |
| 970 | op->flags |= TX_ANNOUNCE; | 970 | op->flags |= TX_ANNOUNCE; |
| 971 | } | 971 | } |
| 972 | 972 | ||
| @@ -1015,7 +1015,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 42 unmodified lines | |||
| 1015 | /* update existing BCM operation */ | 1015 | /* update existing BCM operation */ |
| 1016 | 1016 | ||
| 1017 | /* | 1017 | /* |
| 1018 | * Do we need more space for the can_frames than currently | 1018 | * Do we need more space for the CAN frames than currently |
| 1019 | * allocated? -> This is a _really_ unusual use-case and | 1019 | * allocated? -> This is a _really_ unusual use-case and |
| 1020 | * therefore (complexity / locking) it is not supported. | 1020 | * therefore (complexity / locking) it is not supported. |
| 1021 | */ | 1021 | */ |
| @@ -1023,7 +1023,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 1 unmodified line | |||
| 1023 | return -E2BIG; | 1023 | return -E2BIG; |
| 1024 | 1024 | ||
| 1025 | if (msg_head->nframes) { | 1025 | if (msg_head->nframes) { |
| 1026 | /* update can_frames content */ | 1026 | /* update CAN frames content */ |
| 1027 | err = memcpy_from_msg((u8 *)op->frames, msg, | 1027 | err = memcpy_from_msg((u8 *)op->frames, msg, |
| 1028 | msg_head->nframes * CFSIZ); | 1028 | msg_head->nframes * CFSIZ); |
| 1029 | if (err < 0) | 1029 | if (err < 0) |
| @@ -1048,7 +1048,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 18 unmodified lines | |||
| 1048 | op->nframes = msg_head->nframes; | 1048 | op->nframes = msg_head->nframes; |
| 1049 | 1049 | ||
| 1050 | if (msg_head->nframes > 1) { | 1050 | if (msg_head->nframes > 1) { |
| 1051 | /* create array for can_frames and copy the data */ | 1051 | /* create array for CAN frames and copy the data */ |
| 1052 | op->frames = kmalloc(msg_head->nframes * CFSIZ, | 1052 | op->frames = kmalloc(msg_head->nframes * CFSIZ, |
| 1053 | GFP_KERNEL); | 1053 | GFP_KERNEL); |
| 1054 | if (!op->frames) { | 1054 | if (!op->frames) { |
| @@ -1056,7 +1056,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, · 1 unmodified line | |||
| 1056 | return -ENOMEM; | 1056 | return -ENOMEM; |
| 1057 | } | 1057 | } |
| 1058 | 1058 | ||
| 1059 | /* create and init array for received can_frames */ | 1059 | /* create and init array for received CAN frames */ |
| 1060 | op->last_frames = kzalloc(msg_head->nframes * CFSIZ, | 1060 | op->last_frames = kzalloc(msg_head->nframes * CFSIZ, |
| 1061 | GFP_KERNEL); | 1061 | GFP_KERNEL); |
| 1062 | if (!op->last_frames) { | 1062 | if (!op->last_frames) { |
| @@ -1327,7 +1327,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) · 264 unmodified lines | |||
| 1327 | break; | 1327 | break; |
| 1328 | 1328 | ||
| 1329 | case TX_SEND: | 1329 | case TX_SEND: |
| 1330 | /* we need exactly one can_frame behind the msg head */ | 1330 | /* we need exactly one CAN frame behind the msg head */ |
| 1331 | if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ)) | 1331 | if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ)) |
| 1332 | ret = -EINVAL; | 1332 | ret = -EINVAL; |
| 1333 | else | 1333 | else |