Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938787AbcJQRuG (ORCPT ); Mon, 17 Oct 2016 13:50:06 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:36317 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbcJQRt5 (ORCPT ); Mon, 17 Oct 2016 13:49:57 -0400 Subject: Re: [PATCH 1/2] i2c: bcm-iproc: constify i2c_adapter_quirks structures To: Julia Lawall , Wolfram Sang References: <1476552722-12352-1-git-send-email-Julia.Lawall@lip6.fr> <1476552722-12352-2-git-send-email-Julia.Lawall@lip6.fr> Cc: kernel-janitors@vger.kernel.org, Ray Jui , Scott Branden , Jon Mason , bcm-kernel-feedback-list@broadcom.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org From: Ray Jui Message-ID: Date: Mon, 17 Oct 2016 10:49:10 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:50.0) Gecko/20100101 Thunderbird/50.0 MIME-Version: 1.0 In-Reply-To: <1476552722-12352-2-git-send-email-Julia.Lawall@lip6.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2038 Lines: 72 Hi Julia, On 10/15/2016 10:32 AM, Julia Lawall wrote: > Check for i2c_adapter_quirks structures that are only stored in the > quirks field of an i2c_adapter structure. This field is declared > const, so i2c_adapter_quirks structures that have this property can be > declared as const also. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) > > // > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct i2c_adapter_quirks i@p = { ... }; > > @ok@ > identifier r.i; > struct i2c_adapter e; > position p; > @@ > e.quirks = &i@p; > > @bad@ > position p != {r.p,ok.p}; > identifier r.i; > struct i2c_adapter_quirks e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct i2c_adapter_quirks i = { ... }; > // > > The effect on the layout of the .o file is shown by the following > output of the size command, first before then after the > transformation: > > text data bss dec hex filename > 3458 744 8 4210 1072 drivers/i2c/busses/i2c-bcm-iproc.o > 3490 720 8 4218 107a drivers/i2c/busses/i2c-bcm-iproc.o > > Signed-off-by: Julia Lawall > > --- > drivers/i2c/busses/i2c-bcm-iproc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c b/drivers/i2c/busses/i2c-bcm-iproc.c > index 326b3db..318df55 100644 > --- a/drivers/i2c/busses/i2c-bcm-iproc.c > +++ b/drivers/i2c/busses/i2c-bcm-iproc.c > @@ -395,7 +395,7 @@ static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) > .functionality = bcm_iproc_i2c_functionality, > }; > > -static struct i2c_adapter_quirks bcm_iproc_i2c_quirks = { > +static const struct i2c_adapter_quirks bcm_iproc_i2c_quirks = { > /* need to reserve one byte in the FIFO for the slave address */ > .max_read_len = M_TX_RX_FIFO_SIZE - 1, > }; > Change looks good. Thanks. Acked-by: Ray Jui