From: Georgi Djakov Date: Fri, 15 May 2020 07:46:18 +0000 (+0300) Subject: Merge branch 'icc-get-by-index' into icc-next X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b35da2e86f256a3a4be7c3b31507016100b00847;p=linux.git Merge branch 'icc-get-by-index' into icc-next This is an immutable branch shared with the OPP tree. It contains also the patches to convert the interconnect framework from tristate to bool after Greg agreed with that. This will make the integration between the OPP layer and interconnect much easier. * icc-get-by-index: interconnect: Add of_icc_get_by_index() helper function interconnect: Disallow interconnect core to be built as a module interconnect: Remove unused module exit code from core Signed-off-by: Georgi Djakov --- b35da2e86f256a3a4be7c3b31507016100b00847 diff --cc drivers/interconnect/core.c index f9dd55a632ddf,2d2e497805119..ece2a579a9b04 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@@ -354,35 -350,10 +354,35 @@@ static struct icc_node *of_icc_get_from return node; } +static void devm_icc_release(struct device *dev, void *res) +{ + icc_put(*(struct icc_path **)res); +} + +struct icc_path *devm_of_icc_get(struct device *dev, const char *name) +{ + struct icc_path **ptr, *path; + + ptr = devres_alloc(devm_icc_release, sizeof(**ptr), GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + path = of_icc_get(dev, name); + if (!IS_ERR(path)) { + *ptr = path; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } + + return path; +} +EXPORT_SYMBOL_GPL(devm_of_icc_get); + /** - * of_icc_get() - get a path handle from a DT node based on name + * of_icc_get_by_index() - get a path handle from a DT node based on index * @dev: device pointer for the consumer device - * @name: interconnect path name + * @idx: interconnect path index * * This function will search for a path between two endpoints and return an * icc_path handle on success. Use icc_put() to release constraints when they diff --cc include/linux/interconnect.h index e56a95e3cf257,34e97231a6abb..d8c29049f066a --- a/include/linux/interconnect.h +++ b/include/linux/interconnect.h @@@ -28,10 -28,8 +28,11 @@@ struct device struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id); struct icc_path *of_icc_get(struct device *dev, const char *name); +struct icc_path *devm_of_icc_get(struct device *dev, const char *name); + struct icc_path *of_icc_get_by_index(struct device *dev, int idx); void icc_put(struct icc_path *path); +int icc_enable(struct icc_path *path); +int icc_disable(struct icc_path *path); int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw); void icc_set_tag(struct icc_path *path, u32 tag); @@@ -49,12 -47,11 +50,17 @@@ static inline struct icc_path *of_icc_g return NULL; } +static inline struct icc_path *devm_of_icc_get(struct device *dev, + const char *name) +{ + return NULL; +} + + static inline struct icc_path *of_icc_get_by_index(struct device *dev, int idx) + { + return NULL; + } + static inline void icc_put(struct icc_path *path) { }