fs/fscache/object-list.c: use __seq_open_private()
authorRob Jones <rob.jones@codethink.co.uk>
Wed, 17 Sep 2014 08:56:40 +0000 (09:56 +0100)
committerDavid Howells <dhowells@redhat.com>
Mon, 13 Oct 2014 16:52:21 +0000 (17:52 +0100)
Reduce boilerplate code by using __seq_open_private() instead of seq_open()
in fscache_objlist_open().

Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
fs/fscache/object-list.c

index b8179ca6bf9d125aa7862012eb61e5a43b85234e..51dde817e1f24aadc445d17ef19f8256879cf0cf 100644 (file)
@@ -380,26 +380,14 @@ no_config:
 static int fscache_objlist_open(struct inode *inode, struct file *file)
 {
        struct fscache_objlist_data *data;
-       struct seq_file *m;
-       int ret;
 
-       ret = seq_open(file, &fscache_objlist_ops);
-       if (ret < 0)
-               return ret;
-
-       m = file->private_data;
-
-       /* buffer for key extraction */
-       data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
-       if (!data) {
-               seq_release(inode, file);
+       data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
+       if (!data)
                return -ENOMEM;
-       }
 
        /* get the configuration key */
        fscache_objlist_config(data);
 
-       m->private = data;
        return 0;
 }