Commit 86b27237 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: Make snd_printd() and snd_printdd() inline



Because currently snd_printd() and snd_printdd() macros are expanded
to empty when CONFIG_SND_DEBUG=n, a compile warning like below
appears sometimes, and we had to covert it by ugly ifdefs:
  sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
  sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]

For "fixing" these issues better, this patch replaces snd_printd() and
snd_printdd() definitions with empty inline functions instead of
macros.  This should have the same effect but shut up warnings like
above.

But since we had already put ifdefs, changing to inline functions
would trigger compile errors.  So, such ifdefs is removed in this
patch.

In addition, snd_pci_quirk name field is defined only when
CONFIG_SND_DEBUG_VERBOSE is set, and the reference to it in
snd_printdd() argument triggers the build errors, too.  For avoiding
these errors, introduce a new macro snd_pci_quirk_name() that is
defined no matter how the debug option is set.

Reported-by: default avatarStratos Karafotis <stratosk@semaphore.gr>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f4f678d2
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -394,8 +394,11 @@ void __snd_printk(unsigned int level, const char *file, int line,

#else /* !CONFIG_SND_DEBUG */

#define snd_printd(fmt, args...)	do { } while (0)
#define _snd_printd(level, fmt, args...) do { } while (0)
__printf(1, 2)
static inline void snd_printd(const char *format, ...) {}
__printf(2, 3)
static inline void _snd_printd(int level, const char *format, ...) {}

#define snd_BUG()			do { } while (0)
static inline int __snd_bug_on(int cond)
{
@@ -416,7 +419,8 @@ static inline int __snd_bug_on(int cond)
#define snd_printdd(format, args...) \
	__snd_printk(2, __FILE__, __LINE__, format, ##args)
#else
#define snd_printdd(format, args...)	do { } while (0)
__printf(1, 2)
static inline void snd_printdd(const char *format, ...) {}
#endif


@@ -454,6 +458,7 @@ struct snd_pci_quirk {
#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val)			\
	{_SND_PCI_QUIRK_ID_MASK(vend, mask, dev),			\
			.value = (val), .name = (xname)}
#define snd_pci_quirk_name(q)	((q)->name)
#else
#define SND_PCI_QUIRK(vend,dev,xname,val) \
	{_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
@@ -461,6 +466,7 @@ struct snd_pci_quirk {
	{_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
#define SND_PCI_QUIRK_VENDOR(vend, xname, val)			\
	{_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
#define snd_pci_quirk_name(q)	""
#endif

const struct snd_pci_quirk *
+1 −2
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ MODULE_LICENSE("GPL");
int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int time)
{
	unsigned long end_time = jiffies + (time * HZ + 999) / 1000;
#ifdef CONFIG_SND_DEBUG
	static char *reg_names[VX_REG_MAX] = {
		"ICR", "CVR", "ISR", "IVR", "RXH", "RXM", "RXL",
		"DMA", "CDSP", "RFREQ", "RUER/V2", "DATA", "MEMIRQ",
@@ -60,7 +59,7 @@ int snd_vx_check_reg_bit(struct vx_core *chip, int reg, int mask, int bit, int t
		"MIC3", "INTCSR", "CNTRL", "GPIOC",
		"LOFREQ", "HIFREQ", "CSUER", "RUER"
	};
#endif

	do {
		if ((snd_vx_inb(chip, reg) & mask) == bit)
			return 0;
+3 −2
Original line number Diff line number Diff line
@@ -567,8 +567,9 @@ static int ac97_probing_bugs(struct pci_dev *pci)

	q = snd_pci_quirk_lookup(pci, atiixp_quirks);
	if (q) {
		snd_printdd(KERN_INFO "Atiixp quirk for %s.  "
			    "Forcing codec %d\n", q->name, q->value);
		snd_printdd(KERN_INFO
			    "Atiixp quirk for %s.  Forcing codec %d\n",
			    snd_pci_quirk_name(q), q->value);
		return q->value;
	}
	/* this hardware doesn't need workarounds.  Probe for codec */
+0 −2
Original line number Diff line number Diff line
@@ -698,9 +698,7 @@ static void set_pin_targets(struct hda_codec *codec,

static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
{
#ifdef CONFIG_SND_DEBUG_VERBOSE
	const char *modelname = codec->fixup_name;
#endif

	while (id >= 0) {
		const struct hda_fixup *fix = codec->fixup_list + id;
+0 −2
Original line number Diff line number Diff line
@@ -1579,9 +1579,7 @@ static void debug_show_configs(struct hda_codec *codec,
			       struct auto_pin_cfg *cfg)
{
	struct hda_gen_spec *spec = codec->spec;
#ifdef CONFIG_SND_DEBUG_VERBOSE
	static const char * const lo_type[3] = { "LO", "SP", "HP" };
#endif
	int i;

	debug_badness("multi_outs = %x/%x/%x/%x : %x/%x/%x/%x (type %s)\n",
Loading