iio: chemical: ams-iaq-core: update driver name and DT match table
PATCH 1/1 iio: chemical: ams-iaq-core: update driver name and DT match table
DT match name should be similar to the i2c device table entry, and also make the iio name match the driver name versus the i2c device location.
--- drivers/iio/chemical/ams-iaq-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/chemical/ams-iaq-core.c +5 -3
@@ -27,6 +27,8 @@#define AMS_IAQCORE_VOC_RESISTANCE_IDX 1#define AMS_IAQCORE_VOC_TVOC_IDX 2 +#define AMS_IAQCORE_DRVNAME "ams-iaq-core" +struct ams_iaqcore_reading {__be16 co2_ppm;u8 status;
@@ -164,7 +166,7 @@ static int ams_iaqcore_probe(struct i2c_client *client, indio_dev->dev.parent = &client->dev; indio_dev->info = &ams_iaqcore_info, - indio_dev->name =dev_name (&client->dev); + indio_dev->name =AMS_IAQCORE_DRVNAME ; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->channels = ams_iaqcore_channels;
@@ -180,14 +182,14 @@ static const struct i2c_device_id ams_iaqcore_id[] = {MODULE_DEVICE_TABLE (i2c, ams_iaqcore_id);static const struct of_device_id ams_iaqcore_dt_ids[] = { - { .compatible ="ams,iaq-core" }, + { .compatible ="ams,ams-iaq-core" }, { } };MODULE_DEVICE_TABLE (of, ams_iaqcore_dt_ids);static struct i2c_driver ams_iaqcore_driver = { .driver = { - .name ="ams-iaq-core" , + .name =AMS_IAQCORE_DRVNAME , .of_match_table =of_match_ptr (ams_iaqcore_dt_ids), }, .probe = ams_iaqcore_probe,
Signature · 1 line
2.7.4
Quoted 1 line · Matt Ranostay
DT match name should be similar to the i2c device table entry.
Why?
Quoted 4 lines · Lars-Peter Clausen
Quoted 1 line · Matt Ranostay
DT match name should be similar to the i2c device table entry.
Why?
To be consistent mostly. But I have noticed compatible =
"ams,iaq-core" doesn't actually match...
Does anyone here know if i2c-core just checks the id_table, and not of_match_table as well?
Anyone have thoughts on this but I dig into this too deep?
Quoted 1 line
Quoted 8 lines · Matt Ranostay
Quoted 4 lines · Lars-Peter Clausen
Quoted 1 line · Matt Ranostay
DT match name should be similar to the i2c device table entry.
Why?
To be consistent mostly. But I have noticed compatible =
"ams,iaq-core" doesn't actually match...
Well, consistent with what? The normal pattern for devicetree compatible strings is vendor,partname. So that would suggest that ams,iaq-core is the preferred solution if it is supposed to be consistent. Btw. there seem to be no binding documents for this part.
Quoted 4 lines
Does anyone here know if i2c-core just checks the
id_table, and notof_match_tableas well?Anyone have thoughts on this but I dig into this too deep?
It uses of_match_table when it is set. See
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/i2c-core.c#n609
Quoted 15 lines · Lars-Peter Clausen
Quoted 8 lines · Matt Ranostay
Quoted 4 lines · Lars-Peter Clausen
Quoted 1 line · Matt Ranostay
DT match name should be similar to the i2c device table entry.
Why?
To be consistent mostly. But I have noticed compatible =
"ams,iaq-core" doesn't actually match...Well, consistent with what? The normal pattern for devicetree compatible strings is vendor,partname. So that would suggest that ams,iaq-core is the preferred solution if it is supposed to be consistent. Btw. there seem to be no binding documents for this part.
Quoted 7 lines
Quoted 4 lines
Does anyone here know if i2c-core just checks the
id_table, and notof_match_tableas well?Anyone have thoughts on this but I dig into this too deep?
It uses
of_match_tablewhen it is set. See
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/i2c-core.c#n609
Yeah thought would enumerate it as well.. but could be that someone broke something in i2c controller or core. Will test again :)