aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwtracing/coresight/coresight-platform.c
diff options
context:
space:
mode:
authorSuzuki K Poulose <suzuki.poulose@arm.com>2019-05-22 11:34:47 +0100
committerMathieu Poirier <mathieu.poirier@linaro.org>2019-06-04 11:46:52 -0600
commit7a46f1db10b19100311ba8c336f057a9a0c5d37b (patch)
tree628b1847c25eb85c056ca1d639d157a74b981690 /drivers/hwtracing/coresight/coresight-platform.c
parentdaa60c7babc7b3c4e897d6a250a8339eb6cc5bf2 (diff)
coresight: platform: Make memory allocation helper generic
Rename the of_coresight_alloc_memory() => coresight_alloc_conns() as it is independent of the underlying firmware type. This is in preparation for the ACPI support. Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-platform.c')
-rw-r--r--drivers/hwtracing/coresight/coresight-platform.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 514cc2b67c36..4c31299607cf 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -17,6 +17,24 @@
#include <linux/cpumask.h>
#include <asm/smp_plat.h>
+/*
+ * coresight_alloc_conns: Allocate connections record for each output
+ * port from the device.
+ */
+static int coresight_alloc_conns(struct device *dev,
+ struct coresight_platform_data *pdata)
+{
+ if (pdata->nr_outport) {
+ pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
+ sizeof(*pdata->conns),
+ GFP_KERNEL);
+ if (!pdata->conns)
+ return -ENOMEM;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_OF
static int of_dev_node_match(struct device *dev, void *data)
{
@@ -133,20 +151,6 @@ static void of_coresight_get_ports(const struct device_node *node,
}
}
-static int of_coresight_alloc_memory(struct device *dev,
- struct coresight_platform_data *pdata)
-{
- if (pdata->nr_outport) {
- pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
- sizeof(*pdata->conns),
- GFP_KERNEL);
- if (!pdata->conns)
- return -ENOMEM;
- }
-
- return 0;
-}
-
int of_coresight_get_cpu(const struct device_node *node)
{
int cpu;
@@ -252,7 +256,7 @@ of_get_coresight_platform_data(struct device *dev,
if (!pdata->nr_outport)
return pdata;
- ret = of_coresight_alloc_memory(dev, pdata);
+ ret = coresight_alloc_conns(dev, pdata);
if (ret)
return ERR_PTR(ret);