linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] iio: afe: rescale: Make use of device properties
@ 2022-04-13 19:01 Andy Shevchenko
  2022-04-14 14:32 ` Liam Beguin
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-04-13 19:01 UTC (permalink / raw)
  To: Andy Shevchenko, Jonathan Cameron, Liam Beguin, Peter Rosin,
	linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/afe/Kconfig       | 1 -
 drivers/iio/afe/iio-rescale.c | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/afe/Kconfig b/drivers/iio/afe/Kconfig
index 4fa397822cff..9a1d95c1c7ed 100644
--- a/drivers/iio/afe/Kconfig
+++ b/drivers/iio/afe/Kconfig
@@ -8,7 +8,6 @@ menu "Analog Front Ends"
 
 config IIO_RESCALE
 	tristate "IIO rescale"
-	depends on OF || COMPILE_TEST
 	help
 	  Say yes here to build support for the IIO rescaling
 	  that handles voltage dividers, current sense shunts and
diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
index 7e511293d6d1..c6cf709f0f05 100644
--- a/drivers/iio/afe/iio-rescale.c
+++ b/drivers/iio/afe/iio-rescale.c
@@ -10,9 +10,8 @@
 
 #include <linux/err.h>
 #include <linux/gcd.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 
@@ -536,7 +535,7 @@ static int rescale_probe(struct platform_device *pdev)
 
 	rescale = iio_priv(indio_dev);
 
-	rescale->cfg = of_device_get_match_data(dev);
+	rescale->cfg = device_get_match_data(dev);
 	rescale->numerator = 1;
 	rescale->denominator = 1;
 	rescale->offset = 0;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] iio: afe: rescale: Make use of device properties
  2022-04-13 19:01 [PATCH v1 1/1] iio: afe: rescale: Make use of device properties Andy Shevchenko
@ 2022-04-14 14:32 ` Liam Beguin
  2022-04-14 17:03   ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Liam Beguin @ 2022-04-14 14:32 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, Peter Rosin, linux-iio, linux-kernel,
	Jonathan Cameron, Lars-Peter Clausen

Hi Andy,

On Wed, Apr 13, 2022 at 10:01:17PM +0300, Andy Shevchenko wrote:
> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/iio/afe/Kconfig       | 1 -
>  drivers/iio/afe/iio-rescale.c | 5 ++---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/afe/Kconfig b/drivers/iio/afe/Kconfig
> index 4fa397822cff..9a1d95c1c7ed 100644
> --- a/drivers/iio/afe/Kconfig
> +++ b/drivers/iio/afe/Kconfig
> @@ -8,7 +8,6 @@ menu "Analog Front Ends"
>  
>  config IIO_RESCALE
>  	tristate "IIO rescale"
> -	depends on OF || COMPILE_TEST
>  	help
>  	  Say yes here to build support for the IIO rescaling
>  	  that handles voltage dividers, current sense shunts and
> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> index 7e511293d6d1..c6cf709f0f05 100644
> --- a/drivers/iio/afe/iio-rescale.c
> +++ b/drivers/iio/afe/iio-rescale.c
> @@ -10,9 +10,8 @@
>  
>  #include <linux/err.h>
>  #include <linux/gcd.h>
> +#include <linux/mod_devicetable.h>

Is this really needed?
device_get_match_data() is already defined in <linux/property.h>

Cheers,
Liam

>  #include <linux/module.h>
> -#include <linux/of.h>
> -#include <linux/of_device.h>
>  #include <linux/platform_device.h>
>  #include <linux/property.h>
>  
> @@ -536,7 +535,7 @@ static int rescale_probe(struct platform_device *pdev)
>  
>  	rescale = iio_priv(indio_dev);
>  
> -	rescale->cfg = of_device_get_match_data(dev);
> +	rescale->cfg = device_get_match_data(dev);
>  	rescale->numerator = 1;
>  	rescale->denominator = 1;
>  	rescale->offset = 0;
> -- 
> 2.35.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] iio: afe: rescale: Make use of device properties
  2022-04-14 14:32 ` Liam Beguin
@ 2022-04-14 17:03   ` Andy Shevchenko
  2022-04-15 14:47     ` Liam Beguin
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2022-04-14 17:03 UTC (permalink / raw)
  To: Liam Beguin
  Cc: Jonathan Cameron, Peter Rosin, linux-iio, linux-kernel,
	Jonathan Cameron, Lars-Peter Clausen

On Thu, Apr 14, 2022 at 10:32:38AM -0400, Liam Beguin wrote:
> Hi Andy,
> 
> On Wed, Apr 13, 2022 at 10:01:17PM +0300, Andy Shevchenko wrote:
> > Convert the module to be property provider agnostic and allow
> > it to be used on non-OF platforms.

> > +#include <linux/mod_devicetable.h>
> 
> Is this really needed?

Yes.
This header is missed. I can split its addition to a separate patch.

> device_get_match_data() is already defined in <linux/property.h>

It's indirectly related (just like we do when we clean up of.h). Since
the original of.h is missed there is no header replacement, just adding.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] iio: afe: rescale: Make use of device properties
  2022-04-14 17:03   ` Andy Shevchenko
