mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 03/13] [oss] changed ioctls to unlocked
@ 2009-03-24 21:12 stoyboyker
  2009-04-06  1:45 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: stoyboyker @ 2009-03-24 21:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stoyan Gaydarov, perex, tiwai

From: Stoyan Gaydarov <stoyboyker@gmail.com>

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
---
 sound/oss/sh_dac_audio.c |   60 ++++++++++++++++++++++++++++++---------------
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index e5d4239..22ae271 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -111,35 +111,43 @@ static void dac_audio_set_rate(void)
 	ctrl_outl(interval, TMU1_TCNT);
 }
 
-static int dac_audio_ioctl(struct inode *inode, struct file *file,
-			   unsigned int cmd, unsigned long arg)
+static long dac_audio_ioctl(struct file *file, unsigned int cmd,
+			    unsigned long arg)
 {
 	int val;
+	long ret;
 
 	switch (cmd) {
 	case OSS_GETVERSION:
-		return put_user(SOUND_VERSION, (int *)arg);
+		ret = put_user(SOUND_VERSION, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_SYNC:
 		dac_audio_sync();
-		return 0;
+		ret = 0;
+		break;
 
 	case SNDCTL_DSP_RESET:
 		dac_audio_reset();
-		return 0;
+		ret = 0;
+		break;
 
 	case SNDCTL_DSP_GETFMTS:
-		return put_user(AFMT_U8, (int *)arg);
+		ret = put_user(AFMT_U8, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_SETFMT:
-		return put_user(AFMT_U8, (int *)arg);
+		ret = put_user(AFMT_U8, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_NONBLOCK:
 		file->f_flags |= O_NONBLOCK;
-		return 0;
+		ret = 0;
+		break;
 
 	case SNDCTL_DSP_GETCAPS:
-		return 0;
+		ret = 0;
+		break;
 
 	case SOUND_PCM_WRITE_RATE:
 		val = *(int *)arg;
@@ -147,32 +155,44 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file,
 			rate = val;
 			dac_audio_set_rate();
 		}
-		return put_user(rate, (int *)arg);
+		ret = put_user(rate, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_STEREO:
-		return put_user(0, (int *)arg);
+		ret = put_user(0, (int *)arg);
+		break;
 
 	case SOUND_PCM_WRITE_CHANNELS:
-		return put_user(1, (int *)arg);
+		ret = put_user(1, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_SETDUPLEX:
-		return -EINVAL;
+		ret = -EINVAL;
+		break;
 
 	case SNDCTL_DSP_PROFILE:
-		return -EINVAL;
+		ret = -EINVAL;
+		break;
 
 	case SNDCTL_DSP_GETBLKSIZE:
-		return put_user(BUFFER_SIZE, (int *)arg);
+		ret = put_user(BUFFER_SIZE, (int *)arg);
+		break;
 
 	case SNDCTL_DSP_SETFRAGMENT:
-		return 0;
+		ret = 0;
+		break;
 
 	default:
 		printk(KERN_ERR "sh_dac_audio: unimplemented ioctl=0x%x\n",
 		       cmd);
-		return -EINVAL;
+		ret = -EINVAL;
+		break;
 	}
-	return -EINVAL;
+	if(!ret)
+	    ret = -EINVAL;
+
+	unlock_kernel();
+	return ret;
 }
 
 static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count,
@@ -257,8 +277,8 @@ static int dac_audio_release(struct inode *inode, struct file *file)
 
 const struct file_operations dac_audio_fops = {
       .read =		dac_audio_read,
-      .write =	dac_audio_write,
-      .ioctl =	dac_audio_ioctl,
+      .write =		dac_audio_write,
+      .unlocked_ioctl =	dac_audio_ioctl,
       .open =		dac_audio_open,
       .release =	dac_audio_release,
 };
-- 
1.6.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 03/13] [oss] changed ioctls to unlocked
  2009-03-24 21:12 [PATCH 03/13] [oss] changed ioctls to unlocked stoyboyker
@ 2009-04-06  1:45 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2009-04-06  1:45 UTC (permalink / raw)
  To: stoyboyker; +Cc: linux-kernel, perex

At Tue, 24 Mar 2009 16:12:38 -0500,
stoyboyker@gmail.com wrote:
> 
> From: Stoyan Gaydarov <stoyboyker@gmail.com>
> 
> Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>

The patch wasn't applied cleanly by some reason.
Could you double-check with the latest git tree?
(It might be a problem in my side, though, as I'm working remotely
 now during vacation :)


thanks,

Takashi

> ---
>  sound/oss/sh_dac_audio.c |   60 ++++++++++++++++++++++++++++++---------------
>  1 files changed, 40 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
> index e5d4239..22ae271 100644
> --- a/sound/oss/sh_dac_audio.c
> +++ b/sound/oss/sh_dac_audio.c
> @@ -111,35 +111,43 @@ static void dac_audio_set_rate(void)
>  	ctrl_outl(interval, TMU1_TCNT);
>  }
>  
> -static int dac_audio_ioctl(struct inode *inode, struct file *file,
> -			   unsigned int cmd, unsigned long arg)
> +static long dac_audio_ioctl(struct file *file, unsigned int cmd,
> +			    unsigned long arg)
>  {
>  	int val;
> +	long ret;
>  
>  	switch (cmd) {
>  	case OSS_GETVERSION:
> -		return put_user(SOUND_VERSION, (int *)arg);
> +		ret = put_user(SOUND_VERSION, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_SYNC:
>  		dac_audio_sync();
> -		return 0;
> +		ret = 0;
> +		break;
>  
>  	case SNDCTL_DSP_RESET:
>  		dac_audio_reset();
> -		return 0;
> +		ret = 0;
> +		break;
>  
>  	case SNDCTL_DSP_GETFMTS:
> -		return put_user(AFMT_U8, (int *)arg);
> +		ret = put_user(AFMT_U8, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_SETFMT:
> -		return put_user(AFMT_U8, (int *)arg);
> +		ret = put_user(AFMT_U8, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_NONBLOCK:
>  		file->f_flags |= O_NONBLOCK;
> -		return 0;
> +		ret = 0;
> +		break;
>  
>  	case SNDCTL_DSP_GETCAPS:
> -		return 0;
> +		ret = 0;
> +		break;
>  
>  	case SOUND_PCM_WRITE_RATE:
>  		val = *(int *)arg;
> @@ -147,32 +155,44 @@ static int dac_audio_ioctl(struct inode *inode, struct file *file,
>  			rate = val;
>  			dac_audio_set_rate();
>  		}
> -		return put_user(rate, (int *)arg);
> +		ret = put_user(rate, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_STEREO:
> -		return put_user(0, (int *)arg);
> +		ret = put_user(0, (int *)arg);
> +		break;
>  
>  	case SOUND_PCM_WRITE_CHANNELS:
> -		return put_user(1, (int *)arg);
> +		ret = put_user(1, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_SETDUPLEX:
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		break;
>  
>  	case SNDCTL_DSP_PROFILE:
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		break;
>  
>  	case SNDCTL_DSP_GETBLKSIZE:
> -		return put_user(BUFFER_SIZE, (int *)arg);
> +		ret = put_user(BUFFER_SIZE, (int *)arg);
> +		break;
>  
>  	case SNDCTL_DSP_SETFRAGMENT:
> -		return 0;
> +		ret = 0;
> +		break;
>  
>  	default:
>  		printk(KERN_ERR "sh_dac_audio: unimplemented ioctl=0x%x\n",
>  		       cmd);
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		break;
>  	}
> -	return -EINVAL;
> +	if(!ret)
> +	    ret = -EINVAL;
> +
> +	unlock_kernel();
> +	return ret;
>  }
>  
>  static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count,
> @@ -257,8 +277,8 @@ static int dac_audio_release(struct inode *inode, struct file *file)
>  
>  const struct file_operations dac_audio_fops = {
>        .read =		dac_audio_read,
> -      .write =	dac_audio_write,
> -      .ioctl =	dac_audio_ioctl,
> +      .write =		dac_audio_write,
> +      .unlocked_ioctl =	dac_audio_ioctl,
>        .open =		dac_audio_open,
>        .release =	dac_audio_release,
>  };
> -- 
> 1.6.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-06  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-24 21:12 [PATCH 03/13] [oss] changed ioctls to unlocked stoyboyker
2009-04-06  1:45 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®