Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+11 -7
+7 -4
drivers/devfreq/devfreq.c
··· 1012 1012 /* 1013 1013 * devfreq_get_devfreq_by_phandle - Get the devfreq device from devicetree 1014 1014 * @dev - instance to the given device 1015 + * @phandle_name - name of property holding a phandle value 1015 1016 * @index - index into list of devfreq 1016 1017 * 1017 1018 * return the instance of devfreq device 1018 1019 */ 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) 1020 1022 { 1021 1023 struct device_node *node; 1022 1024 struct devfreq *devfreq; 1023 1025 1024 - if (!dev) 1026 + if (!dev || !phandle_name) 1025 1027 return ERR_PTR(-EINVAL); 1026 1028 1027 1029 if (!dev->of_node) 1028 1030 return ERR_PTR(-EINVAL); 1029 1031 1030 - node = of_parse_phandle(dev->of_node, "devfreq", index); 1032 + node = of_parse_phandle(dev->of_node, phandle_name, index); 1031 1033 if (!node) 1032 1034 return ERR_PTR(-ENODEV); 1033 1035 ··· 1045 1043 return ERR_PTR(-ENODEV); 1046 1044 } 1047 1045 1048 - struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index) 1046 + struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, 1047 + const char *phandle_name, int index) 1049 1048 { 1050 1049 return ERR_PTR(-ENODEV); 1051 1050 }
+1 -1
drivers/devfreq/exynos-bus.c
··· 360 360 profile->exit = exynos_bus_passive_exit; 361 361 362 362 /* 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); 364 364 if (IS_ERR(parent_devfreq)) 365 365 return -EPROBE_DEFER; 366 366
+3 -2
include/linux/devfreq.h
··· 262 262 struct notifier_block *nb, 263 263 unsigned int list); 264 264 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); 266 267 267 268 #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND) 268 269 /** ··· 422 421 } 423 422 424 423 static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, 425 - int index) 424 + const char *phandle_name, int index) 426 425 { 427 426 return ERR_PTR(-ENODEV); 428 427 }