diff mbox series

[v4,2/2] iio: adc: ad7192: move ad7192_of_match table closer to the end of the file

Message ID 20200415055804.17971-2-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series [v4,1/2] iio: adc: ad7192: fix null pointer de-reference crash during probe | expand

Commit Message

Alexandru Ardelean April 15, 2020, 5:58 a.m. UTC
The change is more cosmetic. There is no need to reference this table in
the probe function since 'of_device_get_match_data' is used, which obtains
this information from the driver object.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/adc/ad7192.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Alexandru Ardelean July 13, 2020, 4:11 p.m. UTC | #1
On Wed, 2020-04-15 at 08:58 +0300, Alexandru Ardelean wrote:
> The change is more cosmetic. There is no need to reference this table in
> the probe function since 'of_device_get_match_data' is used, which
> obtains
> this information from the driver object.

This looks like it could be applied now.
The iio/testing branch seems to have patch [1/2].

Thanks
Alex

> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>  drivers/iio/adc/ad7192.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> index 1431f555daa6..fd89a5115c55 100644
> --- a/drivers/iio/adc/ad7192.c
> +++ b/drivers/iio/adc/ad7192.c
> @@ -908,15 +908,6 @@ static int ad7192_channels_config(struct iio_dev
> *indio_dev)
>  	return 0;
>  }
>  
> -static const struct of_device_id ad7192_of_match[] = {
> -	{ .compatible = "adi,ad7190", .data =
> &ad7192_chip_info_tbl[ID_AD7190] },
> -	{ .compatible = "adi,ad7192", .data =
> &ad7192_chip_info_tbl[ID_AD7192] },
> -	{ .compatible = "adi,ad7193", .data =
> &ad7192_chip_info_tbl[ID_AD7193] },
> -	{ .compatible = "adi,ad7195", .data =
> &ad7192_chip_info_tbl[ID_AD7195] },
> -	{}
> -};
> -MODULE_DEVICE_TABLE(of, ad7192_of_match);
> -
>  static int ad7192_probe(struct spi_device *spi)
>  {
>  	struct ad7192_state *st;
> @@ -1050,6 +1041,15 @@ static int ad7192_remove(struct spi_device *spi)
>  	return 0;
>  }
>  
> +static const struct of_device_id ad7192_of_match[] = {
> +	{ .compatible = "adi,ad7190", .data =
> &ad7192_chip_info_tbl[ID_AD7190] },
> +	{ .compatible = "adi,ad7192", .data =
> &ad7192_chip_info_tbl[ID_AD7192] },
> +	{ .compatible = "adi,ad7193", .data =
> &ad7192_chip_info_tbl[ID_AD7193] },
> +	{ .compatible = "adi,ad7195", .data =
> &ad7192_chip_info_tbl[ID_AD7195] },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, ad7192_of_match);
> +
>  static struct spi_driver ad7192_driver = {
>  	.driver = {
>  		.name	= "ad7192",
Jonathan Cameron July 18, 2020, 4:26 p.m. UTC | #2
On Mon, 13 Jul 2020 16:11:39 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:

> On Wed, 2020-04-15 at 08:58 +0300, Alexandru Ardelean wrote:
> > The change is more cosmetic. There is no need to reference this table in
> > the probe function since 'of_device_get_match_data' is used, which
> > obtains
> > this information from the driver object.  
> 
> This looks like it could be applied now.
> The iio/testing branch seems to have patch [1/2].
Thanks.

Applied.

Jonathan

> 
> Thanks
> Alex
> 
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> > ---
> >  drivers/iio/adc/ad7192.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
> > index 1431f555daa6..fd89a5115c55 100644
> > --- a/drivers/iio/adc/ad7192.c
> > +++ b/drivers/iio/adc/ad7192.c
> > @@ -908,15 +908,6 @@ static int ad7192_channels_config(struct iio_dev
> > *indio_dev)
> >  	return 0;
> >  }
> >  
> > -static const struct of_device_id ad7192_of_match[] = {
> > -	{ .compatible = "adi,ad7190", .data =
> > &ad7192_chip_info_tbl[ID_AD7190] },
> > -	{ .compatible = "adi,ad7192", .data =
> > &ad7192_chip_info_tbl[ID_AD7192] },
> > -	{ .compatible = "adi,ad7193", .data =
> > &ad7192_chip_info_tbl[ID_AD7193] },
> > -	{ .compatible = "adi,ad7195", .data =
> > &ad7192_chip_info_tbl[ID_AD7195] },
> > -	{}
> > -};
> > -MODULE_DEVICE_TABLE(of, ad7192_of_match);
> > -
> >  static int ad7192_probe(struct spi_device *spi)
> >  {
> >  	struct ad7192_state *st;
> > @@ -1050,6 +1041,15 @@ static int ad7192_remove(struct spi_device *spi)
> >  	return 0;
> >  }
> >  
> > +static const struct of_device_id ad7192_of_match[] = {
> > +	{ .compatible = "adi,ad7190", .data =
> > &ad7192_chip_info_tbl[ID_AD7190] },
> > +	{ .compatible = "adi,ad7192", .data =
> > &ad7192_chip_info_tbl[ID_AD7192] },
> > +	{ .compatible = "adi,ad7193", .data =
> > &ad7192_chip_info_tbl[ID_AD7193] },
> > +	{ .compatible = "adi,ad7195", .data =
> > &ad7192_chip_info_tbl[ID_AD7195] },
> > +	{}
> > +};
> > +MODULE_DEVICE_TABLE(of, ad7192_of_match);
> > +
> >  static struct spi_driver ad7192_driver = {
> >  	.driver = {
> >  		.name	= "ad7192",
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c
index 1431f555daa6..fd89a5115c55 100644
--- a/drivers/iio/adc/ad7192.c
+++ b/drivers/iio/adc/ad7192.c
@@ -908,15 +908,6 @@  static int ad7192_channels_config(struct iio_dev *indio_dev)
 	return 0;
 }
 
-static const struct of_device_id ad7192_of_match[] = {
-	{ .compatible = "adi,ad7190", .data = &ad7192_chip_info_tbl[ID_AD7190] },
-	{ .compatible = "adi,ad7192", .data = &ad7192_chip_info_tbl[ID_AD7192] },
-	{ .compatible = "adi,ad7193", .data = &ad7192_chip_info_tbl[ID_AD7193] },
-	{ .compatible = "adi,ad7195", .data = &ad7192_chip_info_tbl[ID_AD7195] },
-	{}
-};
-MODULE_DEVICE_TABLE(of, ad7192_of_match);
-
 static int ad7192_probe(struct spi_device *spi)
 {
 	struct ad7192_state *st;
@@ -1050,6 +1041,15 @@  static int ad7192_remove(struct spi_device *spi)
 	return 0;
 }
 
+static const struct of_device_id ad7192_of_match[] = {
+	{ .compatible = "adi,ad7190", .data = &ad7192_chip_info_tbl[ID_AD7190] },
+	{ .compatible = "adi,ad7192", .data = &ad7192_chip_info_tbl[ID_AD7192] },
+	{ .compatible = "adi,ad7193", .data = &ad7192_chip_info_tbl[ID_AD7193] },
+	{ .compatible = "adi,ad7195", .data = &ad7192_chip_info_tbl[ID_AD7195] },
+	{}
+};
+MODULE_DEVICE_TABLE(of, ad7192_of_match);
+
 static struct spi_driver ad7192_driver = {
 	.driver = {
 		.name	= "ad7192",