[v2,3/5] i2c: designware-baytrail: Only check iosf_mbi_available() for shared hosts
diff mbox

Message ID 20161210141908.16470-3-hdegoede@redhat.com
State Superseded
Headers show

Commit Message

Hans de Goede Dec. 10, 2016, 2:19 p.m. UTC
There is no need to delay the probe if iosf_mbi_available() returns
false when an i2c bus is not using the punit semaphore.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/i2c/busses/i2c-designware-baytrail.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Dec. 10, 2016, 2:54 p.m. UTC | #1
On Sat, 2016-12-10 at 15:19 +0100, Hans de Goede wrote:
> There is no need to delay the probe if iosf_mbi_available() returns
> false when an i2c bus is not using the punit semaphore.

> --- a/drivers/i2c/busses/i2c-designware-baytrail.c
> +++ b/drivers/i2c/busses/i2c-designware-baytrail.c
> @@ -139,14 +139,14 @@ int i2c_dw_eval_lock_support(struct dw_i2c_dev
> *dev)
>  		return 0;
>  
>  	if (shared_host) {
> +		if (!iosf_mbi_available())
> +			return -EPROBE_DEFER;
> +

Looking to the implementation of i2c_dw_eval_lock_support() I would
rewrite this like

if (!shared_host)
  return 0;

>  		dev_info(dev->dev, "I2C bus managed by PUNIT\n");
>  		dev->acquire_lock = baytrail_i2c_acquire;
>  		dev->release_lock = baytrail_i2c_release;
>  		dev->pm_runtime_disabled = true;
>  	}
>  
> -	if (!iosf_mbi_available())
> -		return -EPROBE_DEFER;
> -
>  	return 0;
>  }
Hans de Goede Dec. 10, 2016, 7:26 p.m. UTC | #2
Hi,

On 10-12-16 15:54, Andy Shevchenko wrote:
> On Sat, 2016-12-10 at 15:19 +0100, Hans de Goede wrote:
>> There is no need to delay the probe if iosf_mbi_available() returns
>> false when an i2c bus is not using the punit semaphore.
>
>> --- a/drivers/i2c/busses/i2c-designware-baytrail.c
>> +++ b/drivers/i2c/busses/i2c-designware-baytrail.c
>> @@ -139,14 +139,14 @@ int i2c_dw_eval_lock_support(struct dw_i2c_dev
>> *dev)
>>  		return 0;
>>
>>  	if (shared_host) {
>> +		if (!iosf_mbi_available())
>> +			return -EPROBE_DEFER;
>> +
>
> Looking to the implementation of i2c_dw_eval_lock_support() I would
> rewrite this like
>
> if (!shared_host)
>   return 0;

I had the same thought when writing this patch, so ack, will fix for v3.

Regards,

Hans



>
>>  		dev_info(dev->dev, "I2C bus managed by PUNIT\n");
>>  		dev->acquire_lock = baytrail_i2c_acquire;
>>  		dev->release_lock = baytrail_i2c_release;
>>  		dev->pm_runtime_disabled = true;
>>  	}
>>
>> -	if (!iosf_mbi_available())
>> -		return -EPROBE_DEFER;
>> -
>>  	return 0;
>>  }
>
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/i2c/busses/i2c-designware-baytrail.c b/drivers/i2c/busses/i2c-designware-baytrail.c
index a3f581c..a419777 100644
--- a/drivers/i2c/busses/i2c-designware-baytrail.c
+++ b/drivers/i2c/busses/i2c-designware-baytrail.c
@@ -139,14 +139,14 @@  int i2c_dw_eval_lock_support(struct dw_i2c_dev *dev)
 		return 0;
 
 	if (shared_host) {
+		if (!iosf_mbi_available())
+			return -EPROBE_DEFER;
+
 		dev_info(dev->dev, "I2C bus managed by PUNIT\n");
 		dev->acquire_lock = baytrail_i2c_acquire;
 		dev->release_lock = baytrail_i2c_release;
 		dev->pm_runtime_disabled = true;
 	}
 
-	if (!iosf_mbi_available())
-		return -EPROBE_DEFER;
-
 	return 0;
 }