Signed-off-by: Leonardo Brás <leobra...@gmail.com>
---
 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)
 
 #define fbtft_par_dbg(level, par, format, arg...)            \
 do {                                                         \
-       if (unlikely(par->debug & level))                    \
-               dev_info(par->info->device, format, ##arg);  \
+       typeof(par) _par = (par);                                    \
+       if (unlikely(_par->debug & (level)))                    \
+               dev_info(_par->info->device, format, ##arg);  \
 } while (0)
 
 #define fbtft_par_dbg_hex(level, par, dev, type, buf, num, format, arg...) \
-- 
2.18.0

Reply via email to