Patchwork [27/43] drivers/net/sfc: fix sparse warnings: Should it be static?

login
register
mail settings
Submitter Hannes Eder
Date Feb. 14, 2009, 9:42 p.m.
Message ID <20090214214111.24377.87888.stgit@vmbox.hanneseder.net>
Download mbox | patch
Permalink /patch/23173/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Hannes Eder - Feb. 14, 2009, 9:42 p.m.
Impact: Include header file and include the function under the same
condition as in the header file.  If CONFIG_SFS_MTD is not defined
than the functions 'efx_mtd_remove' and 'efx_mtd_rename' are defined
'static inline' with an empty function body in the header file.

Fix this sparse warnings:
  drivers/net/sfc/mtd.c:204:6: warning: symbol 'efx_mtd_remove' was not declared. Should it be static?
  drivers/net/sfc/mtd.c:221:6: warning: symbol 'efx_mtd_rename' was not declared. Should it be static?
  drivers/net/sfc/mtd.c:230:5: warning: symbol 'efx_mtd_probe' was not declared. Should it be static?

Signed-off-by: Hannes Eder <hannes@hanneseder.net>
---
 drivers/net/sfc/mtd.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings - Feb. 16, 2009, 12:37 a.m.
Hannes Eder wrote:
> Impact: Include header file and include the function under the same
> condition as in the header file.  If CONFIG_SFS_MTD is not defined
> than the functions 'efx_mtd_remove' and 'efx_mtd_rename' are defined
> 'static inline' with an empty function body in the header file.
> 
> Fix this sparse warnings:
>   drivers/net/sfc/mtd.c:204:6: warning: symbol 'efx_mtd_remove' was not declared. Should it be static?
>   drivers/net/sfc/mtd.c:221:6: warning: symbol 'efx_mtd_rename' was not declared. Should it be static?
>   drivers/net/sfc/mtd.c:230:5: warning: symbol 'efx_mtd_probe' was not declared. Should it be static?
> 
> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
> ---
>  drivers/net/sfc/mtd.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c
> index 665cafb..94c9ed8 100644
> --- a/drivers/net/sfc/mtd.c
> +++ b/drivers/net/sfc/mtd.c
> @@ -15,6 +15,7 @@
>  #define EFX_DRIVER_NAME "sfc_mtd"
>  #include "net_driver.h"
>  #include "spi.h"
> +#include "efx.h"
>  
>  #define EFX_SPI_VERIFY_BUF_LEN 16
>  

OK, but...

> @@ -201,6 +202,7 @@ static void efx_mtd_sync(struct mtd_info *mtd)
>  	return;
>  }
>  
> +#ifdef CONFIG_SFC_MTD
>  void efx_mtd_remove(struct efx_nic *efx)
>  {
>  	if (efx->spi_flash && efx->spi_flash->mtd) {
> @@ -266,3 +268,4 @@ int efx_mtd_probe(struct efx_nic *efx)
>  
>  	return 0;
>  }
> +#endif /* CONFIG_SFC_MTD */

This is wrong.  The entire file is conditional on CONFIG_SFC_MTD.

Ben.
Hannes Eder - Feb. 16, 2009, 9:38 a.m.
On Mon, Feb 16, 2009 at 1:37 AM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> Hannes Eder wrote:
>> Impact: Include header file and include the function under the same
>> condition as in the header file.  If CONFIG_SFS_MTD is not defined
>> than the functions 'efx_mtd_remove' and 'efx_mtd_rename' are defined
>> 'static inline' with an empty function body in the header file.
>>
>> Fix this sparse warnings:
>>   drivers/net/sfc/mtd.c:204:6: warning: symbol 'efx_mtd_remove' was not declared. Should it be static?
>>   drivers/net/sfc/mtd.c:221:6: warning: symbol 'efx_mtd_rename' was not declared. Should it be static?
>>   drivers/net/sfc/mtd.c:230:5: warning: symbol 'efx_mtd_probe' was not declared. Should it be static?
>>
>> Signed-off-by: Hannes Eder <hannes@hanneseder.net>
>> ---
>>  drivers/net/sfc/mtd.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c
>> index 665cafb..94c9ed8 100644
>> --- a/drivers/net/sfc/mtd.c
>> +++ b/drivers/net/sfc/mtd.c
>> @@ -15,6 +15,7 @@
>>  #define EFX_DRIVER_NAME "sfc_mtd"
>>  #include "net_driver.h"
>>  #include "spi.h"
>> +#include "efx.h"
>>
>>  #define EFX_SPI_VERIFY_BUF_LEN 16
>>
>
> OK, but...
>
>> @@ -201,6 +202,7 @@ static void efx_mtd_sync(struct mtd_info *mtd)
>>       return;
>>  }
>>
>> +#ifdef CONFIG_SFC_MTD
>>  void efx_mtd_remove(struct efx_nic *efx)
>>  {
>>       if (efx->spi_flash && efx->spi_flash->mtd) {
>> @@ -266,3 +268,4 @@ int efx_mtd_probe(struct efx_nic *efx)
>>
>>       return 0;
>>  }
>> +#endif /* CONFIG_SFC_MTD */
>
> This is wrong.  The entire file is conditional on CONFIG_SFC_MTD.

Even better than. It's actually not wrong, just done twice, so we can
omit it, thank you Ben. I'll send an update.

Hannes
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Feb. 18, 2009, 1:39 a.m.
From: Hannes Eder <hannes@hanneseder.net>
Date: Mon, 16 Feb 2009 10:38:26 +0100

> On Mon, Feb 16, 2009 at 1:37 AM, Ben Hutchings
> <bhutchings@solarflare.com> wrote:
> > This is wrong.  The entire file is conditional on CONFIG_SFC_MTD.
> 
> Even better than. It's actually not wrong, just done twice, so we can
> omit it, thank you Ben. I'll send an update.

Ok, I'll skip over this patch.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/sfc/mtd.c b/drivers/net/sfc/mtd.c
index 665cafb..94c9ed8 100644
--- a/drivers/net/sfc/mtd.c
+++ b/drivers/net/sfc/mtd.c
@@ -15,6 +15,7 @@ 
 #define EFX_DRIVER_NAME "sfc_mtd"
 #include "net_driver.h"
 #include "spi.h"
+#include "efx.h"
 
 #define EFX_SPI_VERIFY_BUF_LEN 16
 
@@ -201,6 +202,7 @@  static void efx_mtd_sync(struct mtd_info *mtd)
 	return;
 }
 
+#ifdef CONFIG_SFC_MTD
 void efx_mtd_remove(struct efx_nic *efx)
 {
 	if (efx->spi_flash && efx->spi_flash->mtd) {
@@ -266,3 +268,4 @@  int efx_mtd_probe(struct efx_nic *efx)
 
 	return 0;
 }
+#endif /* CONFIG_SFC_MTD */