* [PATCH 0/5] Various sparse fixes.
@ 2010-11-18 13:29 Marek Belisko
2010-11-18 13:29 ` [PATCH 1/5] common: Add define for IOMEM helper macro Marek Belisko
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
This patch series fix some of warnings found by sparse tool.
There was intorduced new macro IOMEM which make casting for
address pointers to avoid sparse warnings.
Marek Belisko (5):
common: Add define for IOMEM helper macro.
fs: Fix sparse warning.
mtd: Fix sparse warning.
nand_s3c2410: Fix sparse warnings.
smc91111: Various sparse fixes.
drivers/mtd/nand/nand_s3c2410.c | 26 ++++++++++++------------
drivers/net/smc91111.c | 40 +++++++++++++++++++-------------------
fs/fs.c | 2 +-
include/common.h | 2 +
include/linux/mtd/nand.h | 6 ++--
5 files changed, 39 insertions(+), 37 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] common: Add define for IOMEM helper macro.
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
@ 2010-11-18 13:29 ` Marek Belisko
2010-11-18 13:29 ` [PATCH 2/5] fs: Fix sparse warning Marek Belisko
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
IOMEM helper macro is used for address casting which then
is used in read(bwl)/write(bwl) functions.
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
include/common.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/common.h b/include/common.h
index 394542f..a14bfc1 100644
--- a/include/common.h
+++ b/include/common.h
@@ -220,4 +220,6 @@ int memory_display(char *addr, ulong offs, ulong nbytes, int size);
extern const char version_string[];
+#define IOMEM(addr) ((void __force __iomem *)(addr))
+
#endif /* __COMMON_H_ */
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/5] fs: Fix sparse warning.
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
2010-11-18 13:29 ` [PATCH 1/5] common: Add define for IOMEM helper macro Marek Belisko
@ 2010-11-18 13:29 ` Marek Belisko
2010-11-19 8:36 ` Sascha Hauer
2010-11-18 13:29 ` [PATCH 3/5] mtd: " Marek Belisko
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
Patch fix following sparse warning:
fs/fs.c:757:28: warning: dubious: !x & y
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
fs/fs.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/fs.c b/fs/fs.c
index 3b5f284..7d8dea7 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -754,7 +754,7 @@ int mount(const char *device, const char *fsname, const char *_path)
}
fsdev = xzalloc(sizeof(struct fs_device_d));
- if (!fs_drv->flags & FS_DRIVER_NO_DEV) {
+ if (!(fs_drv->flags & FS_DRIVER_NO_DEV)) {
fsdev->backingstore = strdup(device);
if (!device) {
printf("need a device for driver %s\n", fsname);
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/5] mtd: Fix sparse warning.
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
2010-11-18 13:29 ` [PATCH 1/5] common: Add define for IOMEM helper macro Marek Belisko
2010-11-18 13:29 ` [PATCH 2/5] fs: Fix sparse warning Marek Belisko
@ 2010-11-18 13:29 ` Marek Belisko
2010-11-18 13:29 ` [PATCH 4/5] nand_s3c2410: Fix sparse warnings Marek Belisko
2010-11-18 13:29 ` [PATCH 5/5] smc91111: Various sparse fixes Marek Belisko
4 siblings, 0 replies; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
Patch fix following sparse warning:
drivers/mtd/nand/nand_base.c:123:16:
warning: incorrect type in argument 1 (different address spaces)
expected void const volatile [noderef] <asn:2>*<noident>
got void *IO_ADDR_R
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
include/linux/mtd/nand.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index cb35fd2..2befaf0 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -359,10 +359,11 @@ struct nand_buffers {
* (determine if errors are correctable)
* @write_page: [REPLACEABLE] High-level page write function
*/
-
+#define IOMEM(addr) ((void __force __iomem *)addr)
struct nand_chip {
- void *IO_ADDR_R;
- void *IO_ADDR_W;
+
+ void __iomem *IO_ADDR_R;
+ void __iomem *IO_ADDR_W;
uint8_t (*read_byte)(struct mtd_info *mtd);
u16 (*read_word)(struct mtd_info *mtd);
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 4/5] nand_s3c2410: Fix sparse warnings.
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
` (2 preceding siblings ...)
2010-11-18 13:29 ` [PATCH 3/5] mtd: " Marek Belisko
@ 2010-11-18 13:29 ` Marek Belisko
2010-11-18 13:29 ` [PATCH 5/5] smc91111: Various sparse fixes Marek Belisko
4 siblings, 0 replies; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
Patch fix following sparse warnings:
drivers/mtd/nand/nand_s3c2410.c:125:9:
warning: incorrect type in argument 1 (different base types)
expected void const volatile [noderef] <asn:2>*<noident>
got unsigned long
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
drivers/mtd/nand/nand_s3c2410.c | 26 +++++++++++++-------------
include/linux/mtd/nand.h | 1 -
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/nand_s3c2410.c b/drivers/mtd/nand/nand_s3c2410.c
index b989583..fa4acf4 100644
--- a/drivers/mtd/nand/nand_s3c2410.c
+++ b/drivers/mtd/nand/nand_s3c2410.c
@@ -96,7 +96,7 @@ struct s3c24x0_nand_host {
struct mtd_partition *parts;
struct device_d *dev;
- unsigned long base;
+ void __iomem *base;
};
/**
@@ -120,7 +120,7 @@ static struct nand_ecclayout nand_hw_eccoob = {
* @param[in] host Base address of the NAND controller
* @param[in] cmd Command for NAND flash
*/
-static void __nand_boot_init send_cmd(unsigned long host, uint8_t cmd)
+static void __nand_boot_init send_cmd(void __iomem *host, uint8_t cmd)
{
writeb(cmd, host + NFCMD);
}
@@ -130,7 +130,7 @@ static void __nand_boot_init send_cmd(unsigned long host, uint8_t cmd)
* @param[in] host Base address of the NAND controller
* @param[in] addr Address for the NAND flash
*/
-static void __nand_boot_init send_addr(unsigned long host, uint8_t addr)
+static void __nand_boot_init send_addr(void __iomem *host, uint8_t addr)
{
writeb(addr, host + NFADDR);
}
@@ -139,7 +139,7 @@ static void __nand_boot_init send_addr(unsigned long host, uint8_t addr)
* Enable the NAND flash access
* @param[in] host Base address of the NAND controller
*/
-static void __nand_boot_init enable_cs(unsigned long host)
+static void __nand_boot_init enable_cs(void __iomem *host)
{
#ifdef CONFIG_CPU_S3C2410
writew(readw(host + NFCONF) & ~NFCONF_nFCE, host + NFCONF);
@@ -153,7 +153,7 @@ static void __nand_boot_init enable_cs(unsigned long host)
* Disable the NAND flash access
* @param[in] host Base address of the NAND controller
*/
-static void __nand_boot_init disable_cs(unsigned long host)
+static void __nand_boot_init disable_cs(void __iomem *host)
{
#ifdef CONFIG_CPU_S3C2410
writew(readw(host + NFCONF) | NFCONF_nFCE, host + NFCONF);
@@ -168,7 +168,7 @@ static void __nand_boot_init disable_cs(unsigned long host)
* @param[in] host Base address of the NAND controller
* @param[in] timing Timing to access the NAND memory
*/
-static void __nand_boot_init enable_nand_controller(unsigned long host, uint32_t timing)
+static void __nand_boot_init enable_nand_controller(void __iomem *host, uint32_t timing)
{
#ifdef CONFIG_CPU_S3C2410
writew(timing + NFCONF_EN + NFCONF_nFCE, host + NFCONF);
@@ -183,7 +183,7 @@ static void __nand_boot_init enable_nand_controller(unsigned long host, uint32_t
* Diable the NAND flash controller
* @param[in] host Base address of the NAND controller
*/
-static void __nand_boot_init disable_nand_controller(unsigned long host)
+static void __nand_boot_init disable_nand_controller(void __iomem *host)
{
#ifdef CONFIG_CPU_S3C2410
writew(NFCONF_nFCE, host + NFCONF);
@@ -359,7 +359,7 @@ static int s3c24x0_nand_probe(struct device_d *dev)
return -ENOMEM;
host->dev = dev;
- host->base = dev->map_base;
+ host->base = IOMEM(dev->map_base);
/* structures must be linked */
chip = &host->nand;
@@ -375,7 +375,7 @@ static int s3c24x0_nand_probe(struct device_d *dev)
chip->chip_delay = 50;
chip->priv = host;
- chip->IO_ADDR_R = chip->IO_ADDR_W = (void*)(dev->map_base + NFDATA);
+ chip->IO_ADDR_R = chip->IO_ADDR_W = IOMEM(dev->map_base + NFDATA);
chip->cmd_ctrl = s3c24x0_nand_hwcontrol;
chip->dev_ready = s3c24x0_nand_devready;
@@ -418,13 +418,13 @@ static struct driver_d s3c24x0_nand_driver = {
#ifdef CONFIG_S3C24XX_NAND_BOOT
-static void __nand_boot_init wait_for_completion(unsigned long host)
+static void __nand_boot_init wait_for_completion(void __iomem *host)
{
while (!(readw(host + NFSTAT) & NFSTAT_BUSY))
;
}
-static void __nand_boot_init nfc_addr(unsigned long host, uint32_t offs)
+static void __nand_boot_init nfc_addr(void __iomem *host, uint32_t offs)
{
send_addr(host, offs & 0xff);
send_addr(host, (offs >> 9) & 0xff);
@@ -447,7 +447,7 @@ static void __nand_boot_init nfc_addr(unsigned long host, uint32_t offs)
*/
void __nand_boot_init s3c24x0_nand_load_image(void *dest, int size, int page, int pagesize)
{
- unsigned long host = S3C24X0_NAND_BASE;
+ void __iomem *host = (void __iomem *)S3C24X0_NAND_BASE;
int i;
/*
@@ -469,7 +469,7 @@ void __nand_boot_init s3c24x0_nand_load_image(void *dest, int size, int page, in
wait_for_completion(host);
/* copy one page (do *not* use readsb() here!)*/
for (i = 0; i < pagesize; i++)
- writeb(readb(host + NFDATA), (unsigned long)(dest + i));
+ writeb(readb(host + NFDATA), (void __iomem *)(dest + i));
disable_cs(host);
page++;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2befaf0..6cf2bb2 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -359,7 +359,6 @@ struct nand_buffers {
* (determine if errors are correctable)
* @write_page: [REPLACEABLE] High-level page write function
*/
-#define IOMEM(addr) ((void __force __iomem *)addr)
struct nand_chip {
void __iomem *IO_ADDR_R;
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 5/5] smc91111: Various sparse fixes.
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
` (3 preceding siblings ...)
2010-11-18 13:29 ` [PATCH 4/5] nand_s3c2410: Fix sparse warnings Marek Belisko
@ 2010-11-18 13:29 ` Marek Belisko
4 siblings, 0 replies; 7+ messages in thread
From: Marek Belisko @ 2010-11-18 13:29 UTC (permalink / raw)
To: barebox; +Cc: Marek Belisko
Patch fix all similar warnings found by sparse:
drivers/net/smc91111.c:488:9:
warning: incorrect type in argument 1 (different base types)
expected void const volatile [noderef] <asn:2>*<noident>
got unsigned long [unsigned] offset
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
---
drivers/net/smc91111.c | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 605a7d8..535e69a 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -440,20 +440,20 @@
#define MEMORY_WAIT_TIME 16
struct accessors {
- void (*ob)(unsigned, unsigned long);
- void (*ow)(unsigned, unsigned long);
- void (*ol)(unsigned long, unsigned long);
- void (*osl)(unsigned long, const void*, int);
- unsigned (*ib)(unsigned long);
- unsigned (*iw)(unsigned long);
- unsigned long (*il)(unsigned long);
- void (*isl)(unsigned long, void*, int);
+ void (*ob)(unsigned, void __iomem *);
+ void (*ow)(unsigned, void __iomem *);
+ void (*ol)(unsigned long, void __iomem *);
+ void (*osl)(void __iomem *, const void *, int);
+ unsigned (*ib)(void __iomem *);
+ unsigned (*iw)(void __iomem *);
+ unsigned long (*il)(void __iomem *);
+ void (*isl)(void __iomem *, void*, int);
};
struct smc91c111_priv {
struct mii_device miidev;
struct accessors a;
- unsigned long base;
+ void __iomem *base;
};
#if (SMC_DEBUG > 2 )
@@ -483,44 +483,44 @@ struct smc91c111_priv {
#define ETH_ZLEN 60
-static void a_outb(unsigned value, unsigned long offset)
+static void a_outb(unsigned value, void __iomem *offset)
{
writeb(value, offset);
}
-static void a_outw(unsigned value, unsigned long offset)
+static void a_outw(unsigned value, void __iomem *offset)
{
writew(value, offset);
}
-static void a_outl(unsigned long value, unsigned long offset)
+static void a_outl(unsigned long value, void __iomem *offset)
{
writel(value, offset);
}
-static void a_outsl(unsigned long offset, const void *data, int count)
+static void a_outsl(void __iomem *offset, const void *data, int count)
{
- writesl((void*)offset, data, count);
+ writesl(offset, data, count);
}
-static unsigned a_inb(unsigned long offset)
+static unsigned a_inb(void __iomem *offset)
{
return readb(offset);
}
-static unsigned a_inw(unsigned long offset)
+static unsigned a_inw(void __iomem *offset)
{
return readw(offset);
}
-static unsigned long a_inl(unsigned long offset)
+static unsigned long a_inl(void __iomem *offset)
{
return readl(offset);
}
-static inline void a_insl(unsigned long offset, void *data, int count)
+static inline void a_insl(void __iomem *offset, void *data, int count)
{
- readsl((void*)offset, data, count);
+ readsl(offset, data, count);
}
/* access happens via a 32 bit bus */
@@ -1317,7 +1317,7 @@ static int smc91c111_probe(struct device_d *dev)
priv->miidev.address = 0;
priv->miidev.flags = 0;
priv->miidev.edev = edev;
- priv->base = dev->map_base;
+ priv->base = IOMEM(dev->map_base);
smc91c111_reset(edev);
--
1.7.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/5] fs: Fix sparse warning.
2010-11-18 13:29 ` [PATCH 2/5] fs: Fix sparse warning Marek Belisko
@ 2010-11-19 8:36 ` Sascha Hauer
0 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2010-11-19 8:36 UTC (permalink / raw)
To: Marek Belisko; +Cc: barebox
On Thu, Nov 18, 2010 at 02:29:28PM +0100, Marek Belisko wrote:
> Patch fix following sparse warning:
> fs/fs.c:757:28: warning: dubious: !x & y
Don't be shy. You actually found a real bug. I changed the commit log a
bit to reflect that. I added this one to master and the others to next.
Sascha
>
> Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
> ---
> fs/fs.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/fs.c b/fs/fs.c
> index 3b5f284..7d8dea7 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -754,7 +754,7 @@ int mount(const char *device, const char *fsname, const char *_path)
> }
>
> fsdev = xzalloc(sizeof(struct fs_device_d));
> - if (!fs_drv->flags & FS_DRIVER_NO_DEV) {
> + if (!(fs_drv->flags & FS_DRIVER_NO_DEV)) {
> fsdev->backingstore = strdup(device);
> if (!device) {
> printf("need a device for driver %s\n", fsname);
> --
> 1.7.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-19 8:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-18 13:29 [PATCH 0/5] Various sparse fixes Marek Belisko
2010-11-18 13:29 ` [PATCH 1/5] common: Add define for IOMEM helper macro Marek Belisko
2010-11-18 13:29 ` [PATCH 2/5] fs: Fix sparse warning Marek Belisko
2010-11-19 8:36 ` Sascha Hauer
2010-11-18 13:29 ` [PATCH 3/5] mtd: " Marek Belisko
2010-11-18 13:29 ` [PATCH 4/5] nand_s3c2410: Fix sparse warnings Marek Belisko
2010-11-18 13:29 ` [PATCH 5/5] smc91111: Various sparse fixes Marek Belisko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox