Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752433AbdHBIYG (ORCPT ); Wed, 2 Aug 2017 04:24:06 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:35054 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbdHBIYF (ORCPT ); Wed, 2 Aug 2017 04:24:05 -0400 MIME-Version: 1.0 In-Reply-To: <20170708003330.GA15374@embeddedgus> References: <20170708003330.GA15374@embeddedgus> From: Linus Walleij Date: Wed, 2 Aug 2017 10:24:03 +0200 Message-ID: Subject: Re: [PATCH] watchdog: coh901327_wdt: constify watchdog_ops structure To: "Gustavo A. R. Silva" Cc: Wim Van Sebroeck , Guenter Roeck , "linux-arm-kernel@lists.infradead.org" , LINUXWATCHDOG , "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 Content-Length: 952 Lines: 43 On Sat, Jul 8, 2017 at 2:33 AM, Gustavo A. R. Silva wrote: > Check for watchdog_ops structures that are only stored in the ops field of > a watchdog_device structure. This field is declared const, so watchdog_ops > structures that have this property can be declared as const also. > > This issue was detected using Coccinelle and the following semantic patch: > > @r > disable optional_qualifier@ > identifier i; > position p; > @@ > static struct watchdog_ops i@p = { ... }; > > @ok@ > identifier r.i; > struct watchdog_device e; > position p; > @@ > e.ops = &i@p; > > @bad@ > position p != {r.p,ok.p}; > identifier r.i; > struct watchdog_ops e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct watchdog_ops i = { ... }; > > Signed-off-by: Gustavo A. R. Silva Acked-by: Linus Walleij Yours, Linus Walleij