2017-06-23 08:57:30

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH] sony-laptop: constify sony_laptop_input_* and spic_attribute_group

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
31593 4856 372 36821 8fd5 drivers/platform/x86/sony-laptop.o

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/sony-laptop.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index aa2ee51..5fc2047 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 */
@@ -299,7 +299,7 @@ struct sony_laptop_keypress {
59, /* 72 SONYPI_EVENT_VENDOR_PRESSED */
};

-static int sony_laptop_input_keycode_map[] = {
+static const int sony_laptop_input_keycode_map[] = {
KEY_CAMERA, /* 0 SONYPI_EVENT_CAPTURE_PRESSED */
KEY_RESERVED, /* 1 SONYPI_EVENT_CAPTURE_RELEASED */
KEY_RESERVED, /* 2 SONYPI_EVENT_CAPTURE_PARTIALPRESSED */
@@ -4032,7 +4032,7 @@ struct device_attribute spic_attr_##_name = __ATTR(_name, \
NULL
};

-static struct attribute_group spic_attribute_group = {
+static const struct attribute_group spic_attribute_group = {
.attrs = spic_attributes
};

--
1.9.1


2017-06-24 14:57:56

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] sony-laptop: constify sony_laptop_input_* and spic_attribute_group

Hi Arvind,

[auto build test WARNING on platform-drivers-x86/for-next]
[also build test WARNING on v4.12-rc6 next-20170623]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Arvind-Yadav/sony-laptop-constify-sony_laptop_input_-and-spic_attribute_group/20170624-221228
base: git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git for-next
config: x86_64-randconfig-x007-201725 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All warnings (new ones prefixed by >>):

drivers/platform/x86/sony-laptop.c: In function 'sony_laptop_setup_input':
>> drivers/platform/x86/sony-laptop.c:494:19: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
key_dev->keycode = &sony_laptop_input_keycode_map;
^

vim +/const +494 drivers/platform/x86/sony-laptop.c

1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 478 if (!key_dev) {
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 479 error = -ENOMEM;
9593bd07 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 480 goto err_free_kfifo;
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 481 }
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 482
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 483 key_dev->name = "Sony Vaio Keys";
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 484 key_dev->id.bustype = BUS_ISA;
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 485 key_dev->id.vendor = PCI_VENDOR_ID_SONY;
2e4d242c drivers/misc/sony-laptop.c Dmitry Torokhov 2007-11-21 486 key_dev->dev.parent = &acpi_device->dev;
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 487
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 488 /* Initialize the Input Drivers: special keys */
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 489 input_set_capability(key_dev, EV_MSC, MSC_SCAN);
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 490
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 491 __set_bit(EV_KEY, key_dev->evbit);
bc57f865 drivers/misc/sony-laptop.c Mattia Dongili 2007-07-20 492 key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]);
bc57f865 drivers/misc/sony-laptop.c Mattia Dongili 2007-07-20 493 key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map);
bc57f865 drivers/misc/sony-laptop.c Mattia Dongili 2007-07-20 @494 key_dev->keycode = &sony_laptop_input_keycode_map;
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 495 for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++)
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 496 __set_bit(sony_laptop_input_keycode_map[i], key_dev->keybit);
c45bc9d6 drivers/platform/x86/sony-laptop.c Dmitry Torokhov 2009-12-24 497 __clear_bit(KEY_RESERVED, key_dev->keybit);
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 498
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 499 error = input_register_device(key_dev);
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 500 if (error)
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 501 goto err_free_keydev;
1549ee6f drivers/misc/sony-laptop.c [email protected] 2007-04-09 502

:::::: The code at line 494 was first introduced by commit
:::::: bc57f865fa2282ad2b7efe02da0a752e602e982e sony-laptop: Make the driver use MSC_SCAN and a setkeycode and getkeycode key table.

:::::: TO: Mattia Dongili <[email protected]>
:::::: CC: Len Brown <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (4.16 kB)
.config.gz (29.18 kB)
Download all attachments