linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: accel: Abandon of_match_ptr macro
@ 2020-04-24 22:44 Nishant Malpani
  2020-04-24 22:44 ` [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop " Nishant Malpani
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nishant Malpani @ 2020-04-24 22:44 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, jic23, knaack.h, lars, pmeerw, alexandru.Ardelean,
	nish.malpani25

This patchset extends Jonathan's and Alexandru's work [1] on removing the instances of
of_match_ptr macro. Motivation to do so is two-fold:
  1. to have an option of probing from ACPI using PRP0001
  2. prevent people from copying to new driver code

[1] https://patchwork.kernel.org/cover/11497535/

Nishant Malpani (3):
  iio: accel: dmard06: Use mod_devicetable.h and drop of_match_ptr macro
  iio: accel: kxsd9-i2c: Use mod_devicetable.h and drop of_match_ptr
    macro
  iio: accel: mma8452: Drop of_match_ptr macro

 drivers/iio/accel/dmard06.c   | 3 ++-
 drivers/iio/accel/kxsd9-i2c.c | 7 ++-----
 drivers/iio/accel/mma8452.c   | 2 +-
 3 files changed, 5 insertions(+), 7 deletions(-)

-- 
2.20.1


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

* [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop of_match_ptr macro
  2020-04-24 22:44 [PATCH 0/3] iio: accel: Abandon of_match_ptr macro Nishant Malpani
@ 2020-04-24 22:44 ` Nishant Malpani
  2020-04-25 14:35   ` Jonathan Cameron
  2020-04-24 22:44 ` [PATCH 2/3] iio: accel: kxsd9-i2c: " Nishant Malpani
  2020-04-24 22:44 ` [PATCH 3/3] iio: accel: mma8452: Drop " Nishant Malpani
  2 siblings, 1 reply; 7+ messages in thread
From: Nishant Malpani @ 2020-04-24 22:44 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, jic23, knaack.h, lars, pmeerw, alexandru.Ardelean,
	nish.malpani25

Enables ACPI DSDT to probe via PRP0001 and the compatible property.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
---
 drivers/iio/accel/dmard06.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/accel/dmard06.c b/drivers/iio/accel/dmard06.c
index 2bf210fa4ba6..ef89bded7390 100644
--- a/drivers/iio/accel/dmard06.c
+++ b/drivers/iio/accel/dmard06.c
@@ -6,6 +6,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
 
@@ -226,7 +227,7 @@ static struct i2c_driver dmard06_driver = {
 	.id_table = dmard06_id,
 	.driver = {
 		.name = DMARD06_DRV_NAME,
-		.of_match_table = of_match_ptr(dmard06_of_match),
+		.of_match_table = dmard06_of_match,
 		.pm = DMARD06_PM_OPS,
 	},
 };
-- 
2.20.1


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

* [PATCH 2/3] iio: accel: kxsd9-i2c: Use mod_devicetable.h and drop of_match_ptr macro
  2020-04-24 22:44 [PATCH 0/3] iio: accel: Abandon of_match_ptr macro Nishant Malpani
  2020-04-24 22:44 ` [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop " Nishant Malpani
@ 2020-04-24 22:44 ` Nishant Malpani
  2020-04-25 14:36   ` Jonathan Cameron
  2020-04-24 22:44 ` [PATCH 3/3] iio: accel: mma8452: Drop " Nishant Malpani
  2 siblings, 1 reply; 7+ messages in thread
From: Nishant Malpani @ 2020-04-24 22:44 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, jic23, knaack.h, lars, pmeerw, alexandru.Ardelean,
	nish.malpani25

Enables ACPI DSDT to probe via PRP0001 and the compatible property. Also
removes the ifdef protections for CONFIG_OF.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
---
 drivers/iio/accel/kxsd9-i2c.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c
index b6f3de7ef8ea..b580d605f848 100644
--- a/drivers/iio/accel/kxsd9-i2c.c
+++ b/drivers/iio/accel/kxsd9-i2c.c
@@ -2,6 +2,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/delay.h>
@@ -36,15 +37,11 @@ static int kxsd9_i2c_remove(struct i2c_client *client)
 	return kxsd9_common_remove(&client->dev);
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id kxsd9_of_match[] = {
 	{ .compatible = "kionix,kxsd9", },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, kxsd9_of_match);
-#else
-#define kxsd9_of_match NULL
-#endif
 
 static const struct i2c_device_id kxsd9_i2c_id[] = {
 	{"kxsd9", 0},
@@ -55,7 +52,7 @@ MODULE_DEVICE_TABLE(i2c, kxsd9_i2c_id);
 static struct i2c_driver kxsd9_i2c_driver = {
 	.driver = {
 		.name	= "kxsd9",
-		.of_match_table = of_match_ptr(kxsd9_of_match),
+		.of_match_table = kxsd9_of_match,
 		.pm = &kxsd9_dev_pm_ops,
 	},
 	.probe		= kxsd9_i2c_probe,
-- 
2.20.1


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

* [PATCH 3/3] iio: accel: mma8452: Drop of_match_ptr macro
  2020-04-24 22:44 [PATCH 0/3] iio: accel: Abandon of_match_ptr macro Nishant Malpani
  2020-04-24 22:44 ` [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop " Nishant Malpani
  2020-04-24 22:44 ` [PATCH 2/3] iio: accel: kxsd9-i2c: " Nishant Malpani
@ 2020-04-24 22:44 ` Nishant Malpani
  2020-04-25 14:35   ` Jonathan Cameron
  2 siblings, 1 reply; 7+ messages in thread
From: Nishant Malpani @ 2020-04-24 22:44 UTC (permalink / raw)
  To: linux-iio
  Cc: linux-kernel, jic23, knaack.h, lars, pmeerw, alexandru.Ardelean,
	nish.malpani25

Enables ACPI DSDT to probe via PRP0001 and the compatible property.

Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>
---
 drivers/iio/accel/mma8452.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 00e100fc845a..66217fbcc7af 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1815,7 +1815,7 @@ MODULE_DEVICE_TABLE(i2c, mma8452_id);
 static struct i2c_driver mma8452_driver = {
 	.driver = {
 		.name	= "mma8452",
-		.of_match_table = of_match_ptr(mma8452_dt_ids),
+		.of_match_table = mma8452_dt_ids,
 		.pm	= &mma8452_pm_ops,
 	},
 	.probe = mma8452_probe,
-- 
2.20.1


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

* Re: [PATCH 3/3] iio: accel: mma8452: Drop of_match_ptr macro
  2020-04-24 22:44 ` [PATCH 3/3] iio: accel: mma8452: Drop " Nishant Malpani
@ 2020-04-25 14:35   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-04-25 14:35 UTC (permalink / raw)
  To: Nishant Malpani
  Cc: linux-iio, linux-kernel, knaack.h, lars, pmeerw, alexandru.Ardelean

On Sat, 25 Apr 2020 04:14:39 +0530
Nishant Malpani <nish.malpani25@gmail.com> wrote:

> Enables ACPI DSDT to probe via PRP0001 and the compatible property.
> 
> Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>

No on this one.  There is a whole load of device tree specific code in
the driver.  Now that could be moved over to the device properties 
approach but that's a much less trivial job.  Its probably too major
to do without someone giving a tested-by, or whoever does it
having the device to test - or setting up emulation to check
everything works as expected before and after the change.

So far I've been restricting this tidying up to the drivers that are
really simple to review (no other device tree functions called).

Jonathan

> ---
>  drivers/iio/accel/mma8452.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 00e100fc845a..66217fbcc7af 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1815,7 +1815,7 @@ MODULE_DEVICE_TABLE(i2c, mma8452_id);
>  static struct i2c_driver mma8452_driver = {
>  	.driver = {
>  		.name	= "mma8452",
> -		.of_match_table = of_match_ptr(mma8452_dt_ids),
> +		.of_match_table = mma8452_dt_ids,
>  		.pm	= &mma8452_pm_ops,
>  	},
>  	.probe = mma8452_probe,


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

* Re: [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop of_match_ptr macro
  2020-04-24 22:44 ` [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop " Nishant Malpani
@ 2020-04-25 14:35   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-04-25 14:35 UTC (permalink / raw)
  To: Nishant Malpani
  Cc: linux-iio, linux-kernel, knaack.h, lars, pmeerw, alexandru.Ardelean

On Sat, 25 Apr 2020 04:14:37 +0530
Nishant Malpani <nish.malpani25@gmail.com> wrote:

> Enables ACPI DSDT to probe via PRP0001 and the compatible property.
> 
> Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>

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

Thanks,

Jonathan

> ---
>  drivers/iio/accel/dmard06.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/dmard06.c b/drivers/iio/accel/dmard06.c
> index 2bf210fa4ba6..ef89bded7390 100644
> --- a/drivers/iio/accel/dmard06.c
> +++ b/drivers/iio/accel/dmard06.c
> @@ -6,6 +6,7 @@
>   */
>  
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/i2c.h>
>  #include <linux/iio/iio.h>
>  
> @@ -226,7 +227,7 @@ static struct i2c_driver dmard06_driver = {
>  	.id_table = dmard06_id,
>  	.driver = {
>  		.name = DMARD06_DRV_NAME,
> -		.of_match_table = of_match_ptr(dmard06_of_match),
> +		.of_match_table = dmard06_of_match,
>  		.pm = DMARD06_PM_OPS,
>  	},
>  };


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

* Re: [PATCH 2/3] iio: accel: kxsd9-i2c: Use mod_devicetable.h and drop of_match_ptr macro
  2020-04-24 22:44 ` [PATCH 2/3] iio: accel: kxsd9-i2c: " Nishant Malpani
@ 2020-04-25 14:36   ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2020-04-25 14:36 UTC (permalink / raw)
  To: Nishant Malpani
  Cc: linux-iio, linux-kernel, knaack.h, lars, pmeerw, alexandru.Ardelean

On Sat, 25 Apr 2020 04:14:38 +0530
Nishant Malpani <nish.malpani25@gmail.com> wrote:

> Enables ACPI DSDT to probe via PRP0001 and the compatible property. Also
> removes the ifdef protections for CONFIG_OF.
> 
> Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com>

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

Thanks,

Jonathan

> ---
>  drivers/iio/accel/kxsd9-i2c.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c
> index b6f3de7ef8ea..b580d605f848 100644
> --- a/drivers/iio/accel/kxsd9-i2c.c
> +++ b/drivers/iio/accel/kxsd9-i2c.c
> @@ -2,6 +2,7 @@
>  #include <linux/device.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/slab.h>
>  #include <linux/i2c.h>
>  #include <linux/delay.h>
> @@ -36,15 +37,11 @@ static int kxsd9_i2c_remove(struct i2c_client *client)
>  	return kxsd9_common_remove(&client->dev);
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id kxsd9_of_match[] = {
>  	{ .compatible = "kionix,kxsd9", },
>  	{ },
>  };
>  MODULE_DEVICE_TABLE(of, kxsd9_of_match);
> -#else
> -#define kxsd9_of_match NULL
> -#endif
>  
>  static const struct i2c_device_id kxsd9_i2c_id[] = {
>  	{"kxsd9", 0},
> @@ -55,7 +52,7 @@ MODULE_DEVICE_TABLE(i2c, kxsd9_i2c_id);
>  static struct i2c_driver kxsd9_i2c_driver = {
>  	.driver = {
>  		.name	= "kxsd9",
> -		.of_match_table = of_match_ptr(kxsd9_of_match),
> +		.of_match_table = kxsd9_of_match,
>  		.pm = &kxsd9_dev_pm_ops,
>  	},
>  	.probe		= kxsd9_i2c_probe,


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

end of thread, other threads:[~2020-04-25 14:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 22:44 [PATCH 0/3] iio: accel: Abandon of_match_ptr macro Nishant Malpani
2020-04-24 22:44 ` [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop " Nishant Malpani
2020-04-25 14:35   ` Jonathan Cameron
2020-04-24 22:44 ` [PATCH 2/3] iio: accel: kxsd9-i2c: " Nishant Malpani
2020-04-25 14:36   ` Jonathan Cameron
2020-04-24 22:44 ` [PATCH 3/3] iio: accel: mma8452: Drop " Nishant Malpani
2020-04-25 14:35   ` 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).