[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5cdfcd0d-067b-16f0-1860-36997c1f04ee@free.fr>
Date: Tue, 2 Jul 2019 10:37:28 +0200
From: Marc Gonzalez <marc.w.gonzalez@...e.fr>
To: Antti Palosaari <crope@....fi>,
Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media <linux-media@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Jonathan Neuschäfer <j.neuschaefer@....net>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Brad Love <brad@...tdimension.cc>
Subject: Re: [PATCH v1] media: si2168: Refactor command setup code
On 01/07/2019 13:44, Marc Gonzalez wrote:
> By refactoring the command setup code, we can let the compiler
> determine the size of each command.
>
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@...e.fr>
> ---
> drivers/media/dvb-frontends/si2168.c | 142 ++++++++-------------------
> 1 file changed, 41 insertions(+), 101 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
> index 168c503e9154..19398f041c79 100644
> --- a/drivers/media/dvb-frontends/si2168.c
> +++ b/drivers/media/dvb-frontends/si2168.c
> @@ -11,6 +11,12 @@
>
> static const struct dvb_frontend_ops si2168_ops;
>
> +#define CMD_SETUP(cmd, __args, __rlen) do { \
> + int wlen = sizeof(__args) - 1; \
> + memcpy(cmd.args, __args, wlen); \
> + cmd.wlen = wlen; cmd.rlen = __rlen; \
> +} while (0)
> +
I'm planning on sending a v2 where drivers/media/tuners/si2157.c
is refactored the same way. Not sure where to store the macro.
Maybe include/media/dvb_frontend.h ?
Regards.
Powered by blists - more mailing lists