On 08/01/2018 07:39 PM, Oliver Hartkopp wrote: >>> I think the code can be simplified if you introduce a union for can_fram and >>> canfd_frame. >> >> Can you be more specific in which structure/function? >> >> I was thinking of passing a skb to mailbox_read function instead of canfd_frame or can_frame. >> That way the code in rx_overload.c would become cleaner. > > IMO there's no need to have a union of struct can_frame and struct > canfd_frame as the latter has been defined to have a binary compatible > layout. See at: > > https://can-newsletter.org/engineering/standardization/nr_stand_can-fd_linux3.6_120703 > > So you can put either type of CAN frame into a struct canfd_frame. But > whether your content is CAN or CAN FD has to be known somewhere else!! Sure. > At least there should be a comment that the struct canfd_frame is used > for both types of CAN frames. But you need to case it to a std canframe to access it. Setting the length needs if (is_fd) else... Maybe the picture comes a bit clearer on my side, once the flexcan driver is converted to CANFD mode :) 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:
signature.asc
Description: OpenPGP digital signature