diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 17:35:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 17:39:31 +0000 |
commit | 85c675d0d09a45a135bddd15d7b385f8758c32fb (patch) | |
tree | 76267dbc9b9a130337be3640948fe397b04ac629 /drivers/iio/chemical | |
parent | Adding upstream version 6.6.15. (diff) | |
download | linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.tar.xz linux-85c675d0d09a45a135bddd15d7b385f8758c32fb.zip |
Adding upstream version 6.7.7.upstream/6.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/iio/chemical')
-rw-r--r-- | drivers/iio/chemical/atlas-ezo-sensor.c | 6 | ||||
-rw-r--r-- | drivers/iio/chemical/atlas-sensor.c | 32 | ||||
-rw-r--r-- | drivers/iio/chemical/sgp30.c | 24 | ||||
-rw-r--r-- | drivers/iio/chemical/vz89x.c | 16 |
4 files changed, 32 insertions, 46 deletions
diff --git a/drivers/iio/chemical/atlas-ezo-sensor.c b/drivers/iio/chemical/atlas-ezo-sensor.c index 8fc926a2d3..761a853a4d 100644 --- a/drivers/iio/chemical/atlas-ezo-sensor.c +++ b/drivers/iio/chemical/atlas-ezo-sensor.c @@ -203,7 +203,6 @@ MODULE_DEVICE_TABLE(of, atlas_ezo_dt_ids); static int atlas_ezo_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); const struct atlas_ezo_device *chip; struct atlas_ezo_data *data; struct iio_dev *indio_dev; @@ -212,10 +211,7 @@ static int atlas_ezo_probe(struct i2c_client *client) if (!indio_dev) return -ENOMEM; - if (dev_fwnode(&client->dev)) - chip = device_get_match_data(&client->dev); - else - chip = (const struct atlas_ezo_device *)id->driver_data; + chip = i2c_get_match_data(client); if (!chip) return -EINVAL; diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index fb15bb2160..baf93e5e3c 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -87,7 +87,7 @@ enum { struct atlas_data { struct i2c_client *client; struct iio_trigger *trig; - struct atlas_device *chip; + const struct atlas_device *chip; struct regmap *regmap; struct irq_work work; unsigned int interrupt_enabled; @@ -353,7 +353,7 @@ struct atlas_device { int delay; }; -static struct atlas_device atlas_devices[] = { +static const struct atlas_device atlas_devices[] = { [ATLAS_PH_SM] = { .channels = atlas_ph_channels, .num_channels = 3, @@ -589,30 +589,29 @@ static const struct iio_info atlas_info = { }; static const struct i2c_device_id atlas_id[] = { - { "atlas-ph-sm", ATLAS_PH_SM }, - { "atlas-ec-sm", ATLAS_EC_SM }, - { "atlas-orp-sm", ATLAS_ORP_SM }, - { "atlas-do-sm", ATLAS_DO_SM }, - { "atlas-rtd-sm", ATLAS_RTD_SM }, + { "atlas-ph-sm", (kernel_ulong_t)&atlas_devices[ATLAS_PH_SM] }, + { "atlas-ec-sm", (kernel_ulong_t)&atlas_devices[ATLAS_EC_SM] }, + { "atlas-orp-sm", (kernel_ulong_t)&atlas_devices[ATLAS_ORP_SM] }, + { "atlas-do-sm", (kernel_ulong_t)&atlas_devices[ATLAS_DO_SM] }, + { "atlas-rtd-sm", (kernel_ulong_t)&atlas_devices[ATLAS_RTD_SM] }, {} }; MODULE_DEVICE_TABLE(i2c, atlas_id); static const struct of_device_id atlas_dt_ids[] = { - { .compatible = "atlas,ph-sm", .data = (void *)ATLAS_PH_SM, }, - { .compatible = "atlas,ec-sm", .data = (void *)ATLAS_EC_SM, }, - { .compatible = "atlas,orp-sm", .data = (void *)ATLAS_ORP_SM, }, - { .compatible = "atlas,do-sm", .data = (void *)ATLAS_DO_SM, }, - { .compatible = "atlas,rtd-sm", .data = (void *)ATLAS_RTD_SM, }, + { .compatible = "atlas,ph-sm", .data = &atlas_devices[ATLAS_PH_SM] }, + { .compatible = "atlas,ec-sm", .data = &atlas_devices[ATLAS_EC_SM] }, + { .compatible = "atlas,orp-sm", .data = &atlas_devices[ATLAS_ORP_SM] }, + { .compatible = "atlas,do-sm", .data = &atlas_devices[ATLAS_DO_SM] }, + { .compatible = "atlas,rtd-sm", .data = &atlas_devices[ATLAS_RTD_SM] }, { } }; MODULE_DEVICE_TABLE(of, atlas_dt_ids); static int atlas_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); struct atlas_data *data; - struct atlas_device *chip; + const struct atlas_device *chip; struct iio_trigger *trig; struct iio_dev *indio_dev; int ret; @@ -621,10 +620,7 @@ static int atlas_probe(struct i2c_client *client) if (!indio_dev) return -ENOMEM; - if (!dev_fwnode(&client->dev)) - chip = &atlas_devices[id->driver_data]; - else - chip = &atlas_devices[(unsigned long)device_get_match_data(&client->dev)]; + chip = i2c_get_match_data(client); indio_dev->info = &atlas_info; indio_dev->name = ATLAS_DRV_NAME; diff --git a/drivers/iio/chemical/sgp30.c b/drivers/iio/chemical/sgp30.c index b509cff9ce..21730d62b5 100644 --- a/drivers/iio/chemical/sgp30.c +++ b/drivers/iio/chemical/sgp30.c @@ -114,6 +114,7 @@ struct sgp_data { }; struct sgp_device { + unsigned long product_id; const struct iio_chan_spec *channels; int num_channels; }; @@ -182,10 +183,12 @@ static const struct iio_chan_spec sgpc3_channels[] = { static const struct sgp_device sgp_devices[] = { [SGP30] = { + .product_id = SGP30, .channels = sgp30_channels, .num_channels = ARRAY_SIZE(sgp30_channels), }, [SGPC3] = { + .product_id = SGPC3, .channels = sgpc3_channels, .num_channels = ARRAY_SIZE(sgpc3_channels), }, @@ -491,28 +494,25 @@ static const struct iio_info sgp_info = { }; static const struct of_device_id sgp_dt_ids[] = { - { .compatible = "sensirion,sgp30", .data = (void *)SGP30 }, - { .compatible = "sensirion,sgpc3", .data = (void *)SGPC3 }, + { .compatible = "sensirion,sgp30", .data = &sgp_devices[SGP30] }, + { .compatible = "sensirion,sgpc3", .data = &sgp_devices[SGPC3] }, { } }; static int sgp_probe(struct i2c_client *client) { const struct i2c_device_id *id = i2c_client_get_device_id(client); + const struct sgp_device *match_data; struct device *dev = &client->dev; struct iio_dev *indio_dev; struct sgp_data *data; - unsigned long product_id; int ret; indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); if (!indio_dev) return -ENOMEM; - if (dev_fwnode(dev)) - product_id = (unsigned long)device_get_match_data(dev); - else - product_id = id->driver_data; + match_data = i2c_get_match_data(client); data = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); @@ -528,15 +528,15 @@ static int sgp_probe(struct i2c_client *client) data->feature_set = be16_to_cpu(data->buffer.raw_words[0].value); - ret = sgp_check_compat(data, product_id); + ret = sgp_check_compat(data, match_data->product_id); if (ret) return ret; indio_dev->info = &sgp_info; indio_dev->name = id->name; indio_dev->modes = INDIO_DIRECT_MODE; - indio_dev->channels = sgp_devices[product_id].channels; - indio_dev->num_channels = sgp_devices[product_id].num_channels; + indio_dev->channels = match_data->channels; + indio_dev->num_channels = match_data->num_channels; sgp_init(data); @@ -562,8 +562,8 @@ static void sgp_remove(struct i2c_client *client) } static const struct i2c_device_id sgp_id[] = { - { "sgp30", SGP30 }, - { "sgpc3", SGPC3 }, + { "sgp30", (kernel_ulong_t)&sgp_devices[SGP30] }, + { "sgpc3", (kernel_ulong_t)&sgp_devices[SGPC3] }, { } }; diff --git a/drivers/iio/chemical/vz89x.c b/drivers/iio/chemical/vz89x.c index 13555f4f40..5b358bcd31 100644 --- a/drivers/iio/chemical/vz89x.c +++ b/drivers/iio/chemical/vz89x.c @@ -342,19 +342,17 @@ static const struct vz89x_chip_data vz89x_chips[] = { }; static const struct of_device_id vz89x_dt_ids[] = { - { .compatible = "sgx,vz89x", .data = (void *) VZ89X }, - { .compatible = "sgx,vz89te", .data = (void *) VZ89TE }, + { .compatible = "sgx,vz89x", .data = &vz89x_chips[VZ89X] }, + { .compatible = "sgx,vz89te", .data = &vz89x_chips[VZ89TE] }, { } }; MODULE_DEVICE_TABLE(of, vz89x_dt_ids); static int vz89x_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); struct device *dev = &client->dev; struct iio_dev *indio_dev; struct vz89x_data *data; - int chip_id; indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); if (!indio_dev) @@ -369,14 +367,10 @@ static int vz89x_probe(struct i2c_client *client) else return -EOPNOTSUPP; - if (!dev_fwnode(dev)) - chip_id = id->driver_data; - else - chip_id = (unsigned long)device_get_match_data(dev); + data->chip = i2c_get_match_data(client); i2c_set_clientdata(client, indio_dev); data->client = client; - data->chip = &vz89x_chips[chip_id]; data->last_update = jiffies - HZ; mutex_init(&data->lock); @@ -391,8 +385,8 @@ static int vz89x_probe(struct i2c_client *client) } static const struct i2c_device_id vz89x_id[] = { - { "vz89x", VZ89X }, - { "vz89te", VZ89TE }, + { "vz89x", (kernel_ulong_t)&vz89x_chips[VZ89X] }, + { "vz89te", (kernel_ulong_t)&vz89x_chips[VZ89TE] }, { } }; MODULE_DEVICE_TABLE(i2c, vz89x_id); |