public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c
@ 2012-03-21 11:33 Stefano Babic
  2012-03-21 18:42 ` Scott Wood
  2012-03-22  9:56 ` [U-Boot] [PATCH V2] " Stefano Babic
  0 siblings, 2 replies; 5+ messages in thread
From: Stefano Babic @ 2012-03-21 11:33 UTC (permalink / raw)
  To: u-boot

The following warnings are reported for boards using SOFT ECC.

omap_gpmc.c:33:30: warning: 'hw_nand_oob' defined but not used
omap_gpmc.c:78:13: warning: 'omap_hwecc_init' defined but not used
omap_gpmc.c:116:12: warning: 'omap_correct_data' defined but not used
omap_gpmc.c:182:12: warning: 'omap_calculate_ecc' defined but not used
omap_gpmc.c:208:13: warning: 'omap_enable_hwecc' defined but not used

Signed-off-by: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Scott Wood <scottwood@freescale.com>
---
 drivers/mtd/nand/omap_gpmc.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 1dfe074..3a9baff 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -30,7 +30,10 @@
 #include <nand.h>
 
 static uint8_t cs;
+#if !defined(CONFIG_SPL_BUILD) || \
+	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
 static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT;
+#endif
 
 /*
  * omap_nand_hwcontrol - Set the address pointers corretly for the
@@ -69,6 +72,8 @@ int omap_spl_dev_ready(struct mtd_info *mtd)
 }
 #endif
 
+#if !defined(CONFIG_SPL_BUILD) || \
+	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
 /*
  * omap_hwecc_init - Initialize the Hardware ECC for NAND flash in
  *                   GPMC controller
@@ -231,6 +236,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
 		break;
 	}
 }
+#endif
 
 #ifndef CONFIG_SPL_BUILD
 /*
-- 
1.7.5.4

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

* [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c
  2012-03-21 11:33 [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c Stefano Babic
@ 2012-03-21 18:42 ` Scott Wood
  2012-03-22  9:45   ` Stefano Babic
  2012-03-22  9:56 ` [U-Boot] [PATCH V2] " Stefano Babic
  1 sibling, 1 reply; 5+ messages in thread
From: Scott Wood @ 2012-03-21 18:42 UTC (permalink / raw)
  To: u-boot

On 03/21/2012 06:33 AM, Stefano Babic wrote:
> The following warnings are reported for boards using SOFT ECC.
> 
> omap_gpmc.c:33:30: warning: 'hw_nand_oob' defined but not used
> omap_gpmc.c:78:13: warning: 'omap_hwecc_init' defined but not used
> omap_gpmc.c:116:12: warning: 'omap_correct_data' defined but not used
> omap_gpmc.c:182:12: warning: 'omap_calculate_ecc' defined but not used
> omap_gpmc.c:208:13: warning: 'omap_enable_hwecc' defined but not used
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Cc: Scott Wood <scottwood@freescale.com>
> ---
>  drivers/mtd/nand/omap_gpmc.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
> index 1dfe074..3a9baff 100644
> --- a/drivers/mtd/nand/omap_gpmc.c
> +++ b/drivers/mtd/nand/omap_gpmc.c
> @@ -30,7 +30,10 @@
>  #include <nand.h>
>  
>  static uint8_t cs;
> +#if !defined(CONFIG_SPL_BUILD) || \
> +	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
>  static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT;
> +#endif
>  
>  /*
>   * omap_nand_hwcontrol - Set the address pointers corretly for the
> @@ -69,6 +72,8 @@ int omap_spl_dev_ready(struct mtd_info *mtd)
>  }
>  #endif
>  
> +#if !defined(CONFIG_SPL_BUILD) || \
> +	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
>  /*
>   * omap_hwecc_init - Initialize the Hardware ECC for NAND flash in
>   *                   GPMC controller
> @@ -231,6 +236,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
>  		break;
>  	}
>  }
> +#endif
>  
>  #ifndef CONFIG_SPL_BUILD
>  /*

Maybe just use __attribute__((unused))?

Or provide this ifdeffery once at the top of the file, to produce a
single symbol that indicates whether you're using hwecc in this file.

-Scott

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

* [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c
  2012-03-21 18:42 ` Scott Wood
@ 2012-03-22  9:45   ` Stefano Babic
  0 siblings, 0 replies; 5+ messages in thread
From: Stefano Babic @ 2012-03-22  9:45 UTC (permalink / raw)
  To: u-boot

On 21/03/2012 19:42, Scott Wood wrote:
> On 03/21/2012 06:33 AM, Stefano Babic wrote:
>> The following warnings are reported for boards using SOFT ECC.
>>
>> omap_gpmc.c:33:30: warning: 'hw_nand_oob' defined but not used
>> omap_gpmc.c:78:13: warning: 'omap_hwecc_init' defined but not used
>> omap_gpmc.c:116:12: warning: 'omap_correct_data' defined but not used
>> omap_gpmc.c:182:12: warning: 'omap_calculate_ecc' defined but not used
>> omap_gpmc.c:208:13: warning: 'omap_enable_hwecc' defined but not used
>>
>> Signed-off-by: Stefano Babic <sbabic@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> Cc: Scott Wood <scottwood@freescale.com>
>> ---
>>  drivers/mtd/nand/omap_gpmc.c |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
>> index 1dfe074..3a9baff 100644
>> --- a/drivers/mtd/nand/omap_gpmc.c
>> +++ b/drivers/mtd/nand/omap_gpmc.c
>> @@ -30,7 +30,10 @@
>>  #include <nand.h>
>>  
>>  static uint8_t cs;
>> +#if !defined(CONFIG_SPL_BUILD) || \
>> +	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
>>  static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT;
>> +#endif
>>  
>>  /*
>>   * omap_nand_hwcontrol - Set the address pointers corretly for the
>> @@ -69,6 +72,8 @@ int omap_spl_dev_ready(struct mtd_info *mtd)
>>  }
>>  #endif
>>  
>> +#if !defined(CONFIG_SPL_BUILD) || \
>> +	(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_NAND_SOFTECC))
>>  /*
>>   * omap_hwecc_init - Initialize the Hardware ECC for NAND flash in
>>   *                   GPMC controller
>> @@ -231,6 +236,7 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
>>  		break;
>>  	}
>>  }
>> +#endif
>>  
>>  #ifndef CONFIG_SPL_BUILD
>>  /*
> 
> Maybe just use __attribute__((unused))?

Of yourse, you are right. We have already the macro __maybe_unused, I
will use it !

Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot] [PATCH V2] NAND: TI: fix warnings in omap_gpmc.c
  2012-03-21 11:33 [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c Stefano Babic
  2012-03-21 18:42 ` Scott Wood
@ 2012-03-22  9:56 ` Stefano Babic
  2012-03-22 20:02   ` Tom Rini
  1 sibling, 1 reply; 5+ messages in thread
From: Stefano Babic @ 2012-03-22  9:56 UTC (permalink / raw)
  To: u-boot

The following warnings are reported for boards using SOFT ECC.

omap_gpmc.c:33:30: warning: 'hw_nand_oob' defined but not used
omap_gpmc.c:78:13: warning: 'omap_hwecc_init' defined but not used
omap_gpmc.c:116:12: warning: 'omap_correct_data' defined but not used
omap_gpmc.c:182:12: warning: 'omap_calculate_ecc' defined but not used
omap_gpmc.c:208:13: warning: 'omap_enable_hwecc' defined but not used

Signed-off-by: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Scott Wood <scottwood@freescale.com>
---

Changes since V1:
	- drop #ifdef and use  __attribute__((unused) (Scott Wood)

 drivers/mtd/nand/omap_gpmc.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c
index 1dfe074..ca868ef 100644
--- a/drivers/mtd/nand/omap_gpmc.c
+++ b/drivers/mtd/nand/omap_gpmc.c
@@ -27,10 +27,12 @@
 #include <asm/arch/mem.h>
 #include <asm/arch/omap_gpmc.h>
 #include <linux/mtd/nand_ecc.h>
+#include <linux/compiler.h>
 #include <nand.h>
 
 static uint8_t cs;
-static struct nand_ecclayout hw_nand_oob = GPMC_NAND_HW_ECC_LAYOUT;
+static __maybe_unused struct nand_ecclayout hw_nand_oob =
+	GPMC_NAND_HW_ECC_LAYOUT;
 
 /*
  * omap_nand_hwcontrol - Set the address pointers corretly for the
@@ -75,7 +77,7 @@ int omap_spl_dev_ready(struct mtd_info *mtd)
  * @mtd:        MTD device structure
  *
  */
