diff mbox

[v2] Remove macros IO_READ_PROTO and IO_WRITE_PROTO

Message ID 1444235574-15351-1-git-send-email-nutanshinde1992@gmail.com
State New
Headers show

Commit Message

nutanshinde1992 Oct. 7, 2015, 4:32 p.m. UTC
Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
---
 hw/audio/adlib.c  |  9 ++-------
 hw/audio/es1370.c | 17 ++++++-----------
 hw/audio/gus.c    |  9 ++-------
 hw/audio/sb16.c   | 15 +++++----------
 4 files changed, 15 insertions(+), 35 deletions(-)

Comments

Markus Armbruster Oct. 7, 2015, 7:34 p.m. UTC | #1
Copying maintainer.  Please use scripts/get_maintainer.pl to find them
yourself.

Nutan Shinde <nutanshinde1992@gmail.com> writes:

> Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
> ---
>  hw/audio/adlib.c  |  9 ++-------
>  hw/audio/es1370.c | 17 ++++++-----------
>  hw/audio/gus.c    |  9 ++-------
>  hw/audio/sb16.c   | 15 +++++----------
>  4 files changed, 15 insertions(+), 35 deletions(-)
>
> diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
> index 656eb37..334935f 100644
> --- a/hw/audio/adlib.c
> +++ b/hw/audio/adlib.c
> @@ -57,11 +57,6 @@ void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
>  #define SHIFT 1
>  #endif
>  
> -#define IO_READ_PROTO(name) \
> -    uint32_t name (void *opaque, uint32_t nport)
> -#define IO_WRITE_PROTO(name) \
> -    void name (void *opaque, uint32_t nport, uint32_t val)
> -
>  #define TYPE_ADLIB "adlib"
>  #define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
>  
> @@ -124,7 +119,7 @@ static void adlib_kill_timers (AdlibState *s)
>      }
>  }
>  
> -static IO_WRITE_PROTO (adlib_write)
> +static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
>  {
>      AdlibState *s = opaque;
>      int a = nport & 3;
> @@ -141,7 +136,7 @@ static IO_WRITE_PROTO (adlib_write)
>  #endif
>  }
>  
> -static IO_READ_PROTO (adlib_read)
> +static uint32_t adlib_read(void *opaque, uint32_t nport)
>  {
>      AdlibState *s = opaque;
>      uint8_t data;
> diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
> index 8e7bcf5..592578b 100644
> --- a/hw/audio/es1370.c
> +++ b/hw/audio/es1370.c
> @@ -157,11 +157,6 @@ static const unsigned dac1_samplerate[] = { 5512, 11025, 22050, 44100 };
>  #define DAC2_CHANNEL 1
>  #define ADC_CHANNEL 2
>  
> -#define IO_READ_PROTO(n) \
> -static uint32_t n (void *opaque, uint32_t addr)
> -#define IO_WRITE_PROTO(n) \
> -static void n (void *opaque, uint32_t addr, uint32_t val)
> -
>  static void es1370_dac1_callback (void *opaque, int free);
>  static void es1370_dac2_callback (void *opaque, int free);
>  static void es1370_adc_callback (void *opaque, int avail);
> @@ -474,7 +469,7 @@ static inline uint32_t es1370_fixup (ES1370State *s, uint32_t addr)
>      return addr;
>  }
>  
> -IO_WRITE_PROTO (es1370_writeb)
> +static void es1370_writeb(void *opaque, uint32_t addr, uint32_t val)
>  {
>      ES1370State *s = opaque;
>      uint32_t shift, mask;
> @@ -512,7 +507,7 @@ IO_WRITE_PROTO (es1370_writeb)
>      }
>  }
>  
> -IO_WRITE_PROTO (es1370_writew)
> +static void es1370_writew(void *opaque, uint32_t addr, uint32_t val)
>  {
>      ES1370State *s = opaque;
>      addr = es1370_fixup (s, addr);
> @@ -549,7 +544,7 @@ IO_WRITE_PROTO (es1370_writew)
>      }
>  }
>  
> -IO_WRITE_PROTO (es1370_writel)
> +static void es1370_writel(void *opaque, uint32_t addr, uint32_t val)
>  {
>      ES1370State *s = opaque;
>      struct chan *d = &s->chan[0];
> @@ -615,7 +610,7 @@ IO_WRITE_PROTO (es1370_writel)
>      }
>  }
>  
> -IO_READ_PROTO (es1370_readb)
> +static uint32_t es1370_readb(void *opaque, uint32_t addr)
>  {
>      ES1370State *s = opaque;
>      uint32_t val;
> @@ -650,7 +645,7 @@ IO_READ_PROTO (es1370_readb)
>      return val;
>  }
>  
> -IO_READ_PROTO (es1370_readw)
> +static uint32_t es1370_readw(void *opaque, uint32_t addr)
>  {
>      ES1370State *s = opaque;
>      struct chan *d = &s->chan[0];
> @@ -692,7 +687,7 @@ IO_READ_PROTO (es1370_readw)
>      return val;
>  }
>  
> -IO_READ_PROTO (es1370_readl)
> +static uint32_t es1370_readl(void *opaque, uint32_t addr)
>  {
>      ES1370State *s = opaque;
>      uint32_t val;
> diff --git a/hw/audio/gus.c b/hw/audio/gus.c
> index 86223a9..e0c8a4e 100644
> --- a/hw/audio/gus.c
> +++ b/hw/audio/gus.c
> @@ -41,11 +41,6 @@
>  #define GUS_ENDIANNESS 0
>  #endif
>  
> -#define IO_READ_PROTO(name) \
> -    static uint32_t name (void *opaque, uint32_t nport)
> -#define IO_WRITE_PROTO(name) \
> -    static void name (void *opaque, uint32_t nport, uint32_t val)
> -
>  #define TYPE_GUS "gus"
>  #define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS)
>  
> @@ -64,14 +59,14 @@ typedef struct GUSState {
>      qemu_irq pic;
>  } GUSState;
>  
> -IO_READ_PROTO (gus_readb)
> +static uint32_t gus_readb(void *opaque, uint32_t nport)
>  {
>      GUSState *s = opaque;
>  
>      return gus_read (&s->emu, nport, 1);
>  }
>  
> -IO_WRITE_PROTO (gus_writeb)
> +static void gus_writeb(void *opaque, uint32_t nport, uint32_t val)
>  {
>      GUSState *s = opaque;
>  
> diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
> index b052de5..995435f 100644
> --- a/hw/audio/sb16.c
> +++ b/hw/audio/sb16.c
> @@ -40,11 +40,6 @@
>  #define ldebug(...)
>  #endif
>  
> -#define IO_READ_PROTO(name)                             \
> -    uint32_t name (void *opaque, uint32_t nport)
> -#define IO_WRITE_PROTO(name)                                    \
> -    void name (void *opaque, uint32_t nport, uint32_t val)
> -
>  static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
>  
>  #define TYPE_SB16 "sb16"
> @@ -881,7 +876,7 @@ static void reset (SB16State *s)
>      legacy_reset (s);
>  }
>  
> -static IO_WRITE_PROTO (dsp_write)
> +static void dsp_write(void *opaque, uint32_t nport, uint32_t val)
>  {
>      SB16State *s = opaque;
>      int iport;
> @@ -959,7 +954,7 @@ static IO_WRITE_PROTO (dsp_write)
>      }
>  }
>  
> -static IO_READ_PROTO (dsp_read)
> +static uint32_t dsp_read(void *opaque, uint32_t nport)
>  {
>      SB16State *s = opaque;
>      int iport, retval, ack = 0;
> @@ -1058,14 +1053,14 @@ static void reset_mixer (SB16State *s)
>      }
>  }
>  
> -static IO_WRITE_PROTO (mixer_write_indexb)
> +static void mixer_write_indexb(void *opaque, uint32_t nport, uint32_t val)
>  {
>      SB16State *s = opaque;
>      (void) nport;
>      s->mixer_nreg = val;
>  }
>  
> -static IO_WRITE_PROTO (mixer_write_datab)
> +static void mixer_write_datab(void *opaque, uint32_t nport, uint32_t val)
>  {
>      SB16State *s = opaque;
>  
> @@ -1121,7 +1116,7 @@ static IO_WRITE_PROTO (mixer_write_datab)
>      s->mixer_regs[s->mixer_nreg] = val;
>  }
>  
> -static IO_READ_PROTO (mixer_read)
> +static uint32_t mixer_read(void *opaque, uint32_t nport)
>  {
>      SB16State *s = opaque;
Peter Maydell Oct. 7, 2015, 11:14 p.m. UTC | #2
On 7 October 2015 at 17:32, Nutan Shinde <nutanshinde1992@gmail.com> wrote:
> Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
> ---
>  hw/audio/adlib.c  |  9 ++-------
>  hw/audio/es1370.c | 17 ++++++-----------
>  hw/audio/gus.c    |  9 ++-------
>  hw/audio/sb16.c   | 15 +++++----------
>  4 files changed, 15 insertions(+), 35 deletions(-)
>

Thanks! This version looks good to me.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Hopefully Gerd will include it via the audio tree.

-- PMM
Stefan Hajnoczi Oct. 8, 2015, 9:52 a.m. UTC | #3
On Wed, Oct 07, 2015 at 10:02:54PM +0530, Nutan Shinde wrote:
> Signed-off-by: Nutan Shinde <nutanshinde1992@gmail.com>
> ---
>  hw/audio/adlib.c  |  9 ++-------
>  hw/audio/es1370.c | 17 ++++++-----------
>  hw/audio/gus.c    |  9 ++-------
>  hw/audio/sb16.c   | 15 +++++----------
>  4 files changed, 15 insertions(+), 35 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Gerd Hoffmann Oct. 9, 2015, 9:15 a.m. UTC | #4
On Mi, 2015-10-07 at 21:34 +0200, Markus Armbruster wrote:
> Copying maintainer.  Please use scripts/get_maintainer.pl to find them
> yourself.

Thanks, picked up now.  Including the subsystem in the subject (i.e.
"audio: remove macros ...") is useful too.

cheers,
  Gerd
diff mbox

Patch

diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 656eb37..334935f 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -57,11 +57,6 @@  void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
 #define SHIFT 1
 #endif
 
-#define IO_READ_PROTO(name) \
-    uint32_t name (void *opaque, uint32_t nport)
-#define IO_WRITE_PROTO(name) \
-    void name (void *opaque, uint32_t nport, uint32_t val)
-
 #define TYPE_ADLIB "adlib"
 #define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
 
@@ -124,7 +119,7 @@  static void adlib_kill_timers (AdlibState *s)
     }
 }
 
