linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
@ 2022-09-01 19:50 Nathan Chancellor
  2022-09-02 13:03 ` James Clark
  2022-09-06 20:17 ` Mathieu Poirier
  0 siblings, 2 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-09-01 19:50 UTC (permalink / raw)
  To: Mathieu Poirier, Suzuki K Poulose
  Cc: Mike Leach, Leo Yan, James Clark, coresight, linux-arm-kernel,
	linux-kernel, Nathan Chancellor

When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
warning about coresight_cti_reg_store() being unused in the file:

  drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
    184 | static ssize_t coresight_cti_reg_store(struct device *dev,
        |                ^~~~~~~~~~~~~~~~~~~~~~~

This is expected as coresight_cti_reg_store() is only used in the
coresight_cti_reg_rw macro, which is only used in a block guarded by
CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
__maybe_unused to clearly indicate that the function may be unused
depending on the configuration.

Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
index 478b8d38b744..6d59c815ecf5 100644
--- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
+++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
@@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev,
 }
 
 /* Write registers with power check only (no enable check). */
-static ssize_t coresight_cti_reg_store(struct device *dev,
-				       struct device_attribute *attr,
-				       const char *buf, size_t size)
+static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev,
+						      struct device_attribute *attr,
+						      const char *buf, size_t size)
 {
 	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
 	struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr);

