[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    i2c: i2c-cadence: Initialize configuration before probing devices
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2017-01-28 23:11:50
Message-ID: 20170128231150.7190D660BDA () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/0e1929dedea36781e25902118c93edd8d8f09af1
Commit:     0e1929dedea36781e25902118c93edd8d8f09af1
Parent:     7a308bb3016f57e5be11a677d15b821536419d36
Refname:    refs/heads/master
Author:     Mike Looijmans <mike.looijmans@topic.nl>
AuthorDate: Mon Jan 16 15:49:38 2017 +0100
Committer:  Wolfram Sang <wsa@the-dreams.de>
CommitDate: Wed Jan 25 22:07:40 2017 +0100

    i2c: i2c-cadence: Initialize configuration before probing devices
    
    The cadence I2C driver calls cdns_i2c_writereg(..) to setup a workaround
    in the controller, but did so after calling i2c_add_adapter() which starts
    probing devices on the bus. Change the order so that the configuration is
    completely finished before using the adapter.
    
    Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
    Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/busses/i2c-cadence.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 6869712..45d6771 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -962,10 +962,6 @@ static int cdns_i2c_probe(struct platform_device *pdev)
 		goto err_clk_dis;
 	}
 
-	ret = i2c_add_adapter(&id->adap);
-	if (ret < 0)
-		goto err_clk_dis;
-
 	/*
 	 * Cadence I2C controller has a bug wherein it generates
 	 * invalid read transaction after HW timeout in master receiver mode.
@@ -975,6 +971,10 @@ static int cdns_i2c_probe(struct platform_device *pdev)
 	 */
 	cdns_i2c_writereg(CDNS_I2C_TIMEOUT_MAX, CDNS_I2C_TIME_OUT_OFFSET);
 
+	ret = i2c_add_adapter(&id->adap);
+	if (ret < 0)
+		goto err_clk_dis;
+
 	dev_info(&pdev->dev, "%u kHz mmio %08lx irq %d\n",
 		 id->i2c_clk / 1000, (unsigned long)r_mem->start, id->irq);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic