Re: [PATCH] ALSA: emu10k1: macro-ize snd_emu10k1_ptr_{read,write}()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux