linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Thermal devfreq cooling small updates
@ 2019-12-16 14:19 lukasz.luba
  2019-12-16 14:19 ` [PATCH 1/2] thermal: devfreq_cooling: Change license header to SPDX lukasz.luba
  2019-12-16 14:19 ` [PATCH 2/2] thermal: devfreq_cooling: Add device node reclaiming in devfreq_cooling_register() lukasz.luba
  0 siblings, 2 replies; 3+ messages in thread
From: lukasz.luba @ 2019-12-16 14:19 UTC (permalink / raw)
  To: linux-kernel, rui.zhang, daniel.lezcano, linux-pm
  Cc: amit.kucheria, lukasz.luba, dietmar.eggemann

From: Lukasz Luba <lukasz.luba@arm.com>

Hi all,

This patch set adds small changes to devfreq cooling:
- updating the license to SPDX and copyright to 2019
- reclaiming the device node in registration function

It is based on the current work in thermal branch thermal/linux-next
https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/log/?h=thermal/linux-next

Regards,
Lukasz Luba

Lukasz Luba (2):
  thermal: devfreq_cooling: Change license header to SPDX
  thermal: devfreq_cooling: Add device node reclaiming in
    devfreq_cooling_register()

 drivers/thermal/devfreq_cooling.c | 33 ++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 12 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH  1/2] thermal: devfreq_cooling: Change license header to SPDX
  2019-12-16 14:19 [PATCH 0/2] Thermal devfreq cooling small updates lukasz.luba
@ 2019-12-16 14:19 ` lukasz.luba
  2019-12-16 14:19 ` [PATCH 2/2] thermal: devfreq_cooling: Add device node reclaiming in devfreq_cooling_register() lukasz.luba
  1 sibling, 0 replies; 3+ messages in thread
From: lukasz.luba @ 2019-12-16 14:19 UTC (permalink / raw)
  To: linux-kernel, rui.zhang, daniel.lezcano, linux-pm
  Cc: amit.kucheria, lukasz.luba, dietmar.eggemann

From: Lukasz Luba <lukasz.luba@arm.com>

Align with the new license header requirements and switch to SPDX form.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/thermal/devfreq_cooling.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index a87d4fa031c8..1861241c7ef5 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -1,17 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * devfreq_cooling: Thermal cooling device implementation for devices using
  *                  devfreq
  *
- * Copyright (C) 2014-2015 ARM Limited
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- * kind, whether express or implied; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Copyright (C) 2014-2019 ARM Limited
  *
  * TODO:
  *    - If OPPs are added or removed after devfreq cooling has
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH  2/2] thermal: devfreq_cooling: Add device node reclaiming in devfreq_cooling_register()
  2019-12-16 14:19 [PATCH 0/2] Thermal devfreq cooling small updates lukasz.luba
  2019-12-16 14:19 ` [PATCH 1/2] thermal: devfreq_cooling: Change license header to SPDX lukasz.luba
@ 2019-12-16 14:19 ` lukasz.luba
  1 sibling, 0 replies; 3+ messages in thread
From: lukasz.luba @ 2019-12-16 14:19 UTC (permalink / raw)
  To: linux-kernel, rui.zhang, daniel.lezcano, linux-pm
  Cc: amit.kucheria, lukasz.luba, dietmar.eggemann

From: Lukasz Luba <lukasz.luba@arm.com>

Since the devfreq device parent might have the proper device node, devfreq
cooling registration can re-use it. This will allow thermal bind function
to pin thermal zone with cooling device based on definition in the device
tree automatically. It will simplify registration of cooling device in
drivers code.
Fix also 'unregister path' and add IS_ERR_OR_NULL() check.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/thermal/devfreq_cooling.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/thermal/devfreq_cooling.c b/drivers/thermal/devfreq_cooling.c
index 1861241c7ef5..c29056cb4a71 100644
--- a/drivers/thermal/devfreq_cooling.c
+++ b/drivers/thermal/devfreq_cooling.c
@@ -574,7 +574,24 @@ EXPORT_SYMBOL_GPL(of_devfreq_cooling_register);
  */
 struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df)
 {
-	return of_devfreq_cooling_register(NULL, df);
+	struct thermal_cooling_device *dfc;
+	struct device_node *np = NULL;
+	struct device *dev;
+
+	if (IS_ERR_OR_NULL(df))
+		return ERR_PTR(-EINVAL);
+
+	dev = df->dev.parent;
+
+	if (dev && dev->of_node)
+		np = of_node_get(dev->of_node);
+
+	dfc = of_devfreq_cooling_register(np, df);
+
+	if (np)
+		of_node_put(np);
+
+	return dfc;
 }
 EXPORT_SYMBOL_GPL(devfreq_cooling_register);
 
@@ -586,7 +603,7 @@ void devfreq_cooling_unregister(struct thermal_cooling_device *cdev)
 {
 	struct devfreq_cooling_device *dfc;
 
-	if (!cdev)
+	if (IS_ERR_OR_NULL(cdev))
 		return;
 
 	dfc = cdev->devdata;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-16 14:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-16 14:19 [PATCH 0/2] Thermal devfreq cooling small updates lukasz.luba
2019-12-16 14:19 ` [PATCH 1/2] thermal: devfreq_cooling: Change license header to SPDX lukasz.luba
2019-12-16 14:19 ` [PATCH 2/2] thermal: devfreq_cooling: Add device node reclaiming in devfreq_cooling_register() lukasz.luba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).