Message ID | 20220830172614.340962-2-james.clark@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | coresight: Reduce duplicated sysfs accessors | expand |
On Tue, 30 Aug 2022 at 18:26, James Clark <james.clark@arm.com> wrote: > > The ability to use a custom function in this sysfs show function isn't > used so remove it. > > No functional changes. > > Signed-off-by: James Clark <james.clark@arm.com> > --- > drivers/hwtracing/coresight/coresight-priv.h | 16 ++++------------ > 1 file changed, 4 insertions(+), 12 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h > index ff1dd2092ac5..f2458b794ef3 100644 > --- a/drivers/hwtracing/coresight/coresight-priv.h > +++ b/drivers/hwtracing/coresight/coresight-priv.h > @@ -40,31 +40,23 @@ > #define ETM_MODE_EXCL_KERN BIT(30) > #define ETM_MODE_EXCL_USER BIT(31) > > -typedef u32 (*coresight_read_fn)(const struct device *, u32 offset); > -#define __coresight_simple_func(type, func, name, lo_off, hi_off) \ > +#define __coresight_simple_show(type, name, lo_off, hi_off) \ > static ssize_t name##_show(struct device *_dev, \ > struct device_attribute *attr, char *buf) \ > { \ > type *drvdata = dev_get_drvdata(_dev->parent); \ > - coresight_read_fn fn = func; \ > u64 val; \ > pm_runtime_get_sync(_dev->parent); \ > - if (fn) \ > - val = (u64)fn(_dev->parent, lo_off); \ > - else \ > - val = coresight_read_reg_pair(drvdata->base, \ > - lo_off, hi_off); \ > + val = coresight_read_reg_pair(drvdata->base, lo_off, hi_off); \ > pm_runtime_put_sync(_dev->parent); \ > return scnprintf(buf, PAGE_SIZE, "0x%llx\n", val); \ > } \ > static DEVICE_ATTR_RO(name) > > -#define coresight_simple_func(type, func, name, offset) \ > - __coresight_simple_func(type, func, name, offset, -1) > #define coresight_simple_reg32(type, name, offset) \ > - __coresight_simple_func(type, NULL, name, offset, -1) > + __coresight_simple_show(type, name, offset, -1) > #define coresight_simple_reg64(type, name, lo_off, hi_off) \ > - __coresight_simple_func(type, NULL, name, lo_off, hi_off) > + __coresight_simple_show(type, name, lo_off, hi_off) > > extern const u32 coresight_barrier_pkt[4]; > #define CORESIGHT_BARRIER_PKT_SIZE (sizeof(coresight_barrier_pkt)) > -- > 2.28.0 > Reviewed-by: Mike Leach <mike.leach@linaro.org>
diff --git a/drivers/hwtracing/coresight/coresight-priv.h b/drivers/hwtracing/coresight/coresight-priv.h index ff1dd2092ac5..f2458b794ef3 100644 --- a/drivers/hwtracing/coresight/coresight-priv.h +++ b/drivers/hwtracing/coresight/coresight-priv.h @@ -40,31 +40,23 @@ #define ETM_MODE_EXCL_KERN BIT(30) #define ETM_MODE_EXCL_USER BIT(31) -typedef u32 (*coresight_read_fn)(const struct device *, u32 offset); -#define __coresight_simple_func(type, func, name, lo_off, hi_off) \ +#define __coresight_simple_show(type, name, lo_off, hi_off) \ static ssize_t name##_show(struct device *_dev, \ struct device_attribute *attr, char *buf) \ { \ type *drvdata = dev_get_drvdata(_dev->parent); \ - coresight_read_fn fn = func; \ u64 val; \ pm_runtime_get_sync(_dev->parent); \ - if (fn) \ - val = (u64)fn(_dev->parent, lo_off); \ - else \ - val = coresight_read_reg_pair(drvdata->base, \ - lo_off, hi_off); \ + val = coresight_read_reg_pair(drvdata->base, lo_off, hi_off); \ pm_runtime_put_sync(_dev->parent); \ return scnprintf(buf, PAGE_SIZE, "0x%llx\n", val); \ } \ static DEVICE_ATTR_RO(name) -#define coresight_simple_func(type, func, name, offset) \ - __coresight_simple_func(type, func, name, offset, -1) #define coresight_simple_reg32(type, name, offset) \ - __coresight_simple_func(type, NULL, name, offset, -1) + __coresight_simple_show(type, name, offset, -1) #define coresight_simple_reg64(type, name, lo_off, hi_off) \ - __coresight_simple_func(type, NULL, name, lo_off, hi_off) + __coresight_simple_show(type, name, lo_off, hi_off) extern const u32 coresight_barrier_pkt[4]; #define CORESIGHT_BARRIER_PKT_SIZE (sizeof(coresight_barrier_pkt))
The ability to use a custom function in this sysfs show function isn't used so remove it. No functional changes. Signed-off-by: James Clark <james.clark@arm.com> --- drivers/hwtracing/coresight/coresight-priv.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)