diff options
Diffstat (limited to 'drivers/video/cg14.c')
-rw-r--r-- | drivers/video/cg14.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 7f926c619b61..ec6a51a5822d 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c | |||
@@ -452,16 +452,20 @@ struct all_info { | |||
452 | struct cg14_par par; | 452 | struct cg14_par par; |
453 | }; | 453 | }; |
454 | 454 | ||
455 | static void cg14_unmap_regs(struct all_info *all) | 455 | static void cg14_unmap_regs(struct of_device *op, struct all_info *all) |
456 | { | 456 | { |
457 | if (all->par.regs) | 457 | if (all->par.regs) |
458 | of_iounmap(all->par.regs, sizeof(struct cg14_regs)); | 458 | of_iounmap(&op->resource[0], |
459 | all->par.regs, sizeof(struct cg14_regs)); | ||
459 | if (all->par.clut) | 460 | if (all->par.clut) |
460 | of_iounmap(all->par.clut, sizeof(struct cg14_clut)); | 461 | of_iounmap(&op->resource[0], |
462 | all->par.clut, sizeof(struct cg14_clut)); | ||
461 | if (all->par.cursor) | 463 | if (all->par.cursor) |
462 | of_iounmap(all->par.cursor, sizeof(struct cg14_cursor)); | 464 | of_iounmap(&op->resource[0], |
465 | all->par.cursor, sizeof(struct cg14_cursor)); | ||
463 | if (all->info.screen_base) | 466 | if (all->info.screen_base) |
464 | of_iounmap(all->info.screen_base, all->par.fbsize); | 467 | of_iounmap(&op->resource[1], |
468 | all->info.screen_base, all->par.fbsize); | ||
465 | } | 469 | } |
466 | 470 | ||
467 | static int __devinit cg14_init_one(struct of_device *op) | 471 | static int __devinit cg14_init_one(struct of_device *op) |
@@ -506,7 +510,7 @@ static int __devinit cg14_init_one(struct of_device *op) | |||
506 | 510 | ||
507 | if (!all->par.regs || !all->par.clut || !all->par.cursor || | 511 | if (!all->par.regs || !all->par.clut || !all->par.cursor || |
508 | !all->info.screen_base) | 512 | !all->info.screen_base) |
509 | cg14_unmap_regs(all); | 513 | cg14_unmap_regs(op, all); |
510 | 514 | ||
511 | is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == | 515 | is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) == |
512 | (8 * 1024 * 1024)); | 516 | (8 * 1024 * 1024)); |
@@ -541,7 +545,7 @@ static int __devinit cg14_init_one(struct of_device *op) | |||
541 | __cg14_reset(&all->par); | 545 | __cg14_reset(&all->par); |
542 | 546 | ||
543 | if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { | 547 | if (fb_alloc_cmap(&all->info.cmap, 256, 0)) { |
544 | cg14_unmap_regs(all); | 548 | cg14_unmap_regs(op, all); |
545 | kfree(all); | 549 | kfree(all); |
546 | return -ENOMEM; | 550 | return -ENOMEM; |
547 | } | 551 | } |
@@ -552,7 +556,7 @@ static int __devinit cg14_init_one(struct of_device *op) | |||
552 | err = register_framebuffer(&all->info); | 556 | err = register_framebuffer(&all->info); |
553 | if (err < 0) { | 557 | if (err < 0) { |
554 | fb_dealloc_cmap(&all->info.cmap); | 558 | fb_dealloc_cmap(&all->info.cmap); |
555 | cg14_unmap_regs(all); | 559 | cg14_unmap_regs(op, all); |
556 | kfree(all); | 560 | kfree(all); |
557 | return err; | 561 | return err; |
558 | } | 562 | } |
@@ -574,18 +578,18 @@ static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id | |||
574 | return cg14_init_one(op); | 578 | return cg14_init_one(op); |
575 | } | 579 | } |
576 | 580 | ||
577 | static int __devexit cg14_remove(struct of_device *dev) | 581 | static int __devexit cg14_remove(struct of_device *op) |
578 | { | 582 | { |
579 | struct all_info *all = dev_get_drvdata(&dev->dev); | 583 | struct all_info *all = dev_get_drvdata(&op->dev); |
580 | 584 | ||
581 | unregister_framebuffer(&all->info); | 585 | unregister_framebuffer(&all->info); |
582 | fb_dealloc_cmap(&all->info.cmap); | 586 | fb_dealloc_cmap(&all->info.cmap); |
583 | 587 | ||
584 | cg14_unmap_regs(all); | 588 | cg14_unmap_regs(op, all); |
585 | 589 | ||
586 | kfree(all); | 590 | kfree(all); |
587 | 591 | ||
588 | dev_set_drvdata(&dev->dev, NULL); | 592 | dev_set_drvdata(&op->dev, NULL); |
589 | 593 | ||
590 | return 0; | 594 | return 0; |
591 | } | 595 | } |