Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1614416
| Path | csiph.com!xmission!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | simran singhal <singhalsimran0@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] iio: humidity: hdc100x: constify attribute_group structures |
| Date | Sat, 01 Apr 2017 10:30:02 +0200 |
| Message-ID | <trmA2-5T-5@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=EbCGLNPDjBuUE+3281DSzHWAD/xxDQ8r6EBbUUgoU88=; b=JnL85T8cmzrLGqv4HR6vOgrH71Lr20IYpoQiREqpsz4XdliqUmWTnsfJeceiZjbTdZ iGBPn4SUm4Frof6nj2dcufhoiVedpX/CJsy13Xphe5YxD9j8IkifwxhTT11caMmSk3rX ChUfygpdriG7mHgNBWDH+ZJzn+CvL9FBwq/iPNnBKaghWYL1kLeXHQprPF1Sc4C/HfkV dYnbzAyfDhA2oNQUmFCd3q1TP3djeqhalWx5Cn/qkd+A8EkctsLqvfsAMl01FiDI/W9R muTXAwUhdA3DkUF5cwwU45OZG3y9YFOeAL439OQhkF8n1RBG1zkgGBzCbZItNvPW8aVX S79g== |
| 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=EbCGLNPDjBuUE+3281DSzHWAD/xxDQ8r6EBbUUgoU88=; b=pkc10N6cWn49Lfbywcc/aVniP6vwpiuaNc/4JY6gsndcdPkSHZaw66k9to82Noe0gm vbpi3slWZuvb6eMN/163KTVtmEop+Z6De0N9OESBVVkl+kUBdOmB09U/I4YUJItHBg/r 7OMcsq6CEn42SVuxmWAMvvKKQWVEALo/ZlOgKaQJcvifmTsIBeGNfUpp0rQgyvTcUxNL 6O0/mai+R5mFiV3lIG/OhFN6IqVjbADC3vh9TaC7LBh7zl8B2W1neAFqbfK0+gjYHj5C /yj2iSg21qeuL4fNQYT6rC2BxjyClxQn7Hflk+wtawWP/Psx9fxAzOyPasGE09bq4C4Y R2+w== |
| X-Gm-Message-State | AFeK/H2M64AyynBqAJka7PAlFtw7owxjqR1b4rlpN6XlVQiC/Bx87lc9rxnaBbKkXkQ4Vw== |
| X-Received | by 10.98.214.156 with SMTP id a28mr6263430pfl.40.1491035017105; Sat, 01 Apr 2017 01:23:37 -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:53:33 +0530 |
| X-Original-Message-ID | <20170401082333.GA3515@singhal-Inspiron-5558> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1614416 |
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
3459 488 0 3947 f6b drivers/iio/humidity/hdc100x.o
File size after:
text data bss dec hex filename
3507 424 0 3931 f5b drivers/iio/humidity/hdc100x.o
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
drivers/iio/humidity/hdc100x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index 265c34d..aa17115 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -79,7 +79,7 @@ static struct attribute *hdc100x_attributes[] = {
NULL
};
-static struct attribute_group hdc100x_attribute_group = {
+static const struct attribute_group hdc100x_attribute_group = {
.attrs = hdc100x_attributes,
};
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] iio: humidity: hdc100x: constify attribute_group structures simran singhal <singhalsimran0@gmail.com> - 2017-04-01 10:30 +0200 Re: [PATCH] iio: humidity: hdc100x: constify attribute_group structures Jonathan Cameron <jic23@kernel.org> - 2017-04-01 12:40 +0200
csiph-web