fs/romfs/inode.c: trivial improvements
authorWANG Cong <xiyou.wangcong@gmail.com>
Wed, 17 Oct 2007 06:26:15 +0000 (23:26 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 15:42:47 +0000 (08:42 -0700)
- There are no lists in fs/romfs/inode.c, so using list_entry
  is a bit confusing.  Replace it with container_of.

- It is unnecessary to cast the return value of
  kmem_cache_alloc, since it returns a void* pointer.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/romfs/inode.c

index 7c5e5f573b056133b58df7c581fcb7e1acd260db..a49cf5b9a195d32c51c7f077ea7b60cc7dc22cf8 100644 (file)
@@ -92,7 +92,7 @@ static inline unsigned long romfs_maxsize(struct super_block *sb)
 
 static inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
 {
-       return list_entry(inode, struct romfs_inode_info, vfs_inode);
+       return container_of(inode, struct romfs_inode_info, vfs_inode);
 }
 
 static __u32
@@ -555,7 +555,7 @@ static struct kmem_cache * romfs_inode_cachep;
 static struct inode *romfs_alloc_inode(struct super_block *sb)
 {
        struct romfs_inode_info *ei;
-       ei = (struct romfs_inode_info *)kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
+       ei = kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
        if (!ei)
                return NULL;
        return &ei->vfs_inode;