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

Commit 60aa4924 authored by Jonathan Corbet's avatar Jonathan Corbet
Browse files

Rationalize fasync return values



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: default avatarJonathan Corbet <corbet@lwn.net>
parent 76398425
Loading
Loading
Loading
Loading
+1 −6
Original line number Original line Diff line number Diff line
@@ -888,12 +888,7 @@ static irqreturn_t sonypi_irq(int irq, void *dev_id)


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;
	return fasync_helper(fd, filp, on, &sonypi_device.fifo_async);

	retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async);
	if (retval < 0)
		return retval;
	return 0;
}
}


static int sonypi_misc_release(struct inode *inode, struct file *file)
static int sonypi_misc_release(struct inode *inode, struct file *file)
+1 −5
Original line number Original line Diff line number Diff line
@@ -337,14 +337,10 @@ int drm_fasync(int fd, struct file *filp, int on)
{
{
	struct drm_file *priv = filp->private_data;
	struct drm_file *priv = filp->private_data;
	struct drm_device *dev = priv->minor->dev;
	struct drm_device *dev = priv->minor->dev;
	int retcode;


	DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
	DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
		  (long)old_encode_dev(priv->minor->device));
		  (long)old_encode_dev(priv->minor->device));
	retcode = fasync_helper(fd, filp, on, &dev->buf_async);
	return fasync_helper(fd, filp, on, &dev->buf_async);
	if (retcode < 0)
		return retcode;
	return 0;
}
}
EXPORT_SYMBOL(drm_fasync);
EXPORT_SYMBOL(drm_fasync);


+1 −4
Original line number Original line Diff line number Diff line
@@ -227,12 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
 */
 */
static int hiddev_fasync(int fd, struct file *file, int on)
static int hiddev_fasync(int fd, struct file *file, int on)
{
{
	int retval;
	struct hiddev_list *list = file->private_data;
	struct hiddev_list *list = file->private_data;


	retval = fasync_helper(fd, file, on, &list->fasync);
	return fasync_helper(fd, file, on, &list->fasync);

	return retval < 0 ? retval : 0;
}
}




+1 −5
Original line number Original line Diff line number Diff line
@@ -1325,11 +1325,7 @@ static int dv1394_fasync(int fd, struct file *file, int on)


	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);
	return fasync_helper(fd, file, on, &video->fasync);

	if (retval < 0)
		return retval;
        return 0;
}
}


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)
+1 −4
Original line number Original line Diff line number Diff line
@@ -94,11 +94,8 @@ static void evdev_event(struct input_handle *handle,
static int evdev_fasync(int fd, struct file *file, int on)
static int evdev_fasync(int fd, struct file *file, int on)
{
{
	struct evdev_client *client = file->private_data;
	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)
Loading