-static IO_WRITE_PROTO (adlib_write)
+static void adlib_write(void *opaque, uint32_t nport, uint32_t val)
 {
     AdlibState *s = opaque;
     int a = nport & 3;
@@ -141,7 +136,7 @@  static IO_WRITE_PROTO (adlib_write)
 #endif
 }
 
-static IO_READ_PROTO (adlib_read)
+static uint32_t adlib_read(void *opaque, uint32_t nport)
 {
     AdlibState *s = opaque;
     uint8_t data;
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index 8e7bcf5..592578b 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -157,11 +157,6 @@  static const unsigned dac1_samplerate[] = { 5512, 11025, 22050, 44100 };
 #define DAC2_CHANNEL 1
 #define ADC_CHANNEL 2
 
-#define IO_READ_PROTO(n) \
-static uint32_t n (void *opaque, uint32_t addr)
-#define IO_WRITE_PROTO(n) \
-static void n (void *opaque, uint32_t addr, uint32_t val)
-
 static void es1370_dac1_callback (void *opaque, int free);
 static void es1370_dac2_callback (void *opaque, int free);
 static void es1370_adc_callback (void *opaque, int avail);
@@ -474,7 +469,7 @@  static inline uint32_t es1370_fixup (ES1370State *s, uint32_t addr)
     return addr;
 }
 
