From patchwork Sun Sep 11 12:14:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 668434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sX9Nl1xpDz9sBr for ; Sun, 11 Sep 2016 22:34:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756179AbcIKMdk (ORCPT ); Sun, 11 Sep 2016 08:33:40 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:11391 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756055AbcIKMc4 (ORCPT ); Sun, 11 Sep 2016 08:32:56 -0400 X-IronPort-AV: E=Sophos;i="5.30,317,1470693600"; d="scan'208";a="236008860" Received: from palace.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/AES128-SHA256; 11 Sep 2016 14:32:49 +0200 From: Julia Lawall To: Alexandre Torgue Cc: kernel-janitors@vger.kernel.org, Linus Walleij , Maxime Coquelin , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] pinctrl: stm32: constify gpio_chip structures Date: Sun, 11 Sep 2016 14:14:40 +0200 Message-Id: <1473596082-32690-5-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473596082-32690-1-git-send-email-Julia.Lawall@lip6.fr> References: <1473596082-32690-1-git-send-email-Julia.Lawall@lip6.fr> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org These structures are only used to copy into other structures, so declare them as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct gpio_chip i@p = { ... }; @ok@ identifier r.i; expression e; position p; @@ e = i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct gpio_chip e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct gpio_chip i = { ... }; // Signed-off-by: Julia Lawall --- drivers/pinctrl/stm32/pinctrl-stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c index 4ae596b..6d92351 100644 --- a/drivers/pinctrl/stm32/pinctrl-stm32.c +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c @@ -174,7 +174,7 @@ static int stm32_gpio_direction_output(struct gpio_chip *chip, return 0; } -static struct gpio_chip stm32_gpio_template = { +static const struct gpio_chip stm32_gpio_template = { .request = stm32_gpio_request, .free = stm32_gpio_free, .get = stm32_gpio_get,