mtd: maps: gpio-addr-flash: fix warnings and make more portable

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Oct 24 20:59:11 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=ebd71e3a4861849054751779ff5ccd3fb29a1e0a
Commit:     ebd71e3a4861849054751779ff5ccd3fb29a1e0a
Parent:     5954c47c2194abcdeeae5f752e64b7c75770dbd3
Author:     Mike Frysinger <vapier at gentoo.org>
AuthorDate: Sat Oct 16 18:31:14 2010 -0400
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Oct 25 01:16:17 2010 +0100

    mtd: maps: gpio-addr-flash: fix warnings and make more portable
    
    As reported on lkml, building this module for HIMEM systems spews warnings
    about mismatch in pointer types.  Further, we need to use ioremap() in order
    to properly access the flash memory on most systems rather than just doing
    it directly.
    
    Reported-by: Alan Cox <alan at linux.intel.com>
    Signed-off-by: Mike Frysinger <vapier at gentoo.org>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/maps/gpio-addr-flash.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
index 32e89d7..af5707a 100644
--- a/drivers/mtd/maps/gpio-addr-flash.c
+++ b/drivers/mtd/maps/gpio-addr-flash.c
@@ -208,10 +208,14 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev)
 	if (!state)
 		return -ENOMEM;
 
+	/*
+	 * We cast start/end to known types in the boards file, so cast
+	 * away their pointer types here to the known types (gpios->xxx).
+	 */
 	state->gpio_count     = gpios->end;
-	state->gpio_addrs     = (void *)gpios->start;
+	state->gpio_addrs     = (void *)(unsigned long)gpios->start;
 	state->gpio_values    = (void *)(state + 1);
-	state->win_size       = memory->end - memory->start + 1;
+	state->win_size       = resource_size(memory);
 	memset(state->gpio_values, 0xff, arr_size);
 
 	state->map.name       = DRIVER_NAME;
@@ -221,7 +225,7 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev)
 	state->map.copy_to    = gf_copy_to;
 	state->map.bankwidth  = pdata->width;
 	state->map.size       = state->win_size * (1 << state->gpio_count);
-	state->map.virt       = (void __iomem *)memory->start;
+	state->map.virt       = ioremap_nocache(memory->start, state->map.size);
 	state->map.phys       = NO_XIP;
 	state->map.map_priv_1 = (unsigned long)state;
 



More information about the linux-mtd-cvs mailing list