-IO_WRITE_PROTO (es1370_writeb)
+static void es1370_writeb(void *opaque, uint32_t addr, uint32_t val)
 {
     ES1370State *s = opaque;
     uint32_t shift, mask;
@@ -512,7 +507,7 @@  IO_WRITE_PROTO (es1370_writeb)
     }
 }
 
-IO_WRITE_PROTO (es1370_writew)
+static void es1370_writew(void *opaque, uint32_t addr, uint32_t val)
 {
     ES1370State *s = opaque;
     addr = es1370_fixup (s, addr);
@@ -549,7 +544,7 @@  IO_WRITE_PROTO (es1370_writew)
     }
 }
 
-IO_WRITE_PROTO (es1370_writel)
+static void es1370_writel(void *opaque, uint32_t addr, uint32_t val)
 {
     ES1370State *s = opaque;
     struct chan *d = &s->chan[0];
@@ -615,7 +610,7 @@  IO_WRITE_PROTO (es1370_writel)
     }
 }
 
-IO_READ_PROTO (es1370_readb)
+static uint32_t es1370_readb(void *opaque, uint32_t addr)
 {
     ES1370State *s = opaque;
     uint32_t val;
@@ -650,7 +645,7 @@  IO_READ_PROTO (es1370_readb)
     return val;
 }
 
