The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/3] ALSA: hda: Separate codec read status from response
@ 2026-12-03 17:04 Sreeraj S Kurup
  2026-12-03 17:05 ` [PATCH 1/3] ALSA: hda: core: Fix command creation error handling Sreeraj S Kurup
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 17:04 UTC (permalink / raw)
  To: perex, tiwai, lgirdwood, broonie
  Cc: linux-sound, linux-kernel, Sreeraj S Kurup

Hi,

This series improves error handling in the HDA codec command and read
APIs.

Currently, snd_hdac_make_cmd() returns an unsigned int and uses -1 to
indicate an invalid command. Since -1 is converted to 0xffffffff,
which can also represent a valid encoded HDA command, callers cannot
reliably distinguish an error from a valid command.

This series changes snd_hdac_make_cmd() to return an integer status
and provide the encoded command through an output parameter. It also
updates snd_hdac_codec_read() to return an integer status and provide
the codec response through an output parameter.

The affected callers in the HDA core and ASoC HDMI codec driver are
updated to use the new API and handle errors appropriately.

Patch overview:

1. ALSA: hda: core: Fix command creation error handling
2. ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
3. ASoC: codecs: hdac_hdmi: Update codec read API callers

Patches 2 and 3 depend on the API changes introduced in patch 1.

Please let me know if any changes are needed.

Thanks,
Sreeraj

Sreeraj S Kurup (3):
  ALSA: hda: core: Fix command creation error handling
  ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
  ASoC: codecs: hdac_hdmi: Update codec read API callers

 include/sound/hdaudio.h      |  2 +-
 sound/hda/core/device.c      | 69 ++++++++++++++++++++++++----------
 sound/hda/core/hdmi_chmap.c  | 30 ++++++++++++---
 sound/soc/codecs/hdac_hdmi.c | 72 +++++++++++++++++++++++-------------
 4 files changed, 123 insertions(+), 50 deletions(-)

-- 
2.55.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] ALSA: hda: core: Fix command creation error handling
  2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
@ 2026-12-03 17:05 ` Sreeraj S Kurup
  2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 17:05 UTC (permalink / raw)
  To: perex, tiwai, lgirdwood, broonie
  Cc: linux-sound, linux-kernel, Sreeraj S Kurup

snd_hdac_make_cmd() returns -1 when one of the command fields is
out of range. However, its return type is unsigned int, so -1 is
converted to 0xffffffff.

Since 0xffffffff can also be a valid encoded HDA command, callers
cannot reliably distinguish an invalid command from a valid one.

Change snd_hdac_make_cmd() to return an integer status and store
the encoded command through an output parameter. Return -EINVAL
when a command field is out of range and 0 on success.

Update snd_hdac_read(), codec_read() and codec_write() to check
the command creation status before executing the command.

Also change codec_read() and snd_hdac_codec_read() to return an
integer status and provide the codec response through an output
parameter. This separates the response value from the error
status and makes error handling clearer.

Update snd_hdac_sync_power_state() to check the return status
before using the codec response.

