mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Andy Whitcroft <apw@shadowen.org>
Cc: Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 11/13] checkpatch: struct file_operations should normally be const
Date: Mon, 8 Dec 2008 19:30:43 -0500	[thread overview]
Message-ID: <20081209003043.GB12482@goodmis.org> (raw)
In-Reply-To: <1228674650-24392-12-git-send-email-apw@shadowen.org>

On Sun, Dec 07, 2008 at 06:30:48PM +0000, Andy Whitcroft wrote:
> From: Andy Whitcroft <apw@canonical.com>
> 
> In the general use case struct file_operations should be a const object.
> Check for and warn where it is not.  As suggested by Steven and Ingo.

Andy,

Thanks for doing this!

Acked-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> 
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  scripts/checkpatch.pl |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index c39ce0b..94371f6 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2509,6 +2509,11 @@ sub process {
>  		if ($line =~ /^.\s*__initcall\s*\(/) {
>  			WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
>  		}
> +# check for struct file_operations, ensure they are const.
> +		if ($line =~ /\bstruct\s+file_operations\b/ &&
> +		    $line !~ /\bconst\b/) {
> +			WARN("struct file_operations should normally be const\n" . $herecurr);
> +		}
>  
>  # use of NR_CPUS is usually wrong
>  # ignore definitions of NR_CPUS and usage to define arrays as likely right
> -- 
> 1.6.0.4.911.gc990
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

  reply	other threads:[~2008-12-09  0:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-07 18:30 [PATCH 00/13] update checkpatch to version 0.26 Andy Whitcroft
2008-12-07 18:30 ` [PATCH 01/13] checkpatch: update MAINTAINERS entry Andy Whitcroft
2008-12-07 18:30 ` [PATCH 02/13] checkpatch: update copyrights Andy Whitcroft
2008-12-07 18:30 ` [PATCH 03/13] checkpatch: Add warning for p0-patches Andy Whitcroft
2008-12-07 18:30 ` [PATCH 04/13] checkpatch: allow parentheses on return for comparisons Andy Whitcroft
2008-12-07 18:30 ` [PATCH 05/13] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h Andy Whitcroft
2008-12-07 18:30 ` [PATCH 06/13] checkpatch: loosen spacing on typedef function checks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 07/13] checkpatch: fix continuation detection when handling spacing on operators Andy Whitcroft
2008-12-07 18:30 ` [PATCH 08/13] checkpatch: track #ifdef/#else/#endif when tracking blocks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 09/13] checkpatch: do not report nr_static as a static declaration Andy Whitcroft
2008-12-07 18:30 ` [PATCH 10/13] checkpatch: ensure we actually detect if assignments split across lines Andy Whitcroft
2008-12-07 18:30 ` [PATCH 11/13] checkpatch: struct file_operations should normally be const Andy Whitcroft
2008-12-09  0:30   ` Steven Rostedt [this message]
2008-12-07 18:30 ` [PATCH 12/13] checkpatch: fix the perlcritic errors Andy Whitcroft
2008-12-07 18:30 ` [PATCH 13/13] checkpatch: version: 0.26 Andy Whitcroft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081209003043.GB12482@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@osdl.org \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®