diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-31 14:24:58 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-31 14:24:58 -0800 |
commit | 9d572ecbd81b9ff6e6a9bc0d2598212a59eb738a (patch) | |
tree | b59b6610928accc3289f7d142319bb19342eee98 | |
parent | b836267aa79c1c5e23e00d9cec047b6870ae0db1 (diff) | |
parent | f4060c0dbbe9ad7b8c0aeefa142398c8d3468bac (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
[SPARC64]: Handle ISA devices with no 'regs' property.
[SPARC64]: Update defconfig.
[SPARC64]: Fix of_iounmap() region release.
[SPARC64]: Fix "mem=xxx" handling.
-rw-r--r-- | arch/sparc/kernel/ioport.c | 2 | ||||
-rw-r--r-- | arch/sparc64/defconfig | 34 | ||||
-rw-r--r-- | arch/sparc64/kernel/isa.c | 20 | ||||
-rw-r--r-- | arch/sparc64/kernel/of_device.c | 7 | ||||
-rw-r--r-- | arch/sparc64/mm/init.c | 147 | ||||
-rw-r--r-- | drivers/input/serio/i8042-sparcio.h | 6 | ||||
-rw-r--r-- | drivers/serial/sunsab.c | 11 | ||||
-rw-r--r-- | drivers/serial/sunsu.c | 10 | ||||
-rw-r--r-- | drivers/serial/sunzilog.c | 14 | ||||
-rw-r--r-- | drivers/video/bw2.c | 18 | ||||
-rw-r--r-- | drivers/video/cg14.c | 28 | ||||
-rw-r--r-- | drivers/video/cg3.c | 22 | ||||
-rw-r--r-- | drivers/video/cg6.c | 33 | ||||
-rw-r--r-- | drivers/video/ffb.c | 25 | ||||
-rw-r--r-- | drivers/video/leo.c | 29 | ||||
-rw-r--r-- | drivers/video/p9100.c | 25 | ||||
-rw-r--r-- | drivers/video/tcx.c | 33 | ||||
-rw-r--r-- | include/asm-sparc/of_device.h | 2 | ||||
-rw-r--r-- | include/asm-sparc64/of_device.h | 2 |
19 files changed, 313 insertions, 155 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 00a39760877..987ec6782f9 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c @@ -153,7 +153,7 @@ void __iomem *of_ioremap(struct resource *res, unsigned long offset, } EXPORT_SYMBOL(of_ioremap); -void of_iounmap(void __iomem *base, unsigned long size) +void of_iounmap(struct resource *res, void __iomem *base, unsigned long size) { iounmap(base); } diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index bda1436aced..5a9e68b13e6 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.19 -# Sat Dec 9 15:41:30 2006 +# Linux kernel version: 2.6.20-rc2 +# Thu Dec 28 15:09:49 2006 # CONFIG_SPARC=y CONFIG_SPARC64=y @@ -334,7 +334,7 @@ CONFIG_BLK_DEV_LOOP=m CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_NBD=m # CONFIG_BLK_DEV_SX8 is not set -CONFIG_BLK_DEV_UB=m +# CONFIG_BLK_DEV_UB is not set # CONFIG_BLK_DEV_RAM is not set # CONFIG_BLK_DEV_INITRD is not set CONFIG_CDROM_PKTCDVD=m @@ -840,6 +840,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_LM92 is not set # CONFIG_SENSORS_MAX1619 is not set # CONFIG_SENSORS_PC87360 is not set +# CONFIG_SENSORS_PC87427 is not set # CONFIG_SENSORS_SIS5595 is not set # CONFIG_SENSORS_SMSC47M1 is not set # CONFIG_SENSORS_SMSC47M192 is not set @@ -850,6 +851,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_W83781D is not set # CONFIG_SENSORS_W83791D is not set # CONFIG_SENSORS_W83792D is not set +# CONFIG_SENSORS_W83793 is not set # CONFIG_SENSORS_W83L785TS is not set # CONFIG_SENSORS_W83627HF is not set # CONFIG_SENSORS_W83627EHF is not set @@ -962,7 +964,6 @@ CONFIG_SND_VERBOSE_PROCFS=y # CONFIG_SND_MPU401_UART=m CONFIG_SND_AC97_CODEC=m -CONFIG_SND_AC97_BUS=m CONFIG_SND_DUMMY=m CONFIG_SND_VIRMIDI=m CONFIG_SND_MTPAV=m @@ -1045,6 +1046,7 @@ CONFIG_SND_SUN_CS4231=m # Open Sound System # # CONFIG_SOUND_PRIME is not set +CONFIG_AC97_BUS=m # # HID Devices @@ -1096,7 +1098,19 @@ CONFIG_USB_UHCI_HCD=m # # may also be needed; see USB_STORAGE Help for more information # -# CONFIG_USB_STORAGE is not set +CONFIG_USB_STORAGE=m +# CONFIG_USB_STORAGE_DEBUG is not set +# CONFIG_USB_STORAGE_DATAFAB is not set +# CONFIG_USB_STORAGE_FREECOM is not set +# CONFIG_USB_STORAGE_ISD200 is not set +# CONFIG_USB_STORAGE_DPCM is not set +# CONFIG_USB_STORAGE_USBAT is not set +# CONFIG_USB_STORAGE_SDDR09 is not set +# CONFIG_USB_STORAGE_SDDR55 is not set +# CONFIG_USB_STORAGE_JUMPSHOT is not set +# CONFIG_USB_STORAGE_ALAUDA is not set +# CONFIG_USB_STORAGE_ONETOUCH is not set +# CONFIG_USB_STORAGE_KARMA is not set # CONFIG_USB_LIBUSUAL is not set # @@ -1222,6 +1236,10 @@ CONFIG_USB_HIDDEV=y # # +# Virtualization +# + +# # Misc Linux/SPARC drivers # CONFIG_SUN_OPENPROMIO=m @@ -1397,6 +1415,8 @@ CONFIG_PRINTK_TIME=y CONFIG_ENABLE_MUST_CHECK=y CONFIG_MAGIC_SYSRQ=y # CONFIG_UNUSED_SYMBOLS is not set +CONFIG_DEBUG_FS=y +# CONFIG_HEADERS_CHECK is not set CONFIG_DEBUG_KERNEL=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_DETECT_SOFTLOCKUP=y @@ -1414,12 +1434,9 @@ CONFIG_SCHEDSTATS=y # CONFIG_DEBUG_KOBJECT is not set CONFIG_DEBUG_BUGVERBOSE=y # CONFIG_DEBUG_INFO is not set -CONFIG_DEBUG_FS=y # CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_LIST is not set -# CONFIG_UNWIND_INFO is not set CONFIG_FORCED_INLINING=y -# CONFIG_HEADERS_CHECK is not set # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_LKDTM is not set # CONFIG_DEBUG_STACK_USAGE is not set @@ -1489,3 +1506,4 @@ CONFIG_LIBCRC32C=m CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=y CONFIG_PLIST=y +CONFIG_IOMAP_COPY=y diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c index ad1c4f55420..98721a8f861 100644 --- a/arch/sparc64/kernel/isa.c +++ b/arch/sparc64/kernel/isa.c @@ -22,14 +22,15 @@ static void __init report_dev(struct sparc_isa_device *isa_dev, int child) printk(" [%s", isa_dev->prom_node->name); } -static struct linux_prom_registers * __init -isa_dev_get_resource(struct sparc_isa_device *isa_dev) +static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev) { struct linux_prom_registers *pregs; unsigned long base, len; int prop_len; pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len); + if (!pregs) + return; /* Only the first one is interesting. */ len = pregs[0].reg_size; @@ -44,12 +45,9 @@ isa_dev_get_resource(struct sparc_isa_device *isa_dev) request_resource(&isa_dev->bus->parent->io_space, &isa_dev->resource); - - return pregs; } -static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev, - struct linux_prom_registers *pregs) +static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev) { struct of_device *op = of_find_device_by_node(isa_dev->prom_node); @@ -69,7 +67,6 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) printk(" ->"); while (dp) { - struct linux_prom_registers *regs; struct sparc_isa_device *isa_dev; isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); @@ -85,8 +82,8 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) isa_dev->bus = parent_isa_dev->bus; isa_dev->prom_node = dp; - regs = isa_dev_get_resource(isa_dev); - isa_dev_get_irq(isa_dev, regs); + isa_dev_get_resource(isa_dev); + isa_dev_get_irq(isa_dev); report_dev(isa_dev, 1); @@ -99,7 +96,6 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) struct device_node *dp = isa_br->prom_node->child; while (dp) { - struct linux_prom_registers *regs; struct sparc_isa_device *isa_dev; isa_dev = kzalloc(sizeof(*isa_dev), GFP_KERNEL); @@ -137,8 +133,8 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) isa_dev->bus = isa_br; isa_dev->prom_node = dp; - regs = isa_dev_get_resource(isa_dev); - isa_dev_get_irq(isa_dev, regs); + isa_dev_get_resource(isa_dev); + isa_dev_get_irq(isa_dev); report_dev(isa_dev, 0); diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index cec0eceae55..b0f3e0082a0 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c @@ -144,9 +144,12 @@ void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned lo } EXPORT_SYMBOL(of_ioremap); -void of_iounmap(void __iomem *base, unsigned long size) +void of_iounmap(struct resource *res, void __iomem *base, unsigned long size) { - release_region((unsigned long) base, size); + if (res->flags & IORESOURCE_MEM) + release_mem_region((unsigned long) base, size); + else + release_region((unsigned long) base, size); } EXPORT_SYMBOL(of_iounmap); diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index a8e8802eed4..054822a3e05 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -872,6 +872,115 @@ static unsigned long __init choose_bootmap_pfn(unsigned long start_pfn, prom_halt(); } +static void __init trim_pavail(unsigned long *cur_size_p, + unsigned long *end_of_phys_p) +{ + unsigned long to_trim = *cur_size_p - cmdline_memory_size; + unsigned long avoid_start, avoid_end; + int i; + + to_trim = PAGE_ALIGN(to_trim); + + avoid_start = avoid_end = 0; +#ifdef CONFIG_BLK_DEV_INITRD + avoid_start = initrd_start; + avoid_end = PAGE_ALIGN(initrd_end); +#endif + + /* Trim some pavail[] entries in order to satisfy the + * requested "mem=xxx" kernel command line specification. + * + * We must not trim off the kernel image area nor the + * initial ramdisk range (if any). Also, we must not trim + * any pavail[] entry down to zero in order to preserve + * the invariant that all pavail[] entries have a non-zero + * size which is assumed by all of the code in here. + */ + for (i = 0; i < pavail_ents; i++) { + unsigned long start, end, kern_end; + unsigned long trim_low, trim_high, n; + + kern_end = PAGE_ALIGN(kern_base + kern_size); + + trim_low = start = pavail[i].phys_addr; + trim_high = end = start + pavail[i].reg_size; + + if (kern_base >= start && + kern_base < end) { + trim_low = kern_base; + if (kern_end >= end) + continue; + } + if (kern_end >= start && + kern_end < end) { + trim_high = kern_end; + } + if (avoid_start && + avoid_start >= start && + avoid_start < end) { + if (trim_low > avoid_start) + trim_low = avoid_start; + if (avoid_end >= end) + continue; + } + if (avoid_end && + avoid_end >= start && + avoid_end < end) { + if (trim_high < avoid_end) + trim_high = avoid_end; + } + + if (trim_high <= trim_low) + continue; + + if (trim_low == start && trim_high == end) { + /* Whole chunk is available for trimming. + * Trim all except one page, in order to keep + * entry non-empty. + */ + n = (end - start) - PAGE_SIZE; + if (n > to_trim) + n = to_trim; + + if (n) { + pavail[i].phys_addr += n; + pavail[i].reg_size -= n; + to_trim -= n; + } + } else { + n = (trim_low - start); + if (n > to_trim) + n = to_trim; + + if (n) { + pavail[i].phys_addr += n; + pavail[i].reg_size -= n; + to_trim -= n; + } + if (to_trim) { + n = end - trim_high; + if (n > to_trim) + n = to_trim; + if (n) { + pavail[i].reg_size -= n; + to_trim -= n; + } + } + } + + if (!to_trim) + break; + } + + /* Recalculate. */ + *cur_size_p = 0UL; + for (i = 0; i < pavail_ents; i++) { + *end_of_phys_p = pavail[i].phys_addr + + pavail[i].reg_size; + *cur_size_p += pavail[i].reg_size; + } +} + static unsigned long __init bootmem_init(unsigned long *pages_avail, unsigned long phys_base) { @@ -889,31 +998,13 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail, end_of_phys_memory = pavail[i].phys_addr + pavail[i].reg_size; bytes_avail += pavail[i].reg_size; - if (cmdline_memory_size) { - if (bytes_avail > cmdline_memory_size) { - unsigned long slack = bytes_avail - cmdline_memory_size; - - bytes_avail -= slack; - end_of_phys_memory -= slack; - - pavail[i].reg_size -= slack; - if ((long)pavail[i].reg_size <= 0L) { - pavail[i].phys_addr = 0xdeadbeefUL; - pavail[i].reg_size = 0UL; - pavail_ents = i; - } else { - pavail[i+1].reg_size = 0Ul; - pavail[i+1].phys_addr = 0xdeadbeefUL; - pavail_ents = i + 1; - } - break; - } - } } - *pages_avail = bytes_avail >> PAGE_SHIFT; - - end_pfn = end_of_phys_memory >> PAGE_SHIFT; + /* Determine the location of the initial ramdisk before trying + * to honor the "mem=xxx" command line argument. We must know + * where the kernel image and the ramdisk image are so that we + * do not trim those two areas from the physical memory map. + */ #ifdef CONFIG_BLK_DEV_INITRD /* Now have to check initial ramdisk, so that bootmap does not overwrite it */ @@ -932,6 +1023,16 @@ static unsigned long __init bootmem_init(unsigned long *pages_avail, } } #endif + + if (cmdline_memory_size && + bytes_avail > cmdline_memory_size) + trim_pavail(&bytes_avail, + &end_of_phys_memory); + + *pages_avail = bytes_avail >> PAGE_SHIFT; + + end_pfn = end_of_phys_memory >> PAGE_SHIFT; + /* Initialize the boot-time allocator. */ max_pfn = max_low_pfn = end_pfn; min_low_pfn = (phys_base >> PAGE_SHIFT); diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index 54adba2d8ed..d9ca55891cd 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h @@ -16,6 +16,7 @@ static int i8042_aux_irq = -1; #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" static void __iomem *kbd_iobase; +static struct resource *kbd_res; #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) #define I8042_DATA_REG (kbd_iobase + 0x60UL) @@ -60,6 +61,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev i8042_kbd_irq = irq; kbd_iobase = of_ioremap(&kbd->resource[0], 0, 8, "kbd"); + kbd_res = &kbd->resource[0]; } else if (!strcmp(dp->name, OBP_PS2MS_NAME1) || !strcmp(dp->name, OBP_PS2MS_NAME2)) { struct of_device *ms = of_find_device_by_node(dp); @@ -77,7 +79,7 @@ static int __devinit sparc_i8042_probe(struct of_device *op, const struct of_dev static int __devexit sparc_i8042_remove(struct of_device *op) { - of_iounmap(kbd_iobase, 8); + of_iounmap(kbd_res, kbd_iobase, 8); return 0; } @@ -119,7 +121,7 @@ static int __init i8042_platform_init(void) if (i8042_kbd_irq == -1 || i8042_aux_irq == -1) { if (kbd_iobase) { - of_iounmap(kbd_iobase, 8); + of_iounmap(kbd_res, kbd_iobase, 8); kbd_iobase = (void __iomem *) NULL; } return -ENODEV; diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c index 493d5bbb661..145d6236954 100644 --- a/drivers/serial/sunsab.c +++ b/drivers/serial/sunsab.c @@ -1037,7 +1037,8 @@ static int __devinit sunsab_init_one(struct uart_sunsab_port *up, err = request_irq(up->port.irq, sunsab_interrupt, IRQF_SHARED, "sab", up); if (err) { - of_iounmap(up->port.membase, + of_iounmap(&op->resource[0], + up->port.membase, sizeof(union sab82532_async_regs)); return err; } @@ -1064,7 +1065,8 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * sizeof(union sab82532_async_regs), (inst * 2) + 1); if (err) { - of_iounmap(up[0].port.membase, + of_iounmap(&op->resource[0], + up[0].port.membase, sizeof(union sab82532_async_regs)); free_irq(up[0].port.irq, &up[0]); return err; @@ -1082,10 +1084,13 @@ static int __devinit sab_probe(struct of_device *op, const struct of_device_id * static void __devexit sab_remove_one(struct uart_sunsab_port *up) { + struct of_device *op = to_of_device(up->port.dev); + uart_remove_one_port(&sunsab_reg, &up->port); if (!(up->port.line & 1)) free_irq(up->port.irq, up); - of_iounmap(up->port.membase, + of_iounmap(&op->resource[0], + up->port.membase, sizeof(union sab82532_async_regs)); } diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c index 564592b2b2b..3ec3df21816 100644 --- a/drivers/serial/sunsu.c +++ b/drivers/serial/sunsu.c @@ -1480,13 +1480,13 @@ static int __devinit su_probe(struct of_device *op, const struct of_device_id *m return 0; out_unmap: - of_iounmap(up->port.membase, up->reg_size); + of_iounmap(&op->resource[0], up->port.membase, up->reg_size); return err; } -static int __devexit su_remove(struct of_device *dev) +static int __devexit su_remove(struct of_device *op) { - struct uart_sunsu_port *up = dev_get_drvdata(&dev->dev);; + struct uart_sunsu_port *up = dev_get_drvdata(&op->dev); if (up->su_type == SU_PORT_MS || up->su_type == SU_PORT_KBD) { @@ -1499,9 +1499,9 @@ static int __devexit su_remove(struct of_device *dev) } if (up->port.membase) - of_iounmap(up->port.membase, up->reg_size); + of_iounmap(&op->resource[0], up->port.membase, up->reg_size); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c index 75de919a947..244f796dc62 100644 --- a/drivers/serial/sunzilog.c +++ b/drivers/serial/sunzilog.c @@ -1379,13 +1379,15 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m if (!keyboard_mouse) { err = uart_add_one_port(&sunzilog_reg, &up[0].port); if (err) { - of_iounmap(rp, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], + rp, sizeof(struct zilog_layout)); return err; } err = uart_add_one_port(&sunzilog_reg, &up[1].port); if (err) { uart_remove_one_port(&sunzilog_reg, &up[0].port); - of_iounmap(rp, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], + rp, sizeof(struct zilog_layout)); return err; } } else { @@ -1414,18 +1416,18 @@ static void __devexit zs_remove_one(struct uart_sunzilog_port *up) uart_remove_one_port(&sunzilog_reg, &up->port); } -static int __devexit zs_remove(struct of_device *dev) +static int __devexit zs_remove(struct of_device *op) { - struct uart_sunzilog_port *up = dev_get_drvdata(&dev->dev); + struct uart_sunzilog_port *up = dev_get_drvdata(&op->dev); struct zilog_layout __iomem *regs; zs_remove_one(&up[0]); zs_remove_one(&up[1]); regs = sunzilog_chip_regs[up[0].port.line / 2]; - of_iounmap(regs, sizeof(struct zilog_layout)); + of_iounmap(&op->resource[0], regs, sizeof(struct zilog_layout)); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/bw2.c b/drivers/video/bw2.c index c66e3d52cbf..9bb6257d691 100644 --- a/drivers/video/bw2.c +++ b/drivers/video/bw2.c @@ -320,7 +320,7 @@ static int __devinit bw2_init_one(struct of_device *op) all->info.fbops = &bw2_ops; all->info.screen_base = - sbus_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); + of_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram"); all->info.par = &all->par; bw2_blank(0, &all->info); @@ -329,8 +329,10 @@ static int __devinit bw2_init_one(struct of_device *op) err= register_framebuffer(&all->info); if (err < 0) { - of_iounmap(all->par.regs, sizeof(struct bw2_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -351,18 +353,18 @@ static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id return bw2_init_one(op); } -static int __devexit bw2_remove(struct of_device *dev) +static int __devexit bw2_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); - of_iounmap(all->par.regs, sizeof(struct bw2_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct bw2_regs)); + of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 7f926c619b6..ec6a51a5822 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -452,16 +452,20 @@ struct all_info { struct cg14_par par; }; -static void cg14_unmap_regs(struct all_info *all) +static void cg14_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.regs) - of_iounmap(all->par.regs, sizeof(struct cg14_regs)); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg14_regs)); if (all->par.clut) - of_iounmap(all->par.clut, sizeof(struct cg14_clut)); + of_iounmap(&op->resource[0], + all->par.clut, sizeof(struct cg14_clut)); if (all->par.cursor) - of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); + of_iounmap(&op->resource[0], + all->par.cursor, sizeof(struct cg14_cursor)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[1], + all->info.screen_base, all->par.fbsize); } static int __devinit cg14_init_one(struct of_device *op) @@ -506,7 +510,7 @@ static int __devinit cg14_init_one(struct of_device *op) if (!all->par.regs || !all->par.clut || !all->par.cursor || !all->info.screen_base) - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == (8 * 1024 * 1024)); @@ -541,7 +545,7 @@ static int __devinit cg14_init_one(struct of_device *op) __cg14_reset(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -552,7 +556,7 @@ static int __devinit cg14_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); return err; } @@ -574,18 +578,18 @@ static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id return cg14_init_one(op); } -static int __devexit cg14_remove(struct of_device *dev) +static int __devexit cg14_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - cg14_unmap_regs(all); + cg14_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg3.c b/drivers/video/cg3.c index 9c8c753ef45..ada6f7e3a89 100644 --- a/drivers/video/cg3.c +++ b/drivers/video/cg3.c @@ -403,8 +403,10 @@ static int __devinit cg3_init_one(struct of_device *op) cg3_do_default_mode(&all->par); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return -ENOMEM; } @@ -415,8 +417,10 @@ static int __devinit cg3_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -436,19 +440,19 @@ static int __devinit cg3_probe(struct of_device *dev, const struct of_device_id return cg3_init_one(op); } -static int __devexit cg3_remove(struct of_device *dev) +static int __devexit cg3_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct cg3_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs)); + of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/cg6.c b/drivers/video/cg6.c index 64146be2eeb..4dad23a28f5 100644 --- a/drivers/video/cg6.c +++ b/drivers/video/cg6.c @@ -658,21 +658,26 @@ struct all_info { struct cg6_par par; }; -static void cg6_unmap_regs(struct all_info *all) +static void cg6_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.fbc) - of_iounmap(all->par.fbc, 4096); + of_iounmap(&op->resource[0], all->par.fbc, 4096); if (all->par.tec) - of_iounmap(all->par.tec, sizeof(struct cg6_tec)); + of_iounmap(&op->resource[0], + all->par.tec, sizeof(struct cg6_tec)); if (all->par.thc) - of_iounmap(all->par.thc, sizeof(struct cg6_thc)); + of_iounmap(&op->resource[0], + all->par.thc, sizeof(struct cg6_thc)); if (all->par.bt) - of_iounmap(all->par.bt, sizeof(struct bt_regs)); + of_iounmap(&op->resource[0], + all->par.bt, sizeof(struct bt_regs)); if (all->par.fhc) - of_iounmap(all->par.fhc, sizeof(u32)); + of_iounmap(&op->resource[0], + all->par.fhc, sizeof(u32)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); } static int __devinit cg6_init_one(struct of_device *op) @@ -720,7 +725,7 @@ static int __devinit cg6_init_one(struct of_device *op) all->par.fbsize, "cgsix ram"); if (!all->par.fbc || !all->par.tec || !all->par.thc || !all->par.bt || !all->par.fhc || !all->info.screen_base) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -734,7 +739,7 @@ static int __devinit cg6_init_one(struct of_device *op) cg6_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -744,7 +749,7 @@ static int __devinit cg6_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); fb_dealloc_cmap(&all->info.cmap); kfree(all); return err; @@ -767,18 +772,18 @@ static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id return cg6_init_one(op); } -static int __devexit cg6_remove(struct of_device *dev) +static int __devexit cg6_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - cg6_unmap_regs(all); + cg6_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c index 949141bd44d..15854aec318 100644 --- a/drivers/video/ffb.c +++ b/drivers/video/ffb.c @@ -910,7 +910,8 @@ static int ffb_init_one(struct of_device *op) all->par.dac = of_ioremap(&op->resource[1], 0, sizeof(struct ffb_dac), "ffb dac"); if (!all->par.dac) { - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); kfree(all); return -ENOMEM; } @@ -968,8 +969,10 @@ static int ffb_init_one(struct of_device *op) if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { printk(KERN_ERR "ffb: Could not allocate color map.\n"); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], + all->par.dac, sizeof(struct ffb_dac)); kfree(all); return -ENOMEM; } @@ -980,8 +983,10 @@ static int ffb_init_one(struct of_device *op) if (err < 0) { printk(KERN_ERR "ffb: Could not register framebuffer.\n"); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], + all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], + all->par.dac, sizeof(struct ffb_dac)); kfree(all); return err; } @@ -1003,19 +1008,19 @@ static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id return ffb_init_one(op); } -static int __devexit ffb_remove(struct of_device *dev) +static int __devexit ffb_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.fbc, sizeof(struct ffb_fbc)); - of_iounmap(all->par.dac, sizeof(struct ffb_dac)); + of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc)); + of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac)); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/leo.c b/drivers/video/leo.c index f3a24338d9a..a038aa5a9e1 100644 --- a/drivers/video/leo.c +++ b/drivers/video/leo.c @@ -530,20 +530,21 @@ struct all_info { struct leo_par par; }; -static void leo_unmap_regs(struct all_info *all) +static void leo_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.lc_ss0_usr) - of_iounmap(all->par.lc_ss0_usr, 0x1000); + of_iounmap(&op->resource[0], all->par.lc_ss0_usr, 0x1000); if (all->par.ld_ss0) - of_iounmap(all->par.ld_ss0, 0x1000); + of_iounmap(&op->resource[0], all->par.ld_ss0, 0x1000); if (all->par.ld_ss1) - of_iounmap(all->par.ld_ss1, 0x1000); + of_iounmap(&op->resource[0], all->par.ld_ss1, 0x1000); if (all->par.lx_krn) - of_iounmap(all->par.lx_krn, 0x1000); + of_iounmap(&op->resource[0], all->par.lx_krn, 0x1000); if (all->par.cursor) - of_iounmap(all->par.cursor, sizeof(struct leo_cursor)); + of_iounmap(&op->resource[0], + all->par.cursor, sizeof(struct leo_cursor)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, 0x800000); + of_iounmap(&op->resource[0], all->info.screen_base, 0x800000); } static int __devinit leo_init_one(struct of_device *op) @@ -592,7 +593,7 @@ static int __devinit leo_init_one(struct of_device *op) !all->par.lx_krn || !all->par.cursor || !all->info.screen_base) { - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -607,7 +608,7 @@ static int __devinit leo_init_one(struct of_device *op) leo_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return -ENOMEM;; } @@ -617,7 +618,7 @@ static int __devinit leo_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); return err; } @@ -638,18 +639,18 @@ static int __devinit leo_probe(struct of_device *dev, const struct of_device_id return leo_init_one(op); } -static int __devexit leo_remove(struct of_device *dev) +static int __devexit leo_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - leo_unmap_regs(all); + leo_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/p9100.c b/drivers/video/p9100.c index 56ac51d6a7f..637b78bb4bf 100644 --- a/drivers/video/p9100.c +++ b/drivers/video/p9100.c @@ -297,7 +297,8 @@ static int __devinit p9100_init_one(struct of_device *op) all->info.screen_base = of_ioremap(&op->resource[2], 0, all->par.fbsize, "p9100 ram"); if (!all->info.screen_base) { - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); kfree(all); return -ENOMEM; } @@ -306,8 +307,10 @@ static int __devinit p9100_init_one(struct of_device *op) p9100_blank(0, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], + all->info.screen_base, all->par.fbsize); kfree(all); return -ENOMEM; } @@ -317,8 +320,10 @@ static int __devinit p9100_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], + all->info.screen_base, all->par.fbsize); kfree(all); return err; } @@ -340,19 +345,19 @@ static int __devinit p9100_probe(struct of_device *dev, const struct of_device_i return p9100_init_one(op); } -static int __devexit p9100_remove(struct of_device *dev) +static int __devexit p9100_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - of_iounmap(all->par.regs, sizeof(struct p9100_regs)); - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], all->par.regs, sizeof(struct p9100_regs)); + of_iounmap(&op->resource[2], all->info.screen_base, all->par.fbsize); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/drivers/video/tcx.c b/drivers/video/tcx.c index 6990ab11cd0..5a99669232c 100644 --- a/drivers/video/tcx.c +++ b/drivers/video/tcx.c @@ -350,18 +350,23 @@ struct all_info { struct tcx_par par; }; -static void tcx_unmap_regs(struct all_info *all) +static void tcx_unmap_regs(struct of_device *op, struct all_info *all) { if (all->par.tec) - of_iounmap(all->par.tec, sizeof(struct tcx_tec)); + of_iounmap(&op->resource[7], + all->par.tec, sizeof(struct tcx_tec)); if (all->par.thc) - of_iounmap(all->par.thc, sizeof(struct tcx_thc)); + of_iounmap(&op->resource[9], + all->par.thc, sizeof(struct tcx_thc)); if (all->par.bt) - of_iounmap(all->par.bt, sizeof(struct bt_regs)); + of_iounmap(&op->resource[8], + all->par.bt, sizeof(struct bt_regs)); if (all->par.cplane) - of_iounmap(all->par.cplane, all->par.fbsize * sizeof(u32)); + of_iounmap(&op->resource[4], + all->par.cplane, all->par.fbsize * sizeof(u32)); if (all->info.screen_base) - of_iounmap(all->info.screen_base, all->par.fbsize); + of_iounmap(&op->resource[0], + all->info.screen_base, all->par.fbsize); } static int __devinit tcx_init_one(struct of_device *op) @@ -398,7 +403,7 @@ static int __devinit tcx_init_one(struct of_device *op) all->par.fbsize, "tcx ram"); if (!all->par.tec || !all->par.thc || !all->par.bt || !all->info.screen_base) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -409,7 +414,7 @@ static int __devinit tcx_init_one(struct of_device *op) all->par.fbsize * sizeof(u32), "tcx cplane"); if (!all->par.cplane) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -461,7 +466,7 @@ static int __devinit tcx_init_one(struct of_device *op) tcx_blank(FB_BLANK_UNBLANK, &all->info); if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return -ENOMEM; } @@ -472,7 +477,7 @@ static int __devinit tcx_init_one(struct of_device *op) err = register_framebuffer(&all->info); if (err < 0) { fb_dealloc_cmap(&all->info.cmap); - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); return err; } @@ -495,18 +500,18 @@ static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id return tcx_init_one(op); } -static int __devexit tcx_remove(struct of_device *dev) +static int __devexit tcx_remove(struct of_device *op) { - struct all_info *all = dev_get_drvdata(&dev->dev); + struct all_info *all = dev_get_drvdata(&op->dev); unregister_framebuffer(&all->info); fb_dealloc_cmap(&all->info.cmap); - tcx_unmap_regs(all); + tcx_unmap_regs(op, all); kfree(all); - dev_set_drvdata(&dev->dev, NULL); + dev_set_drvdata(&op->dev, NULL); return 0; } diff --git a/include/asm-sparc/of_device.h b/include/asm-sparc/of_device.h index 80ea31f6e17..7cb00c1b09c 100644 --- a/include/asm-sparc/of_device.h +++ b/include/asm-sparc/of_device.h @@ -33,7 +33,7 @@ struct of_device #define to_of_device(d) container_of(d, struct of_device, dev) extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); -extern void of_iounmap(void __iomem *base, unsigned long size); +extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); extern struct of_device *of_find_device_by_node(struct device_node *); diff --git a/include/asm-sparc64/of_device.h b/include/asm-sparc64/of_device.h index a62c7b997d6..60e9173c9ac 100644 --- a/include/asm-sparc64/of_device.h +++ b/include/asm-sparc64/of_device.h @@ -34,7 +34,7 @@ struct of_device #define to_of_device(d) container_of(d, struct of_device, dev) extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name); -extern void of_iounmap(void __iomem *base, unsigned long size); +extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size); extern struct of_device *of_find_device_by_node(struct device_node *); |