On Wed, 24 Sep 2014 12:15:55 +0100 Rob Jones <rob.jones@xxxxxxxxxxxxxxx> wrote:
Add a new function to help reduce boilerplate code.
This is a wrapper function for seq_open() that will simplify the code in a
significant number of cases where seq_open() is currently called.
It's first use is in __seq_open_private(), thereby recovering most of
the code space used by the new function.
It would be nice to include one or more of the conversions in this patch
series so we can see what the effects look like.
@@ -639,28 +639,38 @@ int seq_release_private(struct inode *inode, struct file *file)
+int seq_open_init(struct file *f, const struct seq_operations *ops, void *p)
+ struct seq_file *s;
+ int rc;
+ rc = seq_open(f, ops);
+ if (rc)
+ return rc;
+ s = f->private_data;
+ s->private = p;
+ return 0;
A global exported-to-modules interface should be documented, please.
Especially when it has a void* argument. seq_file.c is patchy - some
of it is documented, some of it uses the read-programmers-mind
And now seq_open_init() has
but these all refer to the same thing. Can we have a bit of
consistency in the naming please? I suggest "private", to match
the seq_file field.