Loading drivers/hwtracing/coresight/of_coresight.c +43 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ #include <linux/coresight.h> #include <linux/cpumask.h> #include <asm/smp_plat.h> #include <linux/coresight-cti.h> static int of_dev_node_match(struct device *dev, void *data) { Loading Loading @@ -216,3 +216,45 @@ int of_get_coresight_csr_name(struct device_node *node, const char **csr_name) return 0; } EXPORT_SYMBOL(of_get_coresight_csr_name); struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node) { int i, ret; uint32_t ctis_len; struct device_node *child_node; struct coresight_cti_data *ctidata; ctidata = devm_kzalloc(dev, sizeof(*ctidata), GFP_KERNEL); if (!ctidata) return ERR_PTR(-ENOMEM); if (of_get_property(node, "coresight-ctis", &ctis_len)) ctidata->nr_ctis = ctis_len/sizeof(uint32_t); else return ERR_PTR(-EINVAL); if (ctidata->nr_ctis) { ctidata->names = devm_kzalloc(dev, ctidata->nr_ctis * sizeof(*ctidata->names), GFP_KERNEL); if (!ctidata->names) return ERR_PTR(-ENOMEM); for (i = 0; i < ctidata->nr_ctis; i++) { child_node = of_parse_phandle(node, "coresight-ctis", i); if (!child_node) return ERR_PTR(-EINVAL); ret = of_property_read_string(child_node, "coresight-name", &ctidata->names[i]); of_node_put(child_node); if (ret) return ERR_PTR(ret); } } return ctidata; } EXPORT_SYMBOL(of_get_coresight_cti_data); include/linux/coresight.h +4 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,8 @@ of_get_coresight_platform_data(struct device *dev, extern int of_get_coresight_csr_name(struct device_node *node, const char **csr_name); extern struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node); #else static inline int of_coresight_get_cpu(const struct device_node *node) { return 0; } Loading @@ -297,6 +299,8 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, const struct device_node *node) { return NULL; } static inline int of_get_coresight_csr_name(struct device_node *node, const char **csr_name){ return -EINVAL; } static inlint struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node) { return NULL; } #endif #endif Loading
drivers/hwtracing/coresight/of_coresight.c +43 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ #include <linux/coresight.h> #include <linux/cpumask.h> #include <asm/smp_plat.h> #include <linux/coresight-cti.h> static int of_dev_node_match(struct device *dev, void *data) { Loading Loading @@ -216,3 +216,45 @@ int of_get_coresight_csr_name(struct device_node *node, const char **csr_name) return 0; } EXPORT_SYMBOL(of_get_coresight_csr_name); struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node) { int i, ret; uint32_t ctis_len; struct device_node *child_node; struct coresight_cti_data *ctidata; ctidata = devm_kzalloc(dev, sizeof(*ctidata), GFP_KERNEL); if (!ctidata) return ERR_PTR(-ENOMEM); if (of_get_property(node, "coresight-ctis", &ctis_len)) ctidata->nr_ctis = ctis_len/sizeof(uint32_t); else return ERR_PTR(-EINVAL); if (ctidata->nr_ctis) { ctidata->names = devm_kzalloc(dev, ctidata->nr_ctis * sizeof(*ctidata->names), GFP_KERNEL); if (!ctidata->names) return ERR_PTR(-ENOMEM); for (i = 0; i < ctidata->nr_ctis; i++) { child_node = of_parse_phandle(node, "coresight-ctis", i); if (!child_node) return ERR_PTR(-EINVAL); ret = of_property_read_string(child_node, "coresight-name", &ctidata->names[i]); of_node_put(child_node); if (ret) return ERR_PTR(ret); } } return ctidata; } EXPORT_SYMBOL(of_get_coresight_cti_data);
include/linux/coresight.h +4 −0 Original line number Diff line number Diff line Loading @@ -290,6 +290,8 @@ of_get_coresight_platform_data(struct device *dev, extern int of_get_coresight_csr_name(struct device_node *node, const char **csr_name); extern struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node); #else static inline int of_coresight_get_cpu(const struct device_node *node) { return 0; } Loading @@ -297,6 +299,8 @@ static inline struct coresight_platform_data *of_get_coresight_platform_data( struct device *dev, const struct device_node *node) { return NULL; } static inline int of_get_coresight_csr_name(struct device_node *node, const char **csr_name){ return -EINVAL; } static inlint struct coresight_cti_data *of_get_coresight_cti_data( struct device *dev, struct device_node *node) { return NULL; } #endif #endif