linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Oliver Hartkopp <socketcan@hartkopp.net>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: [RFC] CAN FD support
Date: Thu, 03 May 2012 15:44:10 +0200	[thread overview]
Message-ID: <4FA28BAA.3000109@pengutronix.de> (raw)
In-Reply-To: <4FA27C3C.8010806@hartkopp.net>

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

On 05/03/2012 02:38 PM, Oliver Hartkopp wrote:
[...]

>> I share this.
>> I'd even prefer u16 over u8 even.
>> No legacy issues exist when changing the meaning of can_dlc, since current
>> CAN frames have equal values for DLC & length!
>>
>>> the struct is also used by the app.
> 
> 
> Yes - that's the main problem IMO.
> 
> What about this binary compatible introduction of cf->len ...

...but it's not 100% source compatible, due to a compiler bug in gcc.
You cannot use C99 initializers on anonymous unions in certain gcc versions.

[..]

> --- a/include/linux/can.h
> +++ b/include/linux/can.h
> @@ -57,7 +57,10 @@ typedef __u32 can_err_mask_t;
>   */
>  struct can_frame {
>  	canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
> -	__u8    can_dlc; /* data length code: 0 .. 8 */
> +	union {
> +		__u8    can_dlc; /* data length code: 0 .. 8 */
> +		__u8    len; /* data length: 0 .. 8 */
> +	};
>  	__u8    data[8] __attribute__((aligned(8)));
>  };

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  parent reply	other threads:[~2012-05-03 13:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 11:14 [RFC] CAN FD support part 1 - uncommented source Oliver Hartkopp
2012-05-03 11:34 ` Wolfgang Grandegger
2012-05-03 11:43   ` Oliver Hartkopp
2012-05-03 12:10     ` Wolfgang Grandegger
2012-05-03 12:18       ` [RFC] CAN FD support Kurt Van Dijck
2012-05-03 12:38         ` Oliver Hartkopp
2012-05-03 12:43           ` Wolfgang Grandegger
2012-05-03 13:00             ` Kurt Van Dijck
2012-05-03 13:13               ` Oliver Hartkopp
2012-05-03 13:44           ` Marc Kleine-Budde [this message]
2012-05-03 14:41             ` Oliver Hartkopp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA28BAA.3000109@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).