Skip to contentSkip to conversation

ASoC: es9356: propagate HID button read errors

PATCH In review Avi Weiss 2 participants 2 messages Oct 30 – Nov 2

Subsystems (2)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 ASoC: es9356: propagate HID button read errors

es9356_sdca_button_detect() returns zero when a regmap read fails, so the interrupt handler cannot distinguish the error from a valid no-button result.

Return the original error and keep the button result signed so the existing negative-result check also handles decoding errors. Leave the ownership handoff unchanged.

Fixes 5d9cb740cd38 ("ASoC: es9356-sdca: Add ES9356 SDCA driver")
---
 sound/soc/codecs/es9356.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
sound/soc/codecs/es9356.c +8 -3
index 9c70ccd5b310..277d0ae56661 100644
@@ -293,13 +293,15 @@ static int es9356_sdca_button(unsigned int *buffer)
 
 static int es9356_sdca_button_detect(struct es9356_sdw_priv *es9356)
 {
-	unsigned int btn_type = 0, offset, idx, val, owner;
+	unsigned int offset, idx, val, owner;
 	unsigned int button[3];
-	int ret;
+	int btn_type = 0, ret;
 
 	ret = regmap_read(es9356->regmap,
 		SDW_SDCA_CTL(FUNC_NUM_HID, ES9356_SDCA_ENT_HID01, ES9356_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), &owner);
-	if (ret < 0 || owner == 0x01)
+	if (ret < 0)
+		return ret;
+	if (owner == 0x01)
 		return 0;
 
 	ret = regmap_read(es9356->regmap, ES9356_BUF_ADDR_HID, &offset);
@@ -320,6 +322,9 @@ static int es9356_sdca_button_detect(struct es9356_sdw_priv *es9356)
 		regmap_write(es9356->regmap,
 			SDW_SDCA_CTL(FUNC_NUM_HID, ES9356_SDCA_ENT_HID01, ES9356_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), 0x01);
 
+	if (ret < 0)
+		return ret;
+
 	return btn_type;
 }
 
maintainer
#1 lore raw
Quoted 1 line · Avi Weiss

ASoC: es9356: propagate HID button read errors

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/1] ASoC: es9356: propagate HID button read errors

      https://git.kernel.org/broonie/sound/c/b491075b3f9a

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark