From patchwork Tue Sep 19 19:54:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13391836 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0E90ACE79A9 for ; Tue, 19 Sep 2023 19:55:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=pcX1uU3UNEi/P+RUXlevLo5c+FYA7AFETEbEuaRh1Hk=; b=ExrzmseuAfNi0l GmApWw702f+OK5VZf22fZQZKmQhID75Q688gsernzWNELlLIL1i1oirg674pUQvZ4WjiNQMYLDgKB XeiBCYFUO0iutOEx+SO6pos/sDPfGTiZ9tqB1zIEBL3uA+m9uIcM27xbcwsNaph5Pubtdd8M+VaM/ TV10sU4i1Wdo8TFQJxI17/B6eSOldAWN8KW5MRS0UenkGpS2LrNzv0BEcG7cGcHATncKbbBE+eE7q FvxPjwaehIDbaXfkmIRA4uA3gAkx1yP7shwl4ylcj5htWiJ5oDJ8g9eagbySv8MCupSPTR+ete8l9 rn+mALwqB/dlxdHMhLmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qigoR-001Bnd-32; Tue, 19 Sep 2023 19:55:11 +0000 Received: from mgamail.intel.com ([134.134.136.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qigoP-001Blz-0L for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 19:55:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695153309; x=1726689309; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Bepkwmn/REb0biKQxCPTgmoT59eVotqTB0kTZUaw9lM=; b=bDr9M0rpNV8jL+TMqqMltS0SI+eDnqZFimhDgUEd0J+n1nzzvLzGbBwe PBVPQwtFM7LYBXsMlVXoHCMTF6nEUP/1TXaHONvA4YnOAjNnklBsY5Q69 NXpYa4/AHsbVUH1lQbDJS+OjR1DRhO7sBuzGBNUlywcVujrISA98635Oo G8EZfWqt6CLBPm580UpI7ugN3FwRiuBNvNvFQbWMjL/+NawBzjq1JELEl 7F8tuebHSCRVS5RAnJmNhNGuEehVC07YMcsHr1axpzh3AHDIJf73XX4uU xJwGEcV0tFgCgX8AX846ZYV5zqjUIoc/3Z1DdaOW5xQoY/DJw2sqolo+P Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="383874533" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="383874533" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 12:54:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="746354996" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="746354996" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 19 Sep 2023 12:54:54 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9473545B; Tue, 19 Sep 2023 22:54:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Cc: Greg Kroah-Hartman , Jiri Slaby , Joel Stanley , Andrew Jeffery , Andi Shyti Subject: [PATCH v1 1/1] serial: 8250_aspeed_vuart: Use devm_clk_get_enabled() Date: Tue, 19 Sep 2023 22:54:50 +0300 Message-Id: <20230919195450.3197881-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_125509_188622_9A46085E X-CRM114-Status: GOOD ( 15.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_clk_get_enabled() to simplify the code. Signed-off-by: Andy Shevchenko Reviewed-by: Andi Shyti --- drivers/tty/serial/8250/8250_aspeed_vuart.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c index 7a4537a1d66c..270b3a710eb6 100644 --- a/drivers/tty/serial/8250/8250_aspeed_vuart.c +++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c @@ -34,7 +34,6 @@ struct aspeed_vuart { struct device *dev; - struct clk *clk; int line; struct timer_list unthrottle_timer; struct uart_8250_port *port; @@ -422,6 +421,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) struct resource *res; u32 clk, prop, sirq[2]; int rc, sirq_polarity; + struct clk *vclk; np = pdev->dev.of_node; @@ -454,18 +454,13 @@ static int aspeed_vuart_probe(struct platform_device *pdev) return rc; if (of_property_read_u32(np, "clock-frequency", &clk)) { - vuart->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(vuart->clk)) { - rc = dev_err_probe(dev, PTR_ERR(vuart->clk), - "clk or clock-frequency not defined\n"); + vclk = devm_clk_get_enabled(dev, NULL); + if (IS_ERR(vclk)) { + rc = dev_err_probe(dev, PTR_ERR(vclk), "clk or clock-frequency not defined\n"); goto err_sysfs_remove; } - rc = clk_prepare_enable(vuart->clk); - if (rc < 0) - goto err_sysfs_remove; - - clk = clk_get_rate(vuart->clk); + clk = clk_get_rate(vclk); } /* If current-speed was set, then try not to change it. */ @@ -565,7 +560,6 @@ static int aspeed_vuart_probe(struct platform_device *pdev) return 0; err_clk_disable: - clk_disable_unprepare(vuart->clk); irq_dispose_mapping(port.port.irq); err_sysfs_remove: sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); @@ -580,7 +574,6 @@ static int aspeed_vuart_remove(struct platform_device *pdev) aspeed_vuart_set_enabled(vuart, false); serial8250_unregister_port(vuart->line); sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); - clk_disable_unprepare(vuart->clk); return 0; }