mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-18 15:51:20 -04:00
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 <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20251212103858.110701-3-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
384b130387
commit
eded4483b8
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user