diff mbox series

[1/6] iio:pressure:ms5637: switch to probe_new

Message ID 20201209234857.1521453-2-alexandre.belloni@bootlin.com
State New
Headers show
Series iio:pressure:ms5637: add ms5803 support | expand

Commit Message

Alexandre Belloni Dec. 9, 2020, 11:48 p.m. UTC
Switch to the modern i2c probe_new callback and drop the i2c_device_id
array.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/iio/pressure/ms5637.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

Comments

Andy Shevchenko Dec. 12, 2020, 1:26 p.m. UTC | #1
On Thu, Dec 10, 2020 at 2:01 AM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>

> Switch to the modern i2c probe_new callback and drop the i2c_device_id

> array.


First part is okay.
The second is interesting. It depends if we would like to keep a
possibility to instantiate devices from user space (strictly speaking
it's an ABI breakage).

-- 
With Best Regards,
Andy Shevchenko
Jonathan Cameron Dec. 13, 2020, 5:04 p.m. UTC | #2
On Sat, 12 Dec 2020 15:26:17 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Thu, Dec 10, 2020 at 2:01 AM Alexandre Belloni

> <alexandre.belloni@bootlin.com> wrote:

> >

> > Switch to the modern i2c probe_new callback and drop the i2c_device_id

> > array.  

> 

> First part is okay.

> The second is interesting. It depends if we would like to keep a

> possibility to instantiate devices from user space (strictly speaking

> it's an ABI breakage).

> 

We've also been bitten by this recently via greybus which does
it's instantiations using the i2c_device_id table as I understand it.
That's resulted in us reverting a few specific cases where we'd
done pretty much what you have done here.

So drop that part of the change.

Thanks,

Jonathan
diff mbox series

Patch

diff --git a/drivers/iio/pressure/ms5637.c b/drivers/iio/pressure/ms5637.c
index 5b59a4137d32..7c3f0ccd917c 100644
--- a/drivers/iio/pressure/ms5637.c
+++ b/drivers/iio/pressure/ms5637.c
@@ -126,8 +126,7 @@  static const struct iio_info ms5637_info = {
 	.attrs = &ms5637_attribute_group,
 };
 
-static int ms5637_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int ms5637_probe(struct i2c_client *client)
 {
 	struct ms_tp_dev *dev_data;
 	struct iio_dev *indio_dev;
@@ -152,7 +151,7 @@  static int ms5637_probe(struct i2c_client *client,
 	mutex_init(&dev_data->lock);
 
 	indio_dev->info = &ms5637_info;
-	indio_dev->name = id->name;
+	indio_dev->name = device_get_match_data(&client->dev);
 	indio_dev->modes = INDIO_DIRECT_MODE;
 	indio_dev->channels = ms5637_channels;
 	indio_dev->num_channels = ARRAY_SIZE(ms5637_channels);
@@ -170,27 +169,17 @@  static int ms5637_probe(struct i2c_client *client,
 	return devm_iio_device_register(&client->dev, indio_dev);
 }
 
-static const struct i2c_device_id ms5637_id[] = {
-	{"ms5637", 0},
-	{"ms5805", 0},
-	{"ms5837", 0},
-	{"ms8607-temppressure", 0},
-	{}
-};
-MODULE_DEVICE_TABLE(i2c, ms5637_id);
-
 static const struct of_device_id ms5637_of_match[] = {
-	{ .compatible = "meas,ms5637", },
-	{ .compatible = "meas,ms5805", },
-	{ .compatible = "meas,ms5837", },
-	{ .compatible = "meas,ms8607-temppressure", },
+	{ .compatible = "meas,ms5637", .data = "ms5637" },
+	{ .compatible = "meas,ms5805", .data = "ms5805" },
+	{ .compatible = "meas,ms5837", .data = "ms5837" },
+	{ .compatible = "meas,ms8607-temppressure", .data = "ms8607-temppressure" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, ms5637_of_match);
 
 static struct i2c_driver ms5637_driver = {
-	.probe = ms5637_probe,
-	.id_table = ms5637_id,
+	.probe_new = ms5637_probe,
 	.driver = {
 		   .name = "ms5637",
 		   .of_match_table = ms5637_of_match,