[2/2] media: i2c: ov7670: Drop CONFIG_OF ifdeffery
Commit Message
Drop of_match_ptr() from ov7670_driver and get rid of ugly CONFIG_OF
if check. This slightly increases the size of ov7670_driver on non-OF
system and shouldn't be an issue.
Add mod_devicetable.h include.
It also allows, in case if needed, to enumerate this device via ACPI with
PRP0001 magic.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/media/i2c/ov7670.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
Hi Biju
On Sun, Sep 10, 2023 at 04:00:33PM +0100, Biju Das wrote:
> Drop of_match_ptr() from ov7670_driver and get rid of ugly CONFIG_OF
> if check. This slightly increases the size of ov7670_driver on non-OF
> system and shouldn't be an issue.
>
> Add mod_devicetable.h include.
>
> It also allows, in case if needed, to enumerate this device via ACPI with
> PRP0001 magic.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> drivers/media/i2c/ov7670.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> index 644457e6993d..41032394a464 100644
> --- a/drivers/media/i2c/ov7670.c
> +++ b/drivers/media/i2c/ov7670.c
> @@ -10,6 +10,7 @@
> */
> #include <linux/clk.h>
> #include <linux/init.h>
> +#include <linux/mod_devicetable.h>
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/i2c.h>
> @@ -2013,18 +2014,16 @@ static const struct i2c_device_id ov7670_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, ov7670_id);
>
> -#if IS_ENABLED(CONFIG_OF)
> static const struct of_device_id ov7670_of_match[] = {
> { .compatible = "ovti,ov7670", &ov7670_devdata },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, ov7670_of_match);
> -#endif
>
> static struct i2c_driver ov7670_driver = {
> .driver = {
> .name = "ov7670",
> - .of_match_table = of_match_ptr(ov7670_of_match),
> + .of_match_table = ov7670_of_match,
While at it, but possibily separate from this patch, all the
#if defined(CONFIG_MEDIA_CONTROLLER)
entries could be removed as well, as since commit 7d3c7d2a2914
("media: i2c: Add a camera sensor top level menu") the
MEDIA_CONTROLLER symbol is selected by the top-level menu.
Let me know if you intended to send a patch or should I.
For this one:
Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
Thanks
j
> },
> .probe = ov7670_probe,
> .remove = ov7670_remove,
> --
> 2.25.1
>
Hi Jacopo Mondi,
Thanks for the feedback.
> Subject: Re: [PATCH 2/2] media: i2c: ov7670: Drop CONFIG_OF ifdeffery
>
> Hi Biju
>
> On Sun, Sep 10, 2023 at 04:00:33PM +0100, Biju Das wrote:
> > Drop of_match_ptr() from ov7670_driver and get rid of ugly CONFIG_OF
> > if check. This slightly increases the size of ov7670_driver on non-OF
> > system and shouldn't be an issue.
> >
> > Add mod_devicetable.h include.
> >
> > It also allows, in case if needed, to enumerate this device via ACPI
> > with
> > PRP0001 magic.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > drivers/media/i2c/ov7670.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
> > index 644457e6993d..41032394a464 100644
> > --- a/drivers/media/i2c/ov7670.c
> > +++ b/drivers/media/i2c/ov7670.c
> > @@ -10,6 +10,7 @@
> > */
> > #include <linux/clk.h>
> > #include <linux/init.h>
> > +#include <linux/mod_devicetable.h>
> > #include <linux/module.h>
> > #include <linux/slab.h>
> > #include <linux/i2c.h>
> > @@ -2013,18 +2014,16 @@ static const struct i2c_device_id ov7670_id[]
> > = { }; MODULE_DEVICE_TABLE(i2c, ov7670_id);
> >
> > -#if IS_ENABLED(CONFIG_OF)
> > static const struct of_device_id ov7670_of_match[] = {
> > { .compatible = "ovti,ov7670", &ov7670_devdata },
> > { /* sentinel */ }
> > };
> > MODULE_DEVICE_TABLE(of, ov7670_of_match); -#endif
> >
> > static struct i2c_driver ov7670_driver = {
> > .driver = {
> > .name = "ov7670",
> > - .of_match_table = of_match_ptr(ov7670_of_match),
> > + .of_match_table = ov7670_of_match,
>
> While at it, but possibily separate from this patch, all the
>
> #if defined(CONFIG_MEDIA_CONTROLLER)
>
> entries could be removed as well, as since commit 7d3c7d2a2914
> ("media: i2c: Add a camera sensor top level menu") the MEDIA_CONTROLLER
> symbol is selected by the top-level menu.
>
> Let me know if you intended to send a patch or should I.
Please feel free to send a patch to fix CONFIG_MEDIA_CONTROLLER ifdeffery.
Cheers,
Biju
>
> For this one:
> Reviewed-by: Jacopo Mondi <jacopo.mondi+renesas@ideasonboard.com>
>
> Thanks
> j
>
>
>
> > },
> > .probe = ov7670_probe,
> > .remove = ov7670_remove,
> > --
> > 2.25.1
> >
@@ -10,6 +10,7 @@
*/
#include <linux/clk.h>
#include <linux/init.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
@@ -2013,18 +2014,16 @@ static const struct i2c_device_id ov7670_id[] = {
};
MODULE_DEVICE_TABLE(i2c, ov7670_id);
-#if IS_ENABLED(CONFIG_OF)
static const struct of_device_id ov7670_of_match[] = {
{ .compatible = "ovti,ov7670", &ov7670_devdata },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, ov7670_of_match);
-#endif
static struct i2c_driver ov7670_driver = {
.driver = {
.name = "ov7670",
- .of_match_table = of_match_ptr(ov7670_of_match),
+ .of_match_table = ov7670_of_match,
},
.probe = ov7670_probe,
.remove = ov7670_remove,