From patchwork Thu Sep 1 18:42:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 665022 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 3sQFpX3JtVz9s5w for ; Fri, 2 Sep 2016 07:32:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933887AbcIAVaL (ORCPT ); Thu, 1 Sep 2016 17:30:11 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:7930 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933523AbcIAVaJ (ORCPT ); Thu, 1 Sep 2016 17:30:09 -0400 X-IronPort-AV: E=Sophos;i="5.30,268,1470693600"; d="scan'208";a="191753946" Received: from palace.rsr.lip6.fr (HELO localhost.localdomain) ([132.227.105.202]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA256; 01 Sep 2016 21:00:15 +0200 From: Julia Lawall To: Ray Jui Cc: kernel-janitors@vger.kernel.org, Scott Branden , Jon Mason , bcm-kernel-feedback-list@broadcom.com, Linus Walleij , linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] pinctrl: nsp: constify pinctrl_ops and pinmux_ops structures Date: Thu, 1 Sep 2016 20:42:20 +0200 Message-Id: <1472755341-9995-3-git-send-email-Julia.Lawall@lip6.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472755341-9995-1-git-send-email-Julia.Lawall@lip6.fr> References: <1472755341-9995-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 Check for pinctrl_ops and pinmux_ops structures that are only stored in the pctlops field and the pmxops field, respectively, of a pinctrl_desc structure. These fields are declared const, so pinctrl_ops and pinmux_ops structures that have this property can be declared as const also. The semantic patch that makes this change in the pinctrl_ops is as follows. The pinmux_ops case is similar. (http://coccinelle.lip6.fr/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct pinctrl_ops i@p = { ... }; @ok@ identifier r.i; struct pinctrl_desc e; position p; @@ e.pctlops = &i@p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct pinctrl_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct pinctrl_ops i = { ... }; // Signed-off-by: Julia Lawall --- drivers/pinctrl/bcm/pinctrl-nsp-mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 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/bcm/pinctrl-nsp-mux.c b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c index 4149db3..35c1765 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-mux.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-mux.c @@ -348,7 +348,7 @@ static void nsp_pin_dbg_show(struct pinctrl_dev *pctrl_dev, seq_printf(s, " %s", dev_name(pctrl_dev->dev)); } -static struct pinctrl_ops nsp_pinctrl_ops = { +static const struct pinctrl_ops nsp_pinctrl_ops = { .get_groups_count = nsp_get_groups_count, .get_group_name = nsp_get_group_name, .get_group_pins = nsp_get_group_pins, @@ -518,7 +518,7 @@ static void nsp_gpio_disable_free(struct pinctrl_dev *pctrl_dev, spin_unlock_irqrestore(&pinctrl->lock, flags); } -static struct pinmux_ops nsp_pinmux_ops = { +static const struct pinmux_ops nsp_pinmux_ops = { .get_functions_count = nsp_get_functions_count, .get_function_name = nsp_get_function_name, .get_function_groups = nsp_get_function_groups,