From: Ingo Molnar Subject: Re: [PATCHv2 3/3] simple_open: Automatically convert to simple_open() Date: Tue, 13 Mar 2012 11:23:58 +0100 Message-ID: <20120313102358.GB1516@elte.hu> References: <1331631988-20527-1-git-send-email-sboyd@codeaurora.org> <1331631988-20527-4-git-send-email-sboyd@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Greg Kroah-Hartman , Al Viro , Julia Lawall , Andrew Morton To: Stephen Boyd Return-path: Content-Disposition: inline In-Reply-To: <1331631988-20527-4-git-send-email-sboyd@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org * Stephen Boyd wrote: > Many users of debugfs copy the implementation of default_open() > when they want to support a custom read/write function op. This > leads to a proliferation of the default_open() implementation > across the entire tree. Now that the common implementation has > been consolidated into libfs we can replace all the users of this > function with simple_open(). > > This replacement was done with the following semantic patch: > > > @ open @ > identifier open_f != simple_open; > identifier i, f; > @@ > -int open_f(struct inode *i, struct file *f) > -{ > ( > -if (i->i_private) > -f->private_data = i->i_private; > | > -f->private_data = i->i_private; > ) > -return 0; > -} > > @ has_open depends on open @ > identifier fops; > identifier open.open_f; > @@ > struct file_operations fops = { > ... > -.open = open_f, > +.open = simple_open, > ... > }; > > > Signed-off-by: Stephen Boyd > Cc: Greg Kroah-Hartman > Cc: Al Viro > Cc: Julia Lawall > Cc: Andrew Morton > --- > arch/arm/mach-msm/smd_debug.c | 8 +---- > arch/arm/plat-mxc/audmux-v2.c | 8 +---- > arch/x86/kernel/kdebugfs.c | 9 +---- Acked-by: Ingo Molnar Thanks, Ingo