linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: ti-vpe: avoid gcc-9 warning
@ 2020-04-28 21:34 Arnd Bergmann
  2020-04-28 22:53 ` Benoit Parrot
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2020-04-28 21:34 UTC (permalink / raw)
  To: Benoit Parrot, Mauro Carvalho Chehab, Hans Verkuil
  Cc: Arnd Bergmann, Mauro Carvalho Chehab, Hans Verkuil,
	Tomi Valkeinen, Laurent Pinchart, linux-media, linux-kernel

gcc warns about empty array declarations, which we get in this driver
when compile-testing without CONFIG_OF:

drivers/media/platform/ti-vpe/cal.c:2194:34: warning: array 'cal_of_match' assumed to have one element
 2194 | static const struct of_device_id cal_of_match[];

Since all users of this driver do need CONFIG_OF anyway, there is no
point in making the array definition conditional to save space, so
just remove the #ifdef and move the array up a little.

Fixes: 343e89a792a5 ("[media] media: ti-vpe: Add CAL v4l2 camera capture driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/platform/ti-vpe/cal.c | 46 +++++++++++++----------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
index 49204872e711..9b18db7af6c3 100644
--- a/drivers/media/platform/ti-vpe/cal.c
+++ b/drivers/media/platform/ti-vpe/cal.c
@@ -2237,7 +2237,26 @@ static struct cal_ctx *cal_create_instance(struct cal_dev *dev, int inst)
 	return NULL;
 }
 
-static const struct of_device_id cal_of_match[];
+static const struct of_device_id cal_of_match[] = {
+	{
+		.compatible = "ti,dra72-cal",
+		.data = (void *)&dra72x_cal_data,
+	},
+	{
+		.compatible = "ti,dra72-pre-es2-cal",
+		.data = (void *)&dra72x_es1_cal_data,
+	},
+	{
+		.compatible = "ti,dra76-cal",
+		.data = (void *)&dra76x_cal_data,
+	},
+	{
+		.compatible = "ti,am654-cal",
+		.data = (void *)&am654_cal_data,
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, cal_of_match);
 
 static int cal_probe(struct platform_device *pdev)
 {
@@ -2413,29 +2432,6 @@ static int cal_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#if defined(CONFIG_OF)
-static const struct of_device_id cal_of_match[] = {
-	{
-		.compatible = "ti,dra72-cal",
-		.data = (void *)&dra72x_cal_data,
-	},
-	{
-		.compatible = "ti,dra72-pre-es2-cal",
-		.data = (void *)&dra72x_es1_cal_data,
-	},
-	{
-		.compatible = "ti,dra76-cal",
-		.data = (void *)&dra76x_cal_data,
-	},
-	{
-		.compatible = "ti,am654-cal",
-		.data = (void *)&am654_cal_data,
-	},
-	{},
-};
-MODULE_DEVICE_TABLE(of, cal_of_match);
-#endif
-
 static int cal_runtime_resume(struct device *dev)
 {
 	struct cal_dev *caldev = dev_get_drvdata(dev);
@@ -2462,7 +2458,7 @@ static struct platform_driver cal_pdrv = {
 	.driver		= {
 		.name	= CAL_MODULE_NAME,
 		.pm	= &cal_pm_ops,
-		.of_match_table = of_match_ptr(cal_of_match),
+		.of_match_table = cal_of_match,
 	},
 };
 
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: ti-vpe: avoid gcc-9 warning
  2020-04-28 21:34 [PATCH] media: ti-vpe: avoid gcc-9 warning Arnd Bergmann
@ 2020-04-28 22:53 ` Benoit Parrot
  0 siblings, 0 replies; 2+ messages in thread
From: Benoit Parrot @ 2020-04-28 22:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mauro Carvalho Chehab, Hans Verkuil, Mauro Carvalho Chehab,
	Hans Verkuil, Tomi Valkeinen, Laurent Pinchart, linux-media,
	linux-kernel

Reviewed-by: Benoit Parrot <bparrot@ti.com>

Arnd Bergmann <arnd@arndb.de> wrote on Tue [2020-Apr-28 23:34:19 +0200]:
> gcc warns about empty array declarations, which we get in this driver
> when compile-testing without CONFIG_OF:
> 
> drivers/media/platform/ti-vpe/cal.c:2194:34: warning: array 'cal_of_match' assumed to have one element
>  2194 | static const struct of_device_id cal_of_match[];
> 
> Since all users of this driver do need CONFIG_OF anyway, there is no
> point in making the array definition conditional to save space, so
> just remove the #ifdef and move the array up a little.
> 
> Fixes: 343e89a792a5 ("[media] media: ti-vpe: Add CAL v4l2 camera capture driver")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/media/platform/ti-vpe/cal.c | 46 +++++++++++++----------------
>  1 file changed, 21 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
> index 49204872e711..9b18db7af6c3 100644
> --- a/drivers/media/platform/ti-vpe/cal.c
> +++ b/drivers/media/platform/ti-vpe/cal.c
> @@ -2237,7 +2237,26 @@ static struct cal_ctx *cal_create_instance(struct cal_dev *dev, int inst)
>  	return NULL;
>  }
>  
> -static const struct of_device_id cal_of_match[];
> +static const struct of_device_id cal_of_match[] = {
> +	{
> +		.compatible = "ti,dra72-cal",
> +		.data = (void *)&dra72x_cal_data,
> +	},
> +	{
> +		.compatible = "ti,dra72-pre-es2-cal",
> +		.data = (void *)&dra72x_es1_cal_data,
> +	},
> +	{
> +		.compatible = "ti,dra76-cal",
> +		.data = (void *)&dra76x_cal_data,
> +	},
> +	{
> +		.compatible = "ti,am654-cal",
> +		.data = (void *)&am654_cal_data,
> +	},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, cal_of_match);
>  
>  static int cal_probe(struct platform_device *pdev)
>  {
> @@ -2413,29 +2432,6 @@ static int cal_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#if defined(CONFIG_OF)
> -static const struct of_device_id cal_of_match[] = {
> -	{
> -		.compatible = "ti,dra72-cal",
> -		.data = (void *)&dra72x_cal_data,
> -	},
> -	{
> -		.compatible = "ti,dra72-pre-es2-cal",
> -		.data = (void *)&dra72x_es1_cal_data,
> -	},
> -	{
> -		.compatible = "ti,dra76-cal",
> -		.data = (void *)&dra76x_cal_data,
> -	},
> -	{
> -		.compatible = "ti,am654-cal",
> -		.data = (void *)&am654_cal_data,
> -	},
> -	{},
> -};
> -MODULE_DEVICE_TABLE(of, cal_of_match);
> -#endif
> -
>  static int cal_runtime_resume(struct device *dev)
>  {
>  	struct cal_dev *caldev = dev_get_drvdata(dev);
> @@ -2462,7 +2458,7 @@ static struct platform_driver cal_pdrv = {
>  	.driver		= {
>  		.name	= CAL_MODULE_NAME,
>  		.pm	= &cal_pm_ops,
> -		.of_match_table = of_match_ptr(cal_of_match),
> +		.of_match_table = cal_of_match,
>  	},
>  };
>  
> -- 
> 2.26.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-28 22:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28 21:34 [PATCH] media: ti-vpe: avoid gcc-9 warning Arnd Bergmann
2020-04-28 22:53 ` Benoit Parrot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).