Skip to content

Commit fcd9814

Browse files
committed
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 0c4ab18 ("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
2 parents 5516745 + 3975b09 commit fcd9814

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

drivers/hid/hid-sensor-custom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ static int hid_sensor_custom_open(struct inode *inode, struct file *file)
687687
if (test_and_set_bit(0, &sensor_inst->misc_opened))
688688
return -EBUSY;
689689

690-
return nonseekable_open(inode, file);
690+
return stream_open(inode, file);
691691
}
692692

693693
static __poll_t hid_sensor_custom_poll(struct file *file,

drivers/input/mousedev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
558558
goto err_free_client;
559559

560560
file->private_data = client;
561-
nonseekable_open(inode, file);
561+
stream_open(inode, file);
562562

563563
return 0;
564564

scripts/coccinelle/api/stream_open.cocci

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ identifier fops0.fops;
134134
.llseek = no_llseek,
135135
};
136136

137+
@ has_noop_llseek @
138+
identifier fops0.fops;
139+
@@
140+
struct file_operations fops = {
141+
.llseek = noop_llseek,
142+
};
143+
137144
@ has_mmap @
138145
identifier fops0.fops;
139146
identifier mmap_f;
@@ -180,7 +187,7 @@ identifier splice_write_f;
180187
//
181188
// XXX for simplicity require no .{read/write}_iter and no .splice_{read/write} for now.
182189
// 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 @
184191
identifier fops0.fops;
185192
@@
186193
struct file_operations fops = {

0 commit comments

Comments
 (0)