From patchwork Tue Sep 8 10:24:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 11763119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4A8A746 for ; Tue, 8 Sep 2020 10:14:15 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC4B2215A4 for ; Tue, 8 Sep 2020 10:14:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dhVcUSWu"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="tAZEZSc0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AC4B2215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=samsung.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jSj0lL+nD/HaEytqWGp1vp3BN9Vo5QnCD/1SA9NUBUI=; b=dhVcUSWuA4DXedHi7wJHr0Hp0/ j2/jBMizZUyP2BJbnF0Jgu54qY5j/Htc3OHm7GdepFcB0zeO75lrbL2siw7QFQi8Tds4JE8Rblzbo Sy1JikCpLqcwXew0Uqy3jQ3/uu1ZzQfHmDvQoi8MWfV/B0eOp7Vdup9P9AcaVF9ZR6Y0W5r5pviog rzJ5Ewx4zvttXUNA5420czqwaMNJzMSC4nn2yVo+y74Nb9X9fiXL5KJiiLhtVgW7mWx+YGY6VhGU9 n+ZM5DI6WQcMpFMzhfxD7w+0bV2BBHnVAoZepniJkut3sjU8m5Kn3SsJm11E3SLHG7ZZJcWBUXUyS xho+5bBg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFacE-0006Nc-9J; Tue, 08 Sep 2020 10:12:42 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFacA-0006M0-20 for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 10:12:39 +0000 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20200908101235epoutp0311a607a588e25ff106ca70ece6448032~yx04DN0fo0358803588epoutp03A for ; Tue, 8 Sep 2020 10:12:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20200908101235epoutp0311a607a588e25ff106ca70ece6448032~yx04DN0fo0358803588epoutp03A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1599559955; bh=J/Dt3B5epxM2hfl2xSuuQL+o/kFO8VBmHsh0AA6NAv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tAZEZSc02t00u0GNIy9jtsUimxQ0iOXA+7AMthZyvozKVFLrnJlVjsCe7+7NJL/Bp f/BsIYn/+XpyPvp2pvO+Dm/WTwH2HRRsiaIlEMM/5GwftZpLuJdvl3ksVB9/7FqtPZ t2nG8UIAHga3vyPavMIe5CPRMd2Ujv1BComv5MlY= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20200908101235epcas1p4e665b4bd0dc7ee631a31d9be8c14de24~yx03wozhq1793617936epcas1p4m; Tue, 8 Sep 2020 10:12:35 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.40.158]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Bm1DH5tFZzMqYlv; Tue, 8 Sep 2020 10:12:31 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 2B.C9.18978.F09575F5; Tue, 8 Sep 2020 19:12:31 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20200908101231epcas1p4b6262aae4d5272f6cce366ac1ffbb955~yx0z5w8121795917959epcas1p4b; Tue, 8 Sep 2020 10:12:31 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200908101231epsmtrp19a55fde1eb3c2658931f53fc9c6b87b2~yx0z5FRHu1887518875epsmtrp1c; Tue, 8 Sep 2020 10:12:31 +0000 (GMT) X-AuditID: b6c32a35-603ff70000004a22-e2-5f57590fda38 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 6E.99.08382.E09575F5; Tue, 8 Sep 2020 19:12:30 +0900 (KST) Received: from localhost.localdomain (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200908101230epsmtip2282421ce7b62a585df96a94121857b21~yx0zqf2h81256012560epsmtip2k; Tue, 8 Sep 2020 10:12:30 +0000 (GMT) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, lukasz.luba@arm.com Subject: [PATCH v3 3/3] PM / devfreq: event: Change prototype of devfreq_event_get_edev_by_phandle function Date: Tue, 8 Sep 2020 19:24:47 +0900 Message-Id: <20200908102447.15097-4-cw00.choi@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200908102447.15097-1-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7bCmni5/ZHi8QdcJXYvrX56zWpw/v4Hd 4mzTG3aLTY+vsVpc3jWHzeJz7xFGixnn9zFZLGxqYbe43biCzYHTY828NYwem1Z1snlsXlLv 0bdlFaPH501yAaxR2TYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkou PgG6bpk5QPcoKZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVUgtScgosC/SKE3OLS/PS9ZLz c60MDQyMTIEKE7Iz1nX/Zy54aFbx7fZu1gbG/bpdjJwcEgImEouPbGMHsYUEdjBK7Jpo0MXI BWR/YpQ4f+ElM0TiG6PEnUMOMA2zfv1lhyjayyjRuXAbM4TzhVFi9ukeJpAqNgEtif0vbrCB 2CICZRK3v1wFK2IWaGWUuPf8GliRsECuxNr+02C7WQRUJZqnrQGL8wpYSdw4/JgVYp28xOoN B8DO4BSwlti+aiEbyCAJgWvsEv9ffIAqcpE42XaLEcIWlnh1fAs7hC0l8bK/Dcqullh58ghU cwejxJb9F6CajSX2L50MtJkD6DxNifW79CHCihI7f88Fm8kswCfx7msPK0iJhACvREebEESJ ssTlB3eZIGxJicXtnWwQtofEhy/zGCGh0scosfz+V6YJjHKzEDYsYGRcxSiWWlCcm55abFhg iBxlmxjBCU7LdAfjxLcf9A4xMnEwHmKU4GBWEuHtOhQaL8SbklhZlVqUH19UmpNafIjRFBh6 E5mlRJPzgSk2ryTe0NTI2NjYwsTQzNTQUEmc9+EthXghgfTEktTs1NSC1CKYPiYOTqkGJplF q+YfPn2Jfa5x9IxXXhYZbu//bOxWOHvoUffO1RfX9y5mrwxi4BFP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RZ9Tyz6TufGYvHA631WiqGLsv23rtRm3HoUFrZrx2NgROqdibeu7e16PGMRx3qy/0W G5f1MLf/Oa5n5nJ0nurs7mkXZ598oyz55VzRsXcFn77kKf3fbigUYnHI6uO/7ItrApilQhg/ +n/lTL1e3iN6i9/08bGMZxdKri6S9rRNUmIpzkg01GIuKk4EALtnlsyzAgAA X-CMS-MailID: 20200908101231epcas1p4b6262aae4d5272f6cce366ac1ffbb955 X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200908101231epcas1p4b6262aae4d5272f6cce366ac1ffbb955 References: <20200908102447.15097-1-cw00.choi@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_061238_445575_307F5CA2 X-CRM114-Status: GOOD ( 29.65 ) X-Spam-Score: -5.2 (-----) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-5.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [203.254.224.33 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [203.254.224.33 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Previously, devfreq core support 'devfreq-events' property in order to get the devfreq-event device by phandle. But, 'devfreq-events' property name is not proper on devicetree binding because this name doesn't mean the any h/w attribute. The devfreq-event core hand over the rights to decide the property name for getting the devfreq-event device on devicetree. Each devfreq-event driver will decide the property name on devicetree binding and then pass the their own property name to devfreq_event_get_edev_by_phandle function. And change the prototype of devfreq_event_get_edev_count function because of used deprecated 'devfreq-events' property. Signed-off-by: Chanwoo Choi Acked-by: Krzysztof Kozlowski --- drivers/devfreq/devfreq-event.c | 14 ++++++++------ drivers/devfreq/exynos-bus.c | 5 +++-- drivers/devfreq/rk3399_dmc.c | 2 +- drivers/memory/samsung/exynos5422-dmc.c | 6 ++++-- include/linux/devfreq-event.h | 14 ++++++++++---- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/drivers/devfreq/devfreq-event.c b/drivers/devfreq/devfreq-event.c index 56efbeb7851e..6765c03334bc 100644 --- a/drivers/devfreq/devfreq-event.c +++ b/drivers/devfreq/devfreq-event.c @@ -213,20 +213,21 @@ EXPORT_SYMBOL_GPL(devfreq_event_reset_event); * devfreq_event_get_edev_by_phandle() - Get the devfreq-event dev from * devicetree. * @dev : the pointer to the given device + * @phandle_name: name of property holding a phandle value * @index : the index into list of devfreq-event device * * Note that this function return the pointer of devfreq-event device. */ struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(struct device *dev, - int index) + const char *phandle_name, int index) { struct device_node *node; struct devfreq_event_dev *edev; - if (!dev->of_node) + if (!dev->of_node || !phandle_name) return ERR_PTR(-EINVAL); - node = of_parse_phandle(dev->of_node, "devfreq-events", index); + node = of_parse_phandle(dev->of_node, phandle_name, index); if (!node) return ERR_PTR(-ENODEV); @@ -258,19 +259,20 @@ EXPORT_SYMBOL_GPL(devfreq_event_get_edev_by_phandle); /** * devfreq_event_get_edev_count() - Get the count of devfreq-event dev * @dev : the pointer to the given device + * @phandle_name: name of property holding a phandle value * * Note that this function return the count of devfreq-event devices. */ -int devfreq_event_get_edev_count(struct device *dev) +int devfreq_event_get_edev_count(struct device *dev, const char *phandle_name) { int count; - if (!dev->of_node) { + if (!dev->of_node || !phandle_name) { dev_err(dev, "device does not have a device node entry\n"); return -EINVAL; } - count = of_property_count_elems_of_size(dev->of_node, "devfreq-events", + count = of_property_count_elems_of_size(dev->of_node, phandle_name, sizeof(u32)); if (count < 0) { dev_err(dev, diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 58dbf51f0983..1e684a448c9e 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -193,7 +193,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np, * Get the devfreq-event devices to get the current utilization of * buses. This raw data will be used in devfreq ondemand governor. */ - count = devfreq_event_get_edev_count(dev); + count = devfreq_event_get_edev_count(dev, "devfreq-events"); if (count < 0) { dev_err(dev, "failed to get the count of devfreq-event dev\n"); ret = count; @@ -209,7 +209,8 @@ static int exynos_bus_parent_parse_of(struct device_node *np, } for (i = 0; i < count; i++) { - bus->edev[i] = devfreq_event_get_edev_by_phandle(dev, i); + bus->edev[i] = devfreq_event_get_edev_by_phandle(dev, + "devfreq-events", i); if (IS_ERR(bus->edev[i])) { ret = -EPROBE_DEFER; goto err_regulator; diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 027769e39f9b..2e912166a993 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -341,7 +341,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) return PTR_ERR(data->dmc_clk); } - data->edev = devfreq_event_get_edev_by_phandle(dev, 0); + data->edev = devfreq_event_get_edev_by_phandle(dev, "devfreq-events", 0); if (IS_ERR(data->edev)) return -EPROBE_DEFER; diff --git a/drivers/memory/samsung/exynos5422-dmc.c b/drivers/memory/samsung/exynos5422-dmc.c index b9c7956e5031..714d1f6f077c 100644 --- a/drivers/memory/samsung/exynos5422-dmc.c +++ b/drivers/memory/samsung/exynos5422-dmc.c @@ -1293,7 +1293,8 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc) int counters_size; int ret, i; - dmc->num_counters = devfreq_event_get_edev_count(dmc->dev); + dmc->num_counters = devfreq_event_get_edev_count(dmc->dev, + "devfreq-events"); if (dmc->num_counters < 0) { dev_err(dmc->dev, "could not get devfreq-event counters\n"); return dmc->num_counters; @@ -1306,7 +1307,8 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc) for (i = 0; i < dmc->num_counters; i++) { dmc->counter[i] = - devfreq_event_get_edev_by_phandle(dmc->dev, i); + devfreq_event_get_edev_by_phandle(dmc->dev, + "devfreq-events", i); if (IS_ERR_OR_NULL(dmc->counter[i])) return -EPROBE_DEFER; } diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h index f14f17f8cb7f..4a50a5c71a5f 100644 --- a/include/linux/devfreq-event.h +++ b/include/linux/devfreq-event.h @@ -106,8 +106,11 @@ extern int devfreq_event_get_event(struct devfreq_event_dev *edev, struct devfreq_event_data *edata); extern int devfreq_event_reset_event(struct devfreq_event_dev *edev); extern struct devfreq_event_dev *devfreq_event_get_edev_by_phandle( - struct device *dev, int index); -extern int devfreq_event_get_edev_count(struct device *dev); + struct device *dev, + const char *phandle_name, + int index); +extern int devfreq_event_get_edev_count(struct device *dev, + const char *phandle_name); extern struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev, struct devfreq_event_desc *desc); extern int devfreq_event_remove_edev(struct devfreq_event_dev *edev); @@ -152,12 +155,15 @@ static inline int devfreq_event_reset_event(struct devfreq_event_dev *edev) } static inline struct devfreq_event_dev *devfreq_event_get_edev_by_phandle( - struct device *dev, int index) + struct device *dev, + const char *phandle_name, + int index) { return ERR_PTR(-EINVAL); } -static inline int devfreq_event_get_edev_count(struct device *dev) +static inline int devfreq_event_get_edev_count(struct device *dev, + const char *phandle_name) { return -EINVAL; }