From patchwork Fri Nov 22 10:28:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 180010 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp45836ilf; Fri, 22 Nov 2019 03:01:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzCQFyvf9UOHoZoJ1pWY3fH7M3CYXSqvTG7TNzs1wBzdZwd/NL4K0R1LF/c14Uvnxyayw7/ X-Received: by 2002:a17:906:edd5:: with SMTP id sb21mr20866407ejb.138.1574420488319; Fri, 22 Nov 2019 03:01:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574420488; cv=none; d=google.com; s=arc-20160816; b=UAG+4lYWPjKH4IwMxMVXoVaTIISMUThwyjQ+uOu/AbQj9LjdtrzshpL/gDh4aCCuz0 Wg/idoOn9t98yCpNt4T6nRuGLbdT5lsK4rNOB5+pghVF6vmSyobM5i16aCsuq/v13M2r rRdupqRjxnniK85AyfiIfHaQUTcIUnn0KmHcuIOhNNMLGPhqEcu8NLpCwu8kS+ziwMe3 LkQbSrgzRDubQoZ58NkD9L5xpdkywkv1gTMyMf6BsnO9Wov4jKXYqUAPkgNAtUGQovGt Gu1CQO87B8JzGiVRVH2GykfVp3fEzio9HoIkbf9QuQd+s+YtOxgYhClJCCV3RBmU9qMj 4xtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xdLNdk4+V8rGQwOlFe7xcxbaGIB0P99c6UVbR632cyM=; b=WuUxQvC5GGfxBmyVf65hJ75zSLNUYH2ojRu8FnwL3LSs6GMAYeElNdSaPBttwW61xe CFJ1B7Mne49grkP6eI1BBI/CGeQJ4CMz1XkZsyneKrsN575KMpfvAqUaIJWuYe+qxQTF IVEyeSNx0hK29rirkBPNnMiqKtf9428ZWL3OBTxAi+OEz9KL7ujp/x164RlI2YAlthu2 +f277aLjIdN4GUHdfetc1cbayZmnQOIBqKijlTC03MH7333sFCRvr5/lLOq3vsUHsOFA PR9jOp1rtGWJTzHmoGpC7+zf5fBhlAOrOp9eSCihbgfBZccrb72WfuB0mlhV4U4yh8Z3 MWIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lljjz2Nc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6si4408862edf.256.2019.11.22.03.01.27; Fri, 22 Nov 2019 03:01:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lljjz2Nc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731188AbfKVLBY (ORCPT + 26 others); Fri, 22 Nov 2019 06:01:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:54244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731168AbfKVLBW (ORCPT ); Fri, 22 Nov 2019 06:01:22 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9107F20721; Fri, 22 Nov 2019 11:01:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574420481; bh=3xOrFvEETPELfuNZgkHn7Y2v1ZZIxqMiDdP4KdOnb0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lljjz2NclBzXgSlcRgvN5HzwrZ0gud83s77J2k+76NxGzuO2l43R2MzHTc48I832K 0zbOyG39d7fIe3wRiBKwZN0qXzMdsjclRFPaKWOpvwgt1kRwHUn/mcpBYAAgpWnJdx 6TeL9rL1pdXWRrP9SoalWwOn9TgZHyql/OLhtrqM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Sylwester Nawrocki , Sasha Levin Subject: [PATCH 4.19 119/220] clk: samsung: Use clk_hw API for calling clk framework from clk notifiers Date: Fri, 22 Nov 2019 11:28:04 +0100 Message-Id: <20191122100921.297126508@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100912.732983531@linuxfoundation.org> References: <20191122100912.732983531@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek Szyprowski [ Upstream commit 1da220e3a5d22fccda0bc8542997abc1d1741268 ] clk_notifier_register() documentation states, that the provided notifier callbacks associated with the notifier must not re-enter into the clk framework by calling any top-level clk APIs. Fix this by replacing clk_get_rate() calls with clk_hw_get_rate(), which is safe in this context. Signed-off-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki Signed-off-by: Sasha Levin --- drivers/clk/samsung/clk-cpu.c | 6 +++--- drivers/clk/samsung/clk-cpu.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index d2c99d8916b83..a5fddebbe5305 100644 --- a/drivers/clk/samsung/clk-cpu.c +++ b/drivers/clk/samsung/clk-cpu.c @@ -152,7 +152,7 @@ static int exynos_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, struct exynos_cpuclk *cpuclk, void __iomem *base) { const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; - unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); + unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); unsigned long alt_div = 0, alt_div_mask = DIV_MASK; unsigned long div0, div1 = 0, mux_reg; unsigned long flags; @@ -280,7 +280,7 @@ static int exynos5433_cpuclk_pre_rate_change(struct clk_notifier_data *ndata, struct exynos_cpuclk *cpuclk, void __iomem *base) { const struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg; - unsigned long alt_prate = clk_get_rate(cpuclk->alt_parent); + unsigned long alt_prate = clk_hw_get_rate(cpuclk->alt_parent); unsigned long alt_div = 0, alt_div_mask = DIV_MASK; unsigned long div0, div1 = 0, mux_reg; unsigned long flags; @@ -432,7 +432,7 @@ int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, else cpuclk->clk_nb.notifier_call = exynos_cpuclk_notifier_cb; - cpuclk->alt_parent = __clk_lookup(alt_parent); + cpuclk->alt_parent = __clk_get_hw(__clk_lookup(alt_parent)); if (!cpuclk->alt_parent) { pr_err("%s: could not lookup alternate parent %s\n", __func__, alt_parent); diff --git a/drivers/clk/samsung/clk-cpu.h b/drivers/clk/samsung/clk-cpu.h index d4b6b517fe1b4..bd38c6aa38970 100644 --- a/drivers/clk/samsung/clk-cpu.h +++ b/drivers/clk/samsung/clk-cpu.h @@ -49,7 +49,7 @@ struct exynos_cpuclk_cfg_data { */ struct exynos_cpuclk { struct clk_hw hw; - struct clk *alt_parent; + struct clk_hw *alt_parent; void __iomem *ctrl_base; spinlock_t *lock; const struct exynos_cpuclk_cfg_data *cfg;