From 2fb3ec5c9503ba8874e24170de2b40e8f1a58370 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 11 May 2011 16:06:29 +0100 Subject: ARM: Replace platform definition of ISA_DMA_THRESHOLD/MAX_DMA_ADDRESS The values of ISA_DMA_THRESHOLD and MAX_DMA_ADDRESS are related; one is the physical/bus address, the other is the virtual address. Both need to be kept in step, so rather than having platforms define both, allow them to define a single macro which sets both of these macros appropraitely. Acked-by: Nicolas Pitre Acked-by: Catalin Marinas Signed-off-by: Russell King --- arch/arm/mach-pxa/include/mach/memory.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch/arm/mach-pxa') diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h index 7f68724dcc27..57a0b689b4d0 100644 --- a/arch/arm/mach-pxa/include/mach/memory.h +++ b/arch/arm/mach-pxa/include/mach/memory.h @@ -23,8 +23,7 @@ void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes); #define arch_adjust_zones(size, holes) \ cmx2xx_pci_adjust_zones(size, holes) -#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1) -#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) +#define ARM_DMA_ZONE_SIZE SZ_64M #endif #endif -- cgit v1.2.3-59-g8ed1b From be20902ba67de70b38c995903321f4152dee57b7 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 11 May 2011 15:39:00 +0100 Subject: ARM: use ARM_DMA_ZONE_SIZE to adjust the zone sizes Rather than each platform providing its own function to adjust the zone sizes, use the new ARM_DMA_ZONE_SIZE definition to perform this adjustment. This ensures that the actual DMA zone size and the ISA_DMA_THRESHOLD/MAX_DMA_ADDRESS definitions are consistent with each other, and moves this complexity out of the platform code. Acked-by: Nicolas Pitre Acked-by: Catalin Marinas Signed-off-by: Russell King --- arch/arm/common/sa1111.c | 8 -------- arch/arm/include/asm/memory.h | 6 ------ arch/arm/mach-davinci/include/mach/memory.h | 15 --------------- arch/arm/mach-ixp4xx/common-pci.c | 23 ----------------------- arch/arm/mach-ixp4xx/include/mach/memory.h | 9 +-------- arch/arm/mach-pxa/cm-x2xx-pci.c | 27 --------------------------- arch/arm/mach-pxa/include/mach/memory.h | 7 +------ arch/arm/mach-realview/core.c | 19 ------------------- arch/arm/mach-realview/include/mach/memory.h | 6 +----- arch/arm/mach-sa1100/include/mach/memory.h | 9 --------- arch/arm/mach-shark/include/mach/memory.h | 17 ----------------- arch/arm/mm/init.c | 23 ++++++++++++++++++++++- 12 files changed, 25 insertions(+), 144 deletions(-) (limited to 'arch/arm/mach-pxa') diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index a12b33c0dc42..9c49a46a2b7a 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c @@ -185,14 +185,6 @@ static struct sa1111_dev_info sa1111_devices[] = { }, }; -void __init sa1111_adjust_zones(unsigned long *size, unsigned long *holes) -{ - unsigned int sz = SZ_1M >> PAGE_SHIFT; - - size[1] = size[0] - sz; - size[0] = sz; -} - /* * SA1111 interrupt support. Since clearing an IRQ while there are * active IRQs causes the interrupt output to pulse, the upper levels diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index ee5ff41027a3..af44a8fb3480 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -215,12 +215,6 @@ static inline unsigned long __phys_to_virt(unsigned long x) #define ISA_DMA_THRESHOLD (PHYS_OFFSET + ARM_DMA_ZONE_SIZE - 1) #endif -#ifndef arch_adjust_zones -#define arch_adjust_zones(size,holes) do { } while (0) -#elif !defined(CONFIG_ZONE_DMA) -#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA" -#endif - /* * PFNs are used to describe any physical page; this means * PFN 0 == physical address 0. diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h index 8d27246cca4d..491249ef209c 100644 --- a/arch/arm/mach-davinci/include/mach/memory.h +++ b/arch/arm/mach-davinci/include/mach/memory.h @@ -41,26 +41,11 @@ */ #define CONSISTENT_DMA_SIZE (14<<20) -#ifndef __ASSEMBLY__ /* * Restrict DMA-able region to workaround silicon bug. The bug * restricts buffers available for DMA to video hardware to be * below 128M */ -static inline void -__arch_adjust_zones(unsigned long *size, unsigned long *holes) -{ - unsigned int sz = (128<<20) >> PAGE_SHIFT; - - size[1] = size[0] - sz; - size[0] = sz; -} - -#define arch_adjust_zones(zone_size, holes) \ - if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(zone_size, holes) - #define ARM_DMA_ZONE_SIZE SZ_128M -#endif - #endif /* __ASM_ARCH_MEMORY_H */ diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index a54b3db80366..e9a589395723 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c @@ -342,29 +342,6 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M); } -/* - * Only first 64MB of memory can be accessed via PCI. - * We use GFP_DMA to allocate safe buffers to do map/unmap. - * This is really ugly and we need a better way of specifying - * DMA-capable regions of memory. - */ -void __init ixp4xx_adjust_zones(unsigned long *zone_size, - unsigned long *zhole_size) -{ - unsigned int sz = SZ_64M >> PAGE_SHIFT; - - /* - * Only adjust if > 64M on current system - */ - if (zone_size[0] <= sz) - return; - - zone_size[1] = zone_size[0] - sz; - zone_size[0] = sz; - zhole_size[1] = zhole_size[0]; - zhole_size[0] = 0; -} - void __init ixp4xx_pci_preinit(void) { unsigned long cpuid = read_cpuid_id(); diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h index a5c26f8d3125..34e79404671a 100644 --- a/arch/arm/mach-ixp4xx/include/mach/memory.h +++ b/arch/arm/mach-ixp4xx/include/mach/memory.h @@ -14,15 +14,8 @@ */ #define PLAT_PHYS_OFFSET UL(0x00000000) -#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI) - -void ixp4xx_adjust_zones(unsigned long *size, unsigned long *holes); - -#define arch_adjust_zones(size, holes) \ - ixp4xx_adjust_zones(size, holes) - +#ifdef CONFIG_PCI #define ARM_DMA_ZONE_SIZE SZ_64M - #endif #endif diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c index 8b1a30959fae..1afc0fb7d6d5 100644 --- a/arch/arm/mach-pxa/cm-x2xx-pci.c +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c @@ -29,33 +29,6 @@ unsigned long it8152_base_address; static int cmx2xx_it8152_irq_gpio; -/* - * Only first 64MB of memory can be accessed via PCI. - * We use GFP_DMA to allocate safe buffers to do map/unmap. - * This is really ugly and we need a better way of specifying - * DMA-capable regions of memory. - */ -void __init cmx2xx_pci_adjust_zones(unsigned long *zone_size, - unsigned long *zhole_size) -{ - unsigned int sz = SZ_64M >> PAGE_SHIFT; - - if (machine_is_armcore()) { - pr_info("Adjusting zones for CM-X2XX\n"); - - /* - * Only adjust if > 64M on current system - */ - if (zone_size[0] <= sz) - return; - - zone_size[1] = zone_size[0] - sz; - zone_size[0] = sz; - zhole_size[1] = zhole_size[0]; - zhole_size[0] = 0; - } -} - static void cmx2xx_it8152_irq_demux(unsigned int irq, struct irq_desc *desc) { /* clear our parent irq */ diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h index 57a0b689b4d0..07734f37f8fd 100644 --- a/arch/arm/mach-pxa/include/mach/memory.h +++ b/arch/arm/mach-pxa/include/mach/memory.h @@ -17,12 +17,7 @@ */ #define PLAT_PHYS_OFFSET UL(0xa0000000) -#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) -void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes); - -#define arch_adjust_zones(size, holes) \ - cmx2xx_pci_adjust_zones(size, holes) - +#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) #define ARM_DMA_ZONE_SIZE SZ_64M #endif diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index 75dbc8791d05..525ad17f8265 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -56,25 +56,6 @@ #include "core.h" -#ifdef CONFIG_ZONE_DMA -/* - * Adjust the zones if there are restrictions for DMA access. - */ -void __init realview_adjust_zones(unsigned long *size, unsigned long *hole) -{ - unsigned long dma_size = SZ_256M >> PAGE_SHIFT; - - if (!machine_is_realview_pbx() || size[0] <= dma_size) - return; - - size[ZONE_NORMAL] = size[0] - dma_size; - size[ZONE_DMA] = dma_size; - hole[ZONE_NORMAL] = hole[0]; - hole[ZONE_DMA] = 0; -} -#endif - - #define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) static int realview_flash_init(void) diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h index 973428d3f7cb..1759fa673eea 100644 --- a/arch/arm/mach-realview/include/mach/memory.h +++ b/arch/arm/mach-realview/include/mach/memory.h @@ -29,11 +29,7 @@ #define PLAT_PHYS_OFFSET UL(0x00000000) #endif -#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA) -extern void realview_adjust_zones(unsigned long *size, unsigned long *hole); -#define arch_adjust_zones(size, hole) \ - realview_adjust_zones(size, hole) - +#ifdef CONFIG_ZONE_DMA #define ARM_DMA_ZONE_SIZE SZ_256M #endif diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h index 090b82982abb..cff31ee246b7 100644 --- a/arch/arm/mach-sa1100/include/mach/memory.h +++ b/arch/arm/mach-sa1100/include/mach/memory.h @@ -14,17 +14,8 @@ */ #define PLAT_PHYS_OFFSET UL(0xc0000000) -#ifndef __ASSEMBLY__ - #ifdef CONFIG_SA1111 -void sa1111_adjust_zones(unsigned long *size, unsigned long *holes); - -#define arch_adjust_zones(size, holes) \ - sa1111_adjust_zones(size, holes) - #define ARM_DMA_ZONE_SIZE SZ_1M - -#endif #endif /* diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h index 48fe84b1f278..4c0831f83b0c 100644 --- a/arch/arm/mach-shark/include/mach/memory.h +++ b/arch/arm/mach-shark/include/mach/memory.h @@ -17,25 +17,8 @@ */ #define PLAT_PHYS_OFFSET UL(0x08000000) -#ifndef __ASSEMBLY__ - -static inline void __arch_adjust_zones(unsigned long *zone_size, unsigned long *zhole_size) -{ - /* Only the first 4 MB (=1024 Pages) are usable for DMA */ - /* See dev / -> .properties in OpenFirmware. */ - zone_size[1] = zone_size[0] - 1024; - zone_size[0] = 1024; - zhole_size[1] = zhole_size[0]; - zhole_size[0] = 0; -} - -#define arch_adjust_zones(size, holes) \ - __arch_adjust_zones(size, holes) - #define ARM_DMA_ZONE_SIZE SZ_4M -#endif - /* * Cache flushing area */ diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index e5f6fc428348..49eaad9136a7 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -201,6 +201,20 @@ static void __init arm_bootmem_init(unsigned long start_pfn, } } +#ifdef CONFIG_ZONE_DMA +static void __init arm_adjust_dma_zone(unsigned long *size, unsigned long *hole, + unsigned long dma_size) +{ + if (size[0] <= dma_size) + return; + + size[ZONE_NORMAL] = size[0] - dma_size; + size[ZONE_DMA] = dma_size; + hole[ZONE_NORMAL] = hole[0]; + hole[ZONE_DMA] = 0; +} +#endif + static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, unsigned long max_high) { @@ -243,11 +257,18 @@ static void __init arm_bootmem_free(unsigned long min, unsigned long max_low, #endif } +#ifdef ARM_DMA_ZONE_SIZE +#ifndef CONFIG_ZONE_DMA +#error ARM_DMA_ZONE_SIZE set but no DMA zone to limit allocations +#endif + /* * Adjust the sizes according to any special requirements for * this machine type. */ - arch_adjust_zones(zone_size, zhole_size); + arm_adjust_dma_zone(zone_size, zhole_size, + ARM_DMA_ZONE_SIZE >> PAGE_SHIFT); +#endif free_area_init_node(0, zone_size, min, zhole_size); } -- cgit v1.2.3-59-g8ed1b From 667f390bee987d45351402e42008c52cdfb77d76 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Wed, 18 May 2011 10:51:55 +0100 Subject: ARM: 6910/1: MTD: physmap: let set_vpp() pass a platform_device instead of a map_info The set_vpp() method provided by physmap passes a map_info back to the platform code, which has little relevance as far as the platform is concerned (this parameter is completely unused). Instead, pass the platform_device, which can be used in the pismo driver to retrieve some important information in a nicer way, instead of the hack that was in place. The empty set_vpp function in board-at572d940hf_ek.c is left untouched, as the board/SoC is scheduled for removal. Cc: Andrew Victor Cc: Nicolas Ferre Acked-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Philipp Zabel Cc: Eric Miao Cc: Ben Dooks Acked-by: Artem Bityutskiy Acked-by: David Woodhouse Signed-off-by: Marc Zyngier Signed-off-by: Russell King --- arch/arm/mach-integrator/integrator_ap.c | 2 +- arch/arm/mach-integrator/integrator_cp.c | 2 +- arch/arm/mach-omap1/flash.c | 2 +- arch/arm/mach-pxa/hx4700.c | 2 +- arch/arm/mach-pxa/magician.c | 2 +- arch/arm/mach-realview/core.c | 2 +- arch/arm/mach-s3c2410/nor-simtec.c | 2 +- arch/arm/mach-versatile/core.c | 2 +- arch/arm/mach-vexpress/v2m.c | 2 +- arch/arm/plat-omap/include/plat/flash.h | 2 +- drivers/mtd/maps/physmap.c | 20 ++++++++++++---- drivers/mtd/maps/pismo.c | 40 +++----------------------------- include/linux/mtd/physmap.h | 2 +- 13 files changed, 29 insertions(+), 53 deletions(-) (limited to 'arch/arm/mach-pxa') diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index 11bd49e8b663..2aa98ee41b8d 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -263,7 +263,7 @@ static void ap_flash_exit(struct platform_device *dev) } } -static void ap_flash_set_vpp(struct map_info *map, int on) +static void ap_flash_set_vpp(struct platform_device *pdev, int on) { void __iomem *reg = on ? SC_CTRLS : SC_CTRLC; diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c index ec9628fe7109..b676b41d70e2 100644 --- a/arch/arm/mach-integrator/integrator_cp.c +++ b/arch/arm/mach-integrator/integrator_cp.c @@ -259,7 +259,7 @@ static void intcp_flash_exit(struct platform_device *dev) writel(val, INTCP_VA_CTRL_BASE + INTCP_FLASHPROG); } -static void intcp_flash_set_vpp(struct map_info *map, int on) +static void intcp_flash_set_vpp(struct platform_device *pdev, int on) { u32 val; diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c index acd161666408..1749cb37dda0 100644 --- a/arch/arm/mach-omap1/flash.c +++ b/arch/arm/mach-omap1/flash.c @@ -13,7 +13,7 @@ #include #include -void omap1_set_vpp(struct map_info *map, int enable) +void omap1_set_vpp(struct platform_device *pdev, int enable) { static int count; u32 l; diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c index 9cdcca597924..f941a495a4a8 100644 --- a/arch/arm/mach-pxa/hx4700.c +++ b/arch/arm/mach-pxa/hx4700.c @@ -735,7 +735,7 @@ static struct platform_device bq24022 = { * StrataFlash */ -static void hx4700_set_vpp(struct map_info *map, int vpp) +static void hx4700_set_vpp(struct platform_device *pdev, int vpp) { gpio_set_value(GPIO91_HX4700_FLASH_VPEN, vpp); } diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 9984ef70bd79..e1920572948a 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c @@ -662,7 +662,7 @@ static struct pxaohci_platform_data magician_ohci_info = { * StrataFlash */ -static void magician_set_vpp(struct map_info *map, int vpp) +static void magician_set_vpp(struct platform_device *pdev, int vpp) { gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); } diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c index d3f1dde70fc9..c8ec08886633 100644 --- a/arch/arm/mach-realview/core.c +++ b/arch/arm/mach-realview/core.c @@ -77,7 +77,7 @@ void __init realview_adjust_zones(unsigned long *size, unsigned long *hole) #define REALVIEW_FLASHCTRL (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_FLASH_OFFSET) -static void realview_flash_set_vpp(struct map_info *map, int on) +static void realview_flash_set_vpp(struct platform_device *pdev, int on) { u32 val; diff --git a/arch/arm/mach-s3c2410/nor-simtec.c b/arch/arm/mach-s3c2410/nor-simtec.c index 598d130633dc..ad9f750f1e55 100644 --- a/arch/arm/mach-s3c2410/nor-simtec.c +++ b/arch/arm/mach-s3c2410/nor-simtec.c @@ -32,7 +32,7 @@ #include "nor-simtec.h" -static void simtec_nor_vpp(struct map_info *map, int vpp) +static void simtec_nor_vpp(struct platform_device *pdev, int vpp) { unsigned int val; unsigned long flags; diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c index 06f406ad8edd..335d8250e364 100644 --- a/arch/arm/mach-versatile/core.c +++ b/arch/arm/mach-versatile/core.c @@ -190,7 +190,7 @@ void __init versatile_map_io(void) #define VERSATILE_FLASHCTRL (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_FLASH_OFFSET) -static void versatile_flash_set_vpp(struct map_info *map, int on) +static void versatile_flash_set_vpp(struct platform_device *pdev, int on) { u32 val; diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index e3268152c834..f860314ef7f6 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -206,7 +206,7 @@ static struct platform_device v2m_usb_device = { .dev.platform_data = &v2m_usb_config, }; -static void v2m_flash_set_vpp(struct map_info *map, int on) +static void v2m_flash_set_vpp(struct platform_device *pdev, int on) { writel(on != 0, MMIO_P2V(V2M_SYS_FLASH)); } diff --git a/arch/arm/plat-omap/include/plat/flash.h b/arch/arm/plat-omap/include/plat/flash.h index 3e6327016b40..3083195123ea 100644 --- a/arch/arm/plat-omap/include/plat/flash.h +++ b/arch/arm/plat-omap/include/plat/flash.h @@ -11,6 +11,6 @@ #include -extern void omap1_set_vpp(struct map_info *map, int enable); +extern void omap1_set_vpp(struct platform_device *pdev, int enable); #endif diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 49676b7a53a4..1a9b94f0ee54 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -74,6 +74,18 @@ static int physmap_flash_remove(struct platform_device *dev) return 0; } +static void physmap_set_vpp(struct map_info *map, int state) +{ + struct platform_device *pdev; + struct physmap_flash_data *physmap_data; + + pdev = (struct platform_device *)map->map_priv_1; + physmap_data = pdev->dev.platform_data; + + if (physmap_data->set_vpp) + physmap_data->set_vpp(pdev, state); +} + static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", @@ -81,10 +93,7 @@ static const char *rom_probe_types[] = { "map_rom", NULL }; #ifdef CONFIG_MTD_PARTITIONS -static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", -#ifdef CONFIG_MTD_AFS_PARTS - "afs", -#endif +static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs", NULL }; #endif @@ -134,8 +143,9 @@ static int physmap_flash_probe(struct platform_device *dev) info->map[i].phys = dev->resource[i].start; info->map[i].size = resource_size(&dev->resource[i]); info->map[i].bankwidth = physmap_data->width; - info->map[i].set_vpp = physmap_data->set_vpp; + info->map[i].set_vpp = physmap_set_vpp; info->map[i].pfow_base = physmap_data->pfow_base; + info->map[i].map_priv_1 = (unsigned long)dev; info->map[i].virt = devm_ioremap(&dev->dev, info->map[i].phys, info->map[i].size); diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c index f4ce273e93fd..65bd1cd4d627 100644 --- a/drivers/mtd/maps/pismo.c +++ b/drivers/mtd/maps/pismo.c @@ -50,39 +50,13 @@ struct pismo_data { struct platform_device *dev[PISMO_NUM_CS]; }; -/* FIXME: set_vpp could do with a better calling convention */ -static struct pismo_data *vpp_pismo; -static DEFINE_MUTEX(pismo_mutex); - -static int pismo_setvpp_probe_fix(struct pismo_data *pismo) +static void pismo_set_vpp(struct platform_device *pdev, int on) { - mutex_lock(&pismo_mutex); - if (vpp_pismo) { - mutex_unlock(&pismo_mutex); - kfree(pismo); - return -EBUSY; - } - vpp_pismo = pismo; - mutex_unlock(&pismo_mutex); - return 0; -} - -static void pismo_setvpp_remove_fix(struct pismo_data *pismo) -{ - mutex_lock(&pismo_mutex); - if (vpp_pismo == pismo) - vpp_pismo = NULL; - mutex_unlock(&pismo_mutex); -} - -static void pismo_set_vpp(struct map_info *map, int on) -{ - struct pismo_data *pismo = vpp_pismo; + struct i2c_client *client = to_i2c_client(pdev->dev.parent); + struct pismo_data *pismo = i2c_get_clientdata(client); pismo->vpp(pismo->vpp_data, on); } -/* end of hack */ - static unsigned int __devinit pismo_width_to_bytes(unsigned int width) { @@ -231,9 +205,6 @@ static int __devexit pismo_remove(struct i2c_client *client) for (i = 0; i < ARRAY_SIZE(pismo->dev); i++) platform_device_unregister(pismo->dev[i]); - /* FIXME: set_vpp needs saner arguments */ - pismo_setvpp_remove_fix(pismo); - kfree(pismo); return 0; @@ -257,11 +228,6 @@ static int __devinit pismo_probe(struct i2c_client *client, if (!pismo) return -ENOMEM; - /* FIXME: set_vpp needs saner arguments */ - ret = pismo_setvpp_probe_fix(pismo); - if (ret) - return ret; - pismo->client = client; if (pdata) { pismo->vpp = pdata->set_vpp; diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h index d37cca05e62c..49b959029417 100644 --- a/include/linux/mtd/physmap.h +++ b/include/linux/mtd/physmap.h @@ -24,7 +24,7 @@ struct physmap_flash_data { unsigned int width; int (*init)(struct platform_device *); void (*exit)(struct platform_device *); - void (*set_vpp)(struct map_info *, int); + void (*set_vpp)(struct platform_device *, int); unsigned int nr_parts; unsigned int pfow_base; char *probe_type; -- cgit v1.2.3-59-g8ed1b