From patchwork Tue Jul 10 20:34:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 10518059 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 96948600CA for ; Tue, 10 Jul 2018 20:41:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 876812913F for ; Tue, 10 Jul 2018 20:41:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AAB42914F; Tue, 10 Jul 2018 20:41:06 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C12662913F for ; Tue, 10 Jul 2018 20:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=563JEYBemaHWhX3k3G2okoUH81zTiU4+Tb7NLu83BMs=; b=mYWc6RnrJ5OGoFjkwMl3ts4T/Z 5Im/K1Mab0VvysEI+hjagHqUuxk/HyZOzwsE2vw0j/uaLHJh5vXf98dUd4cF7L2N3HoPkN2HlsGCS 7gnRmtrLRP/yU3mcb4drSPAiKtF2tBT1MMRqUhmRIB5s89WsYtoAgoBfmRMAPPnAKPtldVRvaECtK qEl7s3RRxfBxMbptT12blIiV3bNroXnUYPhFJOcb5dnNMdL1AS1lUyu4H7e6CEH7QzZck3gZyM5Ot zIBeqQuS/5ep7xX3Zk7h21b1HBt3/JI/UUh96liwmH+WndjxZQiEb6FeSCUjnoMwud3qSpHr9yJKw 8kWA0D1A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fczRY-0006wr-LP; Tue, 10 Jul 2018 20:41:04 +0000 Received: from mailoutvs37.siol.net ([185.57.226.228] helo=mail.siol.net) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fczMN-0001F6-AS for linux-arm-kernel@lists.infradead.org; Tue, 10 Jul 2018 20:35:46 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTP id 31F94522724; Tue, 10 Jul 2018 22:35:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at psrvmta12.zcs-production.pri Received: from mail.siol.net ([127.0.0.1]) by localhost (psrvmta12.zcs-production.pri [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 6mwm1ir_GJx0; Tue, 10 Jul 2018 22:35:30 +0200 (CEST) Received: from mail.siol.net (localhost [127.0.0.1]) by mail.siol.net (Zimbra) with ESMTPS id 9CCB2522729; Tue, 10 Jul 2018 22:35:30 +0200 (CEST) Received: from localhost.localdomain (unknown [194.152.15.144]) (Authenticated sender: 031275009) by mail.siol.net (Zimbra) with ESMTPSA id 2EBFD522724; Tue, 10 Jul 2018 22:35:28 +0200 (CEST) From: Jernej Skrabec To: maxime.ripard@bootlin.com, wens@csie.org, robh+dt@kernel.org Subject: [PATCH v2 04/18] drm/sun4i: tcon-top: Cleanup clock handling Date: Tue, 10 Jul 2018 22:34:57 +0200 Message-Id: <20180710203511.18454-5-jernej.skrabec@siol.net> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710203511.18454-1-jernej.skrabec@siol.net> References: <20180710203511.18454-1-jernej.skrabec@siol.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180710_133543_928052_EA485249 X-CRM114-Status: GOOD ( 11.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP There is no need to acquire reference to clock just to get its name. This commit just cleans up the code. There is no functional change. Reviewed-by: Chen-Yu Tsai Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_tcon_top.c | 48 ++++++-------------------- 1 file changed, 11 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c index 8da0460e0028..9fb51940156f 100644 --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c @@ -44,15 +44,20 @@ static int sun8i_tcon_top_get_connected_ep_id(struct device_node *node, } static struct clk_hw *sun8i_tcon_top_register_gate(struct device *dev, - struct clk *parent, + const char *parent, void __iomem *regs, spinlock_t *lock, u8 bit, int name_index) { const char *clk_name, *parent_name; - int ret; + int ret, index; + + index = of_property_match_string(dev->of_node, "clock-names", parent); + if (IS_ERR_VALUE(index)) + return ERR_PTR(index); + + parent_name = of_clk_get_parent_name(dev->of_node, index); - parent_name = __clk_get_name(parent); ret = of_property_read_string_index(dev->of_node, "clock-output-names", name_index, &clk_name); @@ -69,7 +74,6 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); - struct clk *dsi, *tcon_tv0, *tcon_tv1, *tve0, *tve1; struct clk_hw_onecell_data *clk_data; struct sun8i_tcon_top *tcon_top; bool mixer0_unused = false; @@ -103,36 +107,6 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, return PTR_ERR(tcon_top->bus); } - dsi = devm_clk_get(dev, "dsi"); - if (IS_ERR(dsi)) { - dev_err(dev, "Couldn't get the dsi clock\n"); - return PTR_ERR(dsi); - } - - tcon_tv0 = devm_clk_get(dev, "tcon-tv0"); - if (IS_ERR(tcon_tv0)) { - dev_err(dev, "Couldn't get the tcon-tv0 clock\n"); - return PTR_ERR(tcon_tv0); - } - - tcon_tv1 = devm_clk_get(dev, "tcon-tv1"); - if (IS_ERR(tcon_tv1)) { - dev_err(dev, "Couldn't get the tcon-tv1 clock\n"); - return PTR_ERR(tcon_tv1); - } - - tve0 = devm_clk_get(dev, "tve0"); - if (IS_ERR(tve0)) { - dev_err(dev, "Couldn't get the tve0 clock\n"); - return PTR_ERR(tve0); - } - - tve1 = devm_clk_get(dev, "tve1"); - if (IS_ERR(tve1)) { - dev_err(dev, "Couldn't get the tve1 clock\n"); - return PTR_ERR(tve1); - } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = devm_ioremap_resource(dev, res); if (IS_ERR(regs)) @@ -203,17 +177,17 @@ static int sun8i_tcon_top_bind(struct device *dev, struct device *master, * to TVE clock parent. */ clk_data->hws[CLK_TCON_TOP_TV0] = - sun8i_tcon_top_register_gate(dev, tcon_tv0, regs, + sun8i_tcon_top_register_gate(dev, "tcon-tv0", regs, &tcon_top->reg_lock, TCON_TOP_TCON_TV0_GATE, 0); clk_data->hws[CLK_TCON_TOP_TV1] = - sun8i_tcon_top_register_gate(dev, tcon_tv1, regs, + sun8i_tcon_top_register_gate(dev, "tcon-tv1", regs, &tcon_top->reg_lock, TCON_TOP_TCON_TV1_GATE, 1); clk_data->hws[CLK_TCON_TOP_DSI] = - sun8i_tcon_top_register_gate(dev, dsi, regs, + sun8i_tcon_top_register_gate(dev, "dsi", regs, &tcon_top->reg_lock, TCON_TOP_TCON_DSI_GATE, 2);