Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1614414
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | simran singhal <singhalsimran0@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH] iio: adc: hx711: constify attribute_group structures |
| Date | Sat, 01 Apr 2017 10:20:01 +0200 |
| Message-ID | <trmql-8uf-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=1bfHbTGAvgQOCk9RmGbPPvGDuJBHgGbGknmjrhN8vQ0=; b=CWGec6vaDTViatWy0HkCvTjO5pDbP5JqImolFyZMNlrVUPYztVZumWvZEFkBp/+TMt 8V5v/bP8blan0xf9oFLTrkCB3lf/m8WePkSdaitING0BKudTdBd+Rso647AtGGRhARuT EXgtyvNnYFYleQdsw86mfYvTS+RRJ8Hoezvj32JYeBGNxQzj3jRLESpq6BKRszwHOcIa JxkNbZdkRjvdrrqADSh2XiVpem+PCMHGImGor15X4AzreYxK0ECcBChJr1uBDMIXTCOz GtxymA1a7oECdd2+1DsWe36p+m30wMGbLkU8L0/79G75xtCqIBt2vhe2ZZakx8o1SmY0 YbLg== |
| 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=1bfHbTGAvgQOCk9RmGbPPvGDuJBHgGbGknmjrhN8vQ0=; b=CcbDjG82WhpODnaw7rYiT99OasjF9/N/7znAp4TJ5fv+xPbnBAelMjIiTuTWzkwvcv V33kdkF0oPXi2D01AUzBCKRLR5fkx5LohyKnxzyKHLorle84dM0GAIMGLoNyfDLQS9HD Dr72wsquB3VKCnZvo/z98djBDRLSxL8tpVoEs2MOESbpYZZ0AJ5kVWkV5N1IVyuRDc/o UFCGCF3Y/NUI2GgzPZXvGJLKHgvyIviI812duB5XXpwhmTPwRd9Nfoa9rJvWqZP/rK7d Pz9pl/PtB7I7cTVgPh5tg2vAxwAaoCkLvBPU9M/+fbcmFlpI2El3IeaLFg1STm+vs3wj zKlg== |
| X-Gm-Message-State | AFeK/H0NnPEZVBnP3DxJct5UMmWIWuqYKZEofF7rGe2B8SvzD/voXWUAJ1r/e9mDRIaHBg== |
| X-Received | by 10.98.7.86 with SMTP id b83mr6595857pfd.66.1491034675184; Sat, 01 Apr 2017 01:17:55 -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:47:51 +0530 |
| X-Original-Message-ID | <20170401081751.GA30133@singhal-Inspiron-5558> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1614414 |
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
3042 480 0 3522 dc2 drivers/iio/adc/hx711.o
File size after:
text data bss dec hex filename
3098 416 0 3514 dba drivers/iio/adc/hx711.o
Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
drivers/iio/adc/hx711.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index 139639f..27005d8 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -369,7 +369,7 @@ static struct attribute *hx711_attributes[] = {
NULL,
};
-static struct attribute_group hx711_attribute_group = {
+static const struct attribute_group hx711_attribute_group = {
.attrs = hx711_attributes,
};
--
2.7.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] iio: adc: hx711: constify attribute_group structures simran singhal <singhalsimran0@gmail.com> - 2017-04-01 10:20 +0200 Re: [PATCH] iio: adc: hx711: constify attribute_group structures Jonathan Cameron <jic23@kernel.org> - 2017-04-01 12:40 +0200
csiph-web