[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8dad612dc67b19d1f5c295b46e70ad56666c1b17.camel@esd.eu>
Date: Mon, 23 Jan 2023 15:51:29 +0000
From: Frank Jungclaus <Frank.Jungclaus@....eu>
To: "mkl@...gutronix.de" <mkl@...gutronix.de>,
"mailhol.vincent@...adoo.fr" <mailhol.vincent@...adoo.fr>
CC: Stefan Mätje <Stefan.Maetje@....eu>,
"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
"wg@...ndegger.com" <wg@...ndegger.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] can: esd_usb: Improved decoding for
ESD_EV_CAN_ERROR_EXT messages
On Tue, 2022-12-20 at 10:05 +0100, Marc Kleine-Budde wrote:
> On 20.12.2022 17:53:28, Vincent MAILHOL wrote:
> > > > struct tx_msg {
> > > > @@ -229,10 +237,10 @@ static void esd_usb_rx_event(struct esd_usb_net_priv *priv,
> > > > u32 id = le32_to_cpu(msg->msg.rx.id) & ESD_IDMASK;
> > > >
> > > > if (id == ESD_EV_CAN_ERROR_EXT) {
> > > > - u8 state = msg->msg.rx.data[0];
> > > > - u8 ecc = msg->msg.rx.data[1];
> > > > - u8 rxerr = msg->msg.rx.data[2];
> > > > - u8 txerr = msg->msg.rx.data[3];
> > > > + u8 state = msg->msg.rx.ev_can_err_ext.status;
> > > > + u8 ecc = msg->msg.rx.ev_can_err_ext.ecc;
> > > > + u8 rxerr = msg->msg.rx.ev_can_err_ext.rec;
> > > > + u8 txerr = msg->msg.rx.ev_can_err_ext.tec;
> > >
> > > I do not like how you have to write msg->msg.rx.something. I think it
> > > would be better to make the union within struct esd_usb_msg anonymous:
> > >
> > > https://elixir.bootlin.com/linux/latest/source/drivers/net/can/usb/esd_usb.c#L169
> >
> > Or maybe just declare esd_usb_msg as an union instead of a struct:
>
> +1
Accepted ;)
I'll try to address this in a separate code-clean-up patch.
>
> > union esd_usb_msg {
> > struct header_msg hdr;
> > struct version_msg version;
> > struct version_reply_msg version_reply;
> > struct rx_msg rx;
> > struct tx_msg tx;
> > struct tx_done_msg txdone;
> > struct set_baudrate_msg setbaud;
> > struct id_filter_msg filter;
> > };
>
> Marc
>
Powered by blists - more mailing lists