[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1019942000.124735.1614942841458@mail1.libero.it>
Date: Fri, 5 Mar 2021 12:14:01 +0100 (CET)
From: Dario Binacchi <dariobin@...ero.it>
To: Marc Kleine-Budde <mkl@...gutronix.de>
Cc: linux-kernel@...r.kernel.org,
Alexander Stein <alexander.stein@...tec-electronic.com>,
Federico Vaga <federico.vaga@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oliver Hartkopp <socketcan@...tkopp.net>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Wolfgang Grandegger <wg@...ndegger.com>,
YueHaibing <yuehaibing@...wei.com>,
Zhang Qilong <zhangqilong3@...wei.com>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH v4 5/6] can: c_can: prepare to up the message objects
number
> Il 04/03/2021 16:26 Marc Kleine-Budde <mkl@...gutronix.de> ha scritto:
>
>
> On 02.03.2021 22:54:34, Dario Binacchi wrote:
> > diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
> > index 77b9aee56154..0052ba5197e0 100644
> > --- a/drivers/net/can/c_can/c_can.c
> > +++ b/drivers/net/can/c_can/c_can.c
> [...]
> > -struct net_device *alloc_c_can_dev(void)
> > +struct net_device *alloc_c_can_dev(int msg_obj_num)
> > {
> > struct net_device *dev;
> > struct c_can_priv *priv;
> > + int msg_obj_tx_num = msg_obj_num / 2;
> >
> > - dev = alloc_candev(sizeof(struct c_can_priv), C_CAN_MSG_OBJ_TX_NUM);
> > + dev = alloc_candev(sizeof(*priv) + sizeof(u32) * msg_obj_tx_num,
> > + msg_obj_tx_num);
>
> I've converted this to make use of the struct_size() macro:
>
> + dev = alloc_candev(struct_size(priv, dlc, msg_obj_tx_num),
> + msg_obj_tx_num);
>
Nice!
I learned a new thing.
Thanks and regards,
Dario
> regards,
> Marc
>
> --
> Pengutronix e.K. | Marc Kleine-Budde |
> Embedded Linux | https://www.pengutronix.de |
> Vertretung West/Dortmund | Phone: +49-231-2826-924 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Powered by blists - more mailing lists