From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752330AbdF3QNK (ORCPT ); Fri, 30 Jun 2017 12:13:10 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:36008 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbdF3QNI (ORCPT ); Fri, 30 Jun 2017 12:13:08 -0400 MIME-Version: 1.0 In-Reply-To: <8d970553e4374fa42576306c2da1fc359a04aad5.1498799085.git.arvind.yadav.cs@gmail.com> References: <8d970553e4374fa42576306c2da1fc359a04aad5.1498799085.git.arvind.yadav.cs@gmail.com> From: Andy Shevchenko Date: Fri, 30 Jun 2017 19:13:07 +0300 Message-ID: Subject: Re: [PATCH v2] sony-laptop: constify spic_attribute_group and sony_laptop_input_index. To: Arvind Yadav Cc: Mattia Dongili , "dvhart@infradead.org" , Andy Shevchenko , Platform Driver , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 30, 2017 at 8:09 AM, Arvind Yadav wrote: > attribute_groups are not supposed to change at runtime. All functions > working with attribute_groups provided by work with const > attribute_group. So mark the non-const structs as const. > > 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 > A bit late, Arnd's patch has been applied. Please, test it beforehand next time. Thanks. > Signed-off-by: Arvind Yadav > --- > Changes in v2: > Resolve warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers] > key_dev->keycode = &sony_laptop_input_keycode_map; > > drivers/platform/x86/sony-laptop.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c > index aa2ee51..bfae795 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 @@ 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 > -- With Best Regards, Andy Shevchenko