From patchwork Thu Apr 23 08:51:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 6261011 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 887349F313 for ; Thu, 23 Apr 2015 08:54:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5E2C20380 for ; Thu, 23 Apr 2015 08:54:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E787920328 for ; Thu, 23 Apr 2015 08:54:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCtp-0002KJ-HB; Thu, 23 Apr 2015 08:54:21 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCrd-0000YX-P7 for linux-mediatek@lists.infradead.org; Thu, 23 Apr 2015 08:52:06 +0000 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YlCqs-0004jv-Dh; Thu, 23 Apr 2015 10:51:18 +0200 Received: from sha by dude.hi.pengutronix.de with local (Exim 4.84) (envelope-from ) id 1YlCqr-00060S-D7; Thu, 23 Apr 2015 10:51:17 +0200 From: Sascha Hauer To: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] tty: serial: 8250_mtk: Use devm_clk_get Date: Thu, 23 Apr 2015 10:51:03 +0200 Message-Id: <1429779066-21406-2-git-send-email-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429779066-21406-1-git-send-email-s.hauer@pengutronix.de> References: <1429779066-21406-1-git-send-email-s.hauer@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mediatek@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150423_015206_075911_33B6C966 X-CRM114-Status: GOOD ( 13.54 ) X-Spam-Score: -0.0 (/) Cc: gregkh@linuxfoundation.org, Sascha Hauer , linux-mediatek@lists.infradead.org, linux-serial@vger.kernel.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, Alan Cox X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just because of_clk_get() doesn't mean it should be used. Use devm_clk_get which is the correct function when a struct device * is available. Also since it's a devm function we can drop the calls to clk_put(). While at it also fix a wrong debug message. Signed-off-by: Sascha Hauer --- drivers/tty/serial/8250/8250_mtk.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index 7a11fac..c6901dc 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c @@ -131,18 +131,16 @@ static int mtk8250_probe_of(struct platform_device *pdev, struct uart_port *p, struct mtk8250_data *data) { int err; - struct device_node *np = pdev->dev.of_node; - data->uart_clk = of_clk_get(np, 0); + data->uart_clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(data->uart_clk)) { - dev_warn(&pdev->dev, "Can't get timer clock\n"); + dev_warn(&pdev->dev, "Can't get uart clock\n"); return PTR_ERR(data->uart_clk); } err = clk_prepare_enable(data->uart_clk); if (err) { dev_warn(&pdev->dev, "Can't prepare clock\n"); - clk_put(data->uart_clk); return err; } p->uartclk = clk_get_rate(data->uart_clk); @@ -216,7 +214,6 @@ static int mtk8250_remove(struct platform_device *pdev) serial8250_unregister_port(data->line); if (!IS_ERR(data->uart_clk)) { clk_disable_unprepare(data->uart_clk); - clk_put(data->uart_clk); } pm_runtime_disable(&pdev->dev);