staging: iio: ad9834: add of_device_id table
diff mbox series

Message ID 20190518224720.30404-1-joao.marques.oliveira@usp.br
State New
Headers show
Series
  • staging: iio: ad9834: add of_device_id table
Related show

Commit Message

João Victor Marques de Oliveira May 18, 2019, 10:47 p.m. UTC
Add a of_device_id struct array of_match_table variable and subsequent
call to MODULE_DEVICE_TABLE macro to device tree support.

Co-developed-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
Signed-off-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
Co-developed-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
Signed-off-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
Signed-off-by: João Victor Marques de Oliveira <joao.marques.oliveira@usp.br>
---
 drivers/staging/iio/frequency/ad9834.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Jonathan Cameron May 19, 2019, 10:39 a.m. UTC | #1
On Sat, 18 May 2019 19:47:20 -0300
João Victor Marques de Oliveira         <joao.marques.oliveira@usp.br> wrote:

> Add a of_device_id struct array of_match_table variable and subsequent
> call to MODULE_DEVICE_TABLE macro to device tree support.
> 
> Co-developed-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
> Signed-off-by: Thiago L. A. Miller <tmiller@mochsl.org.br>
> Co-developed-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
> Signed-off-by: Osvaldo M. Yasuda <omyasuda@yahoo.com.br>
> Signed-off-by: João Victor Marques de Oliveira <joao.marques.oliveira@usp.br>
Nice patch.

Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Thanks,

j
> ---
>  drivers/staging/iio/frequency/ad9834.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
> index 6de3cd7363d7..038d6732c3fd 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -521,9 +521,20 @@ static const struct spi_device_id ad9834_id[] = {
>  };
>  MODULE_DEVICE_TABLE(spi, ad9834_id);
>  
> +static const struct of_device_id ad9834_of_match[] = {
> +	{.compatible = "adi,ad9833"},
> +	{.compatible = "adi,ad9834"},
> +	{.compatible = "adi,ad9837"},
> +	{.compatible = "adi,ad9838"},
> +	{}
> +};
> +
> +MODULE_DEVICE_TABLE(of, ad9834_of_match);
> +
>  static struct spi_driver ad9834_driver = {
>  	.driver = {
>  		.name	= "ad9834",
> +		.of_match_table = ad9834_of_match
>  	},
>  	.probe		= ad9834_probe,
>  	.remove		= ad9834_remove,

Patch
diff mbox series

diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 6de3cd7363d7..038d6732c3fd 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -521,9 +521,20 @@  static const struct spi_device_id ad9834_id[] = {
 };
 MODULE_DEVICE_TABLE(spi, ad9834_id);
 
+static const struct of_device_id ad9834_of_match[] = {
+	{.compatible = "adi,ad9833"},
+	{.compatible = "adi,ad9834"},
+	{.compatible = "adi,ad9837"},
+	{.compatible = "adi,ad9838"},
+	{}
+};
+
+MODULE_DEVICE_TABLE(of, ad9834_of_match);
+
 static struct spi_driver ad9834_driver = {
 	.driver = {
 		.name	= "ad9834",
+		.of_match_table = ad9834_of_match
 	},
 	.probe		= ad9834_probe,
 	.remove		= ad9834_remove,