From 4edaf56e0f8a6f71e3361bf74e3dc835811761e6 Mon Sep 17 00:00:00 2001 From: Valentine Barshak Date: Mon, 29 Oct 2007 23:29:02 +0300 Subject: MTD: small physmap_of partition parsing fixes Use of_get_next_child for proper ref counting as suggested by Stephen Rothwell and remove add_mtd_partitions from parse_partitions to avoid duplicate mtd device registration for RedBoot partitions. Signed-off-by: Valentine Barshak Acked-by: David Gibson Heckled-for-on-IRC-by: Josh Boyer Signed-off-by: David Woodhouse --- drivers/mtd/maps/physmap_of.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index aeed9ea7971..d4bcd3f8c57 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -94,14 +94,13 @@ static int __devinit parse_partitions(struct of_flash *info, * line, these take precedence over device tree information */ nr_parts = parse_mtd_partitions(info->mtd, part_probe_types, &info->parts, 0); - if (nr_parts > 0) { - add_mtd_partitions(info->mtd, info->parts, nr_parts); - return 0; - } + if (nr_parts > 0) + return nr_parts; /* First count the subnodes */ nr_parts = 0; - for (pp = dp->child; pp; pp = pp->sibling) + for (pp = of_get_next_child(dp, NULL); pp; + pp = of_get_next_child(dp, pp)) nr_parts++; if (nr_parts == 0) @@ -112,12 +111,14 @@ static int __devinit parse_partitions(struct of_flash *info, if (!info->parts) return -ENOMEM; - for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) { + for (pp = of_get_next_child(dp, NULL), i = 0; pp; + pp = of_get_next_child(dp, pp), i++) { const u32 *reg; int len; reg = of_get_property(pp, "reg", &len); if (!reg || (len != 2*sizeof(u32))) { + of_node_put(pp); dev_err(&dev->dev, "Invalid 'reg' on %s\n", dp->full_name); kfree(info->parts); -- cgit v1.2.3 From 73061e4c2dcfba17c6a0137a1199d3e00d03b14c Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Mon, 19 Nov 2007 22:33:02 +0100 Subject: [MTD] fix CONFIG_MTD_SHARP_SL if CONFIG_MTD=m Sharp Zaurus SL-C3200 with CONFIG_MTD=m and CONFIG_MTD_SHARP_SL=y (as it is bool) lost support for the ROM flash. With CONFIG_MTD=y it has no problems. It is caused by losing of compiled code of drivers/mtd/maps/sharpsl-flash.o. It was linked to drivers/mtd/maps/built-in.o and drivers/mtd/built-in.o, but lost and not linked to drivers/built-in.o (because CONFIG_MTD!=y). Patch below fixes this problem by creating sharpsl-flash.ko (and the code works correctly as a module). Signed-off-by: Stanislav Brabec Signed-off-by: David Woodhouse --- drivers/mtd/maps/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index a592fc04cf7..93dcb780db4 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -576,7 +576,7 @@ config MTD_BAST_MAXSIZE default "4" config MTD_SHARP_SL - bool "ROM mapped on Sharp SL Series" + tristate "ROM mapped on Sharp SL Series" depends on ARCH_PXA help This enables access to the flash chip on the Sharp SL Series of PDAs. -- cgit v1.2.3 From 71053fb1c645e86feb48051d6a4c58b8f2b26806 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Mon, 31 Dec 2007 17:52:29 +0000 Subject: [MTD] [MAPS] Remove Photron PNC-2000 map driver It should be done as a physmap device, and people keep turning it on and whining about it. Signed-off-by: David Woodhouse --- drivers/mtd/maps/Kconfig | 7 ---- drivers/mtd/maps/Makefile | 1 - drivers/mtd/maps/pnc2000.c | 93 ---------------------------------------------- 3 files changed, 101 deletions(-) delete mode 100644 drivers/mtd/maps/pnc2000.c (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index 93dcb780db4..12c253664eb 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig @@ -110,13 +110,6 @@ config MTD_SUN_UFLASH Sun Microsystems boardsets. This driver will require CFI support in the kernel, so if you did not enable CFI previously, do that now. -config MTD_PNC2000 - tristate "CFI Flash device mapped on Photron PNC-2000" - depends on X86 && MTD_CFI && MTD_PARTITIONS - help - PNC-2000 is the name of Network Camera product from PHOTRON - Ltd. in Japan. It uses CFI-compliant flash. - config MTD_SC520CDP tristate "CFI Flash device mapped on AMD SC520 CDP" depends on X86 && MTD_CFI && MTD_CONCAT diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 316382a1401..a9cbe80f99a 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile @@ -28,7 +28,6 @@ obj-$(CONFIG_MTD_PHYSMAP) += physmap.o obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o obj-$(CONFIG_MTD_PMC_MSP_RAMROOT)+= pmcmsp-ramroot.o -obj-$(CONFIG_MTD_PNC2000) += pnc2000.o obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o diff --git a/drivers/mtd/maps/pnc2000.c b/drivers/mtd/maps/pnc2000.c deleted file mode 100644 index d7e16c2d5c4..00000000000 --- a/drivers/mtd/maps/pnc2000.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * pnc2000.c - mapper for Photron PNC-2000 board. - * - * Copyright (C) 2000 Crossnet Co. - * - * This code is GPL - * - * $Id: pnc2000.c,v 1.18 2005/11/07 11:14:28 gleixner Exp $ - */ - -#include -#include -#include -#include - -#include -#include -#include - - -#define WINDOW_ADDR 0xbf000000 -#define WINDOW_SIZE 0x00400000 - -/* - * MAP DRIVER STUFF - */ - - -static struct map_info pnc_map = { - .name = "PNC-2000", - .size = WINDOW_SIZE, - .bankwidth = 4, - .phys = 0xFFFFFFFF, - .virt = (void __iomem *)WINDOW_ADDR, -}; - - -/* - * MTD 'PARTITIONING' STUFF - */ -static struct mtd_partition pnc_partitions[3] = { - { - .name = "PNC-2000 boot firmware", - .size = 0x20000, - .offset = 0 - }, - { - .name = "PNC-2000 kernel", - .size = 0x1a0000, - .offset = 0x20000 - }, - { - .name = "PNC-2000 filesystem", - .size = 0x240000, - .offset = 0x1c0000 - } -}; - -/* - * This is the master MTD device for which all the others are just - * auto-relocating aliases. - */ -static struct mtd_info *mymtd; - -static int __init init_pnc2000(void) -{ - printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR); - - simple_map_init(&pnc_map); - - mymtd = do_map_probe("cfi_probe", &pnc_map); - if (mymtd) { - mymtd->owner = THIS_MODULE; - return add_mtd_partitions(mymtd, pnc_partitions, 3); - } - - return -ENXIO; -} - -static void __exit cleanup_pnc2000(void) -{ - if (mymtd) { - del_mtd_partitions(mymtd); - map_destroy(mymtd); - } -} - -module_init(init_pnc2000); -module_exit(cleanup_pnc2000); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Crossnet Co. "); -MODULE_DESCRIPTION("MTD map driver for Photron PNC-2000 board"); -- cgit v1.2.3 From de7921f01a407e0cb38143363995db89a5f9a5c5 Mon Sep 17 00:00:00 2001 From: Bartlomiej Sieka Date: Mon, 26 Nov 2007 18:55:18 +0100 Subject: [MTD] [NOR] Fix incorrect interface code for x16/x32 chips According to "Common Flash Memory Interface Publication 100" dated December 1, 2001, the interface code for x16/x32 chips is 0x0005, and not 0x0004 used so far. Signed-off-by: Bartlomiej Sieka Signed-off-by: David Woodhouse --- drivers/mtd/maps/scb2_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index dcfb85840d1..0fc5584324e 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c @@ -79,7 +79,7 @@ scb2_fixup_mtd(struct mtd_info *mtd) struct cfi_private *cfi = map->fldrv_priv; /* barf if this doesn't look right */ - if (cfi->cfiq->InterfaceDesc != 1) { + if (cfi->cfiq->InterfaceDesc != CFI_INTERFACE_X16_ASYNC) { printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n", cfi->cfiq->InterfaceDesc); return -1; -- cgit v1.2.3 From 9a310d21196f38f6ad0ad146057548653e495c09 Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Tue, 15 Jan 2008 17:54:43 -0600 Subject: [MTD] Factor out OF partition support from the NOR driver. Signed-off-by: Scott Wood Signed-off-by: David Woodhouse --- drivers/mtd/maps/physmap_of.c | 89 +++++++++++++------------------------------ 1 file changed, 27 insertions(+), 62 deletions(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index d4bcd3f8c57..49acd417189 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -80,65 +80,6 @@ static int parse_obsolete_partitions(struct of_device *dev, return nr_parts; } - -static int __devinit parse_partitions(struct of_flash *info, - struct of_device *dev) -{ - const char *partname; - static const char *part_probe_types[] - = { "cmdlinepart", "RedBoot", NULL }; - struct device_node *dp = dev->node, *pp; - int nr_parts, i; - - /* First look for RedBoot table or partitions on the command - * line, these take precedence over device tree information */ - nr_parts = parse_mtd_partitions(info->mtd, part_probe_types, - &info->parts, 0); - if (nr_parts > 0) - return nr_parts; - - /* First count the subnodes */ - nr_parts = 0; - for (pp = of_get_next_child(dp, NULL); pp; - pp = of_get_next_child(dp, pp)) - nr_parts++; - - if (nr_parts == 0) - return parse_obsolete_partitions(dev, info, dp); - - info->parts = kzalloc(nr_parts * sizeof(*info->parts), - GFP_KERNEL); - if (!info->parts) - return -ENOMEM; - - for (pp = of_get_next_child(dp, NULL), i = 0; pp; - pp = of_get_next_child(dp, pp), i++) { - const u32 *reg; - int len; - - reg = of_get_property(pp, "reg", &len); - if (!reg || (len != 2*sizeof(u32))) { - of_node_put(pp); - dev_err(&dev->dev, "Invalid 'reg' on %s\n", - dp->full_name); - kfree(info->parts); - info->parts = NULL; - return -EINVAL; - } - info->parts[i].offset = reg[0]; - info->parts[i].size = reg[1]; - - partname = of_get_property(pp, "label", &len); - if (!partname) - partname = of_get_property(pp, "name", &len); - info->parts[i].name = (char *)partname; - - if (of_get_property(pp, "read-only", &len)) - info->parts[i].mask_flags = MTD_WRITEABLE; - } - - return nr_parts; -} #else /* MTD_PARTITIONS */ #define OF_FLASH_PARTS(info) (0) #define parse_partitions(info, dev) (0) @@ -213,6 +154,10 @@ static struct mtd_info * __devinit obsolete_probe(struct of_device *dev, static int __devinit of_flash_probe(struct of_device *dev, const struct of_device_id *match) { +#ifdef CONFIG_MTD_PARTITIONS + static const char *part_probe_types[] + = { "cmdlinepart", "RedBoot", NULL }; +#endif struct device_node *dp = dev->node; struct resource res; struct of_flash *info; @@ -275,13 +220,33 @@ static int __devinit of_flash_probe(struct of_device *dev, } info->mtd->owner = THIS_MODULE; - err = parse_partitions(info, dev); +#ifdef CONFIG_MTD_PARTITIONS + /* First look for RedBoot table or partitions on the command + * line, these take precedence over device tree information */ + err = parse_mtd_partitions(info->mtd, part_probe_types, + &info->parts, 0); if (err < 0) - goto err_out; + return err; + +#ifdef CONFIG_MTD_OF_PARTS + if (err == 0) { + err = of_mtd_parse_partitions(&dev->dev, info->mtd, + dp, &info->parts); + if (err < 0) + return err; + } +#endif + + if (err == 0) { + err = parse_obsolete_partitions(dev, info, dp); + if (err < 0) + return err; + } if (err > 0) - add_mtd_partitions(info->mtd, OF_FLASH_PARTS(info), err); + add_mtd_partitions(info->mtd, info->parts, err); else +#endif add_mtd_device(info->mtd); return 0; -- cgit v1.2.3 From df66e7167ac756baf14d2b8ea7a2cfa056600a93 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Fri, 1 Feb 2008 15:26:54 +0100 Subject: [MTD] physmap.c: Add support for multiple resources This patch extends the physmap mapping driver to support multiple resources for non-identical NOR chips that will be concatenated together when selected. This is needed for example for Intel 48F4400 512MBit chips, since they consist of 2 single different NOR chips with different geometries. The first (lower) one has botton boot sectors and the 2nd (upper) has top boot sectors. This currently isn't handled correctly by calling the physmap driver once with only one resource covering both chips in one memory region. The same geometrie is used for both chips. With this patch the following resource structure can be used to describe the 48F4400 chip correctly: static struct resource board_nor_resource[] = { [0] = { .start = 0xf8000000, .end = 0xfbffffff, .flags = IORESOURCE_MEM, }, [1] = { .start = 0xfc000000, .end = 0xffffffff, .flags = IORESOURCE_MEM, } }; Signed-off-by: Stefan Roese Signed-off-by: David Woodhouse --- drivers/mtd/maps/physmap.c | 162 +++++++++++++++++++++++++++++---------------- 1 file changed, 104 insertions(+), 58 deletions(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 28c5ffd7523..5a83ae7e14f 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -20,11 +20,15 @@ #include #include #include +#include #include +#define MAX_RESOURCES 4 + struct physmap_flash_info { - struct mtd_info *mtd; - struct map_info map; + struct mtd_info *mtd[MAX_RESOURCES]; + struct mtd_info *cmtd; + struct map_info map[MAX_RESOURCES]; struct resource *res; #ifdef CONFIG_MTD_PARTITIONS int nr_parts; @@ -32,11 +36,11 @@ struct physmap_flash_info { #endif }; - static int physmap_flash_remove(struct platform_device *dev) { struct physmap_flash_info *info; struct physmap_flash_data *physmap_data; + int i; info = platform_get_drvdata(dev); if (info == NULL) @@ -45,24 +49,33 @@ static int physmap_flash_remove(struct platform_device *dev) physmap_data = dev->dev.platform_data; - if (info->mtd != NULL) { +#ifdef CONFIG_MTD_CONCAT + if (info->cmtd != info->mtd[0]) { + del_mtd_device(info->cmtd); + mtd_concat_destroy(info->cmtd); + } +#endif + + for (i = 0; i < MAX_RESOURCES; i++) { + if (info->mtd[i] != NULL) { #ifdef CONFIG_MTD_PARTITIONS - if (info->nr_parts) { - del_mtd_partitions(info->mtd); - kfree(info->parts); - } else if (physmap_data->nr_parts) { - del_mtd_partitions(info->mtd); - } else { - del_mtd_device(info->mtd); - } + if (info->nr_parts) { + del_mtd_partitions(info->mtd[i]); + kfree(info->parts); + } else if (physmap_data->nr_parts) { + del_mtd_partitions(info->mtd[i]); + } else { + del_mtd_device(info->mtd[i]); + } #else - del_mtd_device(info->mtd); + del_mtd_device(info->mtd[i]); #endif - map_destroy(info->mtd); - } + map_destroy(info->mtd[i]); + } - if (info->map.virt != NULL) - iounmap(info->map.virt); + if (info->map[i].virt != NULL) + iounmap(info->map[i].virt); + } if (info->res != NULL) { release_resource(info->res); @@ -82,16 +95,14 @@ static int physmap_flash_probe(struct platform_device *dev) struct physmap_flash_data *physmap_data; struct physmap_flash_info *info; const char **probe_type; - int err; + int err = 0; + int i; + int devices_found = 0; physmap_data = dev->dev.platform_data; if (physmap_data == NULL) return -ENODEV; - printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n", - (unsigned long long)(dev->resource->end - dev->resource->start + 1), - (unsigned long long)dev->resource->start); - info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL); if (info == NULL) { err = -ENOMEM; @@ -100,56 +111,83 @@ static int physmap_flash_probe(struct platform_device *dev) platform_set_drvdata(dev, info); - info->res = request_mem_region(dev->resource->start, - dev->resource->end - dev->resource->start + 1, - dev->dev.bus_id); - if (info->res == NULL) { - dev_err(&dev->dev, "Could not reserve memory region\n"); - err = -ENOMEM; - goto err_out; - } + for (i = 0; i < dev->num_resources; i++) { + printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n", + (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1), + (unsigned long long)dev->resource[i].start); + + info->res = request_mem_region(dev->resource[i].start, + dev->resource[i].end - dev->resource[i].start + 1, + dev->dev.bus_id); + if (info->res == NULL) { + dev_err(&dev->dev, "Could not reserve memory region\n"); + err = -ENOMEM; + goto err_out; + } - info->map.name = dev->dev.bus_id; - info->map.phys = dev->resource->start; - info->map.size = dev->resource->end - dev->resource->start + 1; - info->map.bankwidth = physmap_data->width; - info->map.set_vpp = physmap_data->set_vpp; + info->map[i].name = dev->dev.bus_id; + info->map[i].phys = dev->resource[i].start; + info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; + info->map[i].bankwidth = physmap_data->width; + info->map[i].set_vpp = physmap_data->set_vpp; + + info->map[i].virt = ioremap(info->map[i].phys, info->map[i].size); + if (info->map[i].virt == NULL) { + dev_err(&dev->dev, "Failed to ioremap flash region\n"); + err = EIO; + goto err_out; + } - info->map.virt = ioremap(info->map.phys, info->map.size); - if (info->map.virt == NULL) { - dev_err(&dev->dev, "Failed to ioremap flash region\n"); - err = EIO; - goto err_out; - } + simple_map_init(&info->map[i]); - simple_map_init(&info->map); + probe_type = rom_probe_types; + for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) + info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); + if (info->mtd[i] == NULL) { + dev_err(&dev->dev, "map_probe failed\n"); + err = -ENXIO; + goto err_out; + } else { + devices_found++; + } + info->mtd[i]->owner = THIS_MODULE; + } - probe_type = rom_probe_types; - for (; info->mtd == NULL && *probe_type != NULL; probe_type++) - info->mtd = do_map_probe(*probe_type, &info->map); - if (info->mtd == NULL) { - dev_err(&dev->dev, "map_probe failed\n"); + if (devices_found == 1) { + info->cmtd = info->mtd[0]; + } else if (devices_found > 1) { + /* + * We detected multiple devices. Concatenate them together. + */ +#ifdef CONFIG_MTD_CONCAT + info->cmtd = mtd_concat_create(info->mtd, devices_found, dev->dev.bus_id); + if (info->cmtd == NULL) + err = -ENXIO; +#else + printk(KERN_ERR "physmap-flash: multiple devices " + "found but MTD concat support disabled.\n"); err = -ENXIO; - goto err_out; +#endif } - info->mtd->owner = THIS_MODULE; + if (err) + goto err_out; #ifdef CONFIG_MTD_PARTITIONS - err = parse_mtd_partitions(info->mtd, part_probe_types, &info->parts, 0); + err = parse_mtd_partitions(info->cmtd, part_probe_types, &info->parts, 0); if (err > 0) { - add_mtd_partitions(info->mtd, info->parts, err); + add_mtd_partitions(info->cmtd, info->parts, err); return 0; } if (physmap_data->nr_parts) { printk(KERN_NOTICE "Using physmap partition information\n"); - add_mtd_partitions(info->mtd, physmap_data->parts, - physmap_data->nr_parts); + add_mtd_partitions(info->cmtd, physmap_data->parts, + physmap_data->nr_parts); return 0; } #endif - add_mtd_device(info->mtd); + add_mtd_device(info->cmtd); return 0; err_out: @@ -162,9 +200,11 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state { struct physmap_flash_info *info = platform_get_drvdata(dev); int ret = 0; + int i; if (info) - ret = info->mtd->suspend(info->mtd); + for (i = 0; i < MAX_RESOURCES; i++) + ret |= info->mtd[i].suspend(info->mtd[i]); return ret; } @@ -172,16 +212,22 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state static int physmap_flash_resume(struct platform_device *dev) { struct physmap_flash_info *info = platform_get_drvdata(dev); + int i; + if (info) - info->mtd->resume(info->mtd); + for (i = 0; i < MAX_RESOURCES; i++) + info->mtd[i].resume(info->mtd[i]); return 0; } static void physmap_flash_shutdown(struct platform_device *dev) { struct physmap_flash_info *info = platform_get_drvdata(dev); - if (info && info->mtd->suspend(info->mtd) == 0) - info->mtd->resume(info->mtd); + int i; + + for (i = 0; i < MAX_RESOURCES; i++) + if (info && info->mtd[i].suspend(info->mtd[i]) == 0) + info->mtd[i].resume(info->mtd[i]); } #endif -- cgit v1.2.3 From d5476689afd48e71395602698409e9f48cbba413 Mon Sep 17 00:00:00 2001 From: "akpm@linux-foundation.org" Date: Sun, 3 Feb 2008 12:56:03 -0800 Subject: [MTD] Fix maps/physmap.c compilation with CONFIG_PM Signed-off-by: Andrew Morton Signed-off-by: David Woodhouse --- drivers/mtd/maps/physmap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/mtd/maps') diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 5a83ae7e14f..f00e04efbe2 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -204,7 +204,7 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state if (info) for (i = 0; i < MAX_RESOURCES; i++) - ret |= info->mtd[i].suspend(info->mtd[i]); + ret |= info->mtd[i]->suspend(info->mtd[i]); return ret; } @@ -216,7 +216,7 @@ static int physmap_flash_resume(struct platform_device *dev) if (info) for (i = 0; i < MAX_RESOURCES; i++) - info->mtd[i].resume(info->mtd[i]); + info->mtd[i]->resume(info->mtd[i]); return 0; } @@ -226,19 +226,21 @@ static void physmap_flash_shutdown(struct platform_device *dev) int i; for (i = 0; i < MAX_RESOURCES; i++) - if (info && info->mtd[i].suspend(info->mtd[i]) == 0) - info->mtd[i].resume(info->mtd[i]); + if (info && info->mtd[i]->suspend(info->mtd[i]) == 0) + info->mtd[i]->resume(info->mtd[i]); } +#else +#define physmap_flash_suspend NULL +#define physmap_flash_resume NULL +#define physmap_flash_shutdown NULL #endif static struct platform_driver physmap_flash_driver = { .probe = physmap_flash_probe, .remove = physmap_flash_remove, -#ifdef CONFIG_PM .suspend = physmap_flash_suspend, .resume = physmap_flash_resume, .shutdown = physmap_flash_shutdown, -#endif .driver = { .name = "physmap-flash", }, -- cgit v1.2.3