diff mbox series

[2/2] media: i2c: mt9v032: Drop CONFIG_OF ifdeffery

Message ID 20230910165432.76378-3-biju.das.jz@bp.renesas.com (mailing list archive)
State New, archived
Headers show
Series Match data improvements for mt9v032 driver | expand

Commit Message

Biju Das Sept. 10, 2023, 4:54 p.m. UTC
Drop of_match_ptr() from mt9v032_driver and get rid of ugly CONFIG_OF
if check. This slightly increases the size of mt9v032_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/mt9v032.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jacopo Mondi Sept. 11, 2023, 9:14 a.m. UTC | #1
Hi Biju

On Sun, Sep 10, 2023 at 05:54:32PM +0100, Biju Das wrote:
> Drop of_match_ptr() from mt9v032_driver and get rid of ugly CONFIG_OF
> if check. This slightly increases the size of mt9v032_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>

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

Thanks
  j

> ---
>  drivers/media/i2c/mt9v032.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
> index 0f448aa27e53..1c6f6cea1204 100644
> --- a/drivers/media/i2c/mt9v032.c
> +++ b/drivers/media/i2c/mt9v032.c
> @@ -14,6 +14,7 @@
>  #include <linux/gpio/consumer.h>
>  #include <linux/i2c.h>
>  #include <linux/log2.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/mutex.h>
>  #include <linux/of.h>
>  #include <linux/of_graph.h>
> @@ -1275,7 +1276,6 @@ static const struct i2c_device_id mt9v032_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, mt9v032_id);
>
> -#if IS_ENABLED(CONFIG_OF)
>  static const struct of_device_id mt9v032_of_match[] = {
>  	{ .compatible = "aptina,mt9v022", .data = &mt9v032_models[MT9V032_MODEL_V022_COLOR] },
>  	{ .compatible = "aptina,mt9v022m", .data = &mt9v032_models[MT9V032_MODEL_V022_MONO] },
> @@ -1288,12 +1288,11 @@ static const struct of_device_id mt9v032_of_match[] = {
>  	{ /* Sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, mt9v032_of_match);
> -#endif
>
>  static struct i2c_driver mt9v032_driver = {
>  	.driver = {
>  		.name = "mt9v032",
> -		.of_match_table = of_match_ptr(mt9v032_of_match),
> +		.of_match_table = mt9v032_of_match,
>  	},
>  	.probe		= mt9v032_probe,
>  	.remove		= mt9v032_remove,
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 0f448aa27e53..1c6f6cea1204 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -14,6 +14,7 @@ 
 #include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/log2.h>
+#include <linux/mod_devicetable.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
@@ -1275,7 +1276,6 @@  static const struct i2c_device_id mt9v032_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mt9v032_id);
 
-#if IS_ENABLED(CONFIG_OF)
 static const struct of_device_id mt9v032_of_match[] = {
 	{ .compatible = "aptina,mt9v022", .data = &mt9v032_models[MT9V032_MODEL_V022_COLOR] },
 	{ .compatible = "aptina,mt9v022m", .data = &mt9v032_models[MT9V032_MODEL_V022_MONO] },
@@ -1288,12 +1288,11 @@  static const struct of_device_id mt9v032_of_match[] = {
 	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mt9v032_of_match);
-#endif
 
 static struct i2c_driver mt9v032_driver = {
 	.driver = {
 		.name = "mt9v032",
-		.of_match_table = of_match_ptr(mt9v032_of_match),
+		.of_match_table = mt9v032_of_match,
 	},
 	.probe		= mt9v032_probe,
 	.remove		= mt9v032_remove,