diff options
author | Jonathan Corbet <corbet@lwn.net> | 2009-02-01 16:52:56 -0500 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2009-03-16 10:34:35 -0400 |
commit | 60aa49243d09afc873f082567d2e3c16634ced84 (patch) | |
tree | bb7c8d9668b35a3aa4e90d0a62500ac9d3e67f7f /drivers | |
parent | 76398425bb06b07cc3a3b1ce169c67dc9d6874ed (diff) |
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: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/sonypi.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 6 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 5 | ||||
-rw-r--r-- | drivers/ieee1394/dv1394.c | 6 | ||||
-rw-r--r-- | drivers/input/evdev.c | 5 | ||||
-rw-r--r-- | drivers/input/joydev.c | 5 | ||||
-rw-r--r-- | drivers/input/mousedev.c | 5 | ||||
-rw-r--r-- | drivers/input/serio/serio_raw.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/cosa.c | 4 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 7 | ||||
-rw-r--r-- | drivers/scsi/sg.c | 4 |
11 files changed, 12 insertions, 46 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index f4374437a033..fd3dced97776 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -888,12 +888,7 @@ found: | |||
888 | 888 | ||
889 | static int sonypi_misc_fasync(int fd, struct file *filp, int on) | 889 | static int sonypi_misc_fasync(int fd, struct file *filp, int on) |
890 | { | 890 | { |
891 | int retval; | 891 | return fasync_helper(fd, filp, on, &sonypi_device.fifo_async); |
892 | |||
893 | retval = fasync_helper(fd, filp, on, &sonypi_device.fifo_async); | ||
894 | if (retval < 0) | ||
895 | return retval; | ||
896 | return 0; | ||
897 | } | 892 | } |
898 | 893 | ||
899 | static int sonypi_misc_release(struct inode *inode, struct file *file) | 894 | static int sonypi_misc_release(struct inode *inode, struct file *file) |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index f52663ebe016..e13cb62bbaee 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -337,14 +337,10 @@ int drm_fasync(int fd, struct file *filp, int on) | |||
337 | { | 337 | { |
338 | struct drm_file *priv = filp->private_data; | 338 | struct drm_file *priv = filp->private_data; |
339 | struct drm_device *dev = priv->minor->dev; | 339 | struct drm_device *dev = priv->minor->dev; |
340 | int retcode; | ||
341 | 340 | ||
342 | DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, | 341 | DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, |
343 | (long)old_encode_dev(priv->minor->device)); | 342 | (long)old_encode_dev(priv->minor->device)); |
344 | retcode = fasync_helper(fd, filp, on, &dev->buf_async); | 343 | return fasync_helper(fd, filp, on, &dev->buf_async); |
345 | if (retcode < 0) | ||
346 | return retcode; | ||
347 | return 0; | ||
348 | } | 344 | } |
349 | EXPORT_SYMBOL(drm_fasync); | 345 | EXPORT_SYMBOL(drm_fasync); |
350 | 346 | ||
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 4940e4d70c2d..3a7b4fe192a3 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -227,12 +227,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) | |||
227 | */ | 227 | */ |
228 | static int hiddev_fasync(int fd, struct file *file, int on) | 228 | static int hiddev_fasync(int fd, struct file *file, int on) |
229 | { | 229 | { |
230 | int retval; | ||
231 | struct hiddev_list *list = file->private_data; | 230 | struct hiddev_list *list = file->private_data; |
232 | 231 | ||
233 | retval = fasync_helper(fd, file, on, &list->fasync); | 232 | return fasync_helper(fd, file, on, &list->fasync); |
234 | |||
235 | return retval < 0 ? retval : 0; | ||
236 | } | 233 | } |
237 | 234 | ||
238 | 235 | ||
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c index 3838bc4acaba..cb15bfa38d70 100644 --- a/drivers/ieee1394/dv1394.c +++ b/drivers/ieee1394/dv1394.c | |||
@@ -1325,11 +1325,7 @@ static int dv1394_fasync(int fd, struct file *file, int on) | |||
1325 | 1325 | ||
1326 | struct video_card *video = file_to_video_card(file); | 1326 | struct video_card *video = file_to_video_card(file); |
1327 | 1327 | ||
1328 | int retval = fasync_helper(fd, file, on, &video->fasync); | 1328 | return fasync_helper(fd, file, on, &video->fasync); |
1329 | |||
1330 | if (retval < 0) | ||
1331 | return retval; | ||
1332 | return 0; | ||
1333 | } | 1329 | } |
1334 | 1330 | ||
1335 | static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) | 1331 | static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index ed8baa0aec3c..7a7a026ba712 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -94,11 +94,8 @@ static void evdev_event(struct input_handle *handle, | |||
94 | static int evdev_fasync(int fd, struct file *file, int on) | 94 | static int evdev_fasync(int fd, struct file *file, int on) |
95 | { | 95 | { |
96 | struct evdev_client *client = file->private_data; | 96 | struct evdev_client *client = file->private_data; |
97 | int retval; | ||
98 | |||
99 | retval = fasync_helper(fd, file, on, &client->fasync); | ||
100 | 97 | ||
101 | return retval < 0 ? retval : 0; | 98 | return fasync_helper(fd, file, on, &client->fasync); |
102 | } | 99 | } |
103 | 100 | ||
104 | static int evdev_flush(struct file *file, fl_owner_t id) | 101 | static int evdev_flush(struct file *file, fl_owner_t id) |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index 6f2366220a50..4224f0112849 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -159,12 +159,9 @@ static void joydev_event(struct input_handle *handle, | |||
159 | 159 | ||
160 | static int joydev_fasync(int fd, struct file *file, int on) | 160 | static int joydev_fasync(int fd, struct file *file, int on) |
161 | { | 161 | { |
162 | int retval; | ||
163 | struct joydev_client *client = file->private_data; | 162 | struct joydev_client *client = file->private_data; |
164 | 163 | ||
165 | retval = fasync_helper(fd, file, on, &client->fasync); | 164 | return fasync_helper(fd, file, on, &client->fasync); |
166 | |||
167 | return retval < 0 ? retval : 0; | ||
168 | } | 165 | } |
169 | 166 | ||
170 | static void joydev_free(struct device *dev) | 167 | static void joydev_free(struct device *dev) |
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index ef99a7e6d40c..17fd6d46d082 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c | |||
@@ -403,12 +403,9 @@ static void mousedev_event(struct input_handle *handle, | |||
403 | 403 | ||
404 | static int mousedev_fasync(int fd, struct file *file, int on) | 404 | static int mousedev_fasync(int fd, struct file *file, int on) |
405 | { | 405 | { |
406 | int retval; | ||
407 | struct mousedev_client *client = file->private_data; | 406 | struct mousedev_client *client = file->private_data; |
408 | 407 | ||
409 | retval = fasync_helper(fd, file, on, &client->fasync); | 408 | return fasync_helper(fd, file, on, &client->fasync); |
410 | |||
411 | return retval < 0 ? retval : 0; | ||
412 | } | 409 | } |
413 | 410 | ||
414 | static void mousedev_free(struct device *dev) | 411 | static void mousedev_free(struct device *dev) |
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index 06bbd0e74c6f..b03009bb7468 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -58,10 +58,8 @@ static unsigned int serio_raw_no; | |||
58 | static int serio_raw_fasync(int fd, struct file *file, int on) | 58 | static int serio_raw_fasync(int fd, struct file *file, int on) |
59 | { | 59 | { |
60 | struct serio_raw_list *list = file->private_data; | 60 | struct serio_raw_list *list = file->private_data; |
61 | int retval; | ||
62 | 61 | ||
63 | retval = fasync_helper(fd, file, on, &list->fasync); | 62 | return fasync_helper(fd, file, on, &list->fasync); |
64 | return retval < 0 ? retval : 0; | ||
65 | } | 63 | } |
66 | 64 | ||
67 | static struct serio_raw *serio_raw_locate(int minor) | 65 | static struct serio_raw *serio_raw_locate(int minor) |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index d80b72e22dea..ce753e9c576b 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -993,8 +993,8 @@ static struct fasync_struct *fasync[256] = { NULL, }; | |||
993 | static int cosa_fasync(struct inode *inode, struct file *file, int on) | 993 | static int cosa_fasync(struct inode *inode, struct file *file, int on) |
994 | { | 994 | { |
995 | int port = iminor(inode); | 995 | int port = iminor(inode); |
996 | int rv = fasync_helper(inode, file, on, &fasync[port]); | 996 | |
997 | return rv < 0 ? rv : 0; | 997 | return fasync_helper(inode, file, on, &fasync[port]); |
998 | } | 998 | } |
999 | #endif | 999 | #endif |
1000 | 1000 | ||
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 537959d07148..bc8996c849ac 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -1917,12 +1917,7 @@ static struct sonypi_compat_s sonypi_compat = { | |||
1917 | 1917 | ||
1918 | static int sonypi_misc_fasync(int fd, struct file *filp, int on) | 1918 | static int sonypi_misc_fasync(int fd, struct file *filp, int on) |
1919 | { | 1919 | { |
1920 | int retval; | 1920 | return fasync_helper(fd, filp, on, &sonypi_compat.fifo_async); |
1921 | |||
1922 | retval = fasync_helper(fd, filp, on, &sonypi_compat.fifo_async); | ||
1923 | if (retval < 0) | ||
1924 | return retval; | ||
1925 | return 0; | ||
1926 | } | 1921 | } |
1927 | 1922 | ||
1928 | static int sonypi_misc_release(struct inode *inode, struct file *file) | 1923 | static int sonypi_misc_release(struct inode *inode, struct file *file) |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 516925d8b570..b4ef2f84ea32 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1154,7 +1154,6 @@ sg_poll(struct file *filp, poll_table * wait) | |||
1154 | static int | 1154 | static int |
1155 | sg_fasync(int fd, struct file *filp, int mode) | 1155 | sg_fasync(int fd, struct file *filp, int mode) |
1156 | { | 1156 | { |
1157 | int retval; | ||
1158 | Sg_device *sdp; | 1157 | Sg_device *sdp; |
1159 | Sg_fd *sfp; | 1158 | Sg_fd *sfp; |
1160 | 1159 | ||
@@ -1163,8 +1162,7 @@ sg_fasync(int fd, struct file *filp, int mode) | |||
1163 | SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n", | 1162 | SCSI_LOG_TIMEOUT(3, printk("sg_fasync: %s, mode=%d\n", |
1164 | sdp->disk->disk_name, mode)); | 1163 | sdp->disk->disk_name, mode)); |
1165 | 1164 | ||
1166 | retval = fasync_helper(fd, filp, mode, &sfp->async_qp); | 1165 | return fasync_helper(fd, filp, mode, &sfp->async_qp); |
1167 | return (retval < 0) ? retval : 0; | ||
1168 | } | 1166 | } |
1169 | 1167 | ||
1170 | static int | 1168 | static int |