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: 9503395 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 BC7E5601EB for ; Sun, 8 Jan 2017 10:36:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADBF7266F3 for ; Sun, 8 Jan 2017 10:36:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A262827BFF; Sun, 8 Jan 2017 10:36:44 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 619D3266F3 for ; Sun, 8 Jan 2017 10:36:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cQAqB-00087A-9A; Sun, 08 Jan 2017 10:36:43 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cQApy-0007Yw-I8; Sun, 08 Jan 2017 10:36:32 +0000 Received: by mail-pg0-x242.google.com with SMTP id 75so10506803pgf.3; 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=haHmBz1Y2WKoxhwoisSWI0W9n1YZyJlOpBHQNmeIzge4eOE5Et+nZWUhDzA4m3vBtA lgoZV28alzGR43ZZT7rC7L+F+94j/7p2QY2Pwu4m2Fu6RzSesAg/LuE+9TdqrxOaujcF zIh/bJ3VruRUC+7Eu9MtxJK+To8fwg/8+jgfnqAvLIrHdV48/x2cAnGKUTqpQaA872U+ T+QPcqwkBxKgK65FXXoFIlKBtGcZAlOdakRjJaD1Qikn2NOcOFwuPlmlahwxNw76fGKn wQ8LtEXx/3pz15svMzv6vfuwNDhqhUVYpC+wjYEgfBqMtrMTw4gY2s5wdm+JchVZvzAv mUNw== X-Gm-Message-State: AIkVDXK/Q/CvHkgKA1njpPrmEuygf7PlqluNoFAmbqqX8fCFkOd/luqqefAkgVdRm3jBdw== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170108_023630_879262_38DACAAA X-CRM114-Status: GOOD ( 10.33 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bhumika Goyal MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.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,