From: Daniel Scheller <d.scheller.oss@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, mchehab@s-opensource.com
Subject: Re: [PATCH 3/4] [media] ddbridge: use common DVB I2C client handling helpers
Date: Wed, 7 Mar 2018 21:09:26 +0100 [thread overview]
Message-ID: <20180307210926.12cd482d@lt530> (raw)
In-Reply-To: <20180307164449.1aca9352@vento.lan>
Am Wed, 7 Mar 2018 16:44:49 -0300
schrieb Mauro Carvalho Chehab <mchehab@kernel.org>:
> Em Wed, 7 Mar 2018 20:23:49 +0100
> Daniel Scheller <d.scheller.oss@gmail.com> escreveu:
>
> > From: Daniel Scheller <d.scheller@gmx.net>
> >
> > Instead of keeping duplicated I2C client handling construct, make
> > use of the newly introduced dvb_module_*() helpers. This not only
> > keeps things way cleaner and removes the need for duplicated I2C
> > client attach code, but even allows to get rid of some variables
> > that won't help in making things look cleaner anymore.
> >
> > The check on a valid ptr on port->en isn't really needed since the
> > cxd2099 driver will set it at a time where it is going to return
> > successfully from probing.
> >
> > Signed-off-by: Daniel Scheller <d.scheller@gmx.net>
> > ---
> > drivers/media/pci/ddbridge/ddbridge-ci.c | 33
> > ++++++--------------------
> > drivers/media/pci/ddbridge/ddbridge-core.c | 37
> > +++++++----------------------- 2 files changed, 15 insertions(+),
> > 55 deletions(-)
> >
> > diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c
> > b/drivers/media/pci/ddbridge/ddbridge-ci.c index
> > 6585ef54ac22..d0ce6a1f1bd0 100644 ---
> > a/drivers/media/pci/ddbridge/ddbridge-ci.c +++
> > b/drivers/media/pci/ddbridge/ddbridge-ci.c @@ -324,34 +324,20 @@
> > static int ci_cxd2099_attach(struct ddb_port *port, u32 bitrate) {
> > struct cxd2099_cfg cxd_cfg = cxd_cfgtmpl;
> > struct i2c_client *client;
> > - struct i2c_board_info board_info = {
> > - .type = "cxd2099",
> > - .addr = 0x40,
> > - .platform_data = &cxd_cfg,
> > - };
> >
> > cxd_cfg.bitrate = bitrate;
> > cxd_cfg.en = &port->en;
> >
> > - request_module(board_info.type);
> > -
> > - client = i2c_new_device(&port->i2c->adap, &board_info);
> > - if (!client || !client->dev.driver)
> > - goto err_ret;
> > -
> > - if (!try_module_get(client->dev.driver->owner))
> > - goto err_i2c;
> > -
> > - if (!port->en)
> > - goto err_i2c;
> > + client = dvb_module_probe("cxd2099", "cxd2099",
> > &port->i2c->adap,
> > + 0x40, &cxd_cfg);
>
> Here and on all similar calls, there's no need to duplicate the name,
> if they're identical. Just use NULL at the second time, e. g.:
>
> client = dvb_module_probe("cxd2099", NULL, &port->i2c->adap,
> 0x40, &cxd_cfg);
>
> The dvb_module_probe() will use the same string for both.
Convinced (wanted to make this look "complete" and "proper").
V2 sent, skipped the cover letter though :-)
Best regards,
Daniel Scheller
--
https://github.com/herrnst
next prev parent reply other threads:[~2018-03-07 20:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-07 19:23 [PATCH 0/4] misc cxd2099/Kconfig/ddbridge/ngene improvements Daniel Scheller
2018-03-07 19:23 ` [PATCH 1/4] [media] dvb-frontends/cxd2099: Kconfig additions Daniel Scheller
2018-03-07 19:23 ` [PATCH 2/4] [media] dvb-frontends/Kconfig: move the SP2 driver to the CI section Daniel Scheller
2018-03-07 19:23 ` [PATCH 3/4] [media] ddbridge: use common DVB I2C client handling helpers Daniel Scheller
2018-03-07 19:44 ` Mauro Carvalho Chehab
2018-03-07 20:09 ` Daniel Scheller [this message]
2018-03-07 19:23 ` [PATCH 4/4] [media] ngene: " Daniel Scheller
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=20180307210926.12cd482d@lt530 \
--to=d.scheller.oss@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mchehab@s-opensource.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 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).