iio: light: clean out of_match_ptr and tidy headers
Subsystems (2)
[email protected]
maintainercover iio: light: clean out of_match_ptr and tidy headers
From: Jonathan Cameron <[email protected]>
Hi All,
Given we keep having to explain to people that of_match_ptr is less than ideal now we have the option of ACPI DSDT using PRP0001 and the compatible, it seems sensible to reduce the number of instances that people might copy for a new driver.
Added theoretical benefit is that we can probe all these drivers from appropriate DSDT (though I doubt anyone will).
I'm sending this first set out to see if anyone has strong views against doing this for at least the simple drivers that have no other device tree dependence. Obviously more work would be needed to remove use of of_match_ptr from IIO completely.
Light sensors picked as a starting point as they tend to be simple.
I may do follow ups in larger blocks to avoid so many small patches (or indeed flatten these into one when applying)
Thanks
Jonathan
Jonathan Cameron (7):
iio: light: bh1780: use mod_devicetable.h and drop of_match_ptr macro
iio: light: cm32181: Add mod_devicetable.h and remove of_match_ptr
iio: light: cm3232: Add mod_devicetable.h include and drop
of_match_ptr
iio: light: gp2ap020a00f: Swap of.h for mod_devicetable.h + drop
of_match_ptr
iio: light: opt3001: Add mod_devicetable.h and drop use of
of_match_ptr
iio: light: st_uvis25: Add mod_devicetable.h and drop of_match_ptr
iio: light: vl6180: swap of.h for mod_devicetable.h and drop
of_match_ptr
drivers/iio/light/bh1780.c | 6 ++---- drivers/iio/light/cm32181.c | 3 ++- drivers/iio/light/cm3232.c | 3 ++- drivers/iio/light/gp2ap020a00f.c | 6 ++---- drivers/iio/light/opt3001.c | 3 ++- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- drivers/iio/light/vl6180.c | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.1
[email protected]
maintainerPATCH 1/7 iio: light: bh1780: use mod_devicetable.h and drop of_match_ptr macro
From: Jonathan Cameron <[email protected]>
Whilst this enables ACPI binding or the device via PRP0001 the primary aim is to remove potential for these two things to be cut and paste into new drivers.
--- drivers/iio/light/bh1780.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/bh1780.c +2 -4
@@ -13,7 +13,7 @@#include <linux/platform_device.h> #include <linux/delay.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/mod_devicetable.h> #include <linux/pm_runtime.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h>
@@ -273,13 +273,11 @@ static const struct i2c_device_id bh1780_id[] = {MODULE_DEVICE_TABLE (i2c, bh1780_id); -#ifdef CONFIG_OF static const struct of_device_id of_bh1780_match[] = { { .compatible ="rohm,bh1780gli" , }, {}, };MODULE_DEVICE_TABLE (of, of_bh1780_match); -#endif static struct i2c_driver bh1780_driver = { .probe = bh1780_probe,
@@ -288,7 +286,7 @@ static struct i2c_driver bh1780_driver = { .driver = { .name = "bh1780", .pm = &bh1780_dev_pm_ops, - .of_match_table = of_match_ptr(of_bh1780_match), + .of_match_table = of_bh1780_match, }, };
Signature · 1 line
2.26.1
Re: [PATCH 1/7] iio: light: bh1780: use mod_devicetable.h and drop of_match_ptr macro
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Whilst this enables ACPI binding or the device via PRP0001 the primary aim is to remove potential for these two things to be cut and paste into new drivers.
Quoted 42 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/bh1780.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/iio/light/bh1780.c +2
-4@@ -13,7 +13,7 @@#include <linux/platform_device.h> #include <linux/delay.h> #include <linux/module.h> -#include <linux/of.h> +#include <linux/mod_devicetable.h> #include <linux/pm_runtime.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> @@ -273,13 +273,11 @@ static const struct i2c_device_id bh1780_id[] = {MODULE_DEVICE_TABLE (i2c, bh1780_id); -#ifdef CONFIG_OF static const struct of_device_id of_bh1780_match[] = { { .compatible ="rohm,bh1780gli" , }, {}, };MODULE_DEVICE_TABLE (of, of_bh1780_match); -#endif static struct i2c_driver bh1780_driver = { .probe = bh1780_probe,@@ -288,7 +286,7 @@ static struct i2c_driver bh1780_driver = { .driver = { .name = "bh1780", .pm = &bh1780_dev_pm_ops, - .of_match_table = of_match_ptr(of_bh1780_match), + .of_match_table = of_bh1780_match, }, };
[email protected]
maintainerPATCH 2/7 iio: light: cm32181: Add mod_devicetable.h and remove of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Enables probing via the ACPI PRP0001 route but more is mosty about removing examples of this that might get copied into new drivers.
--- drivers/iio/light/cm32181.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/cm32181.c +2 -1
@@ -9,6 +9,7 @@#include <linux/i2c.h> #include <linux/mutex.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/interrupt.h> #include <linux/regulator/consumer.h> #include <linux/iio/iio.h>
@@ -354,7 +355,7 @@ MODULE_DEVICE_TABLE(of, cm32181_of_match);static struct i2c_driver cm32181_driver = { .driver = { .name ="cm32181" , - .of_match_table =of_match_ptr (cm32181_of_match), + .of_match_table = cm32181_of_match, }, .id_table = cm32181_id, .probe = cm32181_probe,
Signature · 1 line
2.26.1
Re: [PATCH 2/7] iio: light: cm32181: Add mod_devicetable.h and remove of_match_ptr
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via the ACPI PRP0001 route but more is mosty about removing examples of this that might get copied into new drivers.
Quoted 26 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/cm32181.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/light/cm32181.c +2
-1@@ -9,6 +9,7 @@#include <linux/i2c.h> #include <linux/mutex.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/interrupt.h> #include <linux/regulator/consumer.h> #include <linux/iio/iio.h> @@ -354,7 +355,7 @@ MODULE_DEVICE_TABLE(of, cm32181_of_match);static struct i2c_driver cm32181_driver = { .driver = { .name ="cm32181" , - .of_match_table =of_match_ptr (cm32181_of_match), + .of_match_table = cm32181_of_match, }, .id_table = cm32181_id, .probe = cm32181_probe,
[email protected]
maintainerPATCH 3/7 iio: light: cm3232: Add mod_devicetable.h include and drop of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Enables ACPI probing via PRP0001 and removes an example that might be cut and paste to a new driver.
--- drivers/iio/light/cm3232.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/cm3232.c +2 -1
@@ -10,6 +10,7 @@#include <linux/i2c.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> #include <linux/init.h>
@@ -418,7 +419,7 @@ MODULE_DEVICE_TABLE(of, cm3232_of_match);static struct i2c_driver cm3232_driver = { .driver = { .name ="cm3232" , - .of_match_table =of_match_ptr (cm3232_of_match), + .of_match_table = cm3232_of_match, #ifdef CONFIG_PM_SLEEP .pm = &cm3232_pm_ops, #endif
Signature · 1 line
2.26.1
Re: [PATCH 3/7] iio: light: cm3232: Add mod_devicetable.h include and drop of_match_ptr
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables ACPI probing via PRP0001 and removes an example that might be cut and paste to a new driver.
Quoted 26 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/cm3232.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/light/cm3232.c +2
-1@@ -10,6 +10,7 @@#include <linux/i2c.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> #include <linux/init.h> @@ -418,7 +419,7 @@ MODULE_DEVICE_TABLE(of, cm3232_of_match);static struct i2c_driver cm3232_driver = { .driver = { .name ="cm3232" , - .of_match_table =of_match_ptr (cm3232_of_match), + .of_match_table = cm3232_of_match, #ifdef CONFIG_PM_SLEEP .pm = &cm3232_pm_ops, #endif
[email protected]
maintainerPATCH 4/7 iio: light: gp2ap020a00f: Swap of.h for mod_devicetable.h + drop of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Also drops ifdef protections for CONFIG_OF.
Enables probing via ACPI PRP0001 and removes an example that might be cut and paste into new drivers.
--- drivers/iio/light/gp2ap020a00f.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/light/gp2ap020a00f.c +2 -4
@@ -38,8 +38,8 @@#include <linux/irq.h> #include <linux/irq_work.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> -#include <linux/of.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/slab.h>
@@ -1617,18 +1617,16 @@ static const struct i2c_device_id gp2ap020a00f_id[] = {MODULE_DEVICE_TABLE (i2c, gp2ap020a00f_id); -#ifdef CONFIG_OF static const struct of_device_id gp2ap020a00f_of_match[] = { { .compatible ="sharp,gp2ap020a00f" }, { } };MODULE_DEVICE_TABLE (of, gp2ap020a00f_of_match); -#endif static struct i2c_driver gp2ap020a00f_driver = { .driver = { .name =GP2A_I2C_NAME , - .of_match_table =of_match_ptr (gp2ap020a00f_of_match), + .of_match_table = gp2ap020a00f_of_match, }, .probe = gp2ap020a00f_probe, .remove = gp2ap020a00f_remove,
Signature · 1 line
2.26.1
Re: [PATCH 4/7] iio: light: gp2ap020a00f: Swap of.h for mod_devicetable.h + drop of_match_ptr
Quoted 7 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Also drops ifdef protections for
CONFIG_OF.Enables probing via ACPI PRP0001 and removes an example that might be cut and paste into new drivers.
Quoted 41 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/gp2ap020a00f.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)drivers/iio/light/gp2ap020a00f.c +2
-4@@ -38,8 +38,8 @@#include <linux/irq.h> #include <linux/irq_work.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> -#include <linux/of.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> @@ -1617,18 +1617,16 @@ static const struct i2c_device_id gp2ap020a00f_id[] = {MODULE_DEVICE_TABLE (i2c, gp2ap020a00f_id); -#ifdef CONFIG_OF static const struct of_device_id gp2ap020a00f_of_match[] = { { .compatible ="sharp,gp2ap020a00f" }, { } };MODULE_DEVICE_TABLE (of, gp2ap020a00f_of_match); -#endif static struct i2c_driver gp2ap020a00f_driver = { .driver = { .name =GP2A_I2C_NAME , - .of_match_table =of_match_ptr (gp2ap020a00f_of_match), + .of_match_table = gp2ap020a00f_of_match, }, .probe = gp2ap020a00f_probe,.remove =
gp2ap020a00f_remove,
[email protected]
maintainerPATCH 5/7 iio: light: opt3001: Add mod_devicetable.h and drop use of of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 but mostly about removing examples that might be copied to new drivers.
--- drivers/iio/light/opt3001.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/light/opt3001.c +2 -1
@@ -16,6 +16,7 @@#include <linux/irq.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/slab.h> #include <linux/types.h>
@@ -844,7 +845,7 @@ static struct i2c_driver opt3001_driver = { .driver = { .name = "opt3001", - .of_match_table = of_match_ptr(opt3001_of_match), + .of_match_table = opt3001_of_match, }, };
Signature · 1 line
2.26.1
Re: [PATCH 5/7] iio: light: opt3001: Add mod_devicetable.h and drop use of of_match_ptr
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 but mostly about removing examples that might be copied to new drivers.
Quoted 26 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/opt3001.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/iio/light/opt3001.c +2
-1@@ -16,6 +16,7 @@#include <linux/irq.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/mutex.h> #include <linux/slab.h> #include <linux/types.h> @@ -844,7 +845,7 @@ static struct i2c_driver opt3001_driver = { .driver = { .name = "opt3001", - .of_match_table = of_match_ptr(opt3001_of_match), + .of_match_table = opt3001_of_match, }, };
[email protected]
maintainerPATCH 6/7 iio: light: st_uvis25: Add mod_devicetable.h and drop of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 and removes an example that we don't want people to cut and paste into new drivers.
--- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/iio/light/st_uvis25_i2c.c +2 -1
@@ -9,6 +9,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/i2c.h> #include <linux/slab.h> #include <linux/regmap.h>
@@ -55,7 +56,7 @@ static struct i2c_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_i2c", .pm = &st_uvis25_pm_ops, - .of_match_table = of_match_ptr(st_uvis25_i2c_of_match), + .of_match_table = st_uvis25_i2c_of_match, }, .probe = st_uvis25_i2c_probe, .id_table = st_uvis25_i2c_id_table,
drivers/iio/light/st_uvis25_spi.c +2 -1
@@ -9,6 +9,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/spi/spi.h> #include <linux/slab.h> #include <linux/regmap.h>
@@ -55,7 +56,7 @@ static struct spi_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_spi", .pm = &st_uvis25_pm_ops, - .of_match_table = of_match_ptr(st_uvis25_spi_of_match), + .of_match_table = st_uvis25_spi_of_match, }, .probe = st_uvis25_spi_probe, .id_table = st_uvis25_spi_id_table,
Signature · 1 line
2.26.1
Re: [PATCH 6/7] iio: light: st_uvis25: Add mod_devicetable.h and drop of_match_ptr
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 and removes an example that we don't want people to cut and paste into new drivers.
Quoted 50 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)drivers/iio/light/st_uvis25_i2c.c +2
-1@@ -9,6 +9,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/i2c.h> #include <linux/slab.h> #include <linux/regmap.h> @@ -55,7 +56,7 @@ static struct i2c_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_i2c", .pm = &st_uvis25_pm_ops, - .of_match_table = of_match_ptr(st_uvis25_i2c_of_match), + .of_match_table = st_uvis25_i2c_of_match, }, .probe = st_uvis25_i2c_probe, .id_table = st_uvis25_i2c_id_table,drivers/iio/light/st_uvis25_spi.c +2
-1@@ -9,6 +9,7 @@#include <linux/kernel.h> #include <linux/module.h> +#include <linux/mod_devicetable.h> #include <linux/spi/spi.h> #include <linux/slab.h> #include <linux/regmap.h> @@ -55,7 +56,7 @@ static struct spi_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_spi", .pm = &st_uvis25_pm_ops, - .of_match_table = of_match_ptr(st_uvis25_spi_of_match), + .of_match_table = st_uvis25_spi_of_match, }, .probe = st_uvis25_spi_probe, .id_table = st_uvis25_spi_id_table,
[email protected]
maintainerPATCH 7/7 iio: light: vl6180: swap of.h for mod_devicetable.h and drop of_match_ptr
In reply to [email protected]From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 route and removes an example of an approach we no longer want people to copy.
--- drivers/iio/light/vl6180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/vl6180.c +1 -1
@@ -537,7 +537,7 @@ MODULE_DEVICE_TABLE(i2c, vl6180_id);static struct i2c_driver vl6180_driver = { .driver = { .name =VL6180_DRV_NAME , - .of_match_table =of_match_ptr (vl6180_of_match), + .of_match_table = vl6180_of_match, }, .probe = vl6180_probe, .id_table = vl6180_id,
Signature · 1 line
2.26.1
Re: [PATCH 7/7] iio: light: vl6180: swap of.h for mod_devicetable.h and drop of_match_ptr
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 route and removes an example of an approach we no longer want people to copy.
This doesn't include 'linux/mod_devicetable.h'.
I'm wondering now if it is needed at all.
Should we remove it from the rest?
With that addressed:
Quoted 18 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/vl6180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/vl6180.c +1
-1@@ -537,7 +537,7 @@ MODULE_DEVICE_TABLE(i2c, vl6180_id);static struct i2c_driver vl6180_driver = { .driver = { .name =VL6180_DRV_NAME , - .of_match_table =of_match_ptr (vl6180_of_match), + .of_match_table = vl6180_of_match, }, .probe = vl6180_probe, .id_table = vl6180_id,
Re: [PATCH 7/7] iio: light: vl6180: swap of.h for mod_devicetable.h and drop of_match_ptr
Quoted 11 lines · Alexandru
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 route and removes an example of an approach we no longer want people to copy.
This doesn't include '
linux/mod_devicetable.h'.
I'm wondering now if it is needed at all.
Should we remove it from the rest?
Oops.
So this is one of those classics. mod_devicetable is included by the spi and i2c headers but there is no actual 'need' for them to do so. The could (I think) get away with an appropriate forwards definition.
This is in contrast to the drivers that need to know what that structure looks like (as does the i2c core device tree code etc).
So should we include it or not? I'm generally of the view that we should for resilience but others favour minimal includes.
Jonathan
Quoted 22 lines
With that addressed:
Reviewed-by Alexandru Ardelean <[email protected]>Quoted 18 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/vl6180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/vl6180.c +1
-1@@ -537,7 +537,7 @@ MODULE_DEVICE_TABLE(i2c, vl6180_id);static struct i2c_driver vl6180_driver = { .driver = { .name =VL6180_DRV_NAME , - .of_match_table =of_match_ptr (vl6180_of_match), + .of_match_table = vl6180_of_match, }, .probe = vl6180_probe, .id_table = vl6180_id,
Re: [PATCH 7/7] iio: light: vl6180: swap of.h for mod_devicetable.h and drop of_match_ptr
Quoted 20 lines · Jonathan Cameron
Quoted 11 lines · Alexandru
Quoted 5 lines · On Sun, 2020-04-19 at 16:02 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Enables probing via ACPI PRP0001 route and removes an example of an approach we no longer want people to copy.
This doesn't include '
linux/mod_devicetable.h'.
I'm wondering now if it is needed at all.
Should we remove it from the rest?Oops.
So this is one of those classics.
mod_devicetableis included by the spi and i2c headers but there is no actual 'need' for them to do so. The could (I think) get away with an appropriate forwards definition.
Quoted 5 lines
This is in contrast to the drivers that need to know what that structure looks like (as does the i2c core device tree code etc).
So should we include it or not? I'm generally of the view that we should for resilience but others favour minimal includes.
I'm a bit in the middle here between minimalism & resilience/more-explicit- inclusions.
No strong opinions about it.
I've been through 1-2 inclusion-hell fixing; still no strong opinion. Maybe I need a few more.
I usually leave it to someone else's preference.
Quoted 28 lines
Jonathan
Quoted 22 lines
With that addressed:
Reviewed-by Alexandru Ardelean <[email protected]>Quoted 18 lines
Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/vl6180.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/vl6180.c +1
-1@@ -537,7 +537,7 @@ MODULE_DEVICE_TABLE(i2c, vl6180_id);static struct i2c_driver vl6180_driver = { .driver = { .name =VL6180_DRV_NAME , - .of_match_table =of_match_ptr (vl6180_of_match), + .of_match_table = vl6180_of_match, }, .probe = vl6180_probe, .id_table = vl6180_id,
Quoted 17 lines · On Sun, 2020-04-19 at 16:01 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Hi All,
Given we keep having to explain to people that
of_match_ptris less than ideal now we have the option of ACPI DSDT using PRP0001 and the compatible, it seems sensible to reduce the number of instances that people might copy for a new driver.Added theoretical benefit is that we can probe all these drivers from appropriate DSDT (though I doubt anyone will).
I'm sending this first set out to see if anyone has strong views against doing this for at least the simple drivers that have no other device tree dependence. Obviously more work would be needed to remove use of
of_match_ptrfrom IIO completely.
Quoted 4 lines
Light sensors picked as a starting point as they tend to be simple.
I may do follow ups in larger blocks to avoid so many small patches (or indeed flatten these into one when applying)
fwiw: i was also planning to do a sweep of these;
well, tbh, the main intent was to target ADI drivers first and do a bigger conversion for them to make the slightly friendlier with ACPI;
aside from this, i'm also noticing some bad patterns being copied from older drivers, when asking new people to write Linux drivers;
i did not make a list, probably should have;
one is 'mlock' [still] being copied; and accessing other internal fields; but the internal fields accessing requires a bit of a cleanup in the form of privatizing the fields somehow;
Quoted 28 lines
Thanks
Jonathan
Jonathan Cameron (7):
iio: light: bh1780: usemod_devicetable.hand dropof_match_ptrmacro
iio: light: cm32181: Addmod_devicetable.hand removeof_match_ptr
iio: light: cm3232: Addmod_devicetable.hinclude and drop
of_match_ptr
iio: light: gp2ap020a00f: Swapof.hformod_devicetable.h+ drop
of_match_ptr
iio: light: opt3001: Addmod_devicetable.hand drop use of
of_match_ptr
iio: light:st_uvis25: Addmod_devicetable.hand dropof_match_ptr
iio: light: vl6180: swapof.hformod_devicetable.hand drop
of_match_ptrdrivers/iio/light/bh1780.c | 6 ++---- drivers/iio/light/cm32181.c | 3 ++- drivers/iio/light/cm3232.c | 3 ++- drivers/iio/light/gp2ap020a00f.c | 6 ++---- drivers/iio/light/opt3001.c | 3 ++- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- drivers/iio/light/vl6180.c | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-)
Quoted 29 lines · Alexandru
[External]
Quoted 17 lines · On Sun, 2020-04-19 at 16:01 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Hi All,
Given we keep having to explain to people that
of_match_ptris less than ideal now we have the option of ACPI DSDT using PRP0001 and the compatible, it seems sensible to reduce the number of instances that people might copy for a new driver.Added theoretical benefit is that we can probe all these drivers from appropriate DSDT (though I doubt anyone will).
I'm sending this first set out to see if anyone has strong views against doing this for at least the simple drivers that have no other device tree dependence. Obviously more work would be needed to remove use of
of_match_ptrfrom IIO completely.Quoted 4 lines
Light sensors picked as a starting point as they tend to be simple.
I may do follow ups in larger blocks to avoid so many small patches (or indeed flatten these into one when applying)
fwiw: i was also planning to do a sweep of these;
well, tbh, the main intent was to target ADI drivers first and do a bigger conversion for them to make the slightly friendlier with ACPI;
Quoted 7 lines
aside from this, i'm also noticing some bad patterns being copied from older drivers, when asking new people to write Linux drivers;
i did not make a list, probably should have;
one is 'mlock' [still] being copied; and accessing other internal fields; but the internal fields accessing requires a bit of a cleanup in the form of privatizing the fields somehow;
One thing I noticed in the series.
No idea if it is needed or not; a build would tell:
Is '#include <linux/mod_devicetable.h>' required for this change?
Most patches add it, but I don't feel it is needed; I could be wrong though.
What I noticed is that all 'linux/of.h' , 'linux/of_device.h' & 'linux/of_platform.h' include it.
Quoted 28 lines
Quoted 28 lines
Thanks
Jonathan
Jonathan Cameron (7):
iio: light: bh1780: usemod_devicetable.hand dropof_match_ptrmacro
iio: light: cm32181: Addmod_devicetable.hand removeof_match_ptr
iio: light: cm3232: Addmod_devicetable.hinclude and drop
of_match_ptr
iio: light: gp2ap020a00f: Swapof.hformod_devicetable.h+ drop
of_match_ptr
iio: light: opt3001: Addmod_devicetable.hand drop use of
of_match_ptr
iio: light:st_uvis25: Addmod_devicetable.hand dropof_match_ptr
iio: light: vl6180: swapof.hformod_devicetable.hand drop
of_match_ptrdrivers/iio/light/bh1780.c | 6 ++---- drivers/iio/light/cm32181.c | 3 ++- drivers/iio/light/cm3232.c | 3 ++- drivers/iio/light/gp2ap020a00f.c | 6 ++---- drivers/iio/light/opt3001.c | 3 ++- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- drivers/iio/light/vl6180.c | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-)
Quoted 38 lines · Alexandru
Quoted 29 lines · Alexandru
[External]
Quoted 17 lines · On Sun, 2020-04-19 at 16:01 +0100, [email protected] wrote:
From: Jonathan Cameron <[email protected]>
Hi All,
Given we keep having to explain to people that
of_match_ptris less than ideal now we have the option of ACPI DSDT using PRP0001 and the compatible, it seems sensible to reduce the number of instances that people might copy for a new driver.Added theoretical benefit is that we can probe all these drivers from appropriate DSDT (though I doubt anyone will).
I'm sending this first set out to see if anyone has strong views against doing this for at least the simple drivers that have no other device tree dependence. Obviously more work would be needed to remove use of
of_match_ptrfrom IIO completely.Quoted 4 lines
Light sensors picked as a starting point as they tend to be simple.
I may do follow ups in larger blocks to avoid so many small patches (or indeed flatten these into one when applying)
fwiw: i was also planning to do a sweep of these;
well, tbh, the main intent was to target ADI drivers first and do a bigger conversion for them to make the slightly friendlier with ACPI;Quoted 7 lines
aside from this, i'm also noticing some bad patterns being copied from older drivers, when asking new people to write Linux drivers;
i did not make a list, probably should have;
one is 'mlock' [still] being copied; and accessing other internal fields; but the internal fields accessing requires a bit of a cleanup in the form of privatizing the fields somehow;
Quoted 4 lines
One thing I noticed in the series.
No idea if it is needed or not; a build would tell:
Is '#include <linux/mod_devicetable.h>' required for this change?
Most patches add it, but I don't feel it is needed; I could be wrong though.
I addressed this in reply to patch 7. It's mainly obtained via i2c.h and spi.h in these drivers. They don't have any particular need to include it as they could deal with an opaque pointer.
However, seems unlikely that'll get tidied up any time soon and debatable whether there is any point in doing so.
Quoted 3 lines
What I noticed is that all '
linux/of.h' , 'linux/of_device.h' & 'linux/of_platform.h' include it.
True, but we shouldn't include any of them unless we have reason to do so. They bring baggage we don't need for these drivers.
Jonathan
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Thanks
Jonathan
Jonathan Cameron (7):
iio: light: bh1780: usemod_devicetable.hand dropof_match_ptrmacro
iio: light: cm32181: Addmod_devicetable.hand removeof_match_ptr
iio: light: cm3232: Addmod_devicetable.hinclude and drop
of_match_ptr
iio: light: gp2ap020a00f: Swapof.hformod_devicetable.h+ drop
of_match_ptr
iio: light: opt3001: Addmod_devicetable.hand drop use of
of_match_ptr
iio: light:st_uvis25: Addmod_devicetable.hand dropof_match_ptr
iio: light: vl6180: swapof.hformod_devicetable.hand drop
of_match_ptrdrivers/iio/light/bh1780.c | 6 ++---- drivers/iio/light/cm32181.c | 3 ++- drivers/iio/light/cm3232.c | 3 ++- drivers/iio/light/gp2ap020a00f.c | 6 ++---- drivers/iio/light/opt3001.c | 3 ++- drivers/iio/light/st_uvis25_i2c.c | 3 ++- drivers/iio/light/st_uvis25_spi.c | 3 ++- drivers/iio/light/vl6180.c | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-)
Quoted 10 lines · Jonathan Cameron
Quoted 7 lines · Alexandru
Quoted 1 line · Alexandru
On Sun, 2020-04-19 at 16:01 +0100, [email protected] wrote:
One thing I noticed in the series.
No idea if it is needed or not; a build would tell:
Is '#include <linux/mod_devicetable.h>' required for this change?
Most patches add it, but I don't feel it is needed; I could be wrong though.
Quoted 6 lines
I addressed this in reply to patch 7. It's mainly obtained via
i2c.handspi.hin these drivers. They don't have any particular need to include it as they could deal with an opaque pointer.However, seems unlikely that'll get tidied up any time soon and debatable whether there is any point in doing so.
I would use the simple rule, we include header if we have direct user of it.
Quoted 5 lines
Quoted 2 lines
What I noticed is that all '
linux/of.h' , 'linux/of_device.h' & 'linux/of_platform.h' include it.True, but we shouldn't include any of them unless we have reason to do so. They bring baggage we don't need for these drivers.
--
With Best Regards,
Andy Shevchenko
Jonathan Cameron
maintainerQuoted 12 lines · On Tue, 21 Apr 2020 03:50:57 +0300 Andy Shevchenko <[email protected]>…
Quoted 10 lines · Jonathan Cameron
Quoted 7 lines · Alexandru
Quoted 1 line · Alexandru
On Sun, 2020-04-19 at 16:01 +0100, [email protected] wrote:
One thing I noticed in the series.
No idea if it is needed or not; a build would tell:
Is '#include <linux/mod_devicetable.h>' required for this change?
Most patches add it, but I don't feel it is needed; I could be wrong though.
Quoted 8 lines
Quoted 6 lines
I addressed this in reply to patch 7. It's mainly obtained via
i2c.handspi.hin these drivers. They don't have any particular need to include it as they could deal with an opaque pointer.However, seems unlikely that'll get tidied up any time soon and debatable whether there is any point in doing so.
I would use the simple rule, we include header if we have direct user of it.
Sensible and easy to understand basis to make the decision. Let's go with that (though I don't want to see lots of isolated 'fixes' for 'missing' headers!)
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
What I noticed is that all '
linux/of.h' , 'linux/of_device.h' & 'linux/of_platform.h' include it.True, but we shouldn't include any of them unless we have reason to do so. They bring baggage we don't need for these drivers.
All applied with patch 7 amended to add the include.
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with them.
Thanks,
Jonathan
Quoted 5 lines
--
With Best Regards,
Andy Shevchenko