From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Miaoqian Lin <linmq006@gmail.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Dmitry Rokosov <DDRokosov@sberdevices.ru>,
linux-iio@vger.kernel.org, Gwendal Grignou <gwendal@chromium.org>,
Wolfram Sang <wsa@kernel.org>,
kernel@pengutronix.de, Yang Yingliang <yangyingliang@huawei.com>,
wangjianli <wangjianli@cdjrlc.com>,
Vladimir Oltean <olteanv@gmail.com>,
Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH 10/23] iio: accel: kxcjk-1013: Convert to i2c's .probe_new
Date: Mon, 24 Oct 2022 09:05:18 +0200 [thread overview]
Message-ID: <20221024070518.dnrhsijfphbhs2la@pengutronix.de> (raw)
In-Reply-To: <Y1WQoyek5KBwDqCd@smile.fi.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2282 bytes --]
On Sun, Oct 23, 2022 at 10:06:11PM +0300, Andy Shevchenko wrote:
> On Sun, Oct 23, 2022 at 03:22:49PM +0200, Uwe Kleine-König wrote:
> > .probe_new() doesn't get the i2c_device_id * parameter, so determine
> > that explicitly in .probe(). The device_id array has to move up for that
> > to work.
>
> ...
>
> > +static const struct i2c_device_id kxcjk1013_id[] = {
> > + {"kxcjk1013", KXCJK1013},
> > + {"kxcj91008", KXCJ91008},
> > + {"kxtj21009", KXTJ21009},
> > + {"kxtf9", KXTF9},
> > + {"kx023-1025", KX0231025},
> > + {"SMO8500", KXCJ91008},
> > + {}
> > +};
> > +MODULE_DEVICE_TABLE(i2c, kxcjk1013_id);
>
> I don't like this part. Can we, please, find a way how to dereference this
> table via struct i2c_client, please?
It would be possible to do (on top of my patch here as PoC):
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index e043dd698747..00269b25af99 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -1445,7 +1445,7 @@ MODULE_DEVICE_TABLE(i2c, kxcjk1013_id);
static int kxcjk1013_probe(struct i2c_client *client)
{
- const struct i2c_device_id *id = i2c_match_id(kxcjk1013_id, client);
+ const struct i2c_device_id *id = i2c_match_id(to_i2c_driver(client->dev.driver)->id_table, client);
struct kxcjk1013_data *data;
struct iio_dev *indio_dev;
struct kxcjk_1013_platform_data *pdata;
(only compile tested), you could even create a function or macro to make
this a bit prettier on the source level. For the compiler loading the
address from a local symbol instead of from two pointer dereferences is
(I guess) a bit more effective and IMHO more natural.
*shrug*, I don't care much, but I don't like to have to rework this
series just because you don't like this part. You even didn't give a
rationale, I can imagine several different ones:
[ ] it makes the patch bigger
[ ] it results in an unnatural order of symbols in the driver
[ ] it's some kind of duplication
[ ] something else
please elaborate: ________________________________
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-10-24 7:05 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-23 13:22 [PATCH 00/23] iio: accel: Convert to i2c's .probe_new Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 01/23] iio: accel: adxl367: Convert to i2c's .probe_new() Uwe Kleine-König
2022-10-29 11:43 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 02/23] iio: accel: adxl372: Convert to i2c's .probe_new Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 03/23] iio: accel: bma400: " Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 04/23] iio: accel: bmc150: " Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 05/23] iio: accel: da280: " Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 06/23] iio: accel: da311: Convert to i2c's .probe_new() Uwe Kleine-König
2022-10-29 11:51 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 07/23] iio: accel: dmard06: " Uwe Kleine-König
2022-10-29 11:51 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 08/23] iio: accel: dmard09: " Uwe Kleine-König
2022-10-29 11:52 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 09/23] iio: accel: dmard10: " Uwe Kleine-König
2022-10-29 11:53 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 10/23] iio: accel: kxcjk-1013: Convert to i2c's .probe_new Uwe Kleine-König
2022-10-23 19:06 ` Andy Shevchenko
2022-10-24 7:05 ` Uwe Kleine-König [this message]
2022-10-24 8:39 ` Andy Shevchenko
2022-10-24 9:14 ` Uwe Kleine-König
2022-10-24 9:46 ` Andy Shevchenko
2022-10-24 10:22 ` Nuno Sá
2022-10-24 11:40 ` Andy Shevchenko
2022-10-29 11:49 ` Jonathan Cameron
2022-10-31 23:38 ` Uwe Kleine-König
2022-11-01 14:54 ` Andy Shevchenko
2022-11-01 21:49 ` Uwe Kleine-König
2022-11-02 13:57 ` Andy Shevchenko
2022-11-02 20:46 ` Wolfram Sang
2022-10-23 13:22 ` [PATCH 11/23] iio: accel: kxsd9: Convert to i2c's .probe_new() Uwe Kleine-König
2022-10-29 11:54 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 12/23] iio: accel: mc3230: " Uwe Kleine-König
2022-10-29 11:57 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 13/23] iio: accel: mma7455: Convert to i2c's .probe_new Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 14/23] iio: accel: mma7660: Convert to i2c's .probe_new() Uwe Kleine-König
2022-10-29 11:55 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 15/23] iio: accel: mma8452: Convert to i2c's .probe_new Uwe Kleine-König
2022-10-23 13:22 ` [PATCH 16/23] iio: accel: mma9551: " Uwe Kleine-König
2022-10-23 19:06 ` Andy Shevchenko
2022-10-23 13:22 ` [PATCH 17/23] iio: accel: mma9553: " Uwe Kleine-König
2022-10-23 19:07 ` Andy Shevchenko
2022-10-23 13:22 ` [PATCH 18/23] iio: accel: mxc4005: Convert to i2c's .probe_new() Uwe Kleine-König
2022-10-29 11:56 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 19/23] iio: accel: mxc6255: " Uwe Kleine-König
2022-10-29 11:57 ` Jonathan Cameron
2022-10-23 13:22 ` [PATCH 20/23] iio: accel: stk8312: " Uwe Kleine-König
2022-10-29 11:58 ` Jonathan Cameron
2022-10-23 13:23 ` [PATCH 21/23] iio: accel: stk8ba50: " Uwe Kleine-König
2022-10-29 11:59 ` Jonathan Cameron
2022-10-23 13:23 ` [PATCH 22/23] iio: accel: st_magn: " Uwe Kleine-König
2022-10-29 12:00 ` Jonathan Cameron
2022-10-23 13:23 ` [PATCH 23/23] iio: accel: vl6180: " Uwe Kleine-König
2022-10-29 12:01 ` Jonathan Cameron
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=20221024070518.dnrhsijfphbhs2la@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=DDRokosov@sberdevices.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gwendal@chromium.org \
--cc=jic23@kernel.org \
--cc=kernel@pengutronix.de \
--cc=lars@metafoo.de \
--cc=linmq006@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=wangjianli@cdjrlc.com \
--cc=wsa@kernel.org \
--cc=yangyingliang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox