Skip to contentSkip to conversation

gpiolib: cdev: convert stream-like files from

PATCH In review Yang Li 3 participants 3 messages Feb 7, 2021 – Feb 12, 2021

Subsystems (2)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 gpiolib: cdev: convert stream-like files from

Eliminate the following coccicheck warning:
./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.

---
 drivers/gpio/gpiolib-cdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-cdev.c +1 -1
index 1631727..bad68ef 100644
@@ -2304,7 +2304,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)
 	get_device(&gdev->dev);
 	file->private_data = cdev;
 
-	ret = nonseekable_open(inode, file);
+	ret = stream_open(inode, file);
 	if (ret)
 		goto out_unregister_notifier;
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 25 lines · Yang Li

Eliminate the following coccicheck warning:
./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.

---
 drivers/gpio/gpiolib-cdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib-cdev.c +1 -2
index 1631727..bad68ef 100644
@@ -2304,7 +2304,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file)
        get_device(&gdev->dev);
        file->private_data = cdev;
 
-       ret = nonseekable_open(inode, file);
+       ret = stream_open(inode, file);
        if (ret)
                goto out_unregister_notifier;
 
--
Quoted 2 lines

1.8.3.1

I think you have a false positive here - we don't even take the offset argument into account so I don't see how the line_watch_read callback could be interpreted as seekable.

Bart

#2 lore raw
In reply to Yang Li
Quoted 6 lines · Yang Li

Eliminate the following coccicheck warning:
./drivers/gpio/gpiolib-cdev.c:2307:7-23: WARNING: gpio_fileops: .read() has stream semantic; safe to change nonseekable_open -> stream_open.

This doesn't make any sense to me.

It is pretty clear from context that this file should *not* be seeked and it seems just dangerous to randomly allow that. Better safe than sorry.

I don't know if the function nonseekable_open() has an unintuitive name if it means anything else than that. I burnt myself on the FS before.

Yours,
Linus Walleij