From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
Jakob Hauser <jahau@rocketmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v1 3/4] iio: magnetometer: yamaha-yas530: Switch to new style i2c-driver probe function
Date: Mon, 29 Aug 2022 14:24:06 +0300 [thread overview]
Message-ID: <20220829112407.74917-3-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20220829112407.74917-1-andriy.shevchenko@linux.intel.com>
Switch to the new style i2c-driver probe_new probe function.
Note we do not have any old style board files using this but
user still has a possibility to instantiate device from sysfs.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/iio/magnetometer/yamaha-yas530.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c
index 8cfe1ef9c5b4..bacd2b783113 100644
--- a/drivers/iio/magnetometer/yamaha-yas530.c
+++ b/drivers/iio/magnetometer/yamaha-yas530.c
@@ -168,6 +168,7 @@ struct yas5xx;
/**
* struct yas5xx_chip_info - device-specific data and function pointers
* @devid: device ID number
+ * @product_label: product label used in Linux
* @product_name: product name of the YAS variant
* @version_names: version letters or namings
* @volatile_reg: device-specific volatile registers
@@ -189,6 +190,7 @@ struct yas5xx;
*/
struct yas5xx_chip_info {
unsigned int devid;
+ const char *product_label;
const char *product_name;
const char *version_names[2];
const int *volatile_reg;
@@ -1324,6 +1326,7 @@ static int yas537_power_on(struct yas5xx *yas5xx)
static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
[yas530] = {
.devid = YAS530_DEVICE_ID,
+ .product_label = "yas530",
.product_name = "YAS530 MS-3E",
.version_names = { "A", "B" },
.volatile_reg = yas530_volatile_reg,
@@ -1339,6 +1342,7 @@ static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
},
[yas532] = {
.devid = YAS532_DEVICE_ID,
+ .product_label = "yas532",
.product_name = "YAS532 MS-3R",
.version_names = { "AB", "AC" },
.volatile_reg = yas530_volatile_reg,
@@ -1354,6 +1358,7 @@ static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
},
[yas533] = {
.devid = YAS532_DEVICE_ID,
+ .product_label = "yas533",
.product_name = "YAS533 MS-3F",
.version_names = { "AB", "AC" },
.volatile_reg = yas530_volatile_reg,
@@ -1369,6 +1374,7 @@ static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
},
[yas537] = {
.devid = YAS537_DEVICE_ID,
+ .product_label = "yas537",
.product_name = "YAS537 MS-3T",
.version_names = { "v0", "v1" }, /* version naming unknown */
.volatile_reg = yas537_volatile_reg,
@@ -1384,8 +1390,7 @@ static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
},
};
-static int yas5xx_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
+static int yas5xx_probe(struct i2c_client *i2c)
{
struct iio_dev *indio_dev;
struct device *dev = &i2c->dev;
@@ -1448,7 +1453,7 @@ static int yas5xx_probe(struct i2c_client *i2c,
if (id_check != ci->devid) {
ret = dev_err_probe(dev, -ENODEV,
"device ID %02x doesn't match %s\n",
- id_check, id->name);
+ id_check, ci->product_label);
goto assert_reset;
}
@@ -1474,7 +1479,7 @@ static int yas5xx_probe(struct i2c_client *i2c,
indio_dev->info = &yas5xx_info;
indio_dev->available_scan_masks = yas5xx_scan_masks;
indio_dev->modes = INDIO_DIRECT_MODE;
- indio_dev->name = id->name;
+ indio_dev->name = ci->product_label;
indio_dev->channels = yas5xx_channels;
indio_dev->num_channels = ARRAY_SIZE(yas5xx_channels);
@@ -1607,7 +1612,7 @@ static struct i2c_driver yas5xx_driver = {
.of_match_table = yas5xx_of_match,
.pm = pm_ptr(&yas5xx_dev_pm_ops),
},
- .probe = yas5xx_probe,
+ .probe_new = yas5xx_probe,
.remove = yas5xx_remove,
.id_table = yas5xx_id,
};
--
2.35.1
next prev parent reply other threads:[~2022-08-29 12:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-29 11:24 [PATCH v1 1/4] iio: magnetometer: yamaha-yas530: Use pointers as driver data Andy Shevchenko
2022-08-29 11:24 ` [PATCH v1 2/4] iio: magnetometer: yamaha-yas530: Make strings const in chip info Andy Shevchenko
2022-08-29 11:24 ` Andy Shevchenko [this message]
2022-08-29 11:24 ` [PATCH v1 4/4] iio: magnetometer: yamaha-yas530: Use dev_err_probe() Andy Shevchenko
2022-08-29 17:00 ` [PATCH v1 1/4] iio: magnetometer: yamaha-yas530: Use pointers as driver data Jonathan Cameron
2022-08-29 19:23 ` Andy Shevchenko
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=20220829112407.74917-3-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=jahau@rocketmail.com \
--cc=jic23@kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).