[PATCH 4/9] PM / devfreq: exynos-bus: Replace deprecated 'devfreq' property

Chanwoo Choi
2019-12-17T05:51:47Z

In order to remove the deprecated 'devfreq' property, replace with
new 'exynos,parent-bus' property in order to get the parent devfreq device
in devicetree file instead of 'devfreq' property. But, to guarantee the
backward-compatibility, keep the support 'devfreq' property.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
.../bindings/devfreq/exynos-bus.txt | 16 +++++++--------
drivers/devfreq/exynos-bus.c | 20 ++++++++++++-------
2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
index e71f752cc18f..c948cee01124 100644
--- a/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
+++ b/Documentation/devicetree/bindings/devfreq/exynos-bus.txt
@@ -45,7 +45,7 @@ Required properties only for parent bus device:
of buses.

Required properties only for passive bus device:
-- devfreq: the parent bus device.
+- exynos,parent-bus: the parent bus device.

Optional properties only for parent bus device:
- exynos,saturation-ratio: the percentage value which is used to calibrate
@@ -386,36 +386,36 @@ Example2 :
};

&bus_rightbus {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_lcd0 {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_fsys {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_mcuisp {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_isp {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_peril {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};

&bus_mfc {
- devfreq = <&bus_leftbus>;
+ exynos,parent-bus = <&bus_leftbus>;
status = "okay";
};
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 7893c3b99e60..60d61b168153 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -148,11 +148,17 @@ static int exynos_bus_get_dev_status(struct device *dev,

static struct devfreq *get_parent_devfreq_by_node(struct device_node *np)
{
- struct device_node *node = of_parse_phandle(np, "devfreq", 0);
-
- if (!node)
- return ERR_PTR(-ENODEV);
-
+ struct device_node *node = of_parse_phandle(np, "exynos,parent-bus", 0);
+
+ if (!node) {
+ /*
+ * Check the deprecated 'devfreq' property
+ * to support backward-compatibility.
+ */
+ node = of_parse_phandle(np, "devfreq", 0);
+ if (!node)
+ return ERR_PTR(-ENODEV);
+ }
return devfreq_get_devfreq_by_node(node);
}

@@ -376,7 +382,7 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus,

/* Get the instance of parent devfreq device */
parent_devfreq = get_parent_devfreq_by_node(dev->of_node);
- if (IS_ERR(parent_devfreq)) {
+ if (IS_ERR(parent_devfreq))
return -EPROBE_DEFER;

passive_data = devm_kzalloc(dev, sizeof(*passive_data), GFP_KERNEL);
@@ -423,7 +429,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
if (!profile)
return -ENOMEM;

- node = of_parse_phandle(dev->of_node, "devfreq", 0);
+ node = of_parse_phandle(dev->of_node, "exynos,parent-bus", 0);
if (node) {
of_node_put(node);
passive = true;
--
2.17.1