Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b03052e7 authored by Banajit Goswami's avatar Banajit Goswami
Browse files

ASoC: core: Support for compress ioctls



Compat driver should support compress ioctls when
COMPAT mode is enabled. Change adds support for
handling compress ioctls.

Change-Id: If7223ace326253240a1cd65bc9a111b8903977f1
Signed-off-by: default avatarGopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent 20df5529
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ struct snd_pcm_ops {
	int (*close)(struct snd_pcm_substream *substream);
	int (*ioctl)(struct snd_pcm_substream * substream,
		     unsigned int cmd, void *arg);
	int (*compat_ioctl)(struct snd_pcm_substream *substream,
		     unsigned int cmd, void *arg);
	int (*hw_params)(struct snd_pcm_substream *substream,
			 struct snd_pcm_hw_params *params);
	int (*hw_free)(struct snd_pcm_substream *substream);
+22 −0
Original line number Diff line number Diff line
@@ -655,6 +655,25 @@ enum {
#endif /* CONFIG_X86_X32 */
};

static int snd_compressed_ioctl32(struct snd_pcm_substream *substream,
				 unsigned int cmd, void __user *arg)
{
	struct snd_pcm_runtime *runtime;
	int err = 0;

	if (PCM_RUNTIME_CHECK(substream))
		return -ENXIO;
	runtime = substream->runtime;
	if (substream->ops->compat_ioctl) {
		err = substream->ops->compat_ioctl(substream, cmd, arg);
	} else {
		err = -ENOIOCTLCMD;
		pr_err("%s failed cmd = %d\n", __func__, cmd);
	}
	pr_debug("%s called with cmd = %d\n", __func__, cmd);
	return err;
}

static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
{
	struct snd_pcm_file *pcm_file;
@@ -734,6 +753,9 @@ static long snd_pcm_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
	case SNDRV_PCM_IOCTL_CHANNEL_INFO_X32:
		return snd_pcm_ioctl_channel_info_x32(substream, argp);
#endif /* CONFIG_X86_X32 */
	default:
		if (_IOC_TYPE(cmd) == 'C')
			return snd_compressed_ioctl32(substream, cmd, argp);
	}

	return -ENOIOCTLCMD;