base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  2022-09-01 19:50 [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused Nathan Chancellor
@ 2022-09-02 13:03 ` James Clark
  2022-09-02 15:02   ` Nathan Chancellor
  2022-09-06 20:17 ` Mathieu Poirier
  1 sibling, 1 reply; 4+ messages in thread
From: James Clark @ 2022-09-02 13:03 UTC (permalink / raw)
  To: Nathan Chancellor, Mathieu Poirier, Suzuki K Poulose
  Cc: Mike Leach, Leo Yan, coresight, linux-arm-kernel, linux-kernel



On 01/09/2022 20:50, Nathan Chancellor wrote:
> When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
> warning about coresight_cti_reg_store() being unused in the file:
> 
>   drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
>     184 | static ssize_t coresight_cti_reg_store(struct device *dev,
>         |                ^~~~~~~~~~~~~~~~~~~~~~~
> 
> This is expected as coresight_cti_reg_store() is only used in the
> coresight_cti_reg_rw macro, which is only used in a block guarded by
> CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
> __maybe_unused to clearly indicate that the function may be unused
> depending on the configuration.

It would also be possible to fix this by wrapping the definitions in
#ifdef CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. That way the maybe_unused
isn't needed and it's a bit cleaner.

Either way, thanks for the fix.

Reviewed-by: James Clark <james.clark@arm.com>

> 
> Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> index 478b8d38b744..6d59c815ecf5 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> @@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev,
>  }
>  
>  /* Write registers with power check only (no enable check). */
> -static ssize_t coresight_cti_reg_store(struct device *dev,
> -				       struct device_attribute *attr,
> -				       const char *buf, size_t size)
> +static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev,
> +						      struct device_attribute *attr,
> +						      const char *buf, size_t size)
>  {
>  	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
>  	struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr);
> 
> base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  2022-09-02 13:03 ` James Clark
@ 2022-09-02 15:02   ` Nathan Chancellor
  0 siblings, 0 replies; 4+ messages in thread
From: Nathan Chancellor @ 2022-09-02 15:02 UTC (permalink / raw)
  To: James Clark
  Cc: Mathieu Poirier, Suzuki K Poulose, Mike Leach, Leo Yan,
	coresight, linux-arm-kernel, linux-kernel

On Fri, Sep 02, 2022 at 02:03:07PM +0100, James Clark wrote:
> 
> 
> On 01/09/2022 20:50, Nathan Chancellor wrote:
> > When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
> > warning about coresight_cti_reg_store() being unused in the file:
> > 
> >   drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
> >     184 | static ssize_t coresight_cti_reg_store(struct device *dev,
> >         |                ^~~~~~~~~~~~~~~~~~~~~~~
> > 
> > This is expected as coresight_cti_reg_store() is only used in the
> > coresight_cti_reg_rw macro, which is only used in a block guarded by
> > CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
> > __maybe_unused to clearly indicate that the function may be unused
> > depending on the configuration.
> 
> It would also be possible to fix this by wrapping the definitions in
> #ifdef CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. That way the maybe_unused
> isn't needed and it's a bit cleaner.

Right, I do not have a preference either. I only did this way first
because most maintainers do not like ifdef's in .c files. I am happy to
change the solution if you all prefer!

> Either way, thanks for the fix.
> 
> Reviewed-by: James Clark <james.clark@arm.com>

Thanks for the review!

Cheers,
Nathan

> > Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
> > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >  drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > index 478b8d38b744..6d59c815ecf5 100644
> > --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > @@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev,
> >  }
> >  
> >  /* Write registers with power check only (no enable check). */
> > -static ssize_t coresight_cti_reg_store(struct device *dev,
> > -				       struct device_attribute *attr,
> > -				       const char *buf, size_t size)
> > +static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev,
> > +						      struct device_attribute *attr,
> > +						      const char *buf, size_t size)
> >  {
> >  	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
> >  	struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr);
> > 
> > base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused
  2022-09-01 19:50 [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused Nathan Chancellor
  2022-09-02 13:03 ` James Clark
@ 2022-09-06 20:17 ` Mathieu Poirier
  1 sibling, 0 replies; 4+ messages in thread
From: Mathieu Poirier @ 2022-09-06 20:17 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Suzuki K Poulose, Mike Leach, Leo Yan, James Clark, coresight,
	linux-arm-kernel, linux-kernel

On Thu, Sep 01, 2022 at 12:50:55PM -0700, Nathan Chancellor wrote:
> When building without CONFIG_CORESIGHT_CTI_INTEGRATION_REGS, there is a
> warning about coresight_cti_reg_store() being unused in the file:
> 
>   drivers/hwtracing/coresight/coresight-cti-sysfs.c:184:16: warning: 'coresight_cti_reg_store' defined but not used [-Wunused-function]
>     184 | static ssize_t coresight_cti_reg_store(struct device *dev,
>         |                ^~~~~~~~~~~~~~~~~~~~~~~
> 
> This is expected as coresight_cti_reg_store() is only used in the
> coresight_cti_reg_rw macro, which is only used in a block guarded by
> CONFIG_CORESIGHT_CTI_INTEGRATION_REGS. Mark coresight_cti_reg_store() as
> __maybe_unused to clearly indicate that the function may be unused
> depending on the configuration.
> 
> Fixes: fbca79e55429 ("coresight: cti-sysfs: Re-use same functions for similar sysfs register accessors")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> index 478b8d38b744..6d59c815ecf5 100644
> --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> @@ -181,9 +181,9 @@ static ssize_t coresight_cti_reg_show(struct device *dev,
>  }
>  
>  /* Write registers with power check only (no enable check). */
> -static ssize_t coresight_cti_reg_store(struct device *dev,
> -				       struct device_attribute *attr,
> -				       const char *buf, size_t size)
> +static __maybe_unused ssize_t coresight_cti_reg_store(struct device *dev,
> +						      struct device_attribute *attr,
> +						      const char *buf, size_t size)
>  {

Applied.

Thanks,
Mathieu

>  	struct cti_drvdata *drvdata = dev_get_drvdata(dev->parent);
>  	struct cs_off_attribute *cti_attr = container_of(attr, struct cs_off_attribute, attr);
> 
> base-commit: 0a98181f805058773961c5ab3172ecf1bf1ed0e1
> -- 
> 2.37.3
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-06 20:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-01 19:50 [PATCH] coresight: cti-sysfs: Mark coresight_cti_reg_store() as __maybe_unused Nathan Chancellor
2022-09-02 13:03 ` James Clark
2022-09-02 15:02   ` Nathan Chancellor
2022-09-06 20:17 ` Mathieu Poirier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).