Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1614415
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | simran singhal <singhalsimran0@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] iio: light: apds9960: constify attribute_group structures |
| Date | Sat, 01 Apr 2017 10:30:02 +0200 |
| Message-ID | <trmA2-5T-1@gated-at.bofh.it> (permalink) |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=lgsq7AhYj64ddTzMpwI9xaYB4O9ukqcWhtbWP+mwwXo=; b=hmDPRBwQru4rilFdgaQZ+qssB6YbQzWniQ+EzHfy14NeHr1VpdOopA/IqiRRrJTbys 28T0RLpT/cS09rD9vn1Lyge6IQjMfNGktxkv6vU5tvMlOyeh2bxeOWgT77OyPiYhvw4n 8tFjHyWuEY8qTHyGT7gKbmRRYxp2DM5mvYXGPKembdHICmFxjF23Qt2Av52lrUDphHFa XVibNyPNkyWmFROrhseDBinnpsoPCCA/eudMSjvJK4h+8XA6mAlE6PSDTWSgwF+e1HXk 6l21Iz+WTZTisvR5MIbNuZ7IUstaHjWwEToqz7SMsxRWOz8rOF/vllIaU1LnjYqg+35v RcKw== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=lgsq7AhYj64ddTzMpwI9xaYB4O9ukqcWhtbWP+mwwXo=; b=eDC+kT6qu1N4LMa4YS7F74CEV+vbTkNzRcaE46uiaVs5TfuokfnYQYQc2Z6sVI6y8w 9MDCLZIfLMC+NuJCd98yq2NrYgxhjshDhtgYdqSyzrorE/hL+iPngs4Iw98Ji7zaNf4M 9L9loNjGe492hwpadKmwURbLBFBknliVb5axxYHjoAzg8npzKZDS/69zYDdTvP3kT7LJ HRb1XVl36OFnluk+KXdwYLTnfnxhjRml1ts7O8cUXuCW/GYUkeBNQ0oIXCJjoPUDv26c f7S6LXrTzOFF0Kk+OB6Pr6ZpaikcVrY4toddcF3YrZW7JIjnzar+UOq8wGnRwYDuHFKT sidw== |
| X-Gm-Message-State | AFeK/H3SSEfmJzJm0kWs0oREoP8mvT91Ufpsvu8v/KUV5YaAAvVGOC6+2IaMENnZOvxXxQ== |
| X-Received | by 10.98.25.202 with SMTP id 193mr6660406pfz.134.1491035353565; Sat, 01 Apr 2017 01:29:13 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 66 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Sat, 1 Apr 2017 13:59:10 +0530 |
| X-Original-Message-ID | <20170401082910.GA10374@singhal-Inspiron-5558> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1614415 |
Show key headers only | View raw
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};
@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&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
8503 488 0 8991 231f drivers/iio/light/apds9960.o
File size after:
text data bss dec hex filename
8567 424 0 8991 231f drivers/iio/light/apds9960.o
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
drivers/iio/light/apds9960.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
index 90bc98d..c7af36d 100644
--- a/drivers/iio/light/apds9960.c
+++ b/drivers/iio/light/apds9960.c
@@ -343,7 +343,7 @@ static struct attribute *apds9960_attributes[] = {
NULL,
};
-static struct attribute_group apds9960_attribute_group = {
+static const struct attribute_group apds9960_attribute_group = {
.attrs = apds9960_attributes,
};
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] iio: light: apds9960: constify attribute_group structures simran singhal <singhalsimran0@gmail.com> - 2017-04-01 10:30 +0200 Re: [PATCH] iio: light: apds9960: constify attribute_group structures Jonathan Cameron <jic23@kernel.org> - 2017-04-01 12:40 +0200
csiph-web