mtd/drivers/mtd/maps lubbock-flash.c, 1.22, 1.23 mainstone-flash.c,
1.5, 1.6 Kconfig, 1.65, 1.66 Makefile.common, 1.37,
1.38 amd76xrom.c, 1.21, 1.22 bast-flash.c, 1.5, 1.6 ceiva.c,
1.12, 1.13 ebony.c, 1.16, 1.17 ichxrom.c, 1.19,
1.20 integrator-flash.c, 1.20, 1.21 ipaq-flash.c, 1.6,
1.7 iq80310.c, 1.21, 1.22 ixp2000.c, 1.10, 1.11 ixp4xx.c, 1.13,
1.14 ocotea.c, 1.3, 1.4 omap-toto-flash.c, 1.5, 1.6 omap_nor.c,
1.3, 1.4 plat-ram.c, 1.7, 1.8 sa1100-flash.c, 1.51,
1.52 sun_uflash.c, 1.13, 1.14 tqm8xxl.c, 1.15,
1.16 ts5500_flash.c, 1.5, 1.6 walnut.c, 1.3,
1.4 pxa2xx-flash.c, 1.1, NONE
gleixner at infradead.org
gleixner at infradead.org
Tue Nov 29 15:01:31 EST 2005
Update of /home/cvs/mtd/drivers/mtd/maps
In directory phoenix.infradead.org:/tmp/cvs-serv14005/drivers/mtd/maps
Modified Files:
Kconfig Makefile.common amd76xrom.c bast-flash.c ceiva.c
ebony.c ichxrom.c integrator-flash.c ipaq-flash.c iq80310.c
ixp2000.c ixp4xx.c ocotea.c omap-toto-flash.c omap_nor.c
plat-ram.c sa1100-flash.c sun_uflash.c tqm8xxl.c
ts5500_flash.c walnut.c
Added Files:
lubbock-flash.c mainstone-flash.c
Removed Files:
pxa2xx-flash.c
Log Message:
Big mainline sync: Driver model updates, kfree fixup, version.h removals
Index: lubbock-flash.c
===================================================================
RCS file: lubbock-flash.c
diff -N lubbock-flash.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lubbock-flash.c 29 Nov 2005 20:01:28 -0000 1.23
@@ -0,0 +1,170 @@
+/*
+ * $Id$
+ *
+ * Map driver for the Lubbock developer platform.
+ *
+ * Author: Nicolas Pitre
+ * Copyright: (C) 2001 MontaVista Software Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+
+#include <linux/dma-mapping.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/io.h>
+#include <asm/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/lubbock.h>
+
+
+#define ROM_ADDR 0x00000000
+#define FLASH_ADDR 0x04000000
+
+#define WINDOW_SIZE 64*1024*1024
+
+static void lubbock_map_inval_cache(struct map_info *map, unsigned long from, ssize_t len)
+{
+ consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
+}
+
+static struct map_info lubbock_maps[2] = { {
+ .size = WINDOW_SIZE,
+ .phys = 0x00000000,
+ .inval_cache = lubbock_map_inval_cache,
+}, {
+ .size = WINDOW_SIZE,
+ .phys = 0x04000000,
+ .inval_cache = lubbock_map_inval_cache,
+} };
+
+static struct mtd_partition lubbock_partitions[] = {
+ {
+ .name = "Bootloader",
+ .size = 0x00040000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
+ },{
+ .name = "Kernel",
+ .size = 0x00100000,
+ .offset = 0x00040000,
+ },{
+ .name = "Filesystem",
+ .size = MTDPART_SIZ_FULL,
+ .offset = 0x00140000
+ }
+};
+
+static struct mtd_info *mymtds[2];
+static struct mtd_partition *parsed_parts[2];
+static int nr_parsed_parts[2];
+
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
+static int __init init_lubbock(void)
+{
+ int flashboot = (LUB_CONF_SWITCHES & 1);
+ int ret = 0, i;
+
+ lubbock_maps[0].bankwidth = lubbock_maps[1].bankwidth =
+ (BOOT_DEF & 1) ? 2 : 4;
+
+ /* Compensate for the nROMBT switch which swaps the flash banks */
+ printk(KERN_NOTICE "Lubbock configured to boot from %s (bank %d)\n",
+ flashboot?"Flash":"ROM", flashboot);
+
+ lubbock_maps[flashboot^1].name = "Lubbock Application Flash";
+ lubbock_maps[flashboot].name = "Lubbock Boot ROM";
+
+ for (i = 0; i < 2; i++) {
+ lubbock_maps[i].virt = ioremap(lubbock_maps[i].phys, WINDOW_SIZE);
+ if (!lubbock_maps[i].virt) {
+ printk(KERN_WARNING "Failed to ioremap %s\n", lubbock_maps[i].name);
+ if (!ret)
+ ret = -ENOMEM;
+ continue;
+ }
+ lubbock_maps[i].cached = ioremap_cached(lubbock_maps[i].phys, WINDOW_SIZE);
+ if (!lubbock_maps[i].cached)
+ printk(KERN_WARNING "Failed to ioremap cached %s\n", lubbock_maps[i].name);
+ simple_map_init(&lubbock_maps[i]);
+
+ printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n",
+ lubbock_maps[i].name, lubbock_maps[i].phys,
+ lubbock_maps[i].bankwidth * 8);
+
+ mymtds[i] = do_map_probe("cfi_probe", &lubbock_maps[i]);
+
+ if (!mymtds[i]) {
+ iounmap((void *)lubbock_maps[i].virt);
+ if (lubbock_maps[i].cached)
+ iounmap(lubbock_maps[i].cached);
+ if (!ret)
+ ret = -EIO;
+ continue;
+ }
+ mymtds[i]->owner = THIS_MODULE;
+
+ ret = parse_mtd_partitions(mymtds[i], probes,
+ &parsed_parts[i], 0);
+
+ if (ret > 0)
+ nr_parsed_parts[i] = ret;
+ }
+
+ if (!mymtds[0] && !mymtds[1])
+ return ret;
+
+ for (i = 0; i < 2; i++) {
+ if (!mymtds[i]) {
+ printk(KERN_WARNING "%s is absent. Skipping\n", lubbock_maps[i].name);
+ } else if (nr_parsed_parts[i]) {
+ add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
+ } else if (!i) {
+ printk("Using static partitions on %s\n", lubbock_maps[i].name);
+ add_mtd_partitions(mymtds[i], lubbock_partitions, ARRAY_SIZE(lubbock_partitions));
+ } else {
+ printk("Registering %s as whole device\n", lubbock_maps[i].name);
+ add_mtd_device(mymtds[i]);
+ }
+ }
+ return 0;
+}
+
+static void __exit cleanup_lubbock(void)
+{
+ int i;
+ for (i = 0; i < 2; i++) {
+ if (!mymtds[i])
+ continue;
+
+ if (nr_parsed_parts[i] || !i)
+ del_mtd_partitions(mymtds[i]);
+ else
+ del_mtd_device(mymtds[i]);
+
+ map_destroy(mymtds[i]);
+ iounmap((void *)lubbock_maps[i].virt);
+ if (lubbock_maps[i].cached)
+ iounmap(lubbock_maps[i].cached);
+
+ kfree(parsed_parts[i]);
+ }
+}
+
+module_init(init_lubbock);
+module_exit(cleanup_lubbock);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Nicolas Pitre <nico at cam.org>");
+MODULE_DESCRIPTION("MTD map driver for Intel Lubbock");
Index: mainstone-flash.c
===================================================================
RCS file: mainstone-flash.c
diff -N mainstone-flash.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mainstone-flash.c 29 Nov 2005 20:01:28 -0000 1.6
@@ -0,0 +1,181 @@
+/*
+ * $Id$
+ *
+ * Map driver for the Mainstone developer platform.
+ *
+ * Author: Nicolas Pitre
+ * Copyright: (C) 2001 MontaVista Software Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/dma-mapping.h>
+#include <linux/slab.h>
+
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+
+#include <asm/io.h>
+#include <asm/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/mainstone.h>
+
+
+#define ROM_ADDR 0x00000000
+#define FLASH_ADDR 0x04000000
+
+#define WINDOW_SIZE 0x04000000
+
+static void mainstone_map_inval_cache(struct map_info *map, unsigned long from,
+ ssize_t len)
+{
+ consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
+}
+
+static struct map_info mainstone_maps[2] = { {
+ .size = WINDOW_SIZE,
+ .phys = PXA_CS0_PHYS,
+ .inval_cache = mainstone_map_inval_cache,
+}, {
+ .size = WINDOW_SIZE,
+ .phys = PXA_CS1_PHYS,
+ .inval_cache = mainstone_map_inval_cache,
+} };
+
+static struct mtd_partition mainstone_partitions[] = {
+ {
+ .name = "Bootloader",
+ .size = 0x00040000,
+ .offset = 0,
+ .mask_flags = MTD_WRITEABLE /* force read-only */
+ },{
+ .name = "Kernel",
+ .size = 0x00400000,
+ .offset = 0x00040000,
+ },{
+ .name = "Filesystem",
+ .size = MTDPART_SIZ_FULL,
+ .offset = 0x00440000
+ }
+};
+
+static struct mtd_info *mymtds[2];
+static struct mtd_partition *parsed_parts[2];
+static int nr_parsed_parts[2];
+
+static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
+
+static int __init init_mainstone(void)
+{
+ int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
+ int ret = 0, i;
+
+ mainstone_maps[0].bankwidth = (BOOT_DEF & 1) ? 2 : 4;
+ mainstone_maps[1].bankwidth = 4;
+
+ /* Compensate for SW7 which swaps the flash banks */
+ mainstone_maps[SW7].name = "processor flash";
+ mainstone_maps[SW7 ^ 1].name = "main board flash";
+
+ printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
+ mainstone_maps[0].name);
+
+ for (i = 0; i < 2; i++) {
+ mainstone_maps[i].virt = ioremap(mainstone_maps[i].phys,
+ WINDOW_SIZE);
+ if (!mainstone_maps[i].virt) {
+ printk(KERN_WARNING "Failed to ioremap %s\n",
+ mainstone_maps[i].name);
+ if (!ret)
+ ret = -ENOMEM;
+ continue;
+ }
+ mainstone_maps[i].cached =
+ ioremap_cached(mainstone_maps[i].phys, WINDOW_SIZE);
+ if (!mainstone_maps[i].cached)
+ printk(KERN_WARNING "Failed to ioremap cached %s\n",
+ mainstone_maps[i].name);
+ simple_map_init(&mainstone_maps[i]);
+
+ printk(KERN_NOTICE
+ "Probing %s at physical address 0x%08lx"
+ " (%d-bit bankwidth)\n",
+ mainstone_maps[i].name, mainstone_maps[i].phys,
+ mainstone_maps[i].bankwidth * 8);
+
+ mymtds[i] = do_map_probe("cfi_probe", &mainstone_maps[i]);
+
+ if (!mymtds[i]) {
+ iounmap((void *)mainstone_maps[i].virt);
+ if (mainstone_maps[i].cached)
+ iounmap(mainstone_maps[i].cached);
+ if (!ret)
+ ret = -EIO;
+ continue;
+ }
+ mymtds[i]->owner = THIS_MODULE;
+
+ ret = parse_mtd_partitions(mymtds[i], probes,
+ &parsed_parts[i], 0);
+
+ if (ret > 0)
+ nr_parsed_parts[i] = ret;
+ }
+
+ if (!mymtds[0] && !mymtds[1])
+ return ret;
+
+ for (i = 0; i < 2; i++) {
+ if (!mymtds[i]) {
+ printk(KERN_WARNING "%s is absent. Skipping\n",
+ mainstone_maps[i].name);
+ } else if (nr_parsed_parts[i]) {
+ add_mtd_partitions(mymtds[i], parsed_parts[i],
+ nr_parsed_parts[i]);
+ } else if (!i) {
+ printk("Using static partitions on %s\n",
+ mainstone_maps[i].name);
+ add_mtd_partitions(mymtds[i], mainstone_partitions,
+ ARRAY_SIZE(mainstone_partitions));
+ } else {
+ printk("Registering %s as whole device\n",
+ mainstone_maps[i].name);
+ add_mtd_device(mymtds[i]);
+ }
+ }
+ return 0;
+}
+
+static void __exit cleanup_mainstone(void)
+{
+ int i;
+ for (i = 0; i < 2; i++) {
+ if (!mymtds[i])
+ continue;
+
+ if (nr_parsed_parts[i] || !i)
+ del_mtd_partitions(mymtds[i]);
+ else
+ del_mtd_device(mymtds[i]);
+
+ map_destroy(mymtds[i]);
+ iounmap((void *)mainstone_maps[i].virt);
+ if (mainstone_maps[i].cached)
+ iounmap(mainstone_maps[i].cached);
+ kfree(parsed_parts[i]);
+ }
+}
+
+module_init(init_mainstone);
+module_exit(cleanup_mainstone);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Nicolas Pitre <nico at cam.org>");
+MODULE_DESCRIPTION("MTD map driver for Intel Mainstone");
Index: Kconfig
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Kconfig,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- Kconfig 29 Nov 2005 08:54:55 -0000 1.65
+++ Kconfig 29 Nov 2005 20:01:27 -0000 1.66
@@ -208,13 +208,20 @@
More info at
<http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>.
-config MTD_PXA2XX
- tristate "CFI Flash device mapped on Intel XScale PXA2xx eval board"
- depends on (ARCH_LUBBOCK || MACH_MAINSTONE) && MTD_CFI_INTELEXT
+config MTD_LUBBOCK
+ tristate "CFI Flash device mapped on Intel Lubbock XScale eval board"
+ depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS
+ help
+ This provides a driver for the on-board flash of the Intel
+ 'Lubbock' XScale evaluation board.
+
+config MTD_MAINSTONE
+ tristate "CFI Flash device mapped on Intel Mainstone XScale eval board"
+ depends on MACH_MAINSTONE && MTD_CFI_INTELEXT
select MTD_PARTITIONS
help
This provides a driver for the on-board flash of the Intel
- 'Lubbock' and 'Mainstone' XScale PXA2xx evaluation boards.
+ 'Mainstone PXA27x evaluation board.
config MTD_OCTAGON
tristate "JEDEC Flash device mapped on Octagon 5066 SBC"
Index: Makefile.common
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/Makefile.common,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Makefile.common 29 Nov 2005 08:54:55 -0000 1.37
+++ Makefile.common 29 Nov 2005 20:01:28 -0000 1.38
@@ -21,7 +21,8 @@
obj-$(CONFIG_MTD_AMD76XROM) += amd76xrom.o
obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o
obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
-obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o
+obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o
+obj-$(CONFIG_MTD_MAINSTONE) += mainstone-flash.o
obj-$(CONFIG_MTD_MBX860) += mbx860.o
obj-$(CONFIG_MTD_CEIVA) += ceiva.o
obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
Index: amd76xrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/amd76xrom.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- amd76xrom.c 7 Nov 2005 11:14:26 -0000 1.21
+++ amd76xrom.c 29 Nov 2005 20:01:28 -0000 1.22
@@ -259,9 +259,7 @@
out:
/* Free any left over map structures */
- if (map) {
- kfree(map);
- }
+ kfree(map);
/* See if I have any map structures */
if (list_empty(&window->maps)) {
amd76xrom_cleanup(window);
Index: bast-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/bast-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- bast-flash.c 7 Nov 2005 11:14:26 -0000 1.5
+++ bast-flash.c 29 Nov 2005 20:01:28 -0000 1.6
@@ -63,11 +63,6 @@
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
-static struct bast_flash_info *to_bast_info(struct device *dev)
-{
- return (struct bast_flash_info *)dev_get_drvdata(dev);
-}
-
static void bast_flash_setrw(int to)
{
unsigned int val;
@@ -87,11 +82,11 @@
local_irq_restore(flags);
}
-static int bast_flash_remove(struct device *dev)
+static int bast_flash_remove(struct platform_device *pdev)
{
- struct bast_flash_info *info = to_bast_info(dev);
+ struct bast_flash_info *info = platform_get_drvdata(pdev);
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
if (info == NULL)
return 0;
@@ -104,8 +99,7 @@
map_destroy(info->mtd);
}
- if (info->partitions)
- kfree(info->partitions);
+ kfree(info->partitions);
if (info->area) {
release_resource(info->area);
@@ -117,9 +111,8 @@
return 0;
}
-static int bast_flash_probe(struct device *dev)
+static int bast_flash_probe(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
struct bast_flash_info *info;
struct resource *res;
int err = 0;
@@ -132,13 +125,13 @@
}
memzero(info, sizeof(*info));
- dev_set_drvdata(dev, info);
+ platform_set_drvdata(pdev, info);
res = pdev->resource; /* assume that the flash has one resource */
info->map.phys = res->start;
info->map.size = res->end - res->start + 1;
- info->map.name = dev->bus_id;
+ info->map.name = pdev->dev.bus_id;
info->map.bankwidth = 2;
if (info->map.size > AREA_MAXSIZE)
@@ -200,27 +193,28 @@
/* fall through to exit error */
exit_error:
- bast_flash_remove(dev);
+ bast_flash_remove(pdev);
return err;
}
-static struct device_driver bast_flash_driver = {
- .name = "bast-nor",
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver bast_flash_driver = {
.probe = bast_flash_probe,
.remove = bast_flash_remove,
+ .driver = {
+ .name = "bast-nor",
+ .owner = THIS_MODULE,
+ },
};
static int __init bast_flash_init(void)
{
printk("BAST NOR-Flash Driver, (c) 2004 Simtec Electronics\n");
- return driver_register(&bast_flash_driver);
+ return platform_driver_register(&bast_flash_driver);
}
static void __exit bast_flash_exit(void)
{
- driver_unregister(&bast_flash_driver);
+ platform_driver_unregister(&bast_flash_driver);
}
module_init(bast_flash_init);
Index: ceiva.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ceiva.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ceiva.c 6 Nov 2005 11:15:51 -0000 1.12
+++ ceiva.c 29 Nov 2005 20:01:28 -0000 1.13
@@ -313,8 +313,7 @@
static void __exit clps_destroy_partitions(void)
{
- if (parsed_parts)
- kfree(parsed_parts);
+ kfree(parsed_parts);
}
static struct mtd_info *mymtd;
Index: ebony.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ebony.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ebony.c 7 Nov 2005 11:14:26 -0000 1.16
+++ ebony.c 29 Nov 2005 20:01:28 -0000 1.17
@@ -21,7 +21,6 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/config.h>
-#include <linux/version.h>
#include <asm/io.h>
#include <asm/ibm44x.h>
#include <platforms/4xx/ebony.h>
Index: ichxrom.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ichxrom.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- ichxrom.c 7 Nov 2005 11:14:27 -0000 1.19
+++ ichxrom.c 29 Nov 2005 20:01:28 -0000 1.20
@@ -306,9 +306,8 @@
out:
/* Free any left over map structures */
- if (map) {
- kfree(map);
- }
+ kfree(map);
+
/* See if I have any map structures */
if (list_empty(&window->maps)) {
ichxrom_cleanup(window);
Index: integrator-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/integrator-flash.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- integrator-flash.c 7 Nov 2005 11:14:27 -0000 1.20
+++ integrator-flash.c 29 Nov 2005 20:01:28 -0000 1.21
@@ -67,9 +67,8 @@
static const char *probes[] = { "cmdlinepart", "RedBoot", "afs", NULL };
-static int armflash_probe(struct device *_dev)
+static int armflash_probe(struct platform_device *dev)
{
- struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data;
struct resource *res = dev->resource;
unsigned int size = res->end - res->start + 1;
@@ -138,7 +137,7 @@
}
if (err == 0)
- dev_set_drvdata(&dev->dev, info);
+ platform_set_drvdata(dev, info);
/*
* If we got an error, free all resources.
@@ -148,8 +147,7 @@
del_mtd_partitions(info->mtd);
map_destroy(info->mtd);
}
- if (info->parts)
- kfree(info->parts);
+ kfree(info->parts);
no_device:
iounmap(base);
@@ -164,20 +162,18 @@
return err;
}
-static int armflash_remove(struct device *_dev)
+static int armflash_remove(struct platform_device *dev)
{
- struct platform_device *dev = to_platform_device(_dev);
- struct armflash_info *info = dev_get_drvdata(&dev->dev);
+ struct armflash_info *info = platform_get_drvdata(dev);
- dev_set_drvdata(&dev->dev, NULL);
+ platform_set_drvdata(dev, NULL);
if (info) {
if (info->mtd) {
del_mtd_partitions(info->mtd);
map_destroy(info->mtd);
}
- if (info->parts)
- kfree(info->parts);
+ kfree(info->parts);
iounmap(info->map.virt);
release_resource(info->res);
@@ -192,21 +188,22 @@
return 0;
}
-static struct device_driver armflash_driver = {
- .name = "armflash",
- .bus = &platform_bus_type,
+static struct platform_driver armflash_driver = {
.probe = armflash_probe,
.remove = armflash_remove,
+ .driver = {
+ .name = "armflash",
+ },
};
static int __init armflash_init(void)
{
- return driver_register(&armflash_driver);
+ return platform_driver_register(&armflash_driver);
}
static void __exit armflash_exit(void)
{
- driver_unregister(&armflash_driver);
+ platform_driver_unregister(&armflash_driver);
}
module_init(armflash_init);
Index: ipaq-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ipaq-flash.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ipaq-flash.c 29 Nov 2005 14:33:31 -0000 1.6
+++ ipaq-flash.c 29 Nov 2005 20:01:28 -0000 1.7
@@ -431,8 +431,7 @@
if (my_sub_mtd[i])
map_destroy(my_sub_mtd[i]);
}
- if (parsed_parts)
- kfree(parsed_parts);
+ kfree(parsed_parts);
}
}
Index: iq80310.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/iq80310.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- iq80310.c 7 Nov 2005 11:14:27 -0000 1.21
+++ iq80310.c 29 Nov 2005 20:01:28 -0000 1.22
@@ -103,8 +103,7 @@
if (mymtd) {
del_mtd_partitions(mymtd);
map_destroy(mymtd);
- if (parsed_parts)
- kfree(parsed_parts);
+ kfree(parsed_parts);
}
if (iq80310_map.virt)
iounmap((void *)iq80310_map.virt);
Index: ixp2000.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ixp2000.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ixp2000.c 29 Nov 2005 14:33:31 -0000 1.10
+++ ixp2000.c 29 Nov 2005 20:01:28 -0000 1.11
@@ -111,13 +111,12 @@
}
-static int ixp2000_flash_remove(struct device *_dev)
+static int ixp2000_flash_remove(struct platform_device *dev)
{
- struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data;
- struct ixp2000_flash_info *info = dev_get_drvdata(&dev->dev);
+ struct ixp2000_flash_info *info = platform_get_drvdata(dev);
- dev_set_drvdata(&dev->dev, NULL);
+ platform_set_drvdata(dev, NULL);
if(!info)
return 0;
@@ -129,8 +128,7 @@
if (info->map.map_priv_1)
iounmap((void *) info->map.map_priv_1);
- if (info->partitions) {
- kfree(info->partitions); }
+ kfree(info->partitions);
if (info->res) {
release_resource(info->res);
@@ -144,10 +142,9 @@
}
-static int ixp2000_flash_probe(struct device *_dev)
+static int ixp2000_flash_probe(struct platform_device *dev)
{
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
- struct platform_device *dev = to_platform_device(_dev);
struct ixp2000_flash_data *ixp_data = dev->dev.platform_data;
struct flash_platform_data *plat;
struct ixp2000_flash_info *info;
@@ -178,7 +175,7 @@
}
memzero(info, sizeof(struct ixp2000_flash_info));
- dev_set_drvdata(&dev->dev, info);
+ platform_set_drvdata(dev, info);
/*
* Tell the MTD layer we're not 1:1 mapped so that it does
@@ -249,25 +246,26 @@
return 0;
Error:
- ixp2000_flash_remove(_dev);
+ ixp2000_flash_remove(dev);
return err;
}
-static struct device_driver ixp2000_flash_driver = {
- .name = "IXP2000-Flash",
- .bus = &platform_bus_type,
- .probe = &ixp2000_flash_probe,
- .remove = &ixp2000_flash_remove
+static struct platform_driver ixp2000_flash_driver = {
+ .probe = ixp2000_flash_probe,
+ .remove = ixp2000_flash_remove,
+ .driver = {
+ .name = "IXP2000-Flash",
+ },
};
static int __init ixp2000_flash_init(void)
{
- return driver_register(&ixp2000_flash_driver);
+ return platform_driver_register(&ixp2000_flash_driver);
}
static void __exit ixp2000_flash_exit(void)
{
- driver_unregister(&ixp2000_flash_driver);
+ platform_driver_unregister(&ixp2000_flash_driver);
}
module_init(ixp2000_flash_init);
Index: ixp4xx.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ixp4xx.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- ixp4xx.c 16 Nov 2005 16:23:21 -0000 1.13
+++ ixp4xx.c 29 Nov 2005 20:01:28 -0000 1.14
@@ -153,13 +153,12 @@
static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
-static int ixp4xx_flash_remove(struct device *_dev)
+static int ixp4xx_flash_remove(struct platform_device *dev)
{
- struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data;
- struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
+ struct ixp4xx_flash_info *info = platform_get_drvdata(dev);
- dev_set_drvdata(&dev->dev, NULL);
+ platform_set_drvdata(dev, NULL);
if(!info)
return 0;
@@ -171,8 +170,7 @@
if (info->map.virt)
iounmap(info->map.virt);
- if (info->partitions)
- kfree(info->partitions);
+ kfree(info->partitions);
if (info->res) {
release_resource(info->res);
@@ -185,9 +183,8 @@
return 0;
}
-static int ixp4xx_flash_probe(struct device *_dev)
+static int ixp4xx_flash_probe(struct platform_device *dev)
{
- struct platform_device *dev = to_platform_device(_dev);
struct flash_platform_data *plat = dev->dev.platform_data;
struct ixp4xx_flash_info *info;
int err = -1;
@@ -208,7 +205,7 @@
}
memzero(info, sizeof(struct ixp4xx_flash_info));
- dev_set_drvdata(&dev->dev, info);
+ platform_set_drvdata(dev, info);
/*
* Tell the MTD layer we're not 1:1 mapped so that it does
@@ -269,25 +266,26 @@
return 0;
Error:
- ixp4xx_flash_remove(_dev);
+ ixp4xx_flash_remove(dev);
return err;
}
-static struct device_driver ixp4xx_flash_driver = {
- .name = "IXP4XX-Flash",
- .bus = &platform_bus_type,
+static struct platform_driver ixp4xx_flash_driver = {
.probe = ixp4xx_flash_probe,
.remove = ixp4xx_flash_remove,
+ .driver = {
+ .name = "IXP4XX-Flash",
+ },
};
static int __init ixp4xx_flash_init(void)
{
- return driver_register(&ixp4xx_flash_driver);
+ return platform_driver_register(&ixp4xx_flash_driver);
}
static void __exit ixp4xx_flash_exit(void)
{
- driver_unregister(&ixp4xx_flash_driver);
+ platform_driver_unregister(&ixp4xx_flash_driver);
}
Index: ocotea.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ocotea.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ocotea.c 4 Nov 2004 13:24:15 -0000 1.3
+++ ocotea.c 29 Nov 2005 20:01:28 -0000 1.4
@@ -19,7 +19,6 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/config.h>
-#include <linux/version.h>
#include <asm/io.h>
#include <asm/ibm44x.h>
#include <platforms/4xx/ocotea.h>
Index: omap-toto-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/omap-toto-flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- omap-toto-flash.c 7 Nov 2005 11:14:27 -0000 1.5
+++ omap-toto-flash.c 29 Nov 2005 20:01:28 -0000 1.6
@@ -124,8 +124,7 @@
if (flash_mtd) {
del_mtd_partitions(flash_mtd);
map_destroy(flash_mtd);
- if (parsed_parts)
- kfree(parsed_parts);
+ kfree(parsed_parts);
}
}
Index: omap_nor.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/omap_nor.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- omap_nor.c 7 Nov 2005 11:14:27 -0000 1.3
+++ omap_nor.c 29 Nov 2005 20:01:28 -0000 1.4
@@ -70,11 +70,10 @@
}
}
-static int __devinit omapflash_probe(struct device *dev)
+static int __devinit omapflash_probe(struct platform_device *pdev)
{
int err;
struct omapflash_info *info;
- struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *pdata = pdev->dev.platform_data;
struct resource *res = pdev->resource;
unsigned long size = res->end - res->start + 1;
@@ -119,7 +118,7 @@
#endif
add_mtd_device(info->mtd);
- dev_set_drvdata(&pdev->dev, info);
+ platform_set_drvdata(pdev, info);
return 0;
@@ -133,12 +132,11 @@
return err;
}
-static int __devexit omapflash_remove(struct device *dev)
+static int __devexit omapflash_remove(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct omapflash_info *info = dev_get_drvdata(&pdev->dev);
+ struct omapflash_info *info = platform_get_drvdata(pdev);
- dev_set_drvdata(&pdev->dev, NULL);
+ platform_set_drvdata(pdev, NULL);
if (info) {
if (info->parts) {
@@ -155,21 +153,22 @@
return 0;
}
-static struct device_driver omapflash_driver = {
- .name = "omapflash",
- .bus = &platform_bus_type,
+static struct platform_driver omapflash_driver = {
.probe = omapflash_probe,
.remove = __devexit_p(omapflash_remove),
+ .driver = {
+ .name = "omapflash",
+ },
};
static int __init omapflash_init(void)
{
- return driver_register(&omapflash_driver);
+ return platform_driver_register(&omapflash_driver);
}
static void __exit omapflash_exit(void)
{
- driver_unregister(&omapflash_driver);
+ platform_driver_unregister(&omapflash_driver);
}
module_init(omapflash_init);
Index: plat-ram.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/plat-ram.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- plat-ram.c 7 Nov 2005 11:14:28 -0000 1.7
+++ plat-ram.c 29 Nov 2005 20:01:28 -0000 1.8
@@ -56,9 +56,9 @@
* device private data to struct platram_info conversion
*/
-static inline struct platram_info *to_platram_info(struct device *dev)
+static inline struct platram_info *to_platram_info(struct platform_device *dev)
{
- return (struct platram_info *)dev_get_drvdata(dev);
+ return (struct platram_info *)platform_get_drvdata(dev);
}
/* platram_setrw
@@ -83,13 +83,13 @@
* called to remove the device from the driver's control
*/
-static int platram_remove(struct device *dev)
+static int platram_remove(struct platform_device *pdev)
{
- struct platram_info *info = to_platram_info(dev);
+ struct platram_info *info = to_platram_info(pdev);
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
- dev_dbg(dev, "removing device\n");
+ dev_dbg(&pdev->dev, "removing device\n");
if (info == NULL)
return 0;
@@ -130,61 +130,60 @@
* driver is found.
*/
-static int platram_probe(struct device *dev)
+static int platram_probe(struct platform_device *pdev)
{
- struct platform_device *pd = to_platform_device(dev);
struct platdata_mtd_ram *pdata;
struct platram_info *info;
struct resource *res;
int err = 0;
- dev_dbg(dev, "probe entered\n");
+ dev_dbg(&pdev->dev, "probe entered\n");
- if (dev->platform_data == NULL) {
- dev_err(dev, "no platform data supplied\n");
+ if (pdev->dev.platform_data == NULL) {
+ dev_err(&pdev->dev, "no platform data supplied\n");
err = -ENOENT;
goto exit_error;
}
- pdata = dev->platform_data;
+ pdata = pdev->dev.platform_data;
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) {
- dev_err(dev, "no memory for flash info\n");
+ dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM;
goto exit_error;
}
memset(info, 0, sizeof(*info));
- dev_set_drvdata(dev, info);
+ platform_set_drvdata(pdev, info);
- info->dev = dev;
+ info->dev = &pdev->dev;
info->pdata = pdata;
/* get the resource for the memory mapping */
- res = platform_get_resource(pd, IORESOURCE_MEM, 0);
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
- dev_err(dev, "no memory resource specified\n");
+ dev_err(&pdev->dev, "no memory resource specified\n");
err = -ENOENT;
goto exit_free;
}
- dev_dbg(dev, "got platform resource %p (0x%lx)\n", res, res->start);
+ dev_dbg(&pdev->dev, "got platform resource %p (0x%lx)\n", res, res->start);
/* setup map parameters */
info->map.phys = res->start;
info->map.size = (res->end - res->start) + 1;
- info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pd->name;
+ info->map.name = pdata->mapname != NULL ? pdata->mapname : (char *)pdev->name;
info->map.bankwidth = pdata->bankwidth;
/* register our usage of the memory area */
- info->area = request_mem_region(res->start, info->map.size, pd->name);
+ info->area = request_mem_region(res->start, info->map.size, pdev->name);
if (info->area == NULL) {
- dev_err(dev, "failed to request memory region\n");
+ dev_err(&pdev->dev, "failed to request memory region\n");
err = -EIO;
goto exit_free;
}
@@ -192,23 +191,23 @@
/* remap the memory area */
info->map.virt = ioremap(res->start, info->map.size);
- dev_dbg(dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size);
+ dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size);
if (info->map.virt == NULL) {
- dev_err(dev, "failed to ioremap() region\n");
+ dev_err(&pdev->dev, "failed to ioremap() region\n");
err = -EIO;
goto exit_free;
}
simple_map_init(&info->map);
- dev_dbg(dev, "initialised map, probing for mtd\n");
+ dev_dbg(&pdev->dev, "initialised map, probing for mtd\n");
/* probe for the right mtd map driver */
info->mtd = do_map_probe("map_ram" , &info->map);
if (info->mtd == NULL) {
- dev_err(dev, "failed to probe for map_ram\n");
+ dev_err(&pdev->dev, "failed to probe for map_ram\n");
err = -ENOMEM;
goto exit_free;
}
@@ -237,27 +236,28 @@
#endif /* CONFIG_MTD_PARTITIONS */
if (add_mtd_device(info->mtd)) {
- dev_err(dev, "add_mtd_device() failed\n");
+ dev_err(&pdev->dev, "add_mtd_device() failed\n");
err = -ENOMEM;
}
- dev_info(dev, "registered mtd device\n");
+ dev_info(&pdev->dev, "registered mtd device\n");
return err;
exit_free:
- platram_remove(dev);
+ platram_remove(pdev);
exit_error:
return err;
}
/* device driver info */
-static struct device_driver platram_driver = {
- .name = "mtd-ram",
- .owner = THIS_MODULE,
- .bus = &platform_bus_type,
+static struct platform_driver platram_driver = {
.probe = platram_probe,
.remove = platram_remove,
+ .driver = {
+ .name = "mtd-ram",
+ .owner = THIS_MODULE,
+ },
};
/* module init/exit */
@@ -265,12 +265,12 @@
static int __init platram_init(void)
{
printk("Generic platform RAM MTD, (c) 2004 Simtec Electronics\n");
- return driver_register(&platram_driver);
+ return platform_driver_register(&platram_driver);
}
static void __exit platram_exit(void)
{
- driver_unregister(&platram_driver);
+ platform_driver_unregister(&platram_driver);
}
module_init(platram_init);
Index: sa1100-flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sa1100-flash.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- sa1100-flash.c 7 Nov 2005 11:14:28 -0000 1.51
+++ sa1100-flash.c 29 Nov 2005 20:01:28 -0000 1.52
@@ -241,8 +241,7 @@
#endif
}
- if (info->parts)
- kfree(info->parts);
+ kfree(info->parts);
for (i = info->num_subdev - 1; i >= 0; i--)
sa1100_destroy_subdev(&info->subdev[i]);
@@ -357,9 +356,8 @@
static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
-static int __init sa1100_mtd_probe(struct device *dev)
+static int __init sa1100_mtd_probe(struct platform_device *pdev)
{
- struct platform_device *pdev = to_platform_device(dev);
struct flash_platform_data *plat = pdev->dev.platform_data;
struct mtd_partition *parts;
const char *part_type = NULL;
@@ -403,28 +401,28 @@
info->nr_parts = nr_parts;
- dev_set_drvdata(dev, info);
+ platform_set_drvdata(pdev, info);
err = 0;
out:
return err;
}
-static int __exit sa1100_mtd_remove(struct device *dev)
+static int __exit sa1100_mtd_remove(struct platform_device *pdev)
{
- struct sa_info *info = dev_get_drvdata(dev);
- struct flash_platform_data *plat = dev->platform_data;
+ struct sa_info *info = platform_get_drvdata(pdev);
+ struct flash_platform_data *plat = pdev->dev.platform_data;
- dev_set_drvdata(dev, NULL);
+ platform_set_drvdata(pdev, NULL);
sa1100_destroy(info, plat);
return 0;
}
#ifdef CONFIG_PM
-static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
+static int sa1100_mtd_suspend(struct platform_device *dev, pm_message_t state)
{
- struct sa_info *info = dev_get_drvdata(dev);
+ struct sa_info *info = platform_get_drvdata(dev);
int ret = 0;
if (info)
@@ -433,17 +431,17 @@
return ret;
}
-static int sa1100_mtd_resume(struct device *dev)
+static int sa1100_mtd_resume(struct platform_device *dev)
{
- struct sa_info *info = dev_get_drvdata(dev);
+ struct sa_info *info = platform_get_drvdata(dev);
if (info)
info->mtd->resume(info->mtd);
return 0;
}
-static void sa1100_mtd_shutdown(struct device *dev)
+static void sa1100_mtd_shutdown(struct platform_device *dev)
{
- struct sa_info *info = dev_get_drvdata(dev);
+ struct sa_info *info = platform_get_drvdata(dev);
if (info && info->mtd->suspend(info->mtd) == 0)
info->mtd->resume(info->mtd);
}
@@ -453,24 +451,25 @@
#define sa1100_mtd_shutdown NULL
#endif
-static struct device_driver sa1100_mtd_driver = {
- .name = "flash",
- .bus = &platform_bus_type,
+static struct platform_driver sa1100_mtd_driver = {
.probe = sa1100_mtd_probe,
.remove = __exit_p(sa1100_mtd_remove),
.suspend = sa1100_mtd_suspend,
.resume = sa1100_mtd_resume,
.shutdown = sa1100_mtd_shutdown,
+ .driver = {
+ .name = "flash",
+ },
};
static int __init sa1100_mtd_init(void)
{
- return driver_register(&sa1100_mtd_driver);
+ return platform_driver_register(&sa1100_mtd_driver);
}
static void __exit sa1100_mtd_exit(void)
{
- driver_unregister(&sa1100_mtd_driver);
+ platform_driver_unregister(&sa1100_mtd_driver);
}
module_init(sa1100_mtd_init);
Index: sun_uflash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/sun_uflash.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- sun_uflash.c 7 Nov 2005 11:14:28 -0000 1.13
+++ sun_uflash.c 29 Nov 2005 20:01:28 -0000 1.14
@@ -166,9 +166,7 @@
iounmap(udev->map.virt);
udev->map.virt = NULL;
}
- if(0 != udev->name) {
- kfree(udev->name);
- }
+ kfree(udev->name);
kfree(udev);
}
}
Index: tqm8xxl.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/tqm8xxl.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- tqm8xxl.c 7 Nov 2005 11:14:28 -0000 1.15
+++ tqm8xxl.c 29 Nov 2005 20:01:28 -0000 1.16
@@ -224,10 +224,8 @@
error_mem:
for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) {
if(map_banks[idx] != NULL) {
- if(map_banks[idx]->name != NULL) {
- kfree(map_banks[idx]->name);
- map_banks[idx]->name = NULL;
- }
+ kfree(map_banks[idx]->name);
+ map_banks[idx]->name = NULL;
kfree(map_banks[idx]);
map_banks[idx] = NULL;
}
Index: ts5500_flash.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/ts5500_flash.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ts5500_flash.c 7 Nov 2005 11:14:28 -0000 1.5
+++ ts5500_flash.c 29 Nov 2005 20:01:28 -0000 1.6
@@ -100,7 +100,6 @@
map_destroy(mymtd);
iounmap(ts5500_map.virt);
err2:
-
return rc;
}
Index: walnut.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/maps/walnut.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- walnut.c 7 Nov 2005 11:14:29 -0000 1.3
+++ walnut.c 29 Nov 2005 20:01:28 -0000 1.4
@@ -21,7 +21,6 @@
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/config.h>
-#include <linux/version.h>
#include <asm/io.h>
#include <asm/ibm4xx.h>
#include <platforms/4xx/walnut.h>
--- pxa2xx-flash.c DELETED ---
More information about the linux-mtd-cvs
mailing list