public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix sparse warnings for I2C_BOARD_INFO()
@ 2009-04-08 16:57 Ben Hutchings
  2009-04-08 18:12 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2009-04-08 16:57 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Since the first argument to I2C_BOARD_INFO() must be a string constant,
there is no need to parenthesise it, and adding parentheses results in
an invalid initialiser for char[].  gcc obviously accepts this syntax as
an extension, but sparse complains, e.g.:

drivers/net/sfc/boards.c:173:2: warning: array initialized from parenthesized string constant

Therefore, remove the parentheses.

Signed-off-by: Ben Hutchings <bhutchings-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org>
---
 i2c.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index c86c3b0..f352a0a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -274,7 +274,7 @@ struct i2c_board_info {
  * are provided using conventional syntax.
  */
 #define I2C_BOARD_INFO(dev_type, dev_addr) \
-	.type = (dev_type), .addr = (dev_addr)
+	.type = dev_type, .addr = (dev_addr)
 
 
 /* Add-on boards should register/unregister their devices; e.g. a board

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

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

* Re: [PATCH] Fix sparse warnings for I2C_BOARD_INFO()
  2009-04-08 16:57 [PATCH] Fix sparse warnings for I2C_BOARD_INFO() Ben Hutchings
@ 2009-04-08 18:12 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2009-04-08 18:12 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi Ben,

On Wed, 08 Apr 2009 17:57:33 +0100, Ben Hutchings wrote:
> Since the first argument to I2C_BOARD_INFO() must be a string constant,
> there is no need to parenthesise it, and adding parentheses results in
> an invalid initialiser for char[].  gcc obviously accepts this syntax as
> an extension, but sparse complains, e.g.:
> 
> drivers/net/sfc/boards.c:173:2: warning: array initialized from parenthesized string constant
> 
> Therefore, remove the parentheses.
> 
> Signed-off-by: Ben Hutchings <bhutchings-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org>
> ---
>  i2c.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> ---
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index c86c3b0..f352a0a 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -274,7 +274,7 @@ struct i2c_board_info {
>   * are provided using conventional syntax.
>   */
>  #define I2C_BOARD_INFO(dev_type, dev_addr) \
> -	.type = (dev_type), .addr = (dev_addr)
> +	.type = dev_type, .addr = (dev_addr)
>  
>  
>  /* Add-on boards should register/unregister their devices; e.g. a board
> 

Good catch! Applied, thanks.

-- 
Jean Delvare

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

end of thread, other threads:[~2009-04-08 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 16:57 [PATCH] Fix sparse warnings for I2C_BOARD_INFO() Ben Hutchings
2009-04-08 18:12 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox