diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-12-28 21:01:32 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-31 14:06:05 -0800 |
commit | e3a411a3dfc1d633504aa63efab32b7e00318454 (patch) | |
tree | 2ba6117448edd7056c8fa48cc6a696ae73a6c21a /drivers/video | |
parent | 6fc5bae797a6632bbccdd49a1b6a96121368a4b9 (diff) |
[SPARC64]: Fix of_iounmap() region release.
We need to pass in the resource otherwise we cannot
release the region properly. We must know whether it is
an I/O or MEM resource.
Spotted by Eric Brower.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/video')
-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 |
8 files changed, 122 insertions, 91 deletions
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; } |