-IO_READ_PROTO (es1370_readw)
+static uint32_t es1370_readw(void *opaque, uint32_t addr)
 {
     ES1370State *s = opaque;
     struct chan *d = &s->chan[0];
@@ -692,7 +687,7 @@  IO_READ_PROTO (es1370_readw)
     return val;
 }
 
-IO_READ_PROTO (es1370_readl)
+static uint32_t es1370_readl(void *opaque, uint32_t addr)
 {
     ES1370State *s = opaque;
     uint32_t val;
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 86223a9..e0c8a4e 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -41,11 +41,6 @@ 
 #define GUS_ENDIANNESS 0
 #endif
 
-#define IO_READ_PROTO(name) \
-    static uint32_t name (void *opaque, uint32_t nport)
-#define IO_WRITE_PROTO(name) \
-    static void name (void *opaque, uint32_t nport, uint32_t val)
-
 #define TYPE_GUS "gus"
 #define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS)
 
@@ -64,14 +59,14 @@  typedef struct GUSState {
     qemu_irq pic;
 } GUSState;
 
-IO_READ_PROTO (gus_readb)
+static uint32_t gus_readb(void *opaque, uint32_t nport)
 {
     GUSState *s = opaque;
 
     return gus_read (&s->emu, nport, 1);
 }
 
-IO_WRITE_PROTO (gus_writeb)
+static void gus_writeb(void *opaque, uint32_t nport, uint32_t val)
 {
     GUSState *s = opaque;
 
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index b052de5..995435f 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -40,11 +40,6 @@ 
 #define ldebug(...)
 #endif
 
-#define IO_READ_PROTO(name)                             \
-    uint32_t name (void *opaque, uint32_t nport)
-#define IO_WRITE_PROTO(name)                                    \
-    void name (void *opaque, uint32_t nport, uint32_t val)
-
 static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.";
 
 #define TYPE_SB16 "sb16"
@@ -881,7 +876,7 @@  static void reset (SB16State *s)
     legacy_reset (s);
 }
 
-static IO_WRITE_PROTO (dsp_write)
+static void dsp_write(void *opaque, uint32_t nport, uint32_t val)
 {
     SB16State *s = opaque;
     int iport;
@@ -959,7 +954,7 @@  static IO_WRITE_PROTO (dsp_write)
     }
 }
 
-static IO_READ_PROTO (dsp_read)
+static uint32_t dsp_read(void *opaque, uint32_t nport)
 {
     SB16State *s = opaque;
     int iport, retval, ack = 0;
@@ -1058,14 +1053,14 @@  static void reset_mixer (SB16State *s)
     }
 }
 
-static IO_WRITE_PROTO (mixer_write_indexb)
+static void mixer_write_indexb(void *opaque, uint32_t nport, uint32_t val)
 {
     SB16State *s = opaque;
     (void) nport;
     s->mixer_nreg = val;
 }
 
-static IO_WRITE_PROTO (mixer_write_datab)
+static void mixer_write_datab(void *opaque, uint32_t nport, uint32_t val)
 {
     SB16State *s = opaque;
 
@@ -1121,7 +1116,7 @@  static IO_WRITE_PROTO (mixer_write_datab)
     s->mixer_regs[s->mixer_nreg] = val;
 }
 
-static IO_READ_PROTO (mixer_read)
+static uint32_t mixer_read(void *opaque, uint32_t nport)
 {
     SB16State *s = opaque;