@ 2022-04-15 14:47     ` Liam Beguin
  2022-04-16 10:41       ` Jonathan Cameron
  0 siblings, 1 reply; 5+ messages in thread
From: Liam Beguin @ 2022-04-15 14:47 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Jonathan Cameron, Peter Rosin, linux-iio, linux-kernel,
	Jonathan Cameron, Lars-Peter Clausen

On Thu, Apr 14, 2022 at 08:03:59PM +0300, Andy Shevchenko wrote:
> On Thu, Apr 14, 2022 at 10:32:38AM -0400, Liam Beguin wrote:
> > Hi Andy,
> > 
> > On Wed, Apr 13, 2022 at 10:01:17PM +0300, Andy Shevchenko wrote:
> > > Convert the module to be property provider agnostic and allow
> > > it to be used on non-OF platforms.
> 
> > > +#include <linux/mod_devicetable.h>
> > 
> > Is this really needed?
> 
> Yes.
> This header is missed. I can split its addition to a separate patch.

Understood, maybe a separate patch would make it more explicit.

Cheers,
Liam

> > device_get_match_data() is already defined in <linux/property.h>
> 
> It's indirectly related (just like we do when we clean up of.h). Since
> the original of.h is missed there is no header replacement, just adding.
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] iio: afe: rescale: Make use of device properties
  2022-04-15 14:47     ` Liam Beguin
@ 2022-04-16 10:41       ` Jonathan Cameron
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2022-04-16 10:41 UTC (permalink / raw)
  To: Liam Beguin
  Cc: Andy Shevchenko, Jonathan Cameron, Peter Rosin, linux-iio,
	linux-kernel, Lars-Peter Clausen

On Fri, 15 Apr 2022 10:47:23 -0400
Liam Beguin <liambeguin@gmail.com> wrote:

> On Thu, Apr 14, 2022 at 08:03:59PM +0300, Andy Shevchenko wrote:
> > On Thu, Apr 14, 2022 at 10:32:38AM -0400, Liam Beguin wrote:  
> > > Hi Andy,
> > > 
> > > On Wed, Apr 13, 2022 at 10:01:17PM +0300, Andy Shevchenko wrote:  
> > > > Convert the module to be property provider agnostic and allow
> > > > it to be used on non-OF platforms.  
> >   
> > > > +#include <linux/mod_devicetable.h>  
> > > 
> > > Is this really needed?  
> > 
> > Yes.
> > This header is missed. I can split its addition to a separate patch.  
> 
> Understood, maybe a separate patch would make it more explicit.

You could also argue that the main route people 'expect' that header via
is of.h and given that include is dropped in this patch, we have even more reason
mod_devicetable.h should be included.

So I'm fine with this in one patch on that basis.

Also I'm lazy and not having to go to v2 on this saves me a little bit of effort :)

Hence applied.


Jonathan

> 
> Cheers,
> Liam
> 
> > > device_get_match_data() is already defined in <linux/property.h>  
> > 
> > It's indirectly related (just like we do when we clean up of.h). Since
> > the original of.h is missed there is no header replacement, just adding.
> > 
> > -- 
> > With Best Regards,
> > Andy Shevchenko
> > 
> >   


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-16 10:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-13 19:01 [PATCH v1 1/1] iio: afe: rescale: Make use of device properties Andy Shevchenko
2022-04-14 14:32 ` Liam Beguin
2022-04-14 17:03   ` Andy Shevchenko
2022-04-15 14:47     ` Liam Beguin
2022-04-16 10:41       ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).