All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Gerst <bgerst@didntduck.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, ak@suse.de, perex@suse.cz
Subject: Re: [PATCH 0/3] Conversion to compat_ioctl for ALSA drivers
Date: Sun, 30 Jan 2005 13:02:15 -0500	[thread overview]
Message-ID: <41FD2127.5090907@didntduck.org> (raw)
In-Reply-To: <s5hfz0ywve8.wl@alsa2.suse.de>

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

Takashi Iwai wrote:
> Hi,
> 
> the following three patches convert the 32bit ioctl layer of ALSA to
> the new compat_ioctl (and unlocked_ioctl for native ioctls).
> 
> The first patch covers the basic entries and control API.
> The second patch is for PCM API.
> The last one is for other APIs including OSS-emulation modules.
> 
> After these patches are applied, remove the whole subtree in
> sound/core/ioctl32.  The files in this directory are no longer
> necessary.

Fix 32-bit calls to snd_pcm_channel_info().

Signed-off-by: Brian Gerst <bgerst@didntduck.org>

[-- Attachment #2: alsa-pcm-compat --]
[-- Type: text/plain, Size: 1876 bytes --]

--- linux/sound/core/pcm_native.c.bak	2005-01-30 11:15:24.000000000 -0500
+++ linux/sound/core/pcm_native.c	2005-01-30 11:17:31.000000000 -0500
@@ -602,17 +602,13 @@
 	return 0;
 }
 
-static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info)
+static int snd_pcm_channel_info(snd_pcm_substream_t * substream, snd_pcm_channel_info_t * info)
 {
-	snd_pcm_channel_info_t info;
 	snd_pcm_runtime_t *runtime;
-	int res;
 	unsigned int channel;
 	
 	snd_assert(substream != NULL, return -ENXIO);
-	if (copy_from_user(&info, _info, sizeof(info)))
-		return -EFAULT;
-	channel = info.channel;
+	channel = info->channel;
 	runtime = substream->runtime;
 	snd_pcm_stream_lock_irq(substream);
 	if (runtime->status->state == SNDRV_PCM_STATE_OPEN) {
@@ -622,9 +618,19 @@
 	snd_pcm_stream_unlock_irq(substream);
 	if (channel >= runtime->channels)
 		return -EINVAL;
-	memset(&info, 0, sizeof(info));
-	info.channel = channel;
-	res = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, &info);
+	memset(info, 0, sizeof(*info));
+	info->channel = channel;
+	return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info);
+}
+
+static int snd_pcm_channel_info_user(snd_pcm_substream_t * substream, snd_pcm_channel_info_t __user * _info)
+{
+	snd_pcm_channel_info_t info;
+	int res;
+	
+	if (copy_from_user(&info, _info, sizeof(info)))
+		return -EFAULT;
+	res = snd_pcm_channel_info(substream, &info);
 	if (res < 0)
 		return res;
 	if (copy_to_user(_info, &info, sizeof(info)))
@@ -2440,7 +2446,7 @@
 	case SNDRV_PCM_IOCTL_STATUS:
 		return snd_pcm_status_user(substream, arg);
 	case SNDRV_PCM_IOCTL_CHANNEL_INFO:
-		return snd_pcm_channel_info(substream, arg);
+		return snd_pcm_channel_info_user(substream, arg);
 	case SNDRV_PCM_IOCTL_PREPARE:
 		return snd_pcm_prepare(substream);
 	case SNDRV_PCM_IOCTL_RESET:

  parent reply	other threads:[~2005-01-30 18:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18 16:32 [PATCH 0/3] Conversion to compat_ioctl for ALSA drivers Takashi Iwai
2005-01-18 16:35 ` [PATCH 1/3] " Takashi Iwai
2005-01-18 16:36   ` [PATCH 2/3] " Takashi Iwai
2005-01-18 16:37     ` [PATCH 3/3] " Takashi Iwai
2005-01-18 18:51       ` [PATCH 3/3] Resend: " Takashi Iwai
2005-01-30 18:02 ` Brian Gerst [this message]
2005-01-31 13:39   ` [PATCH 0/3] " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41FD2127.5090907@didntduck.org \
    --to=bgerst@didntduck.org \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.