aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-14 20:08:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-14 20:08:08 -0400
commitfcd98147ac71f35b69e2f50b5fddc5524dd2dfa8 (patch)
tree8471ea0f5092dc4e1fe503be2b0a07c569206794
parent55167453111d3a1e600e29ba6c8e63906bb4821b (diff)
parent3975b097e577bac77267ed8df0f525e3ad3499ec (diff)
Merge tag 'stream_open-5.3' of https://lab.nexedi.com/kirr/linux
Pull stream_open() updates from Kirill Smelkov: "This time on stream_open front it is only two small changes: - the first one converts stream_open.cocci to treat all functions that start with wait_.* as blocking. Previously it was only wait_event_.* functions that were considered as blocking, but this was falsely reporting several deadlock cases as only warning. This was picked by linux-kbuild and entered mainline as commit 0c4ab18fc33b ("coccinelle: api/stream_open: treat all wait_.*() calls as blocking"), and already merged earlier. - the second one teaches stream_open.cocci to consider files as being stream-like even if they use noop_llseek. It results in two more drivers being converted to stream_open() (mousedev.c and hid-sensor-custom.c)" * tag 'stream_open-5.3' of https://lab.nexedi.com/kirr/linux: *: convert stream-like files -> stream_open, even if they use noop_llseek
-rw-r--r--drivers/hid/hid-sensor-custom.c2
-rw-r--r--drivers/input/mousedev.c2
-rw-r--r--scripts/coccinelle/api/stream_open.cocci9
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c
index c60f82673cf2..fb827c295842 100644
--- a/drivers/hid/hid-sensor-custom.c
+++ b/drivers/hid/hid-sensor-custom.c
@@ -687,7 +687,7 @@ static int hid_sensor_custom_open(struct inode *inode, struct file *file)
687 if (test_and_set_bit(0, &sensor_inst->misc_opened)) 687 if (test_and_set_bit(0, &sensor_inst->misc_opened))
688 return -EBUSY; 688 return -EBUSY;
689 689
690 return nonseekable_open(inode, file); 690 return stream_open(inode, file);
691} 691}
692 692
693static __poll_t hid_sensor_custom_poll(struct file *file, 693static __poll_t hid_sensor_custom_poll(struct file *file,
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 3b73e0f17848..505c562a5daa 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -558,7 +558,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
558 goto err_free_client; 558 goto err_free_client;
559 559
560 file->private_data = client; 560 file->private_data = client;
561 nonseekable_open(inode, file); 561 stream_open(inode, file);
562 562
563 return 0; 563 return 0;
564 564
diff --git a/scripts/coccinelle/api/stream_open.cocci b/scripts/coccinelle/api/stream_open.cocci
index 12ce18fa6b74..df00d6619b06 100644
--- a/scripts/coccinelle/api/stream_open.cocci
+++ b/scripts/coccinelle/api/stream_open.cocci
@@ -134,6 +134,13 @@ identifier fops0.fops;
134 .llseek = no_llseek, 134 .llseek = no_llseek,
135 }; 135 };
136 136
137@ has_noop_llseek @
138identifier fops0.fops;
139@@
140 struct file_operations fops = {
141 .llseek = noop_llseek,
142 };
143
137@ has_mmap @ 144@ has_mmap @
138identifier fops0.fops; 145identifier fops0.fops;
139identifier mmap_f; 146identifier mmap_f;
@@ -180,7 +187,7 @@ identifier splice_write_f;
180// 187//
181// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now. 188// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now.
182// XXX maybe_steam.fops cannot be used in other rules - it gives "bad rule maybe_stream or bad variable fops". 189// XXX maybe_steam.fops cannot be used in other rules - it gives "bad rule maybe_stream or bad variable fops".
183@ maybe_stream depends on (!has_llseek || has_no_llseek) && !has_mmap && !has_copy_file_range && !has_remap_file_range && !has_read_iter && !has_write_iter && !has_splice_read && !has_splice_write @ 190@ maybe_stream depends on (!has_llseek || has_no_llseek || has_noop_llseek) && !has_mmap && !has_copy_file_range && !has_remap_file_range && !has_read_iter && !has_write_iter && !has_splice_read && !has_splice_write @
184identifier fops0.fops; 191identifier fops0.fops;
185@@ 192@@
186 struct file_operations fops = { 193 struct file_operations fops = {