Commit 72c8a89a authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by Marc Kleine-Budde

can: bcm: use CAN frame instead of can_frame in comments

can_frame is the name of the struct can_frame which is not meant in
the corrected comments.
Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 95acb490
...@@ -84,7 +84,7 @@ MODULE_LICENSE("Dual BSD/GPL"); ...@@ -84,7 +84,7 @@ MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>"); MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>");
MODULE_ALIAS("can-proto-2"); MODULE_ALIAS("can-proto-2");
/* easy access to can_frame payload */ /* easy access to CAN frame payload */
static inline u64 GET_U64(const struct can_frame *cp) static inline u64 GET_U64(const struct can_frame *cp)
{ {
return *(u64 *)cp->data; return *(u64 *)cp->data;
...@@ -305,13 +305,13 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, ...@@ -305,13 +305,13 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head)); memcpy(skb_put(skb, sizeof(*head)), head, sizeof(*head));
if (head->nframes) { if (head->nframes) {
/* can_frames starting here */ /* CAN frames starting here */
firstframe = (struct can_frame *)skb_tail_pointer(skb); firstframe = (struct can_frame *)skb_tail_pointer(skb);
memcpy(skb_put(skb, datalen), frames, datalen); memcpy(skb_put(skb, datalen), frames, datalen);
/* /*
* the BCM uses the can_dlc-element of the can_frame * the BCM uses the can_dlc-element of the CAN frame
* structure for internal purposes. This is only * structure for internal purposes. This is only
* relevant for updates that are generated by the * relevant for updates that are generated by the
* BCM, where nframes is 1 * BCM, where nframes is 1
...@@ -492,7 +492,7 @@ static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index, ...@@ -492,7 +492,7 @@ static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index,
return; return;
} }
/* do a real check in can_frame data section */ /* do a real check in CAN frame data section */
if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) != if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) !=
(GET_U64(&op->frames[index]) & GET_U64(&op->last_frames[index]))) { (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, ...@@ -501,7 +501,7 @@ static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index,
} }
if (op->flags & RX_CHECK_DLC) { if (op->flags & RX_CHECK_DLC) {
/* do a real check in can_frame dlc */ /* do a real check in CAN frame dlc */
if (rxdata->can_dlc != (op->last_frames[index].can_dlc & if (rxdata->can_dlc != (op->last_frames[index].can_dlc &
BCM_CAN_DLC_MASK)) { BCM_CAN_DLC_MASK)) {
bcm_rx_update_and_send(op, &op->last_frames[index], 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) ...@@ -554,7 +554,7 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
/* if user wants to be informed, when cyclic CAN-Messages come back */ /* if user wants to be informed, when cyclic CAN-Messages come back */
if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) {
/* clear received can_frames to indicate 'nothing received' */ /* clear received CAN frames to indicate 'nothing received' */
memset(op->last_frames, 0, op->nframes * CFSIZ); memset(op->last_frames, 0, op->nframes * CFSIZ);
} }
...@@ -840,7 +840,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -840,7 +840,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
if (!ifindex) if (!ifindex)
return -ENODEV; return -ENODEV;
/* check nframes boundaries - we need at least one can_frame */ /* check nframes boundaries - we need at least one CAN frame */
if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES) if (msg_head->nframes < 1 || msg_head->nframes > MAX_NFRAMES)
return -EINVAL; return -EINVAL;
...@@ -851,14 +851,14 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -851,14 +851,14 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
/* update existing BCM operation */ /* update existing BCM operation */
/* /*
* Do we need more space for the can_frames than currently * Do we need more space for the CAN frames than currently
* allocated? -> This is a _really_ unusual use-case and * allocated? -> This is a _really_ unusual use-case and
* therefore (complexity / locking) it is not supported. * therefore (complexity / locking) it is not supported.
*/ */
if (msg_head->nframes > op->nframes) if (msg_head->nframes > op->nframes)
return -E2BIG; return -E2BIG;
/* update can_frames content */ /* update CAN frames content */
for (i = 0; i < msg_head->nframes; i++) { for (i = 0; i < msg_head->nframes; i++) {
err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ); err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ);
...@@ -883,7 +883,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -883,7 +883,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
op->can_id = msg_head->can_id; op->can_id = msg_head->can_id;
/* create array for can_frames and copy the data */ /* create array for CAN frames and copy the data */
if (msg_head->nframes > 1) { if (msg_head->nframes > 1) {
op->frames = kmalloc(msg_head->nframes * CFSIZ, op->frames = kmalloc(msg_head->nframes * CFSIZ,
GFP_KERNEL); GFP_KERNEL);
...@@ -966,7 +966,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -966,7 +966,7 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
if (op->flags & STARTTIMER) { if (op->flags & STARTTIMER) {
hrtimer_cancel(&op->timer); hrtimer_cancel(&op->timer);
/* spec: send can_frame when starting timer */ /* spec: send CAN frame when starting timer */
op->flags |= TX_ANNOUNCE; op->flags |= TX_ANNOUNCE;
} }
...@@ -1015,7 +1015,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -1015,7 +1015,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
/* update existing BCM operation */ /* update existing BCM operation */
/* /*
* Do we need more space for the can_frames than currently * Do we need more space for the CAN frames than currently
* allocated? -> This is a _really_ unusual use-case and * allocated? -> This is a _really_ unusual use-case and
* therefore (complexity / locking) it is not supported. * therefore (complexity / locking) it is not supported.
*/ */
...@@ -1023,7 +1023,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -1023,7 +1023,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
return -E2BIG; return -E2BIG;
if (msg_head->nframes) { if (msg_head->nframes) {
/* update can_frames content */ /* update CAN frames content */
err = memcpy_from_msg((u8 *)op->frames, msg, err = memcpy_from_msg((u8 *)op->frames, msg,
msg_head->nframes * CFSIZ); msg_head->nframes * CFSIZ);
if (err < 0) if (err < 0)
...@@ -1048,7 +1048,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -1048,7 +1048,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
op->nframes = msg_head->nframes; op->nframes = msg_head->nframes;
if (msg_head->nframes > 1) { if (msg_head->nframes > 1) {
/* create array for can_frames and copy the data */ /* create array for CAN frames and copy the data */
op->frames = kmalloc(msg_head->nframes * CFSIZ, op->frames = kmalloc(msg_head->nframes * CFSIZ,
GFP_KERNEL); GFP_KERNEL);
if (!op->frames) { if (!op->frames) {
...@@ -1056,7 +1056,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg, ...@@ -1056,7 +1056,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
return -ENOMEM; return -ENOMEM;
} }
/* create and init array for received can_frames */ /* create and init array for received CAN frames */
op->last_frames = kzalloc(msg_head->nframes * CFSIZ, op->last_frames = kzalloc(msg_head->nframes * CFSIZ,
GFP_KERNEL); GFP_KERNEL);
if (!op->last_frames) { if (!op->last_frames) {
...@@ -1327,7 +1327,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) ...@@ -1327,7 +1327,7 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
break; break;
case TX_SEND: case TX_SEND:
/* we need exactly one can_frame behind the msg head */ /* we need exactly one CAN frame behind the msg head */
if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ)) if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ))
ret = -EINVAL; ret = -EINVAL;
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment