Skip to content

Commit 86d90fd

Browse files
committed
PM / devfreq: Change prototype of devfreq_get_devfreq_by_phandle function
Previously, devfreq core support 'devfreq' property in order to get the devfreq device by phandle. But, 'devfreq' property name is not proper on devicetree binding because this name doesn't mean the any h/w attribute. The devfreq core hand over the right to decide the property name for getting the devfreq device on devicetree. Each devfreq driver will decide the property name on devicetree binding and pass the their own property name to devfreq_get_devfreq_by_phandle function. Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
1 parent 7b38b7b commit 86d90fd

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

drivers/devfreq/devfreq.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,22 +1012,24 @@ struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
10121012
/*
10131013
* devfreq_get_devfreq_by_phandle - Get the devfreq device from devicetree
10141014
* @dev - instance to the given device
1015+
* @phandle_name - name of property holding a phandle value
10151016
* @index - index into list of devfreq
10161017
*
10171018
* return the instance of devfreq device
10181019
*/
1019-
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
1020+
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
1021+
const char *phandle_name, int index)
10201022
{
10211023
struct device_node *node;
10221024
struct devfreq *devfreq;
10231025

1024-
if (!dev)
1026+
if (!dev || !phandle_name)
10251027
return ERR_PTR(-EINVAL);
10261028

10271029
if (!dev->of_node)
10281030
return ERR_PTR(-EINVAL);
10291031

1030-
node = of_parse_phandle(dev->of_node, "devfreq", index);
1032+
node = of_parse_phandle(dev->of_node, phandle_name, index);
10311033
if (!node)
10321034
return ERR_PTR(-ENODEV);
10331035

@@ -1043,7 +1045,8 @@ struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
10431045
return ERR_PTR(-ENODEV);
10441046
}
10451047

1046-
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
1048+
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
1049+
const char *phandle_name, int index)
10471050
{
10481051
return ERR_PTR(-ENODEV);
10491052
}

drivers/devfreq/exynos-bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
360360
profile->exit = exynos_bus_passive_exit;
361361

362362
/* Get the instance of parent devfreq device */
363-
parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0);
363+
parent_devfreq = devfreq_get_devfreq_by_phandle(dev, "devfreq", 0);
364364
if (IS_ERR(parent_devfreq))
365365
return -EPROBE_DEFER;
366366

include/linux/devfreq.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ void devm_devfreq_unregister_notifier(struct device *dev,
262262
struct notifier_block *nb,
263263
unsigned int list);
264264
struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
265-
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index);
265+
struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
266+
const char *phandle_name, int index);
266267

267268
#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
268269
/**
@@ -421,7 +422,7 @@ static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *no
421422
}
422423

423424
static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
424-
int index)
425+
const char *phandle_name, int index)
425426
{
426427
return ERR_PTR(-ENODEV);
427428
}

0 commit comments

Comments
 (0)