]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: catpt: Update CATPT_IPC_ERROR macro
authorCezary Rojewski <cezary.rojewski@intel.com>
Fri, 12 Dec 2025 10:38:55 +0000 (11:38 +0100)
committerMark Brown <broonie@kernel.org>
Sun, 14 Dec 2025 10:34:56 +0000 (19:34 +0900)
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>
sound/soc/intel/catpt/core.h
sound/soc/intel/catpt/device.c
sound/soc/intel/catpt/loader.c
sound/soc/intel/catpt/pcm.c
sound/soc/intel/catpt/sysfs.c

index 7b7c30a0d2acef7afcaf1432c185aea72de63ffd..d273f24d3d530b8b5d9b37cad5dc7651205e667d 100644 (file)
@@ -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,
index d13062c8e907cc2e1a7f690e7cf82fd37613c95b..d8e0da558495f492acfe4b0cb5405f62c420a53b 100644 (file)
@@ -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;
index f5705cd2c1e113b9a6702c8ab8038f8011c1806b..80c4ab335525db7e9fff40ee828fd8bbec0a6626 100644 (file)
@@ -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) {
index abd1cb07c60c491d94a6d6236e62fc2bd6400813..cc43346f83af4c0d4b5e472726f6f77a7180c545 100644 (file)
@@ -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;
index e961e172f9b760282282eb1d56939d9994611149..0cb122a4dfd2f0cf5537d00994867c139b521891 100644 (file)
@@ -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);