From: Greg KH <gregkh@linuxfoundation.org>
To: Bhumika Goyal <bhumirks@gmail.com>
Cc: outreachy-kernel@googlegroups.com, markh@compro.net,
lidza.louina@gmail.com
Subject: Re: [PATCH] Staging: dgnc: constify attribute_group structures
Date: Sun, 2 Oct 2016 17:22:44 +0200 [thread overview]
Message-ID: <20161002152244.GA32091@kroah.com> (raw)
In-Reply-To: <1475160534-23482-1-git-send-email-bhumirks@gmail.com>
On Thu, Sep 29, 2016 at 08:18:54PM +0530, Bhumika Goyal wrote:
> Check for attribute_group structures that are only passed as a second
> argument to the functions sysfs_remove_group and sysfs_create_group. As
> these arguments are constant so, attribute_group structures having this
> property can also be made constant.
> Done using coccinelle:
>
> @r1 disable optional_qualifier @
> identifier i;
> position p;
> @@
> static struct attribute_group i@p = {...};
>
> @ok1@
> identifier r1.i;
> position p;
> expression e1;
> @@
> (
> sysfs_remove_group(e1,&i@p)
> |
> sysfs_create_group(e1,&i@p)
> )
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> static
> +const
> struct attribute_group i={...};
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct attribute_group i;
>
> File size before:
> text data bss dec hex filename
> 6248 1024 0 7272 1c68
> drivers/staging/dgnc/dgnc_sysfs.o
>
> File size after:
> text data bss dec hex filename
> 6288 960 0 7248 1c50
> drivers/staging/dgnc/dgnc_sysfs.o
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
> drivers/staging/dgnc/dgnc_sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
> index a83e0e4..290bf6e 100644
> --- a/drivers/staging/dgnc/dgnc_sysfs.c
> +++ b/drivers/staging/dgnc/dgnc_sysfs.c
> @@ -677,7 +677,7 @@ static struct attribute *dgnc_sysfs_tty_entries[] = {
> NULL
> };
>
> -static struct attribute_group dgnc_tty_attribute_group = {
> +static const struct attribute_group dgnc_tty_attribute_group = {
> .name = NULL,
> .attrs = dgnc_sysfs_tty_entries,
> };
I'll take this patch, but all of these sysfs files should be removed
from the driver, as there are standard ways of getting this information
from a tty device that is not using this interface.
So if you want to send a follow-on patch, removing all of them, I would
really appreciate it.
thanks,
greg k-h
next prev parent reply other threads:[~2016-10-02 15:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 14:48 [PATCH] Staging: dgnc: constify attribute_group structures Bhumika Goyal
2016-09-29 18:16 ` [Outreachy kernel] " Julia Lawall
2016-09-29 18:20 ` Julia Lawall
2016-10-02 15:22 ` Greg KH [this message]
2016-10-02 20:10 ` Bhumika Goyal
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=20161002152244.GA32091@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=bhumirks@gmail.com \
--cc=lidza.louina@gmail.com \
--cc=markh@compro.net \
--cc=outreachy-kernel@googlegroups.com \
/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 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.