mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org, John Kacur <jkacur@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 2/6] sound/oss: convert to unlocked_ioctl
Date: Sun, 4 Jul 2010 13:08:35 +0200	[thread overview]
Message-ID: <20100704110835.GA31920@merkur.ravnborg.org> (raw)
In-Reply-To: <1278195310-25590-3-git-send-email-arnd@arndb.de>

> 
> diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c
> index c1070e3..3547450 100644
> --- a/sound/oss/au1550_ac97.c
> +++ b/sound/oss/au1550_ac97.c
> @@ -824,22 +824,26 @@ mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
>  	return codec->mixer_ioctl(codec, cmd, arg);
>  }
>  
> -static int
> -au1550_ioctl_mixdev(struct inode *inode, struct file *file,
> -			       unsigned int cmd, unsigned long arg)
> +static long
> +au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg)
>  {
>  	struct au1550_state *s = (struct au1550_state *)file->private_data;
>  	struct ac97_codec *codec = s->codec;
> +	int ret;
> +
> +	lock_kernel();
> +	ret = mixdev_ioctl(codec, cmd, arg);
> +	unlock_kernel();
>  
> -	return mixdev_ioctl(codec, cmd, arg);
> +	return ret;
>  }

General comment...
In several places you declare a local variable of type "int",
but the function return a long.

I know that mixdev_ioctl() return an int so nothing is lost but
it just looks wrong.

> diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
> index 3f3c3f7..b5464fb 100644
> --- a/sound/oss/dmasound/dmasound_core.c
> +++ b/sound/oss/dmasound/dmasound_core.c
> @@ -337,8 +337,8 @@ static int mixer_release(struct inode *inode, struct file *file)
>  	unlock_kernel();
>  	return 0;
>  }
> -static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
> -		       u_long arg)
> +
> +static long mixer_ioctl(struct file *file, u_int cmd, u_long arg)
>  {
>  	if (_SIOC_DIR(cmd) & _SIOC_WRITE)
>  	    mixer.modify_counter++;
> @@ -362,11 +362,22 @@ static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
>  	return -EINVAL;
>  }
>  
> +static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
> +{
> +	int ret;
> +
> +	lock_kernel();
> +	ret = mixer_ioctl(file, cmd, arg);
> +	unlock_kernel();
> +
> +	return ret;
> +}

Here it looks like a potential but.
mixer_ioctl() return a long which is stored in an int and then we return a long.


> -static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
> -		    u_long arg)
> +static long sq_ioctl(struct file *file, u_int cmd, u_long arg)
>  {
>  	int val, result;
>  	u_long fmt;
> @@ -1114,18 +1124,29 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
>  		return IOCTL_OUT(arg,val);
>  
>  	default:
> -		return mixer_ioctl(inode, file, cmd, arg);
> +		return mixer_ioctl(file, cmd, arg);
>  	}
>  	return -EINVAL;
>  }
>  
> +static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
> +{
> +	int ret;
> +
> +	lock_kernel();
> +	ret = sq_ioctl(file, cmd, arg);
> +	unlock_kernel();
> +
> +	return ret;
> +}
ditto: long -> int -> long


	Sam

  reply	other threads:[~2010-07-04 11:08 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-03 22:15 [PATCH 0/6] kill .ioctl file_operation Arnd Bergmann
2010-07-03 22:15 ` [PATCH 1/6] ia64/perfmon: convert to unlocked_ioctl Arnd Bergmann
2010-07-21 23:16   ` Frederic Weisbecker
2010-07-03 22:15 ` [PATCH 2/6] sound/oss: " Arnd Bergmann
2010-07-04 11:08   ` Sam Ravnborg [this message]
2010-07-04 20:52     ` Arnd Bergmann
2010-07-03 22:15 ` [PATCH 3/6] autofs/autofs4: move compat_ioctl handling into fs Arnd Bergmann
2010-07-05 19:24   ` Frederic Weisbecker
2010-07-05 19:42     ` H. Peter Anvin
2010-07-05 19:48       ` Frederic Weisbecker
2010-07-05 19:52         ` Arnd Bergmann
2010-07-05 19:58           ` Frederic Weisbecker
2010-07-05 20:12             ` H. Peter Anvin
2010-07-06  1:11             ` Ian Kent
2010-07-06 11:35               ` Arnd Bergmann
2010-07-06 13:17                 ` Ian Kent
2010-07-16  0:14                   ` Frederic Weisbecker
2010-07-16  4:40                     ` Ian Kent
2010-07-16 11:05                       ` Arnd Bergmann
2010-07-16 12:09                         ` Frederic Weisbecker
2010-07-03 22:15 ` [PATCH 4/6] cris: Pushdown the bkl from ioctl Arnd Bergmann
2010-07-30 17:08   ` Jesper Nilsson
2010-07-03 22:15 ` [PATCH 5/6] v4l: convert v4l2-dev to unlocked_ioctl Arnd Bergmann
2010-07-05 19:27   ` Frederic Weisbecker
2010-07-03 22:15 ` [PATCH 6/6] bkl: remove locked .ioctl file operation Arnd Bergmann

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=20100704110835.GA31920@merkur.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnd@arndb.de \
    --cc=fweisbec@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.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 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®