From patchwork Thu Apr 25 07:56:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 13642935 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 398DCC4345F for ; Thu, 25 Apr 2024 07:57:00 +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:References: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: List-Owner; bh=hFslfs0Rg3MQGO31requwPtq+4deEZct4XdUeRHEZAg=; b=RHi7p6+kk4b8pV vzaE+UIFQlocO+yMzwdIAnF+9Kw+c68gL1eBmiWiX0J+38N4lKULke/T0535nr8bLCwLFR6loheLF zEabR9AervQbtQSB/wrzSnIvjGqlirOoFIYsGgu4+o4xOhBDlVJixRWN7OUQMR69N9DLMKtXPe/Tk 0EOKdWrve3nmgekwRqm1IoU1WWTFT+iVwmf8SbeHYbpwRD7CFhbsG31Np1IY4WAVUtUqJ+KPMNChH IWSB4Sa5Kl8JOyJ1mwlpiRkZfVcTYVnhqB2n3uBxH5RK4s7CMNHxoFfQC2ZVSrCnHkPaSFCrezJfr vB+R1L4qaTdR2vC1POYA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rztyK-00000007LvB-04K7; Thu, 25 Apr 2024 07:56:48 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rztyG-00000007Ltu-1Ket for linux-arm-kernel@lists.infradead.org; Thu, 25 Apr 2024 07:56:47 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240425075635euoutp01bab2230eb2c8961f728ad2fc2c7b5dcf~JdtYlBU5r2025620256euoutp01W for ; Thu, 25 Apr 2024 07:56:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240425075635euoutp01bab2230eb2c8961f728ad2fc2c7b5dcf~JdtYlBU5r2025620256euoutp01W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1714031795; bh=IORyVXtHeFQ58OwStWCgque/3B73pN4jAG+/asraCic=; h=From:To:Cc:Subject:Date:References:From; b=VXHhnsNIskciNAzi2LxzuAEFUBcEzYOXVW7HdJFcKJH03ig+sttj5Zu7Ou4FdEnli s+7GlRuyVT8nQGSxwimXfAD3/AaMBnMMd6R4lVVOTfd/ADMeHiYp4At7CZds9NF5Hn yMv4BQzXo2HapuamMWPZ8c7+DqpiIyEyFV7fVb6s= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240425075634eucas1p1cf6fbf73c5518a3f1de1743a3342fd20~JdtYOU5bR0357703577eucas1p1J; Thu, 25 Apr 2024 07:56:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 1F.D2.09875.2BC0A266; Thu, 25 Apr 2024 08:56:34 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240425075634eucas1p17bef12cf8ccafb6971f352d955e14fae~JdtXlLDFQ0144801448eucas1p1n; Thu, 25 Apr 2024 07:56:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240425075634eusmtrp2a248061711fa1d2dd88a62442725cbf3~JdtXjEcD51885518855eusmtrp2O; Thu, 25 Apr 2024 07:56:34 +0000 (GMT) X-AuditID: cbfec7f4-131ff70000002693-23-662a0cb2b8ea Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 15.4D.08810.2BC0A266; Thu, 25 Apr 2024 08:56:34 +0100 (BST) Received: from AMDC4653.digital.local (unknown [106.120.51.32]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240425075633eusmtip20b8d3830509fd671be1a07384d5363db~JdtWysBbI0079400794eusmtip2C; Thu, 25 Apr 2024 07:56:33 +0000 (GMT) From: Marek Szyprowski To: linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Rob Herring , David Lechner , Bjorn Andersson , Dmitry Baryshkov Subject: [PATCH] clk: samsung: Revert "clk: Use device_get_match_data()" Date: Thu, 25 Apr 2024 09:56:28 +0200 Message-Id: <20240425075628.838497-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJKsWRmVeSWpSXmKPExsWy7djP87qbeLTSDE5fNbZ4MG8bm8W2DhuL 61+es1osahCzmHj+J5vF+fMb2C02Pb7GavGx5x6rxYzz+5gs1h65y25x8ZSrxf89O9gtDr9p Z7X4d20jiwOfx/sbrewem1Z1snl86j/J6nHn2h42j81L6j36tqxi9Pi8SS6APYrLJiU1J7Ms tUjfLoEro2f3BbaCP4IVr45dY21g7OHv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9gtDr9p Z7X4d20jiwOfx/sbrewem1Z1snl86j/J6nHn2h42j81L6j36tqxi9Pi8SS6APUrPpii/tCRV ISO/uMRWKdrQwkjP0NJCz8jEUs/Q2DzWyshUSd/OJiU1J7MstUjfLkEvo2f3BbaCP4IVr45d Y21g7OHvYuTgkBAwkZiwUKSLkYtDSGApo8T5pg9sXYycQHEZiZPTGlghbGGJP9e62CCKPjFK PF3fwg6SYBMwlOh62wXWICKQJTFvwh0mkCJmgfPMEjcatjOCbBAW8JD4sS4RpIZFQFXi0+z7 jCA2r4CdxITf59ghFshL7D94lhkiLihxcuYTFhCbGSjevHU28wRGvllIUrOQpBYwMq1iFEkt Lc5Nzy021CtOzC0uzUvXS87P3cQIjJptx35u3sE479VHvUOMTByMhxglOJiVRHhvftRIE+JN SaysSi3Kjy8qzUktPsRoCnTfRGYp0eR8YNzmlcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJpCeW pGanphakFsH0MXFwSjUwHdaQc+9c0Xl11pRGpiT98xMUvv7g47g/cbHcQuN1kgFa5RdM6v8c 2xUrM0Ul8iq3zrH76e9fM2pu1N6v4HKn6YI/R+7L5jUOskv17i1W+ar6LX1p0GqJTFF7xoXz jqZOXsV0rNVw3nHbsgaGQy95DMvX3arw6d4psy5RdMMW7uuP2vea85bpOKeVzv6x+P2NJSIy yiGyFmEMzULsKfdCZqofUJ9kq7a33ud7G/ekazFHnrzdFLi244Ft4eKvhre2Hdi9JPmu/oZr ixSqXkYGepj9OP5Mftft/kcyrDsEJbY2ix7T2l9umaDRXBOl2POgnGX5PV7nwjeK+8KW/Wmy 0y6Pe2CUcOqFystdE8K2KbEUZyQaajEXFScCAPGXurYjAwAA X-CMS-MailID: 20240425075634eucas1p17bef12cf8ccafb6971f352d955e14fae X-Msg-Generator: CA X-RootMTR: 20240425075634eucas1p17bef12cf8ccafb6971f352d955e14fae X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240425075634eucas1p17bef12cf8ccafb6971f352d955e14fae References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240425_005645_014735_C78DF34C X-CRM114-Status: GOOD ( 19.54 ) 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 device_get_match_data() function should not be used on the device other than the one matched to the given driver, because it always returns the match_data of the matched driver. In case of exynos-clkout driver, the original code matches the OF IDs on the PARENT device, so replacing it with of_device_get_match_data() broke the driver. This has been already pointed once in commit 2bc5febd05ab ("clk: samsung: Revert "clk: samsung: exynos-clkout: Use of_device_get_match_data()""). To avoid further confusion, add a comment about this special case, which requires direct of_match_device() call to pass custom IDs array. This partially reverts commit 409c39ec92a35e3708f5b5798c78eae78512cd71. Fixes: 409c39ec92a3 ("clk: Use device_get_match_data()") Signed-off-by: Marek Szyprowski --- drivers/clk/samsung/clk-exynos-clkout.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c index 3484e6cc80ad..503c6f5b20d5 100644 --- a/drivers/clk/samsung/clk-exynos-clkout.c +++ b/drivers/clk/samsung/clk-exynos-clkout.c @@ -13,9 +13,9 @@ #include #include #include +#include #include #include -#include #define EXYNOS_CLKOUT_NR_CLKS 1 #define EXYNOS_CLKOUT_PARENTS 32 @@ -84,17 +84,24 @@ MODULE_DEVICE_TABLE(of, exynos_clkout_ids); static int exynos_clkout_match_parent_dev(struct device *dev, u32 *mux_mask) { const struct exynos_clkout_variant *variant; + const struct of_device_id *match; if (!dev->parent) { dev_err(dev, "not instantiated from MFD\n"); return -EINVAL; } - variant = device_get_match_data(dev->parent); - if (!variant) { + /* + * 'exynos_clkout_ids' arrays is not the ids array matched by + * the dev->parent driver, so of_device_get_match_data() or + * device_get_match_data() cannot be used here. + */ + match = of_match_device(exynos_clkout_ids, dev->parent); + if (!match) { dev_err(dev, "cannot match parent device\n"); return -EINVAL; } + variant = match->data; *mux_mask = variant->mux_mask;