-static void omap_hwecc_init(struct nand_chip *chip)
+static void __maybe_unused omap_hwecc_init(struct nand_chip *chip)
 {
 	/*
 	 * Init ECC Control Register
@@ -113,7 +115,7 @@ static uint32_t gen_true_ecc(uint8_t *ecc_buf)
  *
  * @return 0 if data is OK or corrected, else returns -1
  */
-static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
+static int __maybe_unused omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
 				uint8_t *read_ecc, uint8_t *calc_ecc)
 {
 	uint32_t orig_ecc, new_ecc, res, hm;
@@ -179,8 +181,8 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat,
  *  @dat:	unused
  *  @ecc_code:	ecc_code buffer
  */
-static int omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
-				uint8_t *ecc_code)
+static int __maybe_unused omap_calculate_ecc(struct mtd_info *mtd,
+		const uint8_t *dat, uint8_t *ecc_code)
 {
 	u_int32_t val;
 
@@ -205,7 +207,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat,
  * @mtd:        MTD device structure
  * @mode:       Read/Write mode
  */
-static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
+static void __maybe_unused omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
 {
 	struct nand_chip *chip = mtd->priv;
 	uint32_t val, dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1;
-- 
1.7.5.4

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

* [U-Boot] [PATCH V2] NAND: TI: fix warnings in omap_gpmc.c
  2012-03-22  9:56 ` [U-Boot] [PATCH V2] " Stefano Babic
@ 2012-03-22 20:02   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2012-03-22 20:02 UTC (permalink / raw)
  To: u-boot

On Thu, Mar 22, 2012 at 10:56:17AM +0100, Stefano Babic wrote:
> The following warnings are reported for boards using SOFT ECC.
> 
> omap_gpmc.c:33:30: warning: 'hw_nand_oob' defined but not used
> omap_gpmc.c:78:13: warning: 'omap_hwecc_init' defined but not used
> omap_gpmc.c:116:12: warning: 'omap_correct_data' defined but not used
> omap_gpmc.c:182:12: warning: 'omap_calculate_ecc' defined but not used
> omap_gpmc.c:208:13: warning: 'omap_enable_hwecc' defined but not used
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Cc: Scott Wood <scottwood@freescale.com>

Applied to u-boot-ti/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120322/a6ee2273/attachment.pgp>

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

end of thread, other threads:[~2012-03-22 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 11:33 [U-Boot] [PATCH] NAND: TI: fix warnings in omap_gpmc.c Stefano Babic
2012-03-21 18:42 ` Scott Wood
2012-03-22  9:45   ` Stefano Babic
2012-03-22  9:56 ` [U-Boot] [PATCH V2] " Stefano Babic
2012-03-22 20:02   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox