* [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning @ 2016-02-09 23:58 Rakhi Sharma 2016-02-10 6:14 ` [Outreachy kernel] " Sudip Mukherjee 2016-02-10 7:23 ` Julia Lawall 0 siblings, 2 replies; 6+ messages in thread From: Rakhi Sharma @ 2016-02-09 23:58 UTC (permalink / raw) To: outreachy-kernel; +Cc: Julia.Lawall, daniel.baluta, gregkh, Rakhi Sharma Fixed a checkpatch warning. WARNING: struct file_operations should normally be const Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> --- drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index b43ce6c..bba37bf 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -288,7 +288,7 @@ static int pool_proc_open(struct inode *inode, struct file *file) return rc; } -static struct file_operations pool_proc_operations = { +static const struct file_operations pool_proc_operations = { .open = pool_proc_open, .read = seq_read, .llseek = seq_lseek, -- 1.9.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning 2016-02-09 23:58 [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning Rakhi Sharma @ 2016-02-10 6:14 ` Sudip Mukherjee 2016-02-10 6:54 ` RAKHI SHARMA 2016-02-10 7:23 ` Julia Lawall 1 sibling, 1 reply; 6+ messages in thread From: Sudip Mukherjee @ 2016-02-10 6:14 UTC (permalink / raw) To: Rakhi Sharma; +Cc: outreachy-kernel, Julia.Lawall, daniel.baluta, gregkh On Wed, Feb 10, 2016 at 05:28:46AM +0530, Rakhi Sharma wrote: > Fixed a checkpatch warning. > WARNING: struct file_operations should normally be const > > Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> > --- It now adds new build warning: ../drivers/staging/lustre/lustre/lov/lov_pool.c: In function ‘lov_pool_new’: ../drivers/staging/lustre/lustre/lov/lov_pool.c:438:7: warning: passing argument 4 of ‘ldebugfs_add_simple’ discards ‘const’ qualifier from pointer target type [enabled by default] &pool_proc_operations); ^ In file included from ../drivers/staging/lustre/lustre/lov/../include/linux/../obd_support.h:43:0, from ../drivers/staging/lustre/lustre/lov/../include/linux/obd.h:44, from ../drivers/staging/lustre/lustre/lov/../include/obd.h:40, from ../drivers/staging/lustre/lustre/lov/lov_pool.c:49: ../drivers/staging/lustre/lustre/lov/../include/linux/../lprocfs_status.h:547:16: note: expected ‘struct file_operations *’ but argument is of type ‘const struct file_operations *’ struct dentry *ldebugfs_add_simple(struct dentry *root, regards sudip ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning 2016-02-10 6:14 ` [Outreachy kernel] " Sudip Mukherjee @ 2016-02-10 6:54 ` RAKHI SHARMA 2016-02-10 7:03 ` Julia Lawall 2016-02-10 7:37 ` Sudip Mukherjee 0 siblings, 2 replies; 6+ messages in thread From: RAKHI SHARMA @ 2016-02-10 6:54 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: outreachy-kernel, Julia Lawall, Daniel Baluta, gregkh [-- Attachment #1: Type: text/plain, Size: 1578 bytes --] On Wed, Feb 10, 2016 at 11:44 AM, Sudip Mukherjee < sudipm.mukherjee@gmail.com> wrote: > On Wed, Feb 10, 2016 at 05:28:46AM +0530, Rakhi Sharma wrote: > > Fixed a checkpatch warning. > > WARNING: struct file_operations should normally be const > > > > Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> > > --- > > It now adds new build warning: > > ../drivers/staging/lustre/lustre/lov/lov_pool.c: In function > ‘lov_pool_new’: > ../drivers/staging/lustre/lustre/lov/lov_pool.c:438:7: warning: passing > argument 4 of ‘ldebugfs_add_simple’ discards ‘const’ qualifier from pointer > target type [enabled by default] > &pool_proc_operations); > ^ > In file included from > ../drivers/staging/lustre/lustre/lov/../include/linux/../obd_support.h:43:0, > from > ../drivers/staging/lustre/lustre/lov/../include/linux/obd.h:44, > from > ../drivers/staging/lustre/lustre/lov/../include/obd.h:40, > from ../drivers/staging/lustre/lustre/lov/lov_pool.c:49: > ../drivers/staging/lustre/lustre/lov/../include/linux/../lprocfs_status.h:547:16: > note: expected ‘struct file_operations *’ but argument is of type ‘const > struct file_operations *’ > struct dentry *ldebugfs_add_simple(struct dentry *root, > > regards > hi Sudip, Will you please help me to understand why this warning produce? Is the const I have put there is wrong? but as I think it is ok there.may be I am wrong this side, please let me know how this is going on? thanks Rakhi > sudip > > [-- Attachment #2: Type: text/html, Size: 2251 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning 2016-02-10 6:54 ` RAKHI SHARMA @ 2016-02-10 7:03 ` Julia Lawall 2016-02-10 7:37 ` Sudip Mukherjee 1 sibling, 0 replies; 6+ messages in thread From: Julia Lawall @ 2016-02-10 7:03 UTC (permalink / raw) To: RAKHI SHARMA; +Cc: Sudip Mukherjee, outreachy-kernel, Daniel Baluta, gregkh [-- Attachment #1: Type: TEXT/PLAIN, Size: 2988 bytes --] On Wed, 10 Feb 2016, RAKHI SHARMA wrote: > > > On Wed, Feb 10, 2016 at 11:44 AM, Sudip Mukherjee > <sudipm.mukherjee@gmail.com> wrote: > On Wed, Feb 10, 2016 at 05:28:46AM +0530, Rakhi Sharma wrote: > > Fixed a checkpatch warning. > > WARNING: struct file_operations should normally be const > > > > Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> > > --- > > It now adds new build warning: > > ../drivers/staging/lustre/lustre/lov/lov_pool.c: In function > ‘lov_pool_new’: > ../drivers/staging/lustre/lustre/lov/lov_pool.c:438:7: warning: > passing argument 4 of ‘ldebugfs_add_simple’ discards ‘const’ > qualifier from pointer target type [enabled by default] > &pool_proc_operations); > ^ > In file included from../drivers/staging/lustre/lustre/lov/../include/linux/../obd_support.h:43:0 > , > from > ../drivers/staging/lustre/lustre/lov/../include/linux/obd.h:44, > from > ../drivers/staging/lustre/lustre/lov/../include/obd.h:40, > from > ../drivers/staging/lustre/lustre/lov/lov_pool.c:49: > ../drivers/staging/lustre/lustre/lov/../include/linux/../lprocfs_status.h:5 > 47:16: note: expected ‘struct file_operations *’ but argument is > of type ‘const struct file_operations *’ > struct dentry *ldebugfs_add_simple(struct dentry *root, > > regards > > hi Sudip, > Will you please help me to understand why this warning produce? Is the const > I have put there is wrong? but as I think it is ok there.may be I am wrong > this side, please let me know how this is going on? In general, a structure is something that gets passed around in the code. If you put the annotation const on it, then all of the variables that point to it, eg functon parameters, local variables etc, also have to be annotated with const. Otherwise, the compiler is not certain that there can be no modification to the structure. If you get a warning like this one, then you should look at the code that it mentions and see if it can be annotated with const too. And so on. Normally a file operations structure should not be modified, so it should work out in the end. But everythng has to be consistent. julia > thanks > Rakhi > sudip > > > -- > You received this message because you are subscribed to the Google Groups > "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to outreachy-kernel+unsubscribe@googlegroups.com. > To post to this group, send email to outreachy-kernel@googlegroups.com. > To view this discussion on the web visithttps://groups.google.com/d/msgid/outreachy-kernel/CAMnyiXsk1P19XHUCx11%3Ds > %2BRtwXSDL-fMxAJdkSaaqdrD6hFSyw%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning 2016-02-10 6:54 ` RAKHI SHARMA 2016-02-10 7:03 ` Julia Lawall @ 2016-02-10 7:37 ` Sudip Mukherjee 1 sibling, 0 replies; 6+ messages in thread From: Sudip Mukherjee @ 2016-02-10 7:37 UTC (permalink / raw) To: RAKHI SHARMA; +Cc: outreachy-kernel, Julia Lawall, Daniel Baluta, gregkh On Wed, Feb 10, 2016 at 12:24:56PM +0530, RAKHI SHARMA wrote: > On Wed, Feb 10, 2016 at 11:44 AM, Sudip Mukherjee < > sudipm.mukherjee@gmail.com> wrote: > > > On Wed, Feb 10, 2016 at 05:28:46AM +0530, Rakhi Sharma wrote: > > > Fixed a checkpatch warning. > > > WARNING: struct file_operations should normally be const > > > > > > Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> > > > --- > > > > It now adds new build warning: > > > > ../drivers/staging/lustre/lustre/lov/lov_pool.c: In function > > ‘lov_pool_new’: > > ../drivers/staging/lustre/lustre/lov/lov_pool.c:438:7: warning: passing > > argument 4 of ‘ldebugfs_add_simple’ discards ‘const’ qualifier from pointer > > target type [enabled by default] > > &pool_proc_operations); > > ^ > > In file included from > > ../drivers/staging/lustre/lustre/lov/../include/linux/../obd_support.h:43:0, > > from > > ../drivers/staging/lustre/lustre/lov/../include/linux/obd.h:44, > > from > > ../drivers/staging/lustre/lustre/lov/../include/obd.h:40, > > from ../drivers/staging/lustre/lustre/lov/lov_pool.c:49: > > ../drivers/staging/lustre/lustre/lov/../include/linux/../lprocfs_status.h:547:16: > > note: expected ‘struct file_operations *’ but argument is of type ‘const > > struct file_operations *’ > > struct dentry *ldebugfs_add_simple(struct dentry *root, > > > > regards > > > hi Sudip, > Will you please help me to understand why this warning produce? Is the > const I have put there is wrong? but as I think it is ok there.may be I am > wrong this side, please let me know how this is going on? you should have also made it as const in the argument of ldebugfs_add_simple() in drivers/staging/lustre/lustre/include/lprocfs_status.h. regards sudip ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning 2016-02-09 23:58 [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning Rakhi Sharma 2016-02-10 6:14 ` [Outreachy kernel] " Sudip Mukherjee @ 2016-02-10 7:23 ` Julia Lawall 1 sibling, 0 replies; 6+ messages in thread From: Julia Lawall @ 2016-02-10 7:23 UTC (permalink / raw) To: Rakhi Sharma; +Cc: outreachy-kernel, Julia.Lawall, daniel.baluta, gregkh Again, the description of the file in the subject line should be shortened and the comment needs to be more clear about what is done. On Wed, 10 Feb 2016, Rakhi Sharma wrote: > Fixed a checkpatch warning. > WARNING: struct file_operations should normally be const The commit message should also say more clearly what you did. What change did you make to cause the warning to go away. In this case, it would also make sense to say where the structure is used, and to argue why a const value is acceptable at those places. julia > Signed-off-by: Rakhi Sharma <rakhish1994@gmail.com> > --- > drivers/staging/lustre/lustre/lov/lov_pool.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c > index b43ce6c..bba37bf 100644 > --- a/drivers/staging/lustre/lustre/lov/lov_pool.c > +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c > @@ -288,7 +288,7 @@ static int pool_proc_open(struct inode *inode, struct file *file) > return rc; > } > > -static struct file_operations pool_proc_operations = { > +static const struct file_operations pool_proc_operations = { > .open = pool_proc_open, > .read = seq_read, > .llseek = seq_lseek, > -- > 1.9.1 > > -- > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com. > To post to this group, send email to outreachy-kernel@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455062326-20870-1-git-send-email-rakhish1994%40gmail.com. > For more options, visit https://groups.google.com/d/optout. > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-10 7:37 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-09 23:58 [PATCH] drivers: staging: lustre: lustre: lov: lov_pool: Fixed a warning Rakhi Sharma 2016-02-10 6:14 ` [Outreachy kernel] " Sudip Mukherjee 2016-02-10 6:54 ` RAKHI SHARMA 2016-02-10 7:03 ` Julia Lawall 2016-02-10 7:37 ` Sudip Mukherjee 2016-02-10 7:23 ` Julia Lawall
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.