iio: srf08: add device tree table
Andreas Klinger
maintainerPATCH v3 2/5 iio: srf08: add device tree table
Added MODULE_DEVICE_TABLE for device tree bindings.
It used to work without it by using the i2c_device_id table, but adding the table makes everything clear and documented.
Signed-off-by Andreas Klinger <[email protected]>
--- drivers/iio/proximity/srf08.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iio/proximity/srf08.c +8 -0
@@ -378,6 +378,13 @@ static int srf08_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } +static const struct of_device_id of_srf08_match[] = { + { .compatible ="devantech,srf08" ,0 }, + {}, +}; + +MODULE_DEVICE_TABLE (of, of_srf08_match); +static const struct i2c_device_id srf08_id[] = { {"srf08" ,0 }, { }
@@ -387,6 +394,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);static struct i2c_driver srf08_driver = { .driver = { .name ="srf08" , + .of_match_table = of_srf08_match, }, .probe = srf08_probe, .id_table = srf08_id,
Signature · 4 lines
2.1.4 --
Jonathan Cameron
maintainerQuoted 6 lines · On Wed, 16 Aug 2017 21:33:47 +0200 Andreas Klinger <[email protected]> wrote:
Added
MODULE_DEVICE_TABLEfor device tree bindings.It used to work without it by using the
i2c_device_idtable, but adding the table makes everything clear and documented.Signed-off-by Andreas Klinger <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,
Jonathan
Quoted 30 lines
--- drivers/iio/proximity/srf08.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/iio/proximity/srf08.c +8
-0@@ -378,6 +378,13 @@ static int srf08_probe(struct i2c_client *client,return devm_iio_device_register (&client->dev, indio_dev); } +static const struct of_device_id of_srf08_match[] = { + { .compatible ="devantech,srf08" ,0 }, + {}, +}; + +MODULE_DEVICE_TABLE (of, of_srf08_match); +static const struct i2c_device_id srf08_id[] = { {"srf08" ,0 }, { }@@ -387,6 +394,7 @@ MODULE_DEVICE_TABLE(i2c, srf08_id);static struct i2c_driver srf08_driver = { .driver = { .name ="srf08" , + .of_match_table = of_srf08_match, }, .probe = srf08_probe, .id_table = srf08_id,