From patchwork Sun Jan 8 10:35:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9503399 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7AB20601EB for ; Sun, 8 Jan 2017 10:37:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C987267EC for ; Sun, 8 Jan 2017 10:37:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F8782807E; Sun, 8 Jan 2017 10:37:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7F8E267EC for ; Sun, 8 Jan 2017 10:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751982AbdAHKg1 (ORCPT ); Sun, 8 Jan 2017 05:36:27 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33499 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750821AbdAHKgJ (ORCPT ); Sun, 8 Jan 2017 05:36:09 -0500 Received: by mail-pg0-f67.google.com with SMTP id 194so4252368pgd.0; Sun, 08 Jan 2017 02:36:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0K2IS3ZbhHuOnMKEN7GY2xj+2QYhJL8SzYYHpfH6XTk=; b=r20BXPL+OkVrsa+rPQy83zNm5rYHMv318JxiYy9IvATJARzjPRSBVjK2vLt4QN6KVe D5+STwvZ2MQV1N6dJfMasN/Q9Y8p707S1wOTuuKViZw0o5kL80t1kjsjMu3JGCaFtC39 4HR2L4QDf87tYM/K6QlIyWPSfbC1xZhv1Hi0IPo+eMGVeUIR5CV7pU4/WuYKmjoto2c8 NR4vqsMR8wHEKz8H85pth+5Lt6fBIvvlSzLhNrr/McLfDUBo4Q8LRmi3UfHh+1e6JHkX PuRyQHSIRuIbHi4NpOeOdH+MGLgLDP+SRc+r7MKyVhsAyBtEBbNEb7/KsKLZY9AKaXES qnUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0K2IS3ZbhHuOnMKEN7GY2xj+2QYhJL8SzYYHpfH6XTk=; b=k2Zbj3z32vE9N8LykiE3zKZqaKjdTHtxdsQNign65MttTDuAw6AHpPoh6f1I+v5oZw bhu7SOHfTxlqhjTUpO5LWa+SSuvwzS2tQeu4vs124uEBw+aSUV8+2NkIXJyzQJ/MS2xP ZcOQGJwoStxx0VLvNkQMeSiYipCIvpVFCGzt1QDKMn3N6L6iPQL3tBQaBsZ47bMNaCl2 fR6fdB1MYsGj4hbH50/Oe+OqxHMnOcOZkxM8ksB9JeUFdu7ck1Lch/OiBJ72RgLhKfJB 6AJqeMMh/wmoiK3Svv4BOMHFr/QzvhoiAswHkoPvM68TzN0E0QQljDetPFZ7jGKjqwLU y7fQ== X-Gm-Message-State: AIkVDXIOotaSiYPy0BESyfuoCldMgHvR+DGSqghXxOKzoj3hNwe8+7BGqmjGc9wI1Zn45A== X-Received: by 10.84.168.129 with SMTP id f1mr186264160plb.42.1483871769015; Sun, 08 Jan 2017 02:36:09 -0800 (PST) Received: from gmail.com ([2405:204:5004:b55a:a5e0:7374:f55e:c219]) by smtp.gmail.com with ESMTPSA id a2sm149140848pgn.24.2017.01.08.02.36.00 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 08 Jan 2017 02:36:07 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Sun, 08 Jan 2017 16:05:57 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, kishon@ti.com, rjui@broadcom.com, sbranden@broadcom.com, jonmason@broadcom.com, bcm-kernel-feedback-list@broadcom.com, chunfeng.yun@mediatek.com, yoshihiro.shimoda.uh@renesas.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] drivers: phy: constify phy_ops structures Date: Sun, 8 Jan 2017 16:05:56 +0530 Message-Id: <1483871756-19008-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Declare phy_ops structures as const as they are only passed as an argument to the function devm_phy_create. This argument is of type const struct phy_ops *, so phy_ops structures having this property can be declared as const. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct phy_ops i@p = {...}; @ok1@ identifier r1.i; position p; @@ devm_phy_create(...,&i@p) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct phy_ops i; File size details: text data bss dec hex filename 1504 264 0 1768 6e8 phy/phy-bcm-cygnus-pcie.o 1576 192 0 1768 6e8 phy/phy-bcm-cygnus-pcie.o 1083 264 0 1347 543 phy/phy-hi6220-usb.o 1155 192 0 1347 543 phy/phy-hi6220-usb.o 2767 264 0 3031 bd7 phy/phy-mt65xx-usb3.o 2829 192 0 3021 bcd phy/phy-mt65xx-usb3.o 2710 304 0 3014 bc6 phy/phy-rcar-gen3-usb2.o 2766 240 0 3006 bbe phy/phy-rcar-gen3-usb2.o Signed-off-by: Bhumika Goyal --- drivers/phy/phy-bcm-cygnus-pcie.c | 2 +- drivers/phy/phy-hi6220-usb.c | 2 +- drivers/phy/phy-mt65xx-usb3.c | 2 +- drivers/phy/phy-rcar-gen3-usb2.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/phy/phy-bcm-cygnus-pcie.c b/drivers/phy/phy-bcm-cygnus-pcie.c index 082c03f..0f4ac5d 100644 --- a/drivers/phy/phy-bcm-cygnus-pcie.c +++ b/drivers/phy/phy-bcm-cygnus-pcie.c @@ -114,7 +114,7 @@ static int cygnus_pcie_phy_power_off(struct phy *p) return cygnus_pcie_power_config(phy, false); } -static struct phy_ops cygnus_pcie_phy_ops = { +static const struct phy_ops cygnus_pcie_phy_ops = { .power_on = cygnus_pcie_phy_power_on, .power_off = cygnus_pcie_phy_power_off, .owner = THIS_MODULE, diff --git a/drivers/phy/phy-hi6220-usb.c b/drivers/phy/phy-hi6220-usb.c index b2141cb..398c102 100644 --- a/drivers/phy/phy-hi6220-usb.c +++ b/drivers/phy/phy-hi6220-usb.c @@ -112,7 +112,7 @@ static int hi6220_phy_exit(struct phy *phy) return hi6220_phy_setup(priv, false); } -static struct phy_ops hi6220_phy_ops = { +static const struct phy_ops hi6220_phy_ops = { .init = hi6220_phy_start, .exit = hi6220_phy_exit, .owner = THIS_MODULE, diff --git a/drivers/phy/phy-mt65xx-usb3.c b/drivers/phy/phy-mt65xx-usb3.c index 4d85e73..d972067 100644 --- a/drivers/phy/phy-mt65xx-usb3.c +++ b/drivers/phy/phy-mt65xx-usb3.c @@ -506,7 +506,7 @@ static struct phy *mt65xx_phy_xlate(struct device *dev, return instance->phy; } -static struct phy_ops mt65xx_u3phy_ops = { +static const struct phy_ops mt65xx_u3phy_ops = { .init = mt65xx_phy_init, .exit = mt65xx_phy_exit, .power_on = mt65xx_phy_power_on, diff --git a/drivers/phy/phy-rcar-gen3-usb2.c b/drivers/phy/phy-rcar-gen3-usb2.c index c63da1b..17be045 100644 --- a/drivers/phy/phy-rcar-gen3-usb2.c +++ b/drivers/phy/phy-rcar-gen3-usb2.c @@ -350,7 +350,7 @@ static int rcar_gen3_phy_usb2_power_off(struct phy *p) return ret; } -static struct phy_ops rcar_gen3_phy_usb2_ops = { +static const struct phy_ops rcar_gen3_phy_usb2_ops = { .init = rcar_gen3_phy_usb2_init, .exit = rcar_gen3_phy_usb2_exit, .power_on = rcar_gen3_phy_usb2_power_on,