Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1488694 > unrolled thread

[PATCH] io:pressure: zpa2326: remove redundant "DEBUG" ifdef

Started byArnd Bergmann <arnd@arndb.de>
First post2016-09-22 11:50 +0200
Last post2016-09-22 20:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] io:pressure: zpa2326: remove redundant "DEBUG" ifdef Arnd Bergmann <arnd@arndb.de> - 2016-09-22 11:50 +0200
    Re: [PATCH] io:pressure: zpa2326: remove redundant "DEBUG" ifdef Jonathan Cameron <jic23@kernel.org> - 2016-09-22 20:40 +0200

#1488694 — [PATCH] io:pressure: zpa2326: remove redundant "DEBUG" ifdef

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-22 11:50 +0200
Subject[PATCH] io:pressure: zpa2326: remove redundant "DEBUG" ifdef
Message-ID<sk8NH-4AG-17@gated-at.bofh.it>
The -Wempty-body gcc warning triggers in the newly added zpa2326 driver:

drivers/iio/pressure/zpa2326.c: In function 'zpa2326_dequeue_pressure':
drivers/iio/pressure/zpa2326.c:578:3: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

The use of an empty statement behind 'if (...)' is harmless here, but
it shows that the dev_dbg() macro is not used correctly: when the "DEBUG"
macro is not set, dev_dbg() already defaults to a no-operation, though
one that lets the compiler know that the arguments are used, and lets
it check the format string.

Fixing this also simplifies the driver.

Fixes: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/iio/pressure/zpa2326.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index 19d2eb46fda6..c720c3ac0b9b 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -147,12 +147,8 @@ struct zpa2326_private {
 #define zpa2326_warn(_idev, _format, _arg...) \
 	dev_warn(_idev->dev.parent, _format, ##_arg)
 
-#ifdef DEBUG
 #define zpa2326_dbg(_idev, _format, _arg...) \
 	dev_dbg(_idev->dev.parent, _format, ##_arg)
-#else
-#define zpa2326_dbg(_idev, _format, _arg...)
-#endif
 
 bool zpa2326_isreg_writeable(struct device *dev, unsigned int reg)
 {
-- 
2.9.0

[toc] | [next] | [standalone]


#1489340

FromJonathan Cameron <jic23@kernel.org>
Date2016-09-22 20:40 +0200
Message-ID<skh4C-1rX-63@gated-at.bofh.it>
In reply to#1488694
On 22/09/16 10:42, Arnd Bergmann wrote:
> The -Wempty-body gcc warning triggers in the newly added zpa2326 driver:
> 
> drivers/iio/pressure/zpa2326.c: In function 'zpa2326_dequeue_pressure':
> drivers/iio/pressure/zpa2326.c:578:3: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
> 
> The use of an empty statement behind 'if (...)' is harmless here, but
> it shows that the dev_dbg() macro is not used correctly: when the "DEBUG"
> macro is not set, dev_dbg() already defaults to a no-operation, though
> one that lets the compiler know that the arguments are used, and lets
> it check the format string.
> 
> Fixing this also simplifies the driver.
> 
> Fixes: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixed up patch title with an extra i and applied to the togreg branch of iio.git
initially pushed out as testing for the autobuilders to play with it.

Thanks,

Jonathan
> ---
>  drivers/iio/pressure/zpa2326.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
> index 19d2eb46fda6..c720c3ac0b9b 100644
> --- a/drivers/iio/pressure/zpa2326.c
> +++ b/drivers/iio/pressure/zpa2326.c
> @@ -147,12 +147,8 @@ struct zpa2326_private {
>  #define zpa2326_warn(_idev, _format, _arg...) \
>  	dev_warn(_idev->dev.parent, _format, ##_arg)
>  
> -#ifdef DEBUG
>  #define zpa2326_dbg(_idev, _format, _arg...) \
>  	dev_dbg(_idev->dev.parent, _format, ##_arg)
> -#else
> -#define zpa2326_dbg(_idev, _format, _arg...)
> -#endif
>  
>  bool zpa2326_isreg_writeable(struct device *dev, unsigned int reg)
>  {
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web