Declare the show function and let procfs open and free the seq_file.
->proc_open() only preallocates the buffer now.

Signed-off-by: Christian Brauner (Amutable) <[email protected]>
---
 fs/proc/stat.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index 79b42f2bfd00..3bfb79edc0f6 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -161,15 +161,13 @@ static int stat_open(struct inode *inode, struct file 
*file)
 
        /* minimum size to display an interrupt count : 2 bytes */
        size += 2 * irq_get_nr_irqs();
-       return single_open_size(file, show_stat, NULL, size);
+       return seq_preallocate(file->private_data, size);
 }
 
 static const struct proc_ops stat_proc_ops = {
        .proc_flags     = PROC_ENTRY_PERMANENT,
+       .proc_show      = show_stat,
        .proc_open      = stat_open,
-       .proc_read_iter = seq_read_iter,
-       .proc_lseek     = seq_lseek,
-       .proc_release   = single_release,
 };
 
 static int __init proc_stat_init(void)

-- 
2.53.0

Reply via email to