Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752206AbdIANbT (ORCPT ); Fri, 1 Sep 2017 09:31:19 -0400 Received: from ozlabs.org ([103.22.144.67]:35219 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752235AbdIAN3w (ORCPT ); Fri, 1 Sep 2017 09:29:52 -0400 X-powerpc-patch-notification: thanks X-powerpc-patch-commit: de854e54d79bc0ad5c45c5be50821b1c0639cb75 In-Reply-To: <1501707705-32425-1-git-send-email-Julia.Lawall@lip6.fr> To: Julia Lawall , Benjamin Herrenschmidt From: Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: powerpc/macintosh: constify wf_sensor_ops structures Message-Id: <3xkKq244Czz9t3F@ozlabs.org> Date: Fri, 1 Sep 2017 23:29:50 +1000 (AEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 991 Lines: 50 On Wed, 2017-08-02 at 21:01:45 UTC, Julia Lawall wrote: > The wf_sensor_ops structures are only stored in the ops field of a > wf_sensor structure, which is declared as const. Thus the > wf_sensor_ops structures themselves can be const. > > Done with the help of Coccinelle. > > // > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct wf_sensor_ops i@p = { ... }; > > @ok1@ > identifier r.i; > struct wf_sensor s; > position p; > @@ > s.ops = &i@p > > @ok2@ > identifier r.i; > struct wf_sat_sensor s; > position p; > @@ > s.sens.ops = &i@p > > @bad@ > position p != {r.p,ok1.p,ok2.p}; > identifier r.i; > struct wf_sensor_ops e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct wf_sensor_ops i = { ... }; > // > > Signed-off-by: Julia Lawall Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/de854e54d79bc0ad5c45c5be50821b cheers