Most fasync implementations do something like:
return fasync_helper(...);
But fasync_helper() will return a positive value at times - a feature used
in at least one place. Thus, a number of other drivers do:
err = fasync_helper(...);
if (err < 0)
return err;
return 0;
In the interests of consistency and more concise code, it makes sense to
map positive return values onto zero where ->fasync() is called.
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
17 files changed:
static int sonypi_misc_fasync(int fd, struct file *filp, int on)
{
static int sonypi_misc_fasync(int fd, struct file *filp, int on)
{
- int retval;
-
- retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
- if (retval < 0)
- return retval;
- return 0;
+ return fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
}
static int sonypi_misc_release(struct inode *inode, struct file *file)
}
static int sonypi_misc_release(struct inode *inode, struct file *file)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->minor->dev;
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->minor->dev;
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
(long)old_encode_dev(priv->minor->device));
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
(long)old_encode_dev(priv->minor->device));
- retcode = fasync_helper(fd, filp, on, &dev->buf_async);
- if (retcode < 0)
- return retcode;
- return 0;
+ return fasync_helper(fd, filp, on, &dev->buf_async);
}
EXPORT_SYMBOL(drm_fasync);
}
EXPORT_SYMBOL(drm_fasync);
*/
static int hiddev_fasync(int fd, struct file *file, int on)
{
*/
static int hiddev_fasync(int fd, struct file *file, int on)
{
struct hiddev_list *list = file->private_data;
struct hiddev_list *list = file->private_data;
- retval = fasync_helper(fd, file, on, &list->fasync);
-
- return retval < 0 ? retval : 0;
+ return fasync_helper(fd, file, on, &list->fasync);
struct video_card *video = file_to_video_card(file);
struct video_card *video = file_to_video_card(file);
- int retval = fasync_helper(fd, file, on, &video->fasync);
-
- if (retval < 0)
- return retval;
- return 0;
+ return fasync_helper(fd, file, on, &video->fasync);
}
static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
}
static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
static int evdev_fasync(int fd, struct file *file, int on)
{
struct evdev_client *client = file->private_data;
static int evdev_fasync(int fd, struct file *file, int on)
{
struct evdev_client *client = file->private_data;
- int retval;
-
- retval = fasync_helper(fd, file, on, &client->fasync);
- return retval < 0 ? retval : 0;
+ return fasync_helper(fd, file, on, &client->fasync);
}
static int evdev_flush(struct file *file, fl_owner_t id)
}
static int evdev_flush(struct file *file, fl_owner_t id)
static int joydev_fasync(int fd, struct file *file, int on)
{
static int joydev_fasync(int fd, struct file *file, int on)
{
struct joydev_client *client = file->private_data;
struct joydev_client *client = file->private_data;
- retval = fasync_helper(fd, file, on, &client->fasync);
-
- return retval < 0 ? retval : 0;
+ return fasync_helper(fd, file, on, &client->fasync);
}
static void joydev_free(struct device *dev)
}
static void joydev_free(struct device *dev)
static int mousedev_fasync(int fd, struct file *file, int on)
{
static int mousedev_fasync(int fd, struct file *file, int on)
{
struct mousedev_client *client = file->private_data;
struct mousedev_client *client = file->private_data;
- retval = fasync_helper(fd, file, on, &client->fasync);
-
- return retval < 0 ? retval : 0;
+ return fasync_helper(fd, file, on, &client->fasync);
}
static void mousedev_free(struct device *dev)
}
static void mousedev_free(struct device *dev)
static int serio_raw_fasync(int fd, struct file *file, int on)
{
struct serio_raw_list *list = file->private_data;
static int serio_raw_fasync(int fd, struct file *file, int on)
{
struct serio_raw_list *list = file->private_data;
- retval = fasync_helper(fd, file, on, &list->fasync);
- return retval < 0 ? retval : 0;
+ return fasync_helper(fd, file, on, &list->fasync);
}
static struct serio_raw *serio_raw_locate(int minor)
}
static struct serio_raw *serio_raw_locate(int minor)
static int cosa_fasync(struct inode *inode, struct file *file, int on)
{
int port = iminor(inode);
static int cosa_fasync(struct inode *inode, struct file *file, int on)
{
int port = iminor(inode);
- int rv = fasync_helper(inode, file, on, &fasync[port]);
- return rv < 0 ? rv : 0;
+
+ return fasync_helper(inode, file, on, &fasync[port]);
static int sonypi_misc_fasync(int fd, struct file *filp, int on)
{
static int sonypi_misc_fasync(int fd, struct file *filp, int on)
{
- int retval;
-
- retval = fasync_helper(fd, filp, on, &sonypi_compat.fifo_async);
- if (retval < 0)
- return retval;
- return 0;
+ return fasync_helper(fd, filp, on, &sonypi_compat.fifo_async);
}
static int sonypi_misc_release(struct inode *inode, struct file *file)
}
static int sonypi_misc_release(struct inode *inode, struct file *file)
static int
sg_fasync(int fd, struct file *filp, int mode)
{
static int
sg_fasync(int fd, struct file *filp, int mode)
{
Sg_device *sdp;
Sg_fd *sfp;
Sg_device *sdp;
Sg_fd *sfp;
SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n",
sdp->disk->disk_name, mode));
SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n",
sdp->disk->disk_name, mode));
- retval = fasync_helper(fd, filp, mode, &sfp->async_qp);
- return (retval < 0) ? retval : 0;
+ return fasync_helper(fd, filp, mode, &sfp->async_qp);
error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
if (error < 0)
goto out;
error = filp->f_op->fasync(fd, filp, (arg & FASYNC) != 0);
if (error < 0)
goto out;
+ if (error > 0)
+ error = 0;
}
spin_lock(&filp->f_lock);
filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK);
}
spin_lock(&filp->f_lock);
filp->f_flags = (arg & SETFL_MASK) | (filp->f_flags & ~SETFL_MASK);
+ return error < 0 ? error : 0;
}
static int ioctl_fsfreeze(struct file *filp)
}
static int ioctl_fsfreeze(struct file *filp)
retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_readers);
mutex_unlock(&inode->i_mutex);
retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_readers);
mutex_unlock(&inode->i_mutex);
- if (retval < 0)
- return retval;
-
- return 0;
retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_writers);
mutex_unlock(&inode->i_mutex);
retval = fasync_helper(fd, filp, on, &inode->i_pipe->fasync_writers);
mutex_unlock(&inode->i_mutex);
- if (retval < 0)
- return retval;
-
- return 0;
fasync_helper(-1, filp, 0, &pipe->fasync_readers);
}
mutex_unlock(&inode->i_mutex);
fasync_helper(-1, filp, 0, &pipe->fasync_readers);
}
mutex_unlock(&inode->i_mutex);
-
- if (retval < 0)
- return retval;
-
- return 0;
static int snd_ctl_fasync(int fd, struct file * file, int on)
{
struct snd_ctl_file *ctl;
static int snd_ctl_fasync(int fd, struct file * file, int on)
{
struct snd_ctl_file *ctl;
ctl = file->private_data;
ctl = file->private_data;
- err = fasync_helper(fd, file, on, &ctl->fasync);
- if (err < 0)
- return err;
- return 0;
+ return fasync_helper(fd, file, on, &ctl->fasync);
err = fasync_helper(fd, file, on, &runtime->fasync);
out:
unlock_kernel();
err = fasync_helper(fd, file, on, &runtime->fasync);
out:
unlock_kernel();
- if (err < 0)
- return err;
- return 0;
static int snd_timer_user_fasync(int fd, struct file * file, int on)
{
struct snd_timer_user *tu;
static int snd_timer_user_fasync(int fd, struct file * file, int on)
{
struct snd_timer_user *tu;
- err = fasync_helper(fd, file, on, &tu->fasync);
- if (err < 0)
- return err;
- return 0;
+ return fasync_helper(fd, file, on, &tu->fasync);
}
static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
}
static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,