From: Cezary Rojewski Date: Fri, 12 Dec 2025 10:38:55 +0000 (+0100) Subject: ASoC: Intel: catpt: Update CATPT_IPC_ERROR macro X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eded4483b8a21eaeb0886ef6f961ccf4e0d9c976;p=thirdparty%2Fkernel%2Flinux.git ASoC: Intel: catpt: Update CATPT_IPC_ERROR macro Make it easier for functions that call IPC handlers to deal with their results by accounting for '0' (success) code. Rename the macro to reflect this behaviour change. Signed-off-by: Cezary Rojewski Link: https://patch.msgid.link/20251212103858.110701-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/intel/catpt/core.h b/sound/soc/intel/catpt/core.h index 7b7c30a0d2ace..d273f24d3d530 100644 --- a/sound/soc/intel/catpt/core.h +++ b/sound/soc/intel/catpt/core.h @@ -129,7 +129,7 @@ irqreturn_t catpt_dsp_irq_thread(int irq, void *dev_id); * HOST <-> DSP communication yet failure to process specific request. * Use below macro to convert returned non-zero values appropriately */ -#define CATPT_IPC_ERROR(err) (((err) < 0) ? (err) : -EREMOTEIO) +#define CATPT_IPC_RET(ret) (((ret) <= 0) ? (ret) : -EREMOTEIO) int catpt_dsp_send_msg_timeout(struct catpt_dev *cdev, struct catpt_ipc_msg request, diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c index d13062c8e907c..d8e0da558495f 100644 --- a/sound/soc/intel/catpt/device.c +++ b/sound/soc/intel/catpt/device.c @@ -41,7 +41,7 @@ static int catpt_do_suspend(struct device *dev) memset(&cdev->dx_ctx, 0, sizeof(cdev->dx_ctx)); ret = catpt_ipc_enter_dxstate(cdev, CATPT_DX_STATE_D3, &cdev->dx_ctx); if (ret) { - ret = CATPT_IPC_ERROR(ret); + ret = CATPT_IPC_RET(ret); goto release_dma_chan; } @@ -107,7 +107,7 @@ static int catpt_resume(struct device *dev) ret = catpt_ipc_set_device_format(cdev, &cdev->devfmt[i]); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); } return 0; diff --git a/sound/soc/intel/catpt/loader.c b/sound/soc/intel/catpt/loader.c index f5705cd2c1e11..80c4ab335525d 100644 --- a/sound/soc/intel/catpt/loader.c +++ b/sound/soc/intel/catpt/loader.c @@ -656,7 +656,7 @@ int catpt_first_boot_firmware(struct catpt_dev *cdev) ret = catpt_ipc_get_mixer_stream_info(cdev, &cdev->mixer); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); ret = catpt_arm_stream_templates(cdev); if (ret) { diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c index abd1cb07c60c4..cc43346f83af4 100644 --- a/sound/soc/intel/catpt/pcm.c +++ b/sound/soc/intel/catpt/pcm.c @@ -365,9 +365,7 @@ static int catpt_dai_apply_usettings(struct snd_soc_dai *dai, if (stream->template->type != CATPT_STRM_TYPE_LOOPBACK) return catpt_set_dspvol(cdev, id, (long *)pos->private_value); ret = catpt_ipc_mute_loopback(cdev, id, *(bool *)pos->private_value); - if (ret) - return CATPT_IPC_ERROR(ret); - return 0; + return CATPT_IPC_RET(ret); } static int catpt_dai_hw_params(struct snd_pcm_substream *substream, @@ -414,7 +412,7 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream, cdev->scratch, &stream->info); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); ret = catpt_dai_apply_usettings(dai, stream); if (ret) { @@ -456,11 +454,11 @@ static int catpt_dai_prepare(struct snd_pcm_substream *substream, ret = catpt_ipc_reset_stream(cdev, stream->info.stream_hw_id); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); ret = catpt_ipc_pause_stream(cdev, stream->info.stream_hw_id); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); stream->prepared = true; return 0; @@ -491,7 +489,7 @@ static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd, ret = catpt_ipc_set_write_pos(cdev, stream->info.stream_hw_id, pos, false, false); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); fallthrough; case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: @@ -499,7 +497,7 @@ static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd, catpt_dsp_update_lpclock(cdev); ret = catpt_ipc_resume_stream(cdev, stream->info.stream_hw_id); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); break; case SNDRV_PCM_TRIGGER_STOP: @@ -510,7 +508,7 @@ static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd, ret = catpt_ipc_pause_stream(cdev, stream->info.stream_hw_id); catpt_dsp_update_lpclock(cdev); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); break; default: @@ -679,7 +677,7 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm, pm_runtime_put_autosuspend(cdev->dev); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); /* store device format set for given SSP */ memcpy(&cdev->devfmt[devfmt.iface], &devfmt, sizeof(devfmt)); @@ -849,9 +847,7 @@ static int catpt_set_dspvol(struct catpt_dev *cdev, u8 stream_id, long *ctlvol) } } - if (ret) - return CATPT_IPC_ERROR(ret); - return 0; + return CATPT_IPC_RET(ret); } static int catpt_volume_info(struct snd_kcontrol *kcontrol, @@ -1041,7 +1037,7 @@ static int catpt_loopback_switch_put(struct snd_kcontrol *kcontrol, pm_runtime_put_autosuspend(cdev->dev); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); *(bool *)kcontrol->private_value = mute; return 0; diff --git a/sound/soc/intel/catpt/sysfs.c b/sound/soc/intel/catpt/sysfs.c index e961e172f9b76..0cb122a4dfd2f 100644 --- a/sound/soc/intel/catpt/sysfs.c +++ b/sound/soc/intel/catpt/sysfs.c @@ -24,7 +24,7 @@ static ssize_t fw_version_show(struct device *dev, pm_runtime_put_autosuspend(cdev->dev); if (ret) - return CATPT_IPC_ERROR(ret); + return CATPT_IPC_RET(ret); return sysfs_emit(buf, "%d.%d.%d.%d\n", version.type, version.major, version.minor, version.build);