Re: [PATCH 11/11] staging: fbtft: Includes parenthesis around macro parameters and avoids multiple usage of macro parameter - Style

From: Dan Carpenter
Date: Tue Aug 07 2018 - 03:46:22 EST


On Tue, Aug 07, 2018 at 01:07:41AM -0300, Leonardo Brás wrote:
> Signed-off-by: Leonardo Brás <leobras.c@xxxxxxxxx>
> ---
> drivers/staging/fbtft/fbtft.h | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> index 41ac00239aa3..eb2bdc4870be 100644
> --- a/drivers/staging/fbtft/fbtft.h
> +++ b/drivers/staging/fbtft/fbtft.h
> @@ -411,17 +411,21 @@ module_exit(fbtft_driver_module_exit)
> #define DEBUG_REQUEST_GPIOS_MATCH BIT(30)
> #define DEBUG_VERIFY_GPIOS BIT(31)
>
> -#define fbtft_init_dbg(dev, format, arg...) \
> -do { \
> - if (unlikely((dev)->platform_data && \
> - (((struct fbtft_platform_data *)(dev)->platform_data)->display.debug & DEBUG_DRIVER_INIT_FUNCTIONS))) \
> - dev_info(dev, format, ##arg); \
> +#define fbtft_init_dbg(dev, format, arg...) \
> +do { \
> + typeof(dev) _dev = (dev); \
> + struct fbtft_platform_data *pddev = (void *)_dev->platform_data;\
> + if (unlikely(pddev && \
> + (pddev->display.debug & \
> + DEBUG_DRIVER_INIT_FUNCTIONS))) \
> + dev_info(_dev, (format), ##arg); \
> } while (0)

We're never going to hit this bug ever... Let's not over engineer
things just for pretend reasons.

Also let's just delete this and replace it with dev_dbg(). You can
turn dev_dbg on for just one function so it already provides everything
we need.

regards,
dan carpenter