From: Dario Binacchi <dariobin@libero.it>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
Alexander Stein <alexander.stein@systec-electronic.com>,
Federico Vaga <federico.vaga@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Oliver Hartkopp <socketcan@hartkopp.net>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Wolfgang Grandegger <wg@grandegger.com>,
YueHaibing <yuehaibing@huawei.com>,
Zhang Qilong <zhangqilong3@huawei.com>,
linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v4 5/6] can: c_can: prepare to up the message objects number
Date: Fri, 5 Mar 2021 12:14:01 +0100 (CET) [thread overview]
Message-ID: <1019942000.124735.1614942841458@mail1.libero.it> (raw)
In-Reply-To: <20210304152618.rqajqmzcqqhszfem@pengutronix.de>
> Il 04/03/2021 16:26 Marc Kleine-Budde <mkl@pengutronix.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 |
next prev parent reply other threads:[~2021-03-05 11:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 21:54 [PATCH v4 0/6] can: c_can: add support to 64 message objects Dario Binacchi
2021-03-02 21:54 ` [PATCH v4 1/6] can: c_can: remove unused code Dario Binacchi
2021-03-02 21:54 ` [PATCH v4 2/6] can: c_can: fix indentation Dario Binacchi
2021-03-02 21:54 ` [PATCH v4 3/6] can: c_can: add a comment about IF_RX interface's use Dario Binacchi
2021-03-02 21:54 ` [PATCH v4 4/6] can: c_can: use 32-bit write to set arbitration register Dario Binacchi
2021-03-02 21:54 ` [PATCH v4 5/6] can: c_can: prepare to up the message objects number Dario Binacchi
2021-03-04 15:26 ` Marc Kleine-Budde
2021-03-05 11:14 ` Dario Binacchi [this message]
2021-03-02 21:54 ` [PATCH v4 6/6] can: c_can: add support to 64 message objects Dario Binacchi
2021-03-04 14:33 ` [PATCH v4 0/6] " Marc Kleine-Budde
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=1019942000.124735.1614942841458@mail1.libero.it \
--to=dariobin@libero.it \
--cc=alexander.stein@systec-electronic.com \
--cc=davem@davemloft.net \
--cc=federico.vaga@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
--cc=netdev@vger.kernel.org \
--cc=socketcan@hartkopp.net \
--cc=wg@grandegger.com \
--cc=yuehaibing@huawei.com \
--cc=zhangqilong3@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.