aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/coresight/coresight-priv.h
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2016-04-05 11:53:50 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-01 14:12:14 -0700
commit154f3520fe1cdef9009909dc62828eb2d7635631 (patch)
tree3861bb7b07eb27c1d620a1524d5f797e07821286 /drivers/hwtracing/coresight/coresight-priv.h
parentcoresight: etm4x: implementing the perf PMU API (diff)
downloadlinux-dev-154f3520fe1cdef9009909dc62828eb2d7635631.tar.xz
linux-dev-154f3520fe1cdef9009909dc62828eb2d7635631.zip
coresight: moving coresight_simple_func() to header file
Macro "coresight_simple_func()" can be used by several drivers. As such making the structure type generic and moving to a globally available header file. That way individual drivers can use the functionality by simply specifying the structure they need to work with. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/coresight/coresight-priv.h')
-rw-r--r--drivers/hwtracing/coresight/coresight-priv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h
index 333eddaed339..3b5dd95a3588 100644
--- a/drivers/hwtracing/coresight/coresight-priv.h
+++ b/drivers/hwtracing/coresight/coresight-priv.h
@@ -37,6 +37,16 @@
#define ETM_MODE_EXCL_KERN BIT(30)
#define ETM_MODE_EXCL_USER BIT(31)
+#define coresight_simple_func(type, name, offset) \
+static ssize_t name##_show(struct device *_dev, \
+ struct device_attribute *attr, char *buf) \
+{ \
+ type *drvdata = dev_get_drvdata(_dev->parent); \
+ return scnprintf(buf, PAGE_SIZE, "0x%x\n", \
+ readl_relaxed(drvdata->base + offset)); \
+} \
+static DEVICE_ATTR_RO(name)
+
enum cs_mode {
CS_MODE_DISABLED,
CS_MODE_SYSFS,