This ensures that invalid commands are not passed to
snd_hdac_exec_verb() and that codec responses are handled
separately from errors.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 include/sound/hdaudio.h |  2 +-
 sound/hda/core/device.c | 69 +++++++++++++++++++++++++++++------------
 2 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index 04fd4794bcee..7d9c034efc1b 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -155,7 +155,7 @@ bool snd_hdac_is_supported_format(struct hdac_device *codec, hda_nid_t nid,
 				  unsigned int format);
 
 int snd_hdac_codec_read(struct hdac_device *hdac, hda_nid_t nid,
-			int flags, unsigned int verb, unsigned int parm);
+			int flags, unsigned int verb, unsigned int parm, unsigned int *res);
 int snd_hdac_codec_write(struct hdac_device *hdac, hda_nid_t nid,
 			int flags, unsigned int verb, unsigned int parm);
 bool snd_hdac_check_power_state(struct hdac_device *hdac,
diff --git a/sound/hda/core/device.c b/sound/hda/core/device.c
index 6187ffaedbfa..d43c949af77c 100644
--- a/sound/hda/core/device.c
+++ b/sound/hda/core/device.c
@@ -219,27 +219,34 @@ EXPORT_SYMBOL_GPL(snd_hdac_codec_modalias);
  * @nid: NID to encode
  * @verb: verb to encode
  * @parm: parameter to encode
+ * @cmd: pointer to store the encoded command.
  *
- * Return an encoded command verb or -1 for error.
+ * Return 0 on success, or a negative error code.
+ * The encoded command is stored in @cmd.
  */
-static unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
-				      unsigned int verb, unsigned int parm)
+static int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
+			     unsigned int verb, unsigned int parm,
+			     unsigned int *cmd)
 {
 	u32 val, addr;
 
+	if (!cmd)
+		return -EINVAL;
+
 	addr = codec->addr;
 	if ((addr & ~0xf) || (nid & ~0x7f) ||
 	    (verb & ~0xfff) || (parm & ~0xffff)) {
 		dev_err(&codec->dev, "out of range cmd %x:%x:%x:%x\n",
 			addr, nid, verb, parm);
-		return -1;
+		return -EINVAL;
 	}
 
 	val = addr << 28;
 	val |= (u32)nid << 20;
 	val |= verb << 8;
 	val |= parm;
-	return val;
+	*cmd = val;
+	return 0;
 }
 
 /**
@@ -276,7 +283,12 @@ int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
 int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
 		  unsigned int verb, unsigned int parm, unsigned int *res)
 {
-	unsigned int cmd = snd_hdac_make_cmd(codec, nid, verb, parm);
+	unsigned int cmd;
+	int err;
+
+	err = snd_hdac_make_cmd(codec, nid, verb, parm, &cmd);
+	if (err)
+		return err;
 
 	return snd_hdac_exec_verb(codec, cmd, 0, res);
 }
@@ -1048,22 +1060,30 @@ bool snd_hdac_is_supported_format(struct hdac_device *codec, hda_nid_t nid,
 }
 EXPORT_SYMBOL_GPL(snd_hdac_is_supported_format);
 
-static unsigned int codec_read(struct hdac_device *hdac, hda_nid_t nid,
-			int flags, unsigned int verb, unsigned int parm)
+static int codec_read(struct hdac_device *hdac, hda_nid_t nid,
+			int flags, unsigned int verb, unsigned int parm,
+			unsigned int *res)
 {
-	unsigned int cmd = snd_hdac_make_cmd(hdac, nid, verb, parm);
-	unsigned int res;
+	unsigned int cmd;
+	int err;
 
-	if (snd_hdac_exec_verb(hdac, cmd, flags, &res))
-		return -1;
+	err = snd_hdac_make_cmd(hdac, nid, verb, parm, &cmd);
+	if (err)
+		return err;
+
+	return snd_hdac_exec_verb(hdac, cmd, flags, res);
 
-	return res;
 }
 
 static int codec_write(struct hdac_device *hdac, hda_nid_t nid,
 			int flags, unsigned int verb, unsigned int parm)
 {
-	unsigned int cmd = snd_hdac_make_cmd(hdac, nid, verb, parm);
+	int err;
+	unsigned int cmd;
+
+	err = snd_hdac_make_cmd(hdac, nid, verb, parm, &cmd);
+	if (err)
+		return err;
 
 	return snd_hdac_exec_verb(hdac, cmd, flags, NULL);
 }
@@ -1075,15 +1095,23 @@ static int codec_write(struct hdac_device *hdac, hda_nid_t nid,
  * @flags: optional bit flags
  * @verb: the verb to send
  * @parm: the parameter for the verb
+ * @res: pointer to store the codec response
  *
  * Send a single command and read the corresponding response.
  *
- * Returns the obtained response value, or -1 for an error.
+ * Returns 0 on success, or a negative error code.
  */
 int snd_hdac_codec_read(struct hdac_device *hdac, hda_nid_t nid,
-			int flags, unsigned int verb, unsigned int parm)
+			int flags, unsigned int verb, unsigned int parm,
+			unsigned int *res)
 {
-	return codec_read(hdac, nid, flags, verb, parm);
+	int err;
+
+	err = codec_read(hdac, nid, flags, verb, parm, res);
+	if (err < 0)
+		return err;
+
+	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_codec_read);
 
