Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1681443

[PATCH] input: ims-pcu: Constify attribute_group structures.

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Arvind Yadav <arvind.yadav.cs@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] input: ims-pcu: Constify attribute_group structures.
Date Wed, 05 Jul 2017 12:40:02 +0200
Message-ID <tZPSW-537-5@gated-at.bofh.it> (permalink)
X-Original-To dmitry.torokhov@gmail.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=6qRM2WoRqm+lO8wM5CrHvTc1KVrdGJ1/UIoss4d23/I=; b=frrDmguQCEhC86Ngf3aWkpw7Jc7dxZXFKIdUj25b5kRXVMJ4QpMnvpn2RNxI9kAkzQ sdljdoxNo2bZC0de6gvZ3Tp0Az6UZaBD/fhVAuFiUyzucg5FeAKc2Fhzpu9fq9wvR7Vu +sGMLwTokyghXfiBhg+1tighP6Zwd9/VBruYL7heHV5wwUfAGRwxkpJLhoLMIckQ/k2Q ayIneG7nZuPWci/KwKpXUIsu+hxQTRzxLEyEVOKijxYWhbEfjgcwJiEQJGxeKTAJHIP+ 6c7HAUKhq5XiJVpAM40mjHx4pSq7c2uOyWAPks0TuVyWpyUqpigpMccoDjyNFiJpn07k dqBQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6qRM2WoRqm+lO8wM5CrHvTc1KVrdGJ1/UIoss4d23/I=; b=k9lA+iL0eGQ65w1fbVCIO1+kJ4bhGUbJTFqzVMU3kTXn13XW3uIh+oOjM4DG3lfvvi PbroLI7Avz7D5mhn1G2P4KxwI4vNlv/Vjt7t2POsP0zLOWuaXCFgYLVRzwvFQGS0xg2z YoY8VOSUiYr7TYM8x4lf4WWF05WJSJOVdhOCYUEJ+Fe63i3ygPI/a/2XPHoROswCWIB9 dhPH87FPiLWLNVY08Ez9AenGePYqmVdQFbgq+4kbRH8CxNY3FuvD8k2tiYhRFauZIHiG utctW2DZvyJEKn4KEp4PqwNG3y6jMOGNJL6C1Mwjnlx+H3G3WUTPJgC/4yGDVMpD8M0x iEqw==
X-Gm-Message-State AIVw1129gHmj5vJ+nA7D/KCW6WcdBQEa3vTx6nf3CUZH9ryuYN1YN5Dz +wtfm8cj0pTYUA==
X-Received by 10.98.194.141 with SMTP id w13mr12908705pfk.41.1499250911488; Wed, 05 Jul 2017 03:35:11 -0700 (PDT)
X-Mailer git-send-email 1.9.1
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 41
Organization linux.* mail to news gateway
X-Original-Cc linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Wed, 5 Jul 2017 16:04:54 +0530
X-Original-Message-ID <4d578e7696c17e4ae288707c723fbfb7a48e4ccb.1499250830.git.arvind.yadav.cs@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1681443

Show key headers only | View raw


attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  13547	   1600	      0	  15147	   3b2b	drivers/input/misc/ims-pcu.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  13675	   1472	      0	  15147	   3b2b	drivers/input/misc/ims-pcu.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/input/misc/ims-pcu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index f4e8fbe..6bf82ea 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1261,7 +1261,7 @@ static umode_t ims_pcu_is_attr_visible(struct kobject *kobj,
 	return mode;
 }
 
-static struct attribute_group ims_pcu_attr_group = {
+static const struct attribute_group ims_pcu_attr_group = {
 	.is_visible	= ims_pcu_is_attr_visible,
 	.attrs		= ims_pcu_attrs,
 };
@@ -1480,7 +1480,7 @@ struct ims_pcu_ofn_bit_attribute ims_pcu_ofn_attr_##_field = {		\
 	NULL
 };
 
-static struct attribute_group ims_pcu_ofn_attr_group = {
+static const struct attribute_group ims_pcu_ofn_attr_group = {
 	.name	= "ofn",
 	.attrs	= ims_pcu_ofn_attrs,
 };
-- 
1.9.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] input: ims-pcu: Constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-05 12:40 +0200

csiph-web