diff options
author | Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@teamlog.com> | 2006-12-10 15:21:29 -0500 |
---|---|---|
committer | Jean Delvare <khali@arrakis.delvare> | 2006-12-10 15:21:29 -0500 |
commit | 31c095b09ea2fe6a4c752fccaabd9025e1c6e7c7 (patch) | |
tree | 2d8c976933cca004c74a30a73bc109f6acc5acf3 /drivers/i2c/busses/i2c-ibm_iic.c | |
parent | 41561f28e76a47dc6de0a954da85d0b5c42874eb (diff) |
i2c: Add request/release_mem_region to i2c-ibm_iic bus driver
Reserving I/O memory for a driver with request_mem_region is necessary to
avoid memory access conflicts. Even if it's never going to happen, it is
cleaner and it allows to monitor I/O memory used in /proc/iomem.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@teamlog.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c/busses/i2c-ibm_iic.c')
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 781a99c1647a..1898e9987021 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -680,6 +680,12 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
680 | dev->idx = ocp->def->index; | 680 | dev->idx = ocp->def->index; |
681 | ocp_set_drvdata(ocp, dev); | 681 | ocp_set_drvdata(ocp, dev); |
682 | 682 | ||
683 | if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs), | ||
684 | "ibm_iic")) { | ||
685 | ret = -EBUSY; | ||
686 | goto fail1; | ||
687 | } | ||
688 | |||
683 | if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ | 689 | if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ |
684 | printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n", | 690 | printk(KERN_CRIT "ibm-iic%d: failed to ioremap device registers\n", |
685 | dev->idx); | 691 | dev->idx); |
@@ -750,6 +756,8 @@ fail: | |||
750 | 756 | ||
751 | iounmap(dev->vaddr); | 757 | iounmap(dev->vaddr); |
752 | fail2: | 758 | fail2: |
759 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
760 | fail1: | ||
753 | ocp_set_drvdata(ocp, NULL); | 761 | ocp_set_drvdata(ocp, NULL); |
754 | kfree(dev); | 762 | kfree(dev); |
755 | return ret; | 763 | return ret; |
@@ -777,6 +785,7 @@ static void __devexit iic_remove(struct ocp_device *ocp) | |||
777 | free_irq(dev->irq, dev); | 785 | free_irq(dev->irq, dev); |
778 | } | 786 | } |
779 | iounmap(dev->vaddr); | 787 | iounmap(dev->vaddr); |
788 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
780 | kfree(dev); | 789 | kfree(dev); |
781 | } | 790 | } |
782 | } | 791 | } |