Get rid of ugly CONFIG_OF ifdeffery by adding mod_devicetable.h include.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2:
* New patch.
---
drivers/regulator/pv88080-regulator.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c
index 4009239b6784..2404df78d639 100644
--- a/drivers/regulator/pv88080-regulator.c
+++ b/drivers/regulator/pv88080-regulator.c
@@ -5,6 +5,7 @@
#include <linux/err.h>
#include <linux/i2c.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/init.h>
@@ -513,7 +514,6 @@ static int pv88080_i2c_probe(struct i2c_client *i2c)
return 0;
}
-#ifdef CONFIG_OF
static const struct of_device_id pv88080_dt_ids[] = {
{ .compatible = "pvs,pv88080", .data = &pv88080_aa_regs },
{ .compatible = "pvs,pv88080-aa", .data = &pv88080_aa_regs },
@@ -521,7 +521,6 @@ static const struct of_device_id pv88080_dt_ids[] = {
{}
};
MODULE_DEVICE_TABLE(of, pv88080_dt_ids);
-#endif
static const struct i2c_device_id pv88080_i2c_id[] = {
{ "pv88080", (kernel_ulong_t)&pv88080_aa_regs },
@@ -535,7 +534,7 @@ static struct i2c_driver pv88080_regulator_driver = {
.driver = {
.name = "pv88080",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
- .of_match_table = of_match_ptr(pv88080_dt_ids),
+ .of_match_table = pv88080_dt_ids,
},
.probe = pv88080_i2c_probe,
.id_table = pv88080_i2c_id,
--
2.25.1
On Mon, Aug 28, 2023 at 06:24:17PM +0100, Biju Das wrote: > Get rid of ugly CONFIG_OF ifdeffery by adding mod_devicetable.h include. Commit message needs to be improved. Inclusion of that header doesn't allow to do what you have done. Dropping of_match_ptr() does. And you need to explain that leaving OF table for non-OF system is fine and doesn't waste too much memory anyway. Look for the existing changes like this in the kernel history (`git log --no-merges --grep ...` at your service). -- With Best Regards, Andy Shevchenko
© 2016 - 2025 Red Hat, Inc.