commit 3a451a0d0cda399df30562e2226960057a153b7f
Author: Eugeni Dodonov <eugeni.dodonov@intel.com>
Date:   Wed Sep 28 18:53:02 2011 -0300

    Do the disabling after talking to i2c bus

diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 8741192..8b11f68 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -191,21 +191,21 @@ intel_gpio_create(struct drm_i915_private *dev_priv, u32 pin)
 	gpio->algo.timeout = usecs_to_jiffies(2200);
 	gpio->algo.data = gpio;
 
-	/* Let's verify if we are talking to a real device. This can be indicated
-	 * by stuck bits. A similar testing is performed in i2c_algo_bit module
-	 * when using bit_test=1, but we do it locally to avoid extra overhead.
-	 */
-	set_data(gpio, 0);
-	udelay((gpio->algo.udelay + 1) / 2);
-
-	if (get_data(gpio)) {
-		printk(KERN_WARNING "i915: i2c SDA stuck high for %s, disabling pin\n",
-				gpio->adapter.name);
-		dev_priv->gmbus[pin].disabled = 1;
-		goto out_free;
-	}
 	if ((err = i2c_bit_add_bus(&gpio->adapter)) < 0) {
 		printk(KERN_WARNING "i915: i2c_bit_add_bus failed with %d\n", err);
+		/* Let's verify if we are talking to a real device. This can be indicated
+		 * by stuck bits. A similar testing is performed in i2c_algo_bit module
+		 * when using bit_test=1, but we do it locally to avoid extra overhead.
+		 */
+		set_data(gpio, 0);
+		udelay((gpio->algo.udelay + 1) / 2);
+
+		if (get_data(gpio)) {
+			printk(KERN_WARNING "i915: i2c SDA stuck high for %s, disabling pin\n",
+					gpio->adapter.name);
+			dev_priv->gmbus[pin].disabled = 1;
+			goto out_free;
+		}
 		goto out_free;
 	}