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


Groups > linux.kernel > #1609771

[PATCH v3] staging: goldfish: Fix style issues in macros

From aviyae <aviyae42@gmail.com>
Newsgroups linux.kernel
Subject [PATCH v3] staging: goldfish: Fix style issues in macros
Date 2017-03-27 14:30 +0200
Message-ID <tpBWy-80f-15@gated-at.bofh.it> (permalink)
References <tpzBo-66r-17@gated-at.bofh.it> <tpBtw-7vp-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Fix coding style issues in macros:
1. Add parenthesis around macro arguments
2. Avoid arguments reuse in macro

Signed-off-by: Aviya Erenfeld <aviyae42@gmail.com>
---
 drivers/staging/goldfish/goldfish_audio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c
index bd55995..f1640ab 100644
--- a/drivers/staging/goldfish/goldfish_audio.c
+++ b/drivers/staging/goldfish/goldfish_audio.c
@@ -61,10 +61,12 @@ struct goldfish_audio {
 #define COMBINED_BUFFER_SIZE    ((2 * READ_BUFFER_SIZE) + \
                                        (2 * WRITE_BUFFER_SIZE))

-#define AUDIO_READ(data, addr)         (readl(data->reg_base + addr))
-#define AUDIO_WRITE(data, addr, x)     (writel(x, data->reg_base + addr))
+#define AUDIO_READ(data, addr)         (readl((data)->reg_base + (addr)))
+#define AUDIO_WRITE(data, addr, x)     (writel(x, (data)->reg_base + (addr)))
 #define AUDIO_WRITE64(data, addr, addr2, x)    \
-       (gf_write_dma_addr((x), data->reg_base + addr, data->reg_base + addr2))
+       ({typeof(data) _data = (data); \
+       gf_write_dma_addr((x), _data->reg_base + (addr), \
+                         _data->reg_base + (addr2)); })

 /*
  *  temporary variable used between goldfish_audio_probe() and
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] staging: goldfish: Fix coding style issues aviyae <aviyae42@gmail.com> - 2017-03-27 12:00 +0200
  Re: [PATCH] staging: goldfish: Fix coding style issues Greg KH <gregkh@linuxfoundation.org> - 2017-03-27 12:10 +0200
  [PATCH v2] staging: goldfish: Fix style issues in macros aviyae <aviyae42@gmail.com> - 2017-03-27 14:00 +0200
    Re: [PATCH v2] staging: goldfish: Fix style issues in macros Frans Klaver <fransklaver@gmail.com> - 2017-03-27 14:10 +0200
      Re: [PATCH v2] staging: goldfish: Fix style issues in macros aviyae <aviyae42@gmail.com> - 2017-03-27 14:30 +0200
        Re: [PATCH v2] staging: goldfish: Fix style issues in macros Frans Klaver <fransklaver@gmail.com> - 2017-03-27 14:30 +0200
    [PATCH v3] staging: goldfish: Fix style issues in macros aviyae <aviyae42@gmail.com> - 2017-03-27 14:30 +0200
      Re: [PATCH v3] staging: goldfish: Fix style issues in macros Greg KH <gregkh@linuxfoundation.org> - 2017-03-29 09:30 +0200
      [PATCH] staging: goldfish: Add parenthesis around macros arguments aviyae <aviyae42@gmail.com> - 2017-03-29 23:20 +0200
        Re: [PATCH] staging: goldfish: Add parenthesis around macros  arguments Greg KH <gregkh@linuxfoundation.org> - 2017-04-08 17:10 +0200
        Re: [PATCH] staging: goldfish: Add parenthesis around macros  arguments Greg KH <gregkh@linuxfoundation.org> - 2017-04-08 17:10 +0200

csiph-web