From patchwork Tue Oct 2 11:52:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 147974 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5051441lji; Tue, 2 Oct 2018 04:52:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV63jrBDLGJnAhMENUQnc7885RwQ6XIfvaDmbXXV4xbJzdSYR/maxau0aYI6DfuVpZdBuM1Dy X-Received: by 2002:a62:824a:: with SMTP id w71-v6mr14763906pfd.68.1538481144375; Tue, 02 Oct 2018 04:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538481144; cv=none; d=google.com; s=arc-20160816; b=AQTQxR3mBQdw7Ugrx+Vbqh0X0Vae4BaheNzbhrPoEFE6uDBsfoHo3GnC9/Q5WsvzOU kWBC13QKx+J8uSc42KISn+nsw5yOkdKSTlzPfvgsbWOTZfGUyTwvWC2hbrXJRtPecTbb /lCpy0maloKtehUN8FPpghwPpbKrKNBSFdj7CM3qUY7wWkqvPkpBU3r6B4gBmq9H2Qej bBdXjl2wPF4aZWzkCKN0r8Q4AxYhhibYFeRWQ1KdNeJkUMKoCKFTqI6QSghHy2HkHpyI cvWGCirLS4ioB4wlPAE5/iljr/FqGOd1Rt7RAVu0PHARHbcZwDocMzSR2ifQEoTSjZTy py2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=tkzFoqdyXUE0fEabu9IjR2ZjdeoI14v46fnrlUnf5A8=; b=qGDprsyXCrooLr6jeD1ZYxukFT5dMLodUH6aPR2/POlafrfHAItFCZlC/Si4b19caO cmJUiN9UA1fpNtWJdOc61uxr3HGrrHOMvgvkcZw3fjQowMu4kLgMEIgmWx+U/ZQ6Xm7k 2K4HvPxHQzcX8w0IKcn+VeoC2enYzhFzYmoE0MvQ+Avl9WYNPy/MaIqvqlc7EXM1PUSp R5zrBH/TJ9nY8qG+3AhQcgmD0vO7/GO1/CbVxQHwQoqLjAjKx526ES9+6XVZaCiZP6Ie hTvQZpcUVTOsf4FU+UKB0yGi/x6/U3F3APOsoWGWFyLnJg39nbpWhrJJRgPA4RyaiGaN dnaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=MATYoSiY; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 20-v6si12387280pgk.190.2018.10.02.04.52.24; Tue, 02 Oct 2018 04:52:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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=@samsung.com header.s=mail20170921 header.b=MATYoSiY; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727512AbeJBSfS (ORCPT + 3 others); Tue, 2 Oct 2018 14:35:18 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:45970 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727510AbeJBSfS (ORCPT ); Tue, 2 Oct 2018 14:35:18 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20181002115221euoutp02ebc3502223a38bc5e5e6feb3729222cb~ZyHJiGsvK2696526965euoutp02M; Tue, 2 Oct 2018 11:52:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181002115221euoutp02ebc3502223a38bc5e5e6feb3729222cb~ZyHJiGsvK2696526965euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1538481141; bh=tkzFoqdyXUE0fEabu9IjR2ZjdeoI14v46fnrlUnf5A8=; h=From:To:Cc:Subject:Date:References:From; b=MATYoSiYBkXYYmS8uV48wyxwx3qutcx+95cjiL+HRgXlV+NwUhu7R2Y/z60qOEsmf RmwxzzlcDDJ3c1/VDwwIH/811ZziumsAn7Jo86IlKaeRw8C/c3/DQKggqVKLYuFVsX PG/Koy+ShyVFcnEJjSQp20B1TM44f8F5D3gI+Tss= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20181002115220eucas1p19c51bd9ef346a4cbdb7a6f246bff180e~ZyHJG2mi23041430414eucas1p1m; Tue, 2 Oct 2018 11:52:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id BE.6E.04294.4FB53BB5; Tue, 2 Oct 2018 12:52:20 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20181002115219eucas1p23816d543c4dedb233406869c22713a95~ZyHIRKW743260632606eucas1p2D; Tue, 2 Oct 2018 11:52:19 +0000 (GMT) X-AuditID: cbfec7f4-c77a99c0000010c6-11-5bb35bf48404 Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 01.FF.04284.3FB53BB5; Tue, 2 Oct 2018 12:52:19 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PFY009KWZN48Y50@eusync1.samsung.com>; Tue, 02 Oct 2018 12:52:19 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH] clk: samsung: Use clk_hw API for calling clk framework from clk notifiers Date: Tue, 02 Oct 2018 13:52:10 +0200 Message-id: <20181002115210.15541-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprKIsWRmVeSWpSXmKPExsWy7djPc7pfojdHG+xZrmyxccZ6VovrX56z Wpw/v4Hd4mPPPVaLGef3MVmsPXKX3aL96UtmB3aPTas62Tz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr49vMmWwF+4Qrtu95xdzAuEegi5GTQ0LAROLCgt3MXYxcHEICKxglnv86ygbhfGaU 6Dw6nRWm6mjzTSaIxDJGiSW717BDOA1MEt1fHrGAVLEJGEp0ve1iA7FFBBwkPn96zQhSxCzw mFFi68mvzCAJYYEYiV97fjCB2CwCqhL3Or+D2bwCthJrZs5mgVgnL7F6wwGwoyQE7rJKHL/b D3WHi8TP5+1sELawxKvjW9ghbBmJzo6DTBANzYwS7TNmsUM4PUCr5+yA6rCWOHz8ItgkZgE+ iUnbpgOt4ACK80p0tAlBlHhIfN/0E2yokECsxNGvt9kmMEosYGRYxSieWlqcm55abJSXWq5X nJhbXJqXrpecn7uJERhZp/8d/7KDcdefpEOMAhyMSjy8DPKbooVYE8uKK3MPMUpwMCuJ8LJa b44W4k1JrKxKLcqPLyrNSS0+xCjNwaIkzrts3sZoIYH0xJLU7NTUgtQimCwTB6dUA2PBx2xt g9dRl3+E38lr7H7+/phaogrX4oeyJ3O71z34MfOn5/nXt7P37df+5mf24ZTe292dTy8WLNs0 VXzllFV698903Epb7XhVM7T1bOOxeE/+2fdipoqyntB7HbzsoOIOX82MnUk+5q+62foPPS0I NntzK3uL+xseuQidXZpntt1dmfjvU8cfJZbijERDLeai4kQAm+poRagCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t/xy7qfozdHG/w7ZGaxccZ6VovrX56z Wpw/v4Hd4mPPPVaLGef3MVmsPXKX3aL96UtmB3aPTas62Tz6tqxi9Pi8SS6AOYrLJiU1J7Ms tUjfLoEr49vMmWwF+4Qrtu95xdzAuEegi5GTQ0LAROJo802mLkYuDiGBJYwSWzf3M0I4TUwS SxYdZwepYhMwlOh628UGYosIOEh8/vQarIhZ4DGjxLnFG1hBEsICMRK/9vxgArFZBFQl7nV+ B7N5BWwl1syczQKxTl5i9YYDzBMYuRYwMqxiFEktLc5Nzy021CtOzC0uzUvXS87P3cQI9P22 Yz8372C8tDH4EKMAB6MSDy+D/KZoIdbEsuLK3EOMEhzMSiK8rNabo4V4UxIrq1KL8uOLSnNS iw8xSnOwKInznjeojBISSE8sSc1OTS1ILYLJMnFwSjUw5s1ttSrgtUwyzK6d91eh/cizY0tn ZKsxv96ccEE/5dGhiT3OH3nqb5+c2CzTtlzH/ayRX9uRNSf+b+qX3fplN9tTp4+Psq6kWzPP U376o0zF9+I26f1sM123dAjIBsx5en8dcxgfw7MWht4LkepTAy/yBViqSW425bWdZv4rRzxY p8V76rUnSizFGYmGWsxFxYkA6unFHPkBAAA= X-CMS-MailID: 20181002115219eucas1p23816d543c4dedb233406869c22713a95 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20181002115219eucas1p23816d543c4dedb233406869c22713a95 References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 --- drivers/clk/samsung/clk-cpu.c | 6 +++--- drivers/clk/samsung/clk-cpu.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/clk/samsung/clk-cpu.c b/drivers/clk/samsung/clk-cpu.c index d2c99d8916b8..a5fddebbe530 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 d4b6b517fe1b..bd38c6aa3897 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;