Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751342AbbHBL0U (ORCPT ); Sun, 2 Aug 2015 07:26:20 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:57120 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750850AbbHBL0T (ORCPT ); Sun, 2 Aug 2015 07:26:19 -0400 X-IronPort-AV: E=Sophos;i="5.15,594,1432591200"; d="scan'208";a="172418053" Date: Sun, 2 Aug 2015 13:26:16 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@localhost6.localdomain6 To: Shraddha Barke cc: Oleg Drokin , Andreas Dilger , Al Viro , Greg Kroah-Hartman , Frank Zago , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Staging : lustre: Struct file_operations should be const In-Reply-To: <1438513366-23462-1-git-send-email-shraddha.6596@gmail.com> Message-ID: References: <1438513366-23462-1-git-send-email-shraddha.6596@gmail.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1816 Lines: 53 On Sun, 2 Aug 2015, Shraddha Barke wrote: > This patch fixes the following checkpatch.pl warning: > > WARNING: struct file_operations should normally be const This is not the good way to write the message. The information it conveys is "checkpatch generated this warning, so I have made some change (unspecified) that make checkpatch not complain". A better approach would be to say: Declare the file_operations structure ll_file_operations as const, as done elsewhere in the kernel, as there are no modifications to its fields. Problem found using checkpatch. This way the reader knows what was done, and what issues were taken into account when making the change. At the same time, you still credit checkpatch for helping you find the problem julia > > Signed-off-by: Shraddha Barke > --- > drivers/staging/lustre/lustre/llite/file.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c > index dcd0c6d..369a722 100644 > --- a/drivers/staging/lustre/lustre/llite/file.c > +++ b/drivers/staging/lustre/lustre/llite/file.c > @@ -3116,7 +3116,7 @@ int ll_inode_permission(struct inode *inode, int mask) > } > > /* -o localflock - only provides locally consistent flock locks */ > -struct file_operations ll_file_operations = { > +const struct file_operations ll_file_operations = { > .read_iter = ll_file_read_iter, > .write_iter = ll_file_write_iter, > .unlocked_ioctl = ll_file_ioctl, > -- > 2.1.0 > > -- 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/