qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>, qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/4] wm8750: remove duplicate macro
Date: Thu, 11 Oct 2018 12:39:45 +0200	[thread overview]
Message-ID: <682179e1-f851-8f1b-7ad3-b92b1c3d474b@redhat.com> (raw)
In-Reply-To: <20181011090007.1103-2-maozhongyi@cmss.chinamobile.com>

Hi Mao,

On 11/10/2018 11:00, Mao Zhongyi wrote:
> The header file wm8750.h contains '#define TYPE_WM8750 "wm8750"'
> macro, but '#define CODEC "wm8750"' macro is redefined in wm8750.c,
> just remove the local CODEC macro and replace it with TYPE_WM8750.
> 
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> 
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> ---
>  hw/audio/wm8750.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
> index f4aa838f62..4be3602079 100644
> --- a/hw/audio/wm8750.c
> +++ b/hw/audio/wm8750.c
> @@ -15,8 +15,6 @@
>  #define IN_PORT_N	3
>  #define OUT_PORT_N	3
>  
> -#define CODEC		"wm8750"
> -
>  typedef struct {
>      int adc;
>      int adc_hz;
> @@ -204,11 +202,11 @@ static void wm8750_set_format(WM8750State *s)
>      in_fmt.fmt = AUD_FMT_S16;
>  
>      s->adc_voice[0] = AUD_open_in(&s->card, s->adc_voice[0],
> -                    CODEC ".input1", s, wm8750_audio_in_cb, &in_fmt);
> +                    TYPE_WM8750 ".input1", s, wm8750_audio_in_cb, &in_fmt);

I don't think this is correct. The TYPE_name could change, but the CODEC
shouldn't change. Both definitions are different.

Regards,

Phil.

>      s->adc_voice[1] = AUD_open_in(&s->card, s->adc_voice[1],
> -                    CODEC ".input2", s, wm8750_audio_in_cb, &in_fmt);
> +                    TYPE_WM8750 ".input2", s, wm8750_audio_in_cb, &in_fmt);
>      s->adc_voice[2] = AUD_open_in(&s->card, s->adc_voice[2],
> -                    CODEC ".input3", s, wm8750_audio_in_cb, &in_fmt);
> +                    TYPE_WM8750 ".input3", s, wm8750_audio_in_cb, &in_fmt);
>  
>      /* Setup output */
>      out_fmt.endianness = 0;
> @@ -217,12 +215,12 @@ static void wm8750_set_format(WM8750State *s)
>      out_fmt.fmt = AUD_FMT_S16;
>  
>      s->dac_voice[0] = AUD_open_out(&s->card, s->dac_voice[0],
> -                    CODEC ".speaker", s, wm8750_audio_out_cb, &out_fmt);
> +                    TYPE_WM8750 ".speaker", s, wm8750_audio_out_cb, &out_fmt);
>      s->dac_voice[1] = AUD_open_out(&s->card, s->dac_voice[1],
> -                    CODEC ".headphone", s, wm8750_audio_out_cb, &out_fmt);
> +                    TYPE_WM8750 ".headphone", s, wm8750_audio_out_cb, &out_fmt);
>      /* MONOMIX is also in stereo for simplicity */
>      s->dac_voice[2] = AUD_open_out(&s->card, s->dac_voice[2],
> -                    CODEC ".monomix", s, wm8750_audio_out_cb, &out_fmt);
> +                    TYPE_WM8750 ".monomix", s, wm8750_audio_out_cb, &out_fmt);
>      /* no sense emulating OUT3 which is a mix of other outputs */
>  
>      wm8750_vol_update(s);
> @@ -584,7 +582,7 @@ static int wm8750_post_load(void *opaque, int version_id)
>  }
>  
>  static const VMStateDescription vmstate_wm8750 = {
> -    .name = CODEC,
> +    .name = TYPE_WM8750,
>      .version_id = 0,
>      .minimum_version_id = 0,
>      .pre_save = wm8750_pre_save,
> @@ -621,7 +619,7 @@ static void wm8750_realize(DeviceState *dev, Error **errp)
>  {
>      WM8750State *s = WM8750(dev);
>  
> -    AUD_register_card(CODEC, &s->card);
> +    AUD_register_card(TYPE_WM8750, &s->card);
>      wm8750_reset(I2C_SLAVE(s));
>  }
>  
> 

  reply	other threads:[~2018-10-11 10:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  9:00 [Qemu-devel] [PATCH 0/4] use object link instead of qdev property Mao Zhongyi
2018-10-11  9:00 ` [Qemu-devel] [PATCH 1/4] wm8750: remove duplicate macro Mao Zhongyi
2018-10-11 10:39   ` Philippe Mathieu-Daudé [this message]
2018-10-12  1:09     ` maozy
2018-10-11  9:00 ` [Qemu-devel] [PATCH 2/4] audio: use TYPE_WM8750 instead of a hardcoded string Mao Zhongyi
2018-10-11 10:40   ` Philippe Mathieu-Daudé
2018-10-11  9:00 ` [Qemu-devel] [PATCH 3/4] audio: use object link instead of qdev property to pass wm8750 reference Mao Zhongyi
2018-10-11  9:00 ` [Qemu-devel] [PATCH 4/4] audio: use existing macros istead of hardcoded strings Mao Zhongyi
2018-10-11 10:45   ` Philippe Mathieu-Daudé
2018-10-11 11:05     ` Peter Maydell
2018-10-12  1:16       ` [Qemu-devel] [PATCH 4/4] audio: use existing macros istead ofhardcoded strings maozy
2018-10-17 11:55       ` [Qemu-devel] [PATCH 4/4] audio: use existing macros istead of hardcoded strings Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=682179e1-f851-8f1b-7ad3-b92b1c3d474b@redhat.com \
    --to=philmd@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=maozhongyi@cmss.chinamobile.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).