From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Linus Walleij <linus.walleij@linaro.org>,
Jakob Hauser <jahau@rocketmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v2 1/3] iio: magnetometer: yamaha-yas530: Use pointers as driver data
Date: Sun, 4 Sep 2022 16:30:50 +0100 [thread overview]
Message-ID: <20220904163050.7cc52153@jic23-huawei> (raw)
In-Reply-To: <20220831141530.80572-1-andriy.shevchenko@linux.intel.com>
On Wed, 31 Aug 2022 17:15:28 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> Unify ID tables to use pointers for driver data. It will allow
> to simplify the driver later on.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Series applied to the togreg branch of iio.git and pushed out as testing
for 0-day to see if it can find things we missed.
Still time for feedback from others before I push this out as the
more or less non-rebasing, togreg branch.
Thanks,
Jonathan
> ---
> v2: left ID fallback in place (Jonathan)
> drivers/iio/magnetometer/yamaha-yas530.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
> index 026f71e524f3..58f527cfde07 100644
> --- a/drivers/iio/magnetometer/yamaha-yas530.c
> +++ b/drivers/iio/magnetometer/yamaha-yas530.c
> @@ -32,6 +32,7 @@
> #include <linux/mod_devicetable.h>
> #include <linux/mutex.h>
> #include <linux/pm_runtime.h>
> +#include <linux/property.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> #include <linux/random.h>
> @@ -1437,8 +1438,10 @@ static int yas5xx_probe(struct i2c_client *i2c,
> goto assert_reset;
> }
>
> - yas5xx->chip_info = &yas5xx_chip_info_tbl[id->driver_data];
> - ci = yas5xx->chip_info;
> + ci = device_get_match_data(dev);
> + if (!ci)
> + ci = (const struct yas5xx_chip_info *)id->driver_data;
> + yas5xx->chip_info = ci;
>
> ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &id_check);
> if (ret)
> @@ -1583,19 +1586,19 @@ static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend,
> yas5xx_runtime_resume, NULL);
>
> static const struct i2c_device_id yas5xx_id[] = {
> - {"yas530", yas530 },
> - {"yas532", yas532 },
> - {"yas533", yas533 },
> - {"yas537", yas537 },
> + {"yas530", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas530] },
> + {"yas532", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas532] },
> + {"yas533", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas533] },
> + {"yas537", (kernel_ulong_t)&yas5xx_chip_info_tbl[yas537] },
> {}
> };
> MODULE_DEVICE_TABLE(i2c, yas5xx_id);
>
> static const struct of_device_id yas5xx_of_match[] = {
> - { .compatible = "yamaha,yas530", },
> - { .compatible = "yamaha,yas532", },
> - { .compatible = "yamaha,yas533", },
> - { .compatible = "yamaha,yas537", },
> + { .compatible = "yamaha,yas530", &yas5xx_chip_info_tbl[yas530] },
> + { .compatible = "yamaha,yas532", &yas5xx_chip_info_tbl[yas532] },
> + { .compatible = "yamaha,yas533", &yas5xx_chip_info_tbl[yas533] },
> + { .compatible = "yamaha,yas537", &yas5xx_chip_info_tbl[yas537] },
> {}
> };
> MODULE_DEVICE_TABLE(of, yas5xx_of_match);
prev parent reply other threads:[~2022-09-04 16:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 14:15 Andy Shevchenko
2022-08-31 14:15 ` [PATCH v2 2/3] iio: magnetometer: yamaha-yas530: Make strings const in chip info Andy Shevchenko
2022-08-31 14:15 ` [PATCH v2 3/3] iio: magnetometer: yamaha-yas530: Use dev_err_probe() Andy Shevchenko
2022-09-04 15:30 ` Jonathan Cameron [this message]
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=20220904163050.7cc52153@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jahau@rocketmail.com \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®