@@ -1145,8 +1173,11 @@ unsigned int snd_hdac_sync_power_state(struct hdac_device *codec,
 	unsigned int state, actual_state, count;
 
 	for (count = 0; count < 500; count++) {
-		state = snd_hdac_codec_read(codec, nid, 0,
-				AC_VERB_GET_POWER_STATE, 0);
+		if (snd_hdac_codec_read(codec, nid, 0,
+				AC_VERB_GET_POWER_STATE, 0, &state)) {
+			msleep(20);
+			break;
+		}
 		if (state & AC_PWRST_ERROR) {
 			msleep(20);
 			break;
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
  2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
  2026-12-03 17:05 ` [PATCH 1/3] ALSA: hda: core: Fix command creation error handling Sreeraj S Kurup
@ 2026-12-03 17:05 ` Sreeraj S Kurup
  2026-12-04  4:32   ` kernel test robot
                     ` (2 more replies)
  2026-12-03 17:05 ` [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers Sreeraj S Kurup
  2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
  3 siblings, 3 replies; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 17:05 UTC (permalink / raw)
  To: perex, tiwai, lgirdwood, broonie
  Cc: linux-sound, linux-kernel, Sreeraj S Kurup

Update callers of snd_hdac_codec_read() in hdmi_chmap.c to use
the new status and output parameter interface.

Check the return status before using the codec response, and
propagate read errors from the channel mapping helper functions.

Also avoid updating the converter channel count when reading the
current channel count fails.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/hda/core/hdmi_chmap.c | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/sound/hda/core/hdmi_chmap.c b/sound/hda/core/hdmi_chmap.c
index c897fc443467..e9e599154ef1 100644
--- a/sound/hda/core/hdmi_chmap.c
+++ b/sound/hda/core/hdmi_chmap.c
@@ -190,21 +190,41 @@ static int hdmi_pin_set_slot_channel(struct hdac_device *codec,
 static int hdmi_pin_get_slot_channel(struct hdac_device *codec,
 			hda_nid_t pin_nid, int asp_slot)
 {
-	return (snd_hdac_codec_read(codec, pin_nid, 0,
+	unsigned int res;
+	int err;
+
+	err = snd_hdac_codec_read(codec, pin_nid, 0,
 				   AC_VERB_GET_HDMI_CHAN_SLOT,
-				   asp_slot) & 0xf0) >> 4;
+				   asp_slot, &res);
+	if (err < 0)
+		return err;
+
+	return (res & 0xf0) >> 4;
 }
 
 static int hdmi_get_channel_count(struct hdac_device *codec, hda_nid_t cvt_nid)
 {
-	return 1 + snd_hdac_codec_read(codec, cvt_nid, 0,
-					AC_VERB_GET_CVT_CHAN_COUNT, 0);
+	unsigned int res;
+	int err;
+
+	err = snd_hdac_codec_read(codec, cvt_nid, 0,
+					AC_VERB_GET_CVT_CHAN_COUNT, 0, &res);
+	if (err < 0)
+		return err;
+
+	return 1 + res;
 }
 
 static void hdmi_set_channel_count(struct hdac_device *codec,
 				   hda_nid_t cvt_nid, int chs)
 {
-	if (chs != hdmi_get_channel_count(codec, cvt_nid))
+	int current;
+
+	current = hdmi_get_channel_count(codec, cvt_nid);
+	if (current < 0)
+		return;
+
+	if (chs != current)
 		snd_hdac_codec_write(codec, cvt_nid, 0,
 				    AC_VERB_SET_CVT_CHAN_COUNT, chs - 1);
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers
  2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
  2026-12-03 17:05 ` [PATCH 1/3] ALSA: hda: core: Fix command creation error handling Sreeraj S Kurup
  2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
@ 2026-12-03 17:05 ` Sreeraj S Kurup
  2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
  3 siblings, 0 replies; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 17:05 UTC (permalink / raw)
  To: perex, tiwai, lgirdwood, broonie
  Cc: linux-sound, linux-kernel, Sreeraj S Kurup

Update callers of snd_hdac_codec_read() in hdac_hdmi.c to use
the new status and output parameter interface.

Check the return status before using codec responses and handle
command failures appropriately in port selection, power
management and vendor-specific verb operations.

This ensures that codec read errors are handled separately
from response values.

Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
 sound/soc/codecs/hdac_hdmi.c | 72 +++++++++++++++++++++++-------------
 1 file changed, 47 insertions(+), 25 deletions(-)

diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index f7922ffaad97..8dad9f1644f8 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -241,8 +241,15 @@ static int hdac_hdmi_get_port_len(struct hdac_device *hdev, hda_nid_t nid)
 static int hdac_hdmi_port_select_get(struct hdac_device *hdev,
 					struct hdac_hdmi_port *port)
 {
-	return snd_hdac_codec_read(hdev, port->pin->nid,
-				0, AC_VERB_GET_DEVICE_SEL, 0);
+	unsigned int res;
+	int err;
+
+	err = snd_hdac_codec_read(hdev, port->pin->nid,
+				0, AC_VERB_GET_DEVICE_SEL, 0, &res);
+	if (err < 0)
+		return err;
+
+	return res;
 }
 
 /*
@@ -253,6 +260,7 @@ static int hdac_hdmi_port_select_set(struct hdac_device *hdev,
 					struct hdac_hdmi_port *port)
 {
 	int num_ports;
+	int selected;
 
 	if (!port->pin->mst_capable)
 		return 0;
@@ -271,7 +279,11 @@ static int hdac_hdmi_port_select_set(struct hdac_device *hdev,
 	snd_hdac_codec_write(hdev, port->pin->nid, 0,
 			AC_VERB_SET_DEVICE_SEL, port->id);
 
-	if (port->id != hdac_hdmi_port_select_get(hdev, port))
+	selected = hdac_hdmi_port_select_get(hdev, port);
+	if (selected < 0)
+		return selected;
+
+	if (port->id != selected)
 		return -EIO;
 
 	dev_dbg(&hdev->dev, "Selected the port=%d\n", port->id);
@@ -740,15 +752,18 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_device *hdev,
 static void hdac_hdmi_set_power_state(struct hdac_device *hdev,
 			     hda_nid_t nid, unsigned int pwr_state)
 {
-	int count;
-	unsigned int state;
+	int count, err;
+	unsigned int state, res;
 
 	if (snd_hdac_get_wcaps(hdev, nid) & AC_WCAP_POWER) {
 		if (!snd_hdac_check_power_state(hdev, nid, pwr_state)) {
 			for (count = 0; count < 10; count++) {
-				snd_hdac_codec_read(hdev, nid, 0,
+				err = snd_hdac_codec_read(hdev, nid, 0,
 						AC_VERB_SET_POWER_STATE,
-						pwr_state);
+						pwr_state, &res);
+				if (err < 0)
+					break;
+
 				state = snd_hdac_sync_power_state(hdev,
 						nid, pwr_state);
 				if (!(state & AC_PWRST_ERROR))
@@ -1401,38 +1416,40 @@ static int hdac_hdmi_add_pin(struct hdac_device *hdev, hda_nid_t nid)
 
 static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdev)
 {
-	unsigned int vendor_param;
+	unsigned int vendor_param, res;
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
 	unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
+	int err;
 
-	vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
-				INTEL_GET_VENDOR_VERB, 0);
-	if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS)
+	err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+			INTEL_GET_VENDOR_VERB, 0, &vendor_param);
+	if (err < 0 || (vendor_param & INTEL_EN_ALL_PIN_CVTS))
 		return;
 
 	vendor_param |= INTEL_EN_ALL_PIN_CVTS;
-	vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
-				INTEL_SET_VENDOR_VERB, vendor_param);
-	if (vendor_param == -1)
+	err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+			INTEL_SET_VENDOR_VERB, vendor_param, &res);
+	if (err < 0)
 		return;
 }
 
 static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
 {
-	unsigned int vendor_param;
+	unsigned int vendor_param, res;
 	struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
 	unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
+	int err;
 
-	vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
-				INTEL_GET_VENDOR_VERB, 0);
-	if (vendor_param == -1 || vendor_param & INTEL_EN_DP12)
+	err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+				INTEL_GET_VENDOR_VERB, 0, &vendor_param);
+	if (err < 0 || (vendor_param & INTEL_EN_DP12))
 		return;
 
 	/* enable DP1.2 mode */
 	vendor_param |= INTEL_EN_DP12;
-	vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
-				INTEL_SET_VENDOR_VERB, vendor_param);
-	if (vendor_param == -1)
+	err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+			INTEL_SET_VENDOR_VERB, vendor_param, &res);
+	if (err < 0)
 		return;
 
 }
@@ -1942,6 +1959,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
 	struct hdac_ext_link *hlink;
+	int ret;
+	unsigned int res;
 
 	dev_dbg(dev, "Enter: %s\n", __func__);
 
@@ -1956,8 +1975,10 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
 	 * is received. So setting power state is ensured without using loop
 	 * to read the state.
 	 */
-	snd_hdac_codec_read(hdev, hdev->afg, 0,	AC_VERB_SET_POWER_STATE,
-							AC_PWRST_D3);
+	ret = snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
+							AC_PWRST_D3, &res);
+	if (ret < 0)
+		return ret;
 
 	hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, dev_name(dev));
 	if (!hlink) {
@@ -1978,6 +1999,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
 	struct hdac_ext_link *hlink;
+	unsigned int res;
 
 	dev_dbg(dev, "Enter: %s\n", __func__);
 
@@ -2000,8 +2022,8 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
 	hdac_hdmi_skl_enable_dp12(hdev);
 
 	/* Power up afg */
-	snd_hdac_codec_read(hdev, hdev->afg, 0,	AC_VERB_SET_POWER_STATE,
-							AC_PWRST_D0);
+	snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
+						AC_PWRST_D0, &res);
 
 	return 0;
 }
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] ALSA: hda: Separate codec read status from response
  2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
                   ` (2 preceding siblings ...)
  2026-12-03 17:05 ` [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers Sreeraj S Kurup
@ 2026-12-03 17:33 ` Takashi Iwai
  2026-12-03 18:10   ` Sreeraj S Kurup
  2026-12-03 18:31   ` Sreeraj S Kurup
  3 siblings, 2 replies; 11+ messages in thread
From: Takashi Iwai @ 2026-12-03 17:33 UTC (permalink / raw)
  To: Sreeraj S Kurup
  Cc: perex, tiwai, lgirdwood, broonie, linux-sound, linux-kernel

On Thu, 03 Dec 2026 18:04:59 +0100,
Sreeraj S Kurup wrote:
> 
> Hi,
> 
> This series improves error handling in the HDA codec command and read
> APIs.
> 
> Currently, snd_hdac_make_cmd() returns an unsigned int and uses -1 to
> indicate an invalid command. Since -1 is converted to 0xffffffff,
> which can also represent a valid encoded HDA command, callers cannot
> reliably distinguish an error from a valid command.
> 
> This series changes snd_hdac_make_cmd() to return an integer status
> and provide the encoded command through an output parameter. It also
> updates snd_hdac_codec_read() to return an integer status and provide
> the codec response through an output parameter.
> 
> The affected callers in the HDA core and ASoC HDMI codec driver are
> updated to use the new API and handle errors appropriately.
> 
> Patch overview:
> 
> 1. ALSA: hda: core: Fix command creation error handling
> 2. ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
> 3. ASoC: codecs: hdac_hdmi: Update codec read API callers
> 
> Patches 2 and 3 depend on the API changes introduced in patch 1.

You can't do it in that way.  Each patch (commit) must not break
builds.


Takashi

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] ALSA: hda: Separate codec read status from response
  2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
@ 2026-12-03 18:10   ` Sreeraj S Kurup
  2026-12-03 18:31   ` Sreeraj S Kurup
  1 sibling, 0 replies; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 18:10 UTC (permalink / raw)
  To: tiwai
  Cc: broonie, lgirdwood, linux-kernel, linux-sound, perex,
	sreekuttan2156239

Hi Takashi,

Thanks for the feedback.

Would it be okay if I combine all three patches into a single patch so that the API change and all affected 
caller updates are included together, ensuring that the commit builds independently?

Please let me know if you have any concerns with this approach.

Thanks,
Sreeraj

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] ALSA: hda: Separate codec read status from response
  2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
  2026-12-03 18:10   ` Sreeraj S Kurup
@ 2026-12-03 18:31   ` Sreeraj S Kurup
  2026-12-04  8:25     ` Takashi Iwai
  1 sibling, 1 reply; 11+ messages in thread
From: Sreeraj S Kurup @ 2026-12-03 18:31 UTC (permalink / raw)
  To: tiwai
  Cc: broonie, lgirdwood, linux-kernel, linux-sound, perex,
	sreekuttan2156239

Hi Takashi,

I reviewed your comments and the issues found by Sashiko AI. The review pointed 
out that "0xffffffff" cannot be a valid command with the current command encoding. 
It also found some missed callers and error-handling issues in my changes.

After reviewing these points, I think the proposed API change is not needed. 
I'll drop this patchset instead of sending a new version.

Sorry for the noise, and thanks for your time.

Best regards,
Sreeraj

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
  2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
@ 2026-12-04  4:32   ` kernel test robot
  2026-12-04  4:54   ` kernel test robot
  2026-12-04  4:54   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-12-04  4:32 UTC (permalink / raw)
  To: Sreeraj S Kurup, perex, tiwai, lgirdwood, broonie
  Cc: oe-kbuild-all, linux-sound, linux-kernel, Sreeraj S Kurup

Hi Sreeraj,

kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus broonie-sound/for-next linus/master v7.4-rc5 next-20261203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sreeraj-S-Kurup/ALSA-hda-core-Fix-command-creation-error-handling/20261203-170500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20261203170741.3873-3-sreekuttan2156239%40gmail.com
patch subject: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
config: powerpc64-randconfig-1000-20261204 (https://download.01.org/0day-ci/archive/20261204/20261204122112.w6qucz7q-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204122112.w6qucz7q-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261204122112.w6qucz7q-lkp@intel.com/

All errors (new ones prefixed by >>):

   sound/hda/core/hdmi_chmap.c: In function 'hdmi_set_channel_count':
   sound/hda/core/hdmi_chmap.c:221:9: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     221 |         int current;
         |         ^~~
   In file included from include/linux/sched.h:12,
                    from arch/powerpc/include/asm/elf.h:8,
                    from include/linux/elf.h:6,
                    from include/linux/module.h:20,
                    from sound/hda/core/hdmi_chmap.c:6:
>> arch/powerpc/include/asm/current.h:26:17: error: conflicting types for 'get_current'; have 'int()'
      26 | #define current get_current()
         |                 ^~~~~~~~~~~
   sound/hda/core/hdmi_chmap.c:221:13: note: in expansion of macro 'current'
     221 |         int current;
         |             ^~~~~~~
   arch/powerpc/include/asm/current.h:15:35: note: previous definition of 'get_current' with type 'struct task_struct *(void)'
      15 | static inline struct task_struct *get_current(void)
         |                                   ^~~~~~~~~~~
   sound/hda/core/hdmi_chmap.c:223:17: error: lvalue required as left operand of assignment
     223 |         current = hdmi_get_channel_count(codec, cvt_nid);
         |                 ^
   cc1: some warnings being treated as errors
--
   hdmi_chmap.c: In function 'hdmi_set_channel_count':
   hdmi_chmap.c:221:9: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     221 |         int current;
         |         ^~~
   In file included from include/linux/sched.h:12,
                    from arch/powerpc/include/asm/elf.h:8,
                    from include/linux/elf.h:6,
                    from include/linux/module.h:20,
                    from hdmi_chmap.c:6:
>> arch/powerpc/include/asm/current.h:26:17: error: conflicting types for 'get_current'; have 'int()'
      26 | #define current get_current()
         |                 ^~~~~~~~~~~
   hdmi_chmap.c:221:13: note: in expansion of macro 'current'
     221 |         int current;
         |             ^~~~~~~
   arch/powerpc/include/asm/current.h:15:35: note: previous definition of 'get_current' with type 'struct task_struct *(void)'
      15 | static inline struct task_struct *get_current(void)
         |                                   ^~~~~~~~~~~
   hdmi_chmap.c:223:17: error: lvalue required as left operand of assignment
     223 |         current = hdmi_get_channel_count(codec, cvt_nid);
         |                 ^
   cc1: some warnings being treated as errors


vim +26 arch/powerpc/include/asm/current.h

584224e4095d8a include/asm-powerpc/current.h      David Gibson    2005-11-09  14  
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  15  static inline struct task_struct *get_current(void)
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  16  {
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  17  	struct task_struct *task;
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  18  
e354d7dc81d0e8 arch/powerpc/include/asm/current.h Nicholas Piggin 2019-06-13  19  	/* get_current can be cached by the compiler, so no volatile */
e354d7dc81d0e8 arch/powerpc/include/asm/current.h Nicholas Piggin 2019-06-13  20  	asm ("ld %0,%1(13)"
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  21  	: "=r" (task)
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  22  	: "i" (offsetof(struct paca_struct, __current)));
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  23  
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  24  	return task;
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31  25  }
5fe8e8b88e68e5 include/asm-powerpc/current.h      Hugh Dickins    2006-10-31 @26  #define current	get_current()
584224e4095d8a include/asm-powerpc/current.h      David Gibson    2005-11-09  27  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
  2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
  2026-12-04  4:32   ` kernel test robot
@ 2026-12-04  4:54   ` kernel test robot
  2026-12-04  4:54   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-12-04  4:54 UTC (permalink / raw)
  To: Sreeraj S Kurup, perex, tiwai, lgirdwood, broonie
  Cc: oe-kbuild-all, linux-sound, linux-kernel, Sreeraj S Kurup

Hi Sreeraj,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tiwai-sound/for-next]
[also build test WARNING on tiwai-sound/for-linus broonie-sound/for-next linus/master v7.4-rc5 next-20261203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sreeraj-S-Kurup/ALSA-hda-core-Fix-command-creation-error-handling/20261203-170500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20261203170741.3873-3-sreekuttan2156239%40gmail.com
patch subject: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20261204/20261204124504.62MCVj5F-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204124504.62MCVj5F-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261204124504.62MCVj5F-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from ./arch/alpha/include/generated/asm/current.h:1,
                    from include/linux/mutex.h:14,
                    from include/linux/kernfs.h:11,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/module.h:22,
                    from sound/hda/core/hdmi_chmap.c:6:
   sound/hda/core/hdmi_chmap.c: In function 'hdmi_set_channel_count':
   include/asm-generic/current.h:8:45: error: expected ')' before '->' token
       8 | #define get_current() (current_thread_info()->task)
         |                                             ^~
   include/asm-generic/current.h:9:17: note: in expansion of macro 'get_current'
       9 | #define current get_current()
         |                 ^~~~~~~~~~~
   sound/hda/core/hdmi_chmap.c:221:13: note: in expansion of macro 'current'
     221 |         int current;
         |             ^~~~~~~
   sound/hda/core/hdmi_chmap.c:223:17: error: assignment to 'struct task_struct *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     223 |         current = hdmi_get_channel_count(codec, cvt_nid);
         |                 ^
>> sound/hda/core/hdmi_chmap.c:224:21: warning: ordered comparison of pointer with integer zero [-Wextra]
     224 |         if (current < 0)
         |                     ^
>> sound/hda/core/hdmi_chmap.c:227:17: warning: comparison between pointer and integer
     227 |         if (chs != current)
         |                 ^~


vim +224 sound/hda/core/hdmi_chmap.c

   217	
   218	static void hdmi_set_channel_count(struct hdac_device *codec,
   219					   hda_nid_t cvt_nid, int chs)
   220	{
   221		int current;
   222	
   223		current = hdmi_get_channel_count(codec, cvt_nid);
 > 224		if (current < 0)
   225			return;
   226	
 > 227		if (chs != current)
   228			snd_hdac_codec_write(codec, cvt_nid, 0,
   229					    AC_VERB_SET_CVT_CHAN_COUNT, chs - 1);
   230	}
   231	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
  2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
  2026-12-04  4:32   ` kernel test robot
  2026-12-04  4:54   ` kernel test robot
@ 2026-12-04  4:54   ` kernel test robot
  2 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2026-12-04  4:54 UTC (permalink / raw)
  To: Sreeraj S Kurup, perex, tiwai, lgirdwood, broonie
  Cc: oe-kbuild-all, linux-sound, linux-kernel, Sreeraj S Kurup

Hi Sreeraj,

kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus broonie-sound/for-next linus/master v7.4-rc5 next-20261203]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sreeraj-S-Kurup/ALSA-hda-core-Fix-command-creation-error-handling/20261203-170500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20261203170741.3873-3-sreekuttan2156239%40gmail.com
patch subject: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
config: parisc-randconfig-1001-20261204 (https://download.01.org/0day-ci/archive/20261204/20261204125206.uCtXT7cD-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261204/20261204125206.uCtXT7cD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261204125206.uCtXT7cD-lkp@intel.com/

All errors (new ones prefixed by >>):

   sound/hda/core/hdmi_chmap.c: In function 'hdmi_set_channel_count':
   sound/hda/core/hdmi_chmap.c:221:9: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     221 |         int current;
         |         ^~~
   In file included from include/linux/mutex.h:14,
                    from include/linux/kernfs.h:11,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/module.h:22,
                    from sound/hda/core/hdmi_chmap.c:6:
>> arch/parisc/include/asm/current.h:17:17: error: conflicting types for 'get_current'; have 'int()'
      17 | #define current get_current()
         |                 ^~~~~~~~~~~
   sound/hda/core/hdmi_chmap.c:221:13: note: in expansion of macro 'current'
     221 |         int current;
         |             ^~~~~~~
   arch/parisc/include/asm/current.h:8:44: note: previous definition of 'get_current' with type 'struct task_struct *(void)'
       8 | static __always_inline struct task_struct *get_current(void)
         |                                            ^~~~~~~~~~~
   sound/hda/core/hdmi_chmap.c:223:17: error: lvalue required as left operand of assignment
     223 |         current = hdmi_get_channel_count(codec, cvt_nid);
         |                 ^
   cc1: some warnings being treated as errors
--
   hdmi_chmap.c: In function 'hdmi_set_channel_count':
   hdmi_chmap.c:221:9: error: function declaration isn't a prototype [-Werror=strict-prototypes]
     221 |         int current;
         |         ^~~
   In file included from include/linux/mutex.h:14,
                    from include/linux/kernfs.h:11,
                    from include/linux/sysfs.h:16,
                    from include/linux/kobject.h:20,
                    from include/linux/module.h:22,
                    from hdmi_chmap.c:6:
>> arch/parisc/include/asm/current.h:17:17: error: conflicting types for 'get_current'; have 'int()'
      17 | #define current get_current()
         |                 ^~~~~~~~~~~
   hdmi_chmap.c:221:13: note: in expansion of macro 'current'
     221 |         int current;
         |             ^~~~~~~
   arch/parisc/include/asm/current.h:8:44: note: previous definition of 'get_current' with type 'struct task_struct *(void)'
       8 | static __always_inline struct task_struct *get_current(void)
         |                                            ^~~~~~~~~~~
   hdmi_chmap.c:223:17: error: lvalue required as left operand of assignment
     223 |         current = hdmi_get_channel_count(codec, cvt_nid);
         |                 ^
   cc1: some warnings being treated as errors


vim +17 arch/parisc/include/asm/current.h

2214c0e77259b42 Helge Deller 2021-10-15  16  
2214c0e77259b42 Helge Deller 2021-10-15 @17  #define current get_current()
2214c0e77259b42 Helge Deller 2021-10-15  18  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/3] ALSA: hda: Separate codec read status from response
  2026-12-03 18:31   ` Sreeraj S Kurup
@ 2026-12-04  8:25     ` Takashi Iwai
  0 siblings, 0 replies; 11+ messages in thread
