From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: Antti Palosaari <crope@iki.fi>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media <linux-media@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Bjorn Andersson" <bjorn.andersson@linaro.org>,
"Brad Love" <brad@nextdimension.cc>
Subject: Re: [PATCH v1] media: si2168: Refactor command setup code
Date: Tue, 2 Jul 2019 10:37:28 +0200 [thread overview]
Message-ID: <5cdfcd0d-067b-16f0-1860-36997c1f04ee@free.fr> (raw)
In-Reply-To: <6a8f9a5b-2e88-8c26-440b-76af0d91eda6@free.fr>
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@free.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.
next prev parent reply other threads:[~2019-07-02 8:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 11:44 [PATCH v1] media: si2168: Refactor command setup code Marc Gonzalez
2019-07-02 8:37 ` Marc Gonzalez [this message]
2019-07-02 9:51 ` Jonathan Neuschäfer
2019-07-03 12:47 ` Marc Gonzalez
2019-07-03 14:15 ` Marc Gonzalez
2019-07-03 16:35 ` Jonathan Neuschäfer
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=5cdfcd0d-067b-16f0-1860-36997c1f04ee@free.fr \
--to=marc.w.gonzalez@free.fr \
--cc=bjorn.andersson@linaro.org \
--cc=brad@nextdimension.cc \
--cc=crope@iki.fi \
--cc=j.neuschaefer@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).