iio: afe: rescale: Make use of device properties
Subsystems (2)
PATCH 1/1 iio: afe: rescale: Make use of device properties
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
--- drivers/iio/afe/Kconfig | 1 - drivers/iio/afe/iio-rescale.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/iio/afe/Kconfig +0 -1
@@ -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
drivers/iio/afe/iio-rescale.c +2 -3
@@ -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 ;
Signature · 1 line
2.35.1
Hi Andy,
Quoted 26 lines · Andy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/iio/afe/Kconfig | 1 - drivers/iio/afe/iio-rescale.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-)drivers/iio/afe/Kconfig +0
-1@@ -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 anddrivers/iio/afe/iio-rescale.c +0
-0
drivers/iio/afe/iio-rescale.c line 13
Quoted 4 lines
drivers/iio/afe/iio-rescale.c +1
-0@@ -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
Quoted 18 lines
drivers/iio/afe/iio-rescale.c +1
-3#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 ;Signature · 1 line
2.35.1
Quoted 9 lines · Liam Beguin
Hi Andy,
Quoted 4 lines · Andy Shevchenko
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.
Quoted 1 line
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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Liam Beguin
Hi Andy,
Quoted 2 lines · Andy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+#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
Quoted 10 lines
Quoted 1 line
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 originalof.his missed there is no header replacement, just adding.Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 8 lines · On Fri, 15 Apr 2022 10:47:23 -0400 Liam Beguin <[email protected]> wrote:
Quoted 7 lines · Andy Shevchenko
Quoted 5 lines · Liam Beguin
Hi Andy,
Quoted 2 lines · Andy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+#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
Quoted 14 lines
Cheers,
LiamQuoted 10 lines
Quoted 1 line
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 originalof.his missed there is no header replacement, just adding.Signature · 2 lines
With Best Regards, Andy Shevchenko