public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Kailang Yang <kailang@realtek.com>, Arnd Bergmann <arnd@arndb.de>,
	Simon Trimmer <simont@opensource.cirrus.com>,
	Joshua Grisham <josh@joshuagrisham.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] snd: hda: realtek: fix incorrect IS_REACHABLE() usage
Date: Tue, 04 Mar 2025 15:43:06 +0100	[thread overview]
Message-ID: <87tt88oo05.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250304142620.582191-1-arnd@kernel.org>

On Tue, 04 Mar 2025 15:25:55 +0100,
Arnd Bergmann wrote:
> 
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The alternative path leads to a build error after a recent change:
> 
> sound/pci/hda/patch_realtek.c: In function 'alc233_fixup_lenovo_low_en_micmute_led':
> include/linux/stddef.h:9:14: error: called object is not a function or function pointer
>     9 | #define NULL ((void *)0)
>       |              ^
> sound/pci/hda/patch_realtek.c:5041:49: note: in expansion of macro 'NULL'
>  5041 | #define alc233_fixup_lenovo_line2_mic_hotkey    NULL
>       |                                                 ^~~~
> sound/pci/hda/patch_realtek.c:5063:9: note: in expansion of macro 'alc233_fixup_lenovo_line2_mic_hotkey'
>  5063 |         alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
> 
> Using IS_REACHABLE() is somewhat questionable here anyway since it
> leads to the input code not working when the HDA driver is builtin
> but input is in a loadable module. Replace this with a hard compile-time
> dependency on CONFIG_INPUT. In practice this won't chance much
> other than solve the compiler error because it is rare to require
> sound output but no input support.
> 
> Fixes: f603b159231b ("ALSA: hda/realtek - add supported Mic Mute LED for Lenovo platform")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks for the patch.  Indeed it's a very corner case, but I still
hesitate to add a kconfig dependency.  Can we take an alternative fix
to define the proper dummy functions like below instead?


Takashi

-- 8< --
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -5038,8 +5038,21 @@ static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
 	}
 }
 #else /* INPUT */
-#define alc280_fixup_hp_gpio2_mic_hotkey	NULL
-#define alc233_fixup_lenovo_line2_mic_hotkey	NULL
+static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
+					     const struct hda_fixup *fix,
+					     int action)
+{
+	if (action == HDA_FIXUP_ACT_PRE_PROBE)
+		codec_info(codec, "Input is disabled, skipping quirk\n");
+}
+
+static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
+						 const struct hda_fixup *fix,
+						 int action)
+{
+	if (action == HDA_FIXUP_ACT_PRE_PROBE)
+		codec_info(codec, "Input is disabled, skipping quirk\n");
+}
 #endif /* INPUT */
 
 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,

  reply	other threads:[~2025-03-04 14:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 14:25 [PATCH] snd: hda: realtek: fix incorrect IS_REACHABLE() usage Arnd Bergmann
2025-03-04 14:43 ` Takashi Iwai [this message]
2025-03-04 14:54   ` Arnd Bergmann
2025-03-04 16:03     ` 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=87tt88oo05.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=josh@joshuagrisham.com \
    --cc=kailang@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=simont@opensource.cirrus.com \
    --cc=tiwai@suse.com \
    /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