From: Takashi Iwai <tiwai@suse.de>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: emu10k1: macro-ize snd_emu10k1_ptr_{read,write}()
Date: Mon, 08 May 2023 09:14:01 +0200 [thread overview]
Message-ID: <878rdzfg7a.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230428095941.1706263-1-oswald.buddenhagen@gmx.de>
On Fri, 28 Apr 2023 11:59:41 +0200,
Oswald Buddenhagen wrote:
> +#define snd_emu10k1_ptr_read(emu, reg, voice) \
> + ({ \
> + u32 data = snd_emu10k1_ptr_read_raw(emu, REG_ADDR(reg, voice)); \
> + if (REG_SIZE(reg)) \
> + data = REG_VAL_GET(reg, data); \
> + data; \
> + })
> +#define snd_emu10k1_ptr_write(emu, reg, voice, data) \
> + do { \
> + if (REG_SIZE(reg)) \
> + snd_emu10k1_ptr_modify(emu, REG_ADDR(reg, voice), \
> + ~REG_MASK(reg), REG_VAL_PUT(reg, data)); \
> + else \
> + snd_emu10k1_ptr_write_raw(emu, REG_ADDR(reg, voice), data); \
> + } while (0)
Must those be macros? Not only that macro isn't really safe to use
for obvious reasons, the expansion would cost significantly as they
are called in many places.
> --- a/sound/pci/emu10k1/io.c
> +++ b/sound/pci/emu10k1/io.c
> @@ -18,72 +18,64 @@
> #include <linux/export.h>
> #include "p17v.h"
>
> -unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn)
> +static inline int check_ptr_reg(struct snd_emu10k1 *emu, u32 reg)
Should be bool.
thanks,
Takashi
next prev parent reply other threads:[~2023-05-08 7:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-28 9:59 [PATCH] ALSA: emu10k1: macro-ize snd_emu10k1_ptr_{read,write}() Oswald Buddenhagen
2023-04-28 10:32 ` Takashi Iwai
2023-05-08 7:14 ` Takashi Iwai [this message]
2023-05-08 11:14 ` Oswald Buddenhagen
2023-05-08 11:40 ` Takashi Iwai
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=878rdzfg7a.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=oswald.buddenhagen@gmx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.