diff mbox

misc: cxl: sysfs.c: Remove unused function

Message ID 1419092024-6701-1-git-send-email-rickard_strandqvist@spectrumdigital.se (mailing list archive)
State Rejected
Headers show

Commit Message

Rickard Strandqvist Dec. 20, 2014, 4:13 p.m. UTC
Remove the function mmio_size_show() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 drivers/misc/cxl/sysfs.c |   11 -----------
 1 file changed, 11 deletions(-)

Comments

Michael Neuling Dec. 21, 2014, 4:05 a.m. UTC | #1
> Remove the function mmio_size_show() that is not used anywhere.

Did you compile check this patch?

  drivers/misc/cxl/sysfs.c:291:74: error: ‘mmio_size_show’ undeclared here (not in a function)

It's used here:
        static struct device_attribute afu_attrs[] = {
        	__ATTR_RO(mmio_size),

> This was partially found by using a static code analysis program called cppcheck.

Thanks for letting me know which tool to avoid :-)

Mikey


> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
>  drivers/misc/cxl/sysfs.c |   11 -----------
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
> index ce7ec06..0431ec3 100644
> --- a/drivers/misc/cxl/sysfs.c
> +++ b/drivers/misc/cxl/sysfs.c
> @@ -102,17 +102,6 @@ static struct device_attribute afu_master_attrs[] = {
>  
>  /*********  AFU attributes  **************************************************/
>  
> -static ssize_t mmio_size_show(struct device *device,
> -			      struct device_attribute *attr,
> -			      char *buf)
> -{
> -	struct cxl_afu *afu = to_cxl_afu(device);
> -
> -	if (afu->pp_size)
> -		return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size);
> -	return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size);
> -}
> -
>  static ssize_t reset_store_afu(struct device *device,
>  			       struct device_attribute *attr,
>  			       const char *buf, size_t count)
Rickard Strandqvist Dec. 21, 2014, 12:46 p.m. UTC | #2
2014-12-21 5:05 GMT+01:00 Michael Neuling <mikey@neuling.org>:
>> Remove the function mmio_size_show() that is not used anywhere.
>
> Did you compile check this patch?
>
>   drivers/misc/cxl/sysfs.c:291:74: error: ‘mmio_size_show’ undeclared here (not in a function)
>
> It's used here:
>         static struct device_attribute afu_attrs[] = {
>                 __ATTR_RO(mmio_size),
>
>> This was partially found by using a static code analysis program called cppcheck.
>
> Thanks for letting me know which tool to avoid :-)
>
> Mikey
>
>
>>
>> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> ---
>>  drivers/misc/cxl/sysfs.c |   11 -----------
>>  1 file changed, 11 deletions(-)
>>
>> diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
>> index ce7ec06..0431ec3 100644
>> --- a/drivers/misc/cxl/sysfs.c
>> +++ b/drivers/misc/cxl/sysfs.c
>> @@ -102,17 +102,6 @@ static struct device_attribute afu_master_attrs[] = {
>>
>>  /*********  AFU attributes  **************************************************/
>>
>> -static ssize_t mmio_size_show(struct device *device,
>> -                           struct device_attribute *attr,
>> -                           char *buf)
>> -{
>> -     struct cxl_afu *afu = to_cxl_afu(device);
>> -
>> -     if (afu->pp_size)
>> -             return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size);
>> -     return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size);
>> -}
>> -
>>  static ssize_t reset_store_afu(struct device *device,
>>                              struct device_attribute *attr,
>>                              const char *buf, size_t count)
>


Hi

Sorry about that.

Strange because I compile everything as allyesconfig, allmodconfig and
allnoconfig.

Kind regards
Rickard Strandqvist
Michael Ellerman Dec. 22, 2014, 3:55 a.m. UTC | #3
On Sun, 2014-12-21 at 13:46 +0100, Rickard Strandqvist wrote:
> 2014-12-21 5:05 GMT+01:00 Michael Neuling <mikey@neuling.org>:
> >> Remove the function mmio_size_show() that is not used anywhere.
> >
> > Did you compile check this patch?
> >
> >   drivers/misc/cxl/sysfs.c:291:74: error: ‘mmio_size_show’ undeclared here (not in a function)
> >
> > It's used here:
> >         static struct device_attribute afu_attrs[] = {
> >                 __ATTR_RO(mmio_size),
> 
> Hi
> 
> Sorry about that.
> 
> Strange because I compile everything as allyesconfig, allmodconfig and
> allnoconfig.

The allyes should have picked it up, so you must have done something wrong.

Please be more careful with these attribute routines, they are not visible with
grep.

cheers
diff mbox

Patch

diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index ce7ec06..0431ec3 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -102,17 +102,6 @@  static struct device_attribute afu_master_attrs[] = {
 
 /*********  AFU attributes  **************************************************/
 
-static ssize_t mmio_size_show(struct device *device,
-			      struct device_attribute *attr,
-			      char *buf)
-{
-	struct cxl_afu *afu = to_cxl_afu(device);
-
-	if (afu->pp_size)
-		return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->pp_size);
-	return scnprintf(buf, PAGE_SIZE, "%llu\n", afu->adapter->ps_size);
-}
-
 static ssize_t reset_store_afu(struct device *device,
 			       struct device_attribute *attr,
 			       const char *buf, size_t count)