aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 19:14:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-26 19:14:02 -0400
commit8e9d2089723d08d51e66c5eea49253d76e27941e (patch)
treecf15609d5eeb0c1f3a39231d8ce793d3c8ad0ed0 /drivers
parentba1eb95cf3cc666769afe42eaa15a3a34ae82f94 (diff)
parent60aa49243d09afc873f082567d2e3c16634ced84 (diff)
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: Rationalize fasync return values Move FASYNC bit handling to f_op->fasync() Use f_lock to protect f_flags Rename struct file->f_ep_lock
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/sonypi.c7
-rw-r--r--drivers/char/tty_io.c5
-rw-r--r--drivers/gpu/drm/drm_fops.c6
-rw-r--r--drivers/hid/usbhid/hiddev.c5
-rw-r--r--drivers/ieee1394/dv1394.c6
-rw-r--r--drivers/input/evdev.c5
-rw-r--r--drivers/input/joydev.c5
-rw-r--r--drivers/input/mousedev.c5
-rw-r--r--drivers/input/serio/serio_raw.c4
-rw-r--r--drivers/net/wan/cosa.c4
-rw-r--r--drivers/platform/x86/sony-laptop.c7
-rw-r--r--drivers/scsi/sg.c4
-rw-r--r--drivers/usb/gadget/file_storage.c7
13 files changed, 20 insertions, 50 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
889static int sonypi_misc_fasync(int fd, struct file *filp, int on) 889static 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
899static int sonypi_misc_release(struct inode *inode, struct file *file) 894static int sonypi_misc_release(struct inode *inode, struct file *file)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bc84e125c6bc..224f271d8cbe 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2162,13 +2162,12 @@ static int fionbio(struct file *file, int __user *p)
2162 if (get_user(nonblock, p)) 2162 if (get_user(nonblock, p))
2163 return -EFAULT; 2163 return -EFAULT;
2164 2164
2165 /* file->f_flags is still BKL protected in the fs layer - vomit */ 2165 spin_lock(&file->f_lock);
2166 lock_kernel();
2167 if (nonblock) 2166 if (nonblock)
2168 file->f_flags |= O_NONBLOCK; 2167 file->f_flags |= O_NONBLOCK;
2169 else 2168 else
2170 file->f_flags &= ~O_NONBLOCK; 2169 file->f_flags &= ~O_NONBLOCK;
2171 unlock_kernel(); 2170 spin_unlock(&file->f_lock);
2172 return 0; 2171 return 0;
2173} 2172}
2174 2173
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}
349EXPORT_SYMBOL(drm_fasync); 345EXPORT_SYMBOL(drm_fasync);
350 346
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 1f5b5d4c3c34..aa214170baf4 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 */
228static int hiddev_fasync(int fd, struct file *file, int on) 228static 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
1335static ssize_t dv1394_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) 1331static 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,
94static int evdev_fasync(int fd, struct file *file, int on) 94static 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
104static int evdev_flush(struct file *file, fl_owner_t id) 101static 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
160static int joydev_fasync(int fd, struct file *file, int on) 160static 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
170static void joydev_free(struct device *dev) 167static 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
404static int mousedev_fasync(int fd, struct file *file, int on) 404static 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
414static void mousedev_free(struct device *dev) 411static 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;
58static int serio_raw_fasync(int fd, struct file *file, int on) 58static 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
67static struct serio_raw *serio_raw_locate(int minor) 65static struct serio_raw *serio_raw_locate(int minor)
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index d276d72ee3b7..61581ee5f08c 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -998,8 +998,8 @@ static struct fasync_struct *fasync[256] = { NULL, };
998static int cosa_fasync(struct inode *inode, struct file *file, int on) 998static int cosa_fasync(struct inode *inode, struct file *file, int on)
999{ 999{
1000 int port = iminor(inode); 1000 int port = iminor(inode);
1001 int rv = fasync_helper(inode, file, on, &fasync[port]); 1001
1002 return rv < 0 ? rv : 0; 1002 return fasync_helper(inode, file, on, &fasync[port]);
1003} 1003}
1004#endif 1004#endif
1005 1005
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
1918static int sonypi_misc_fasync(int fd, struct file *filp, int on) 1918static 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
1928static int sonypi_misc_release(struct inode *inode, struct file *file) 1923static 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)
1154static int 1154static int
1155sg_fasync(int fd, struct file *filp, int mode) 1155sg_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
1170static int 1168static int
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index d3c2464dee82..5c030b080d4c 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1711,7 +1711,9 @@ static int do_write(struct fsg_dev *fsg)
1711 curlun->sense_data = SS_WRITE_PROTECTED; 1711 curlun->sense_data = SS_WRITE_PROTECTED;
1712 return -EINVAL; 1712 return -EINVAL;
1713 } 1713 }
1714 spin_lock(&curlun->filp->f_lock);
1714 curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait 1715 curlun->filp->f_flags &= ~O_SYNC; // Default is not to wait
1716 spin_unlock(&curlun->filp->f_lock);
1715 1717
1716 /* Get the starting Logical Block Address and check that it's 1718 /* Get the starting Logical Block Address and check that it's
1717 * not too big */ 1719 * not too big */
@@ -1728,8 +1730,11 @@ static int do_write(struct fsg_dev *fsg)
1728 curlun->sense_data = SS_INVALID_FIELD_IN_CDB; 1730 curlun->sense_data = SS_INVALID_FIELD_IN_CDB;
1729 return -EINVAL; 1731 return -EINVAL;
1730 } 1732 }
1731 if (fsg->cmnd[1] & 0x08) // FUA 1733 if (fsg->cmnd[1] & 0x08) { // FUA
1734 spin_lock(&curlun->filp->f_lock);
1732 curlun->filp->f_flags |= O_SYNC; 1735 curlun->filp->f_flags |= O_SYNC;
1736 spin_unlock(&curlun->filp->f_lock);
1737 }
1733 } 1738 }
1734 if (lba >= curlun->num_sectors) { 1739 if (lba >= curlun->num_sectors) {
1735 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; 1740 curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE;