From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean Delvare Subject: Re: [PATCH] i2c: make PCI device id constant Date: Sun, 10 Jan 2010 16:33:31 +0100 Message-ID: <20100110163331.0fca7abf@hyperion.delvare> References: <4B49E524.1090404@freemail.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <4B49E524.1090404-Y8qEzhMunLyT9ig0jae3mg@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= Cc: Ben Dooks , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, LKML , Julia Lawall , cocci-dAYI7NvHqcQ@public.gmane.org List-Id: linux-i2c@vger.kernel.org Hi M=C3=A1rton, On Sun, 10 Jan 2010 15:33:08 +0100, N=C3=A9meth M=C3=A1rton wrote: > From: M=C3=A1rton N=C3=A9meth >=20 > The id_table field of the struct pci_driver is constant in > so it is worth to make initialization data also constant. >=20 > The semantic match that finds this kind of pattern is as follows: > (http://coccinelle.lip6.fr/) >=20 > // > @r@ > disable decl_init,const_decl_init; > identifier I1, I2, x; > @@ > struct I1 { > ... > const struct I2 *x; > ... > }; > @s@ > identifier r.I1, y; > identifier r.x, E; > @@ > struct I1 y =3D { > .x =3D E, > }; > @c@ > identifier r.I2; > identifier s.E; > @@ > const struct I2 E[] =3D ... ; > @depends on !c@ > identifier r.I2; > identifier s.E; > @@ > + const > struct I2 E[] =3D ...; > // >=20 > Signed-off-by: M=C3=A1rton N=C3=A9meth > Cc: Julia Lawall > Cc: cocci-dAYI7NvHqcQ@public.gmane.org > --- Applied, thanks. --=20 Jean Delvare From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295Ab0AJPdf (ORCPT ); Sun, 10 Jan 2010 10:33:35 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752729Ab0AJPde (ORCPT ); Sun, 10 Jan 2010 10:33:34 -0500 Received: from bamako.nerim.net ([62.4.17.28]:56655 "EHLO bamako.nerim.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951Ab0AJPdd convert rfc822-to-8bit (ORCPT ); Sun, 10 Jan 2010 10:33:33 -0500 Date: Sun, 10 Jan 2010 16:33:31 +0100 From: Jean Delvare To: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= Cc: Ben Dooks , linux-i2c@vger.kernel.org, LKML , Julia Lawall , cocci@diku.dk Subject: Re: [PATCH] i2c: make PCI device id constant Message-ID: <20100110163331.0fca7abf@hyperion.delvare> In-Reply-To: <4B49E524.1090404@freemail.hu> References: <4B49E524.1090404@freemail.hu> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.14.4; i586-suse-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Márton, On Sun, 10 Jan 2010 15:33:08 +0100, Németh Márton wrote: > From: Márton Németh > > The id_table field of the struct pci_driver is constant in > so it is worth to make initialization data also constant. > > The semantic match that finds this kind of pattern is as follows: > (http://coccinelle.lip6.fr/) > > // > @r@ > disable decl_init,const_decl_init; > identifier I1, I2, x; > @@ > struct I1 { > ... > const struct I2 *x; > ... > }; > @s@ > identifier r.I1, y; > identifier r.x, E; > @@ > struct I1 y = { > .x = E, > }; > @c@ > identifier r.I2; > identifier s.E; > @@ > const struct I2 E[] = ... ; > @depends on !c@ > identifier r.I2; > identifier s.E; > @@ > + const > struct I2 E[] = ...; > // > > Signed-off-by: Márton Németh > Cc: Julia Lawall > Cc: cocci@diku.dk > --- Applied, thanks. -- Jean Delvare