From: Arvind Yadav <arvind.yadav.cs@gmail.com>
Date: Fri, 30 Jun 2017 05:09:47 +0000 (+0530)
Subject: platform/x86: sony-laptop: constify attribute_group and input index array
X-Git-Tag: v4.13-rc1~135^2
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d791db9a57ab7f390916dce0fa1315130bb6664c;p=users%2Fhch%2Fmisc.git

platform/x86: sony-laptop: constify attribute_group and input index array

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.

The content of sony_laptop_input_index does not change and is declared
as a static global array.

Constify spic_attribute_group and sony_laptop_input_index.

File size before:
   text	   data	    bss	    dec	    hex	filename
  31273	   5176	    372	  36821	   8fd5	drivers/platform/x86/sony-laptop.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  31337	   5112	    372	  36821	   8fd5	drivers/platform/x86/sony-laptop.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
[dvhart: updated commit message, includes fix suggested by Arnd Bergmann]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
---

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index aa2ee51d3547..bfae79534f44 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -222,7 +222,7 @@ struct sony_laptop_keypress {
 /* Correspondance table between sonypi events
  * and input layer indexes in the keymap
  */
-static int sony_laptop_input_index[] = {
+static const int sony_laptop_input_index[] = {
 	-1,	/*  0 no event */
 	-1,	/*  1 SONYPI_EVENT_JOGDIAL_DOWN */
 	-1,	/*  2 SONYPI_EVENT_JOGDIAL_UP */
@@ -4032,7 +4032,7 @@ static struct attribute *spic_attributes[] = {
 	NULL
 };
 
-static struct attribute_group spic_attribute_group = {
+static const struct attribute_group spic_attribute_group = {
 	.attrs = spic_attributes
 };