RE: [PATCH 20/24] staging:iio:cdc:ad7150: Add of_match_table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Jonathan Cameron [mailto:jic23@xxxxxxxxxx]
> Sent: Monday, February 8, 2021 4:46 AM
> To: linux-iio@xxxxxxxxxxxxxxx
> Cc: Lars-Peter Clausen <lars@xxxxxxxxxx>; Michael Hennerich
> <Michael.Hennerich@xxxxxxxxxx>; Song Bao Hua (Barry Song)
> <song.bao.hua@xxxxxxxxxxxxx>; robh+dt@xxxxxxxxxx; Jonathan Cameron
> <jonathan.cameron@xxxxxxxxxx>
> Subject: [PATCH 20/24] staging:iio:cdc:ad7150: Add of_match_table
> 
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> 
> Rather than using the fallback path in the i2c subsystem and hoping
> for no clashes across vendors, lets put in an explicit table for
> matching.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> ---
>  drivers/staging/iio/cdc/ad7150.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/staging/iio/cdc/ad7150.c
> b/drivers/staging/iio/cdc/ad7150.c
> index 0bc8c7a99883..33c8a78c076f 100644
> --- a/drivers/staging/iio/cdc/ad7150.c
> +++ b/drivers/staging/iio/cdc/ad7150.c
> @@ -12,6 +12,7 @@
>  #include <linux/i2c.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
> 
> @@ -655,9 +656,16 @@ static const struct i2c_device_id ad7150_id[] = {
> 
>  MODULE_DEVICE_TABLE(i2c, ad7150_id);
> 
> +static const struct of_device_id ad7150_of_match[] = {
> +	{ "adi,ad7150" },
> +	{ "adi,ad7151" },
> +	{ "adi,ad7156" },
> +	{}
> +};

Does it compile if CONFIG_OF is not enabled?

>  static struct i2c_driver ad7150_driver = {
>  	.driver = {
>  		.name = "ad7150",
> +		.of_match_table = ad7150_of_match,

of_match_ptr(ad7150_of_match)?

Do we need dt-binding doc?


>  	},
>  	.probe = ad7150_probe,
>  	.id_table = ad7150_id,
> --
> 2.30.0

Thanks
Barry




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux