iio: accel: Abandon of_match_ptr macro
cover iio: accel: Abandon of_match_ptr macro
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(-)
Signature · 1 line
2.20.1
PATCH 1/3 iio: accel: dmard06: Use mod_devicetable.h and drop of_match_ptr macro
Enables ACPI DSDT to probe via PRP0001 and the compatible property.
--- drivers/iio/accel/dmard06.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/accel/dmard06.c +2 -1
@@ -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, }, };
Signature · 1 line
2.20.1
Jonathan Cameron
maintainerRe: [PATCH 1/3] iio: accel: dmard06: Use mod_devicetable.h and drop of_match_ptr macro
Quoted 3 lines · On Sat, 25 Apr 2020 04:14:37 +0530 Nishant Malpani <[email protected]>…
Enables ACPI DSDT to probe via PRP0001 and the compatible property.
Signed-off-by Nishant Malpani <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 25 lines
--- drivers/iio/accel/dmard06.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/accel/dmard06.c +2
-1@@ -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, }, };
PATCH 2/3 iio: accel: kxsd9-i2c: Use mod_devicetable.h and drop of_match_ptr macro
In reply to Nishant MalpaniEnables ACPI DSDT to probe via PRP0001 and the compatible property. Also removes the ifdef protections for CONFIG_OF.
--- drivers/iio/accel/kxsd9-i2c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/iio/accel/kxsd9-i2c.c +2 -5
@@ -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,
Signature · 1 line
2.20.1
Jonathan Cameron
maintainerRe: [PATCH 2/3] iio: accel: kxsd9-i2c: Use mod_devicetable.h and drop of_match_ptr macro
Quoted 4 lines · On Sat, 25 Apr 2020 04:14:38 +0530 Nishant Malpani <[email protected]>…
Enables ACPI DSDT to probe via PRP0001 and the compatible property. Also removes the ifdef protections for
CONFIG_OF.Signed-off-by Nishant Malpani <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it.
Thanks,
Jonathan
Quoted 41 lines
--- drivers/iio/accel/kxsd9-i2c.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/iio/accel/kxsd9-i2c.c +2
-5@@ -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,
PATCH 3/3 iio: accel: mma8452: Drop of_match_ptr macro
In reply to Nishant MalpaniEnables ACPI DSDT to probe via PRP0001 and the compatible property.
--- drivers/iio/accel/mma8452.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/mma8452.c +1 -1
@@ -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,
Signature · 1 line
2.20.1
Jonathan Cameron
maintainerRe: [PATCH 3/3] iio: accel: mma8452: Drop of_match_ptr macro
Quoted 3 lines · On Sat, 25 Apr 2020 04:14:39 +0530 Nishant Malpani <[email protected]>…
Enables ACPI DSDT to probe via PRP0001 and the compatible property.
Signed-off-by Nishant Malpani <[email protected]>
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
Quoted 17 lines
--- drivers/iio/accel/mma8452.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/mma8452.c +1
-1@@ -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,