Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=31c095b09ea2fe6a4c752fccaabd9025e1c6e7c7
Commit:     31c095b09ea2fe6a4c752fccaabd9025e1c6e7c7
Parent:     41561f28e76a47dc6de0a954da85d0b5c42874eb
Author:     Jean-Baptiste Maneyrol <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 10 21:21:29 2006 +0100
Committer:  Jean Delvare <[EMAIL PROTECTED]>
CommitDate: Sun Dec 10 21:21:29 2006 +0100

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
---
 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 781a99c..1898e99 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){
        dev->idx = ocp->def->index;
        ocp_set_drvdata(ocp, dev);
        
+       if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs),
+                               "ibm_iic")) {
+               ret = -EBUSY;
+               goto fail1;
+       }
+
        if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){
                printk(KERN_CRIT "ibm-iic%d: failed to ioremap device 
registers\n",
                        dev->idx);
@@ -750,6 +756,8 @@ fail:
 
        iounmap(dev->vaddr);
 fail2: 
+       release_mem_region(ocp->def->paddr, sizeof(struct iic_regs));
+fail1:
        ocp_set_drvdata(ocp, NULL);
        kfree(dev);     
        return ret;
@@ -777,6 +785,7 @@ static void __devexit iic_remove(struct ocp_device *ocp)
                    free_irq(dev->irq, dev);
                }
                iounmap(dev->vaddr);
+               release_mem_region(ocp->def->paddr, sizeof(struct iic_regs));
                kfree(dev);
        }
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to