[PATCH v1 0/4] coresight: Reduce duplicated sysfs accessors

James Clark posted 4 patches 3 years, 8 months ago
There is a newer version of this series
drivers/hwtracing/coresight/coresight-catu.c  |  27 +--
drivers/hwtracing/coresight/coresight-core.c  |  14 ++
.../hwtracing/coresight/coresight-cti-sysfs.c | 213 +++++++-----------
drivers/hwtracing/coresight/coresight-etb10.c |  28 +--
.../coresight/coresight-etm3x-sysfs.c         |  34 +--
drivers/hwtracing/coresight/coresight-priv.h  |  48 ++--
.../coresight/coresight-replicator.c          |  10 +-
drivers/hwtracing/coresight/coresight-stm.c   |  40 +---
.../hwtracing/coresight/coresight-tmc-core.c  |  48 ++--
include/linux/coresight.h                     |  18 ++
10 files changed, 196 insertions(+), 284 deletions(-)
[PATCH v1 0/4] coresight: Reduce duplicated sysfs accessors
Posted by James Clark 3 years, 8 months ago
The intent of this change is to reduce the large number identical of
functions created by macros for sysfs accessors. It's possible to re-use
the same function but pass in the register to access as an argument.
This reduces the size of the coresight modules folder by 244KB.

The first two patches are refactors to simplify and remove some dead
code, and the second two are the changes to use a shared function.

Testing
=======

No changes in any of the outputs:

  cat /sys/bus/coresight/devices/*/mgmt/* > before.txt
  cat /sys/bus/coresight/devices/*/mgmt/* > after.txt
  diff before.txt after.txt

With the following modules loaded:

  ls /sys/bus/coresight/devices/
  etm0  etm2  funnel0  funnel2  replicator0  tmc_etf0  tmc_etf2  tpiu0
  etm1  etm3  funnel1  funnel3  stm0         tmc_etf1  tmc_etr0

James Clark (4):
  coresight: Remove unused function parameter
  coresight: Simplify sysfs accessors by using csdev_access abstraction
  coresight: Re-use same function for similar sysfs register accessors
  coresight: cti-sysfs: Re-use same functions for similar sysfs register
    accessors

 drivers/hwtracing/coresight/coresight-catu.c  |  27 +--
 drivers/hwtracing/coresight/coresight-core.c  |  14 ++
 .../hwtracing/coresight/coresight-cti-sysfs.c | 213 +++++++-----------
 drivers/hwtracing/coresight/coresight-etb10.c |  28 +--
 .../coresight/coresight-etm3x-sysfs.c         |  34 +--
 drivers/hwtracing/coresight/coresight-priv.h  |  48 ++--
 .../coresight/coresight-replicator.c          |  10 +-
 drivers/hwtracing/coresight/coresight-stm.c   |  40 +---
 .../hwtracing/coresight/coresight-tmc-core.c  |  48 ++--
 include/linux/coresight.h                     |  18 ++
 10 files changed, 196 insertions(+), 284 deletions(-)

-- 
2.28.0
Re: [PATCH v1 0/4] coresight: Reduce duplicated sysfs accessors
Posted by Mathieu Poirier 3 years, 7 months ago
On Mon, Jul 25, 2022 at 03:52:17PM +0100, James Clark wrote:
> The intent of this change is to reduce the large number identical of
> functions created by macros for sysfs accessors. It's possible to re-use
> the same function but pass in the register to access as an argument.
> This reduces the size of the coresight modules folder by 244KB.
> 
> The first two patches are refactors to simplify and remove some dead
> code, and the second two are the changes to use a shared function.
> 
> Testing
> =======
> 
> No changes in any of the outputs:
> 
>   cat /sys/bus/coresight/devices/*/mgmt/* > before.txt
>   cat /sys/bus/coresight/devices/*/mgmt/* > after.txt
>   diff before.txt after.txt
> 
> With the following modules loaded:
> 
>   ls /sys/bus/coresight/devices/
>   etm0  etm2  funnel0  funnel2  replicator0  tmc_etf0  tmc_etf2  tpiu0
>   etm1  etm3  funnel1  funnel3  stm0         tmc_etf1  tmc_etr0
> 
> James Clark (4):
>   coresight: Remove unused function parameter
>   coresight: Simplify sysfs accessors by using csdev_access abstraction
>   coresight: Re-use same function for similar sysfs register accessors
>   coresight: cti-sysfs: Re-use same functions for similar sysfs register
>     accessors
> 
>  drivers/hwtracing/coresight/coresight-catu.c  |  27 +--
>  drivers/hwtracing/coresight/coresight-core.c  |  14 ++
>  .../hwtracing/coresight/coresight-cti-sysfs.c | 213 +++++++-----------
>  drivers/hwtracing/coresight/coresight-etb10.c |  28 +--
>  .../coresight/coresight-etm3x-sysfs.c         |  34 +--
>  drivers/hwtracing/coresight/coresight-priv.h  |  48 ++--
>  .../coresight/coresight-replicator.c          |  10 +-
>  drivers/hwtracing/coresight/coresight-stm.c   |  40 +---
>  .../hwtracing/coresight/coresight-tmc-core.c  |  48 ++--
>  include/linux/coresight.h                     |  18 ++
>  10 files changed, 196 insertions(+), 284 deletions(-)

I am done reviewing this set.  It would be nice if you could respin this as
quickly as possible so that I could apply it to next early in the cycle.

Thanks,
Mathieu

> 
> -- 
> 2.28.0
>