From: Takashi Iwai @ 2026-12-04  8:25 UTC (permalink / raw)
  To: Sreeraj S Kurup
  Cc: tiwai, broonie, lgirdwood, linux-kernel, linux-sound, perex

On Thu, 03 Dec 2026 19:31:49 +0100,
Sreeraj S Kurup wrote:
> 
> Hi Takashi,
> 
> I reviewed your comments and the issues found by Sashiko AI. The review pointed 
> out that "0xffffffff" cannot be a valid command with the current command encoding. 
> It also found some missed callers and error-handling issues in my changes.
> 
> After reviewing these points, I think the proposed API change is not needed. 
> I'll drop this patchset instead of sending a new version.

Admittedly the current API pattern isn't optimal, and your suggested
function would be better.  But the API conversion is a cumbersome task
when used widely, and this doesn't bring so much benefit as you've
noticed, so you traced the route showing why we've stayed as lazy
animals until now :)


thanks,

Takashi

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-12-04  8:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
2026-12-03 17:05 ` [PATCH 1/3] ALSA: hda: core: Fix command creation error handling Sreeraj S Kurup
2026-12-03 17:05 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
2026-12-04  4:32   ` kernel test robot
2026-12-04  4:54   ` kernel test robot
2026-12-04  4:54   ` kernel test robot
2026-12-03 17:05 ` [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers Sreeraj S Kurup
2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
2026-12-03 18:10   ` Sreeraj S Kurup
2026-12-03 18:31   ` Sreeraj S Kurup
2026-12-04  8:25     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox