Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp187124rwb; Tue, 4 Oct 2022 02:33:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+jDS6l4cm2+Gkx8VFR4MJEmNk109mQpAmkdgp1yoR2W9O8fyJwHfhbsoA20yiqJ5N5Qxm X-Received: by 2002:a17:907:94c6:b0:787:9157:a87a with SMTP id dn6-20020a17090794c600b007879157a87amr18850018ejc.5.1664876034089; Tue, 04 Oct 2022 02:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664876034; cv=none; d=google.com; s=arc-20160816; b=MRyXmi8vgWZiUugp3p1Re3OSr7+JXmr1KmizRYqPpEc5h8J3gpfRWamBLToA/N0Jxp /7Y99NUeFQWsTNSKmX0ryTZug0tGZSi5NumU6f33COO43KqJQsR85sm2PveBlIqp+Llb YV2dqT29NGNvJyO7KYqhP5P3TjJZqIcJuhBwc3FxSkcCkxr7Z+bznWv4y9LUupbDFGwK 6DQiEF+WSSSve1/l4P0jpeL+eaVyESyEygQnzMbkC7VuUVLXzEhCoz2mtuO92gHM37x3 l8kmmXObVF0GIMM2k0OHXE8PgxZYnNpnY/eNAmHXiiRi/EjJyzrR7aBfC98iV+UBvWU+ bZ+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=bjO1yx2ZmJ/fwGYbywClmLhI9D7iW4UUWVmJvkwsN2A=; b=PVgRMBtskH6cHZGuwW2ZS5HpKCTnqIGMYVqqXtPL4aLfkPfY6dyTQy3FTPP7enhNG7 sw1BESUBPgVM22+JIgzOFlDrvh+qLCLzT/tCE/9T2olBlQz42SYrBxsLVnJsdeAsz+4e 8V5EMAbfRFytGNe/ryt3W56kzoi7H4UWKyC5dFE+Emj9BqHC1W/NCZvGYm8tn0yYZMKt 2t02rl/hXVtx2QPOnvzHdRMbaFo1AFmowliZFhSrOkAPM425ct8auwMVkE6icPbjfDrp yHLrZonQR//Ps03AUhooNSYnpG3fwr8NrgzAzhnXDKhdbztbQTqPevLEzDIu4zjzOFHm M/2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lx1wOLFV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b17-20020a056402279100b00456f51ed614si11660270ede.361.2022.10.04.02.33.28; Tue, 04 Oct 2022 02:33:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=lx1wOLFV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231247AbiJDJbJ (ORCPT + 99 others); Tue, 4 Oct 2022 05:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbiJDJ1t (ORCPT ); Tue, 4 Oct 2022 05:27:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70AE268; Tue, 4 Oct 2022 02:27:11 -0700 (PDT) Date: Tue, 04 Oct 2022 09:27:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1664875630; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bjO1yx2ZmJ/fwGYbywClmLhI9D7iW4UUWVmJvkwsN2A=; b=lx1wOLFV5R5OYy/hNntAmOk9dE/cWq1CVHyJg3I8iaMgfNdXaLIiS3p9fZR2msJCBU2s2a 3CwKPab92oMB44vUTVsMK8sJIBGqcHZN+CKD1iXZxPWcXjXbqdOO9eko7OIGOTkjtUN30g VJqjinJ7yIUR4cN3JT7pQyF0wvqqeGOWHb8G0NI4vgUFFQuLYyU3cjTKX7SQBUI+/U4b8Y c94N92vmoMxkHjxqESHnhLykYfhQCWpmSM4g9eqpnXgDSOsAkZ7RsuxBfM+AtUnksuK6B1 JDT4zLyCr68N04DS1Ms8Mhyq1m+khnc0uIrJuRYq1jKhmcE6/sPzbapLGzxlMQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1664875630; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bjO1yx2ZmJ/fwGYbywClmLhI9D7iW4UUWVmJvkwsN2A=; b=cyzK8yH0M0x0Uooc4sTyq37ToP428aKESmlimqIvyW5bUHnllSXuQr9ADziCsjUd5e5osx 6xnkfhfmMXYfEmAg== From: "tip-bot2 for Tony Lindgren" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] clocksource/drivers/timer-ti-dm: Get clock in probe with devm_clk_get() Cc: Tony Lindgren , Janusz Krzysztofik , Daniel Lezcano , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220815131250.34603-10-tony@atomide.com> References: <20220815131250.34603-10-tony@atomide.com> MIME-Version: 1.0 Message-ID: <166487562906.401.7725425779932812533.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/core branch of tip: Commit-ID: 789d4b1070261fa98b06384d2067f23c080dc9f1 Gitweb: https://git.kernel.org/tip/789d4b1070261fa98b06384d2067f23c080dc9f1 Author: Tony Lindgren AuthorDate: Mon, 15 Aug 2022 16:12:50 +03:00 Committer: Daniel Lezcano CommitterDate: Tue, 20 Sep 2022 10:49:46 +02:00 clocksource/drivers/timer-ti-dm: Get clock in probe with devm_clk_get() We can simplify the code a bit by getting the clock in probe, and using devm_clk_get(). This will also make further changes easier as the clock is available in probe instead of prepare. Signed-off-by: Tony Lindgren Reviewed-by: Janusz Krzysztofik Link: https://lore.kernel.org/r/20220815131250.34603-10-tony@atomide.com Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-ti-dm.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c index 2310f97..cad29de 100644 --- a/drivers/clocksource/timer-ti-dm.c +++ b/drivers/clocksource/timer-ti-dm.c @@ -473,18 +473,6 @@ static int omap_dm_timer_prepare(struct dmtimer *timer) struct device *dev = &timer->pdev->dev; int rc; - /* - * FIXME: OMAP1 devices do not use the clock framework for dmtimers so - * do not call clk_get() for these devices. - */ - if (!timer->omap1) { - timer->fclk = clk_get(&timer->pdev->dev, "fck"); - if (WARN_ON_ONCE(IS_ERR(timer->fclk))) { - dev_err(&timer->pdev->dev, ": No fclk handle.\n"); - return -EINVAL; - } - } - rc = pm_runtime_resume_and_get(dev); if (rc) return rc; @@ -650,8 +638,6 @@ static int omap_dm_timer_free(struct omap_dm_timer *cookie) if (unlikely(!timer)) return -EINVAL; - clk_put(timer->fclk); - WARN_ON(!timer->reserved); timer->reserved = 0; return 0; @@ -1098,7 +1084,6 @@ static int omap_dm_timer_probe(struct platform_device *pdev) if (timer->irq < 0) return timer->irq; - timer->fclk = ERR_PTR(-ENODEV); timer->io_base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(timer->io_base)) return PTR_ERR(timer->io_base); @@ -1122,6 +1107,15 @@ static int omap_dm_timer_probe(struct platform_device *pdev) timer->omap1 = timer->capability & OMAP_TIMER_NEEDS_RESET; + /* OMAP1 devices do not yet use the clock framework for dmtimers */ + if (!timer->omap1) { + timer->fclk = devm_clk_get(dev, "fck"); + if (IS_ERR(timer->fclk)) + return PTR_ERR(timer->fclk); + } else { + timer->fclk = ERR_PTR(-ENODEV); + } + if (!(timer->capability & OMAP_TIMER_ALWON)) { timer->nb.notifier_call = omap_timer_context_notifier; cpu_pm_register_notifier(&timer->nb);