diff mbox series

[v5,09/21] hwmon: (mr75203) skip reset-control deassert for SOCs that don't support it

Message ID 20220908152449.35457-10-farbere@amazon.com
State Accepted
Commit 493372f5d3df9905087a2ce9f8b5a2dca5af889f
Headers show
Series [v5,01/21] dt-bindings: hwmon: (mr75203) fix "intel,vm-map" property to be optional | expand

Commit Message

Farber, Eliav Sept. 8, 2022, 3:24 p.m. UTC
Don't fail the probe function and don't deassert the reset controller if
a "reset" property doesn't exist in the device tree.

Change is done for SOCs that don't support a reset controller.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
V3 -> v2:
- Change "reset" property to be optional instead of skipping it.

 drivers/hwmon/mr75203.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Guenter Roeck Sept. 9, 2022, 2:18 a.m. UTC | #1
On Thu, Sep 08, 2022 at 03:24:37PM +0000, Eliav Farber wrote:
> Don't fail the probe function and don't deassert the reset controller if
> a "reset" property doesn't exist in the device tree.
> 
> Change is done for SOCs that don't support a reset controller.
> 
> Signed-off-by: Eliav Farber <farbere@amazon.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to hwmon-next.

Thanks,
Guenter

> ---
> V3 -> v2:
> - Change "reset" property to be optional instead of skipping it.
> 
>  drivers/hwmon/mr75203.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
> index 41e3d3b54baf..19ec9fb91202 100644
> --- a/drivers/hwmon/mr75203.c
> +++ b/drivers/hwmon/mr75203.c
> @@ -551,14 +551,17 @@ static int mr75203_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> -	pvt->rst = devm_reset_control_get_exclusive(dev, NULL);
> +	pvt->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
>  	if (IS_ERR(pvt->rst))
>  		return dev_err_probe(dev, PTR_ERR(pvt->rst),
>  				     "failed to get reset control\n");
>  
> -	ret = pvt_reset_control_deassert(dev, pvt);
> -	if (ret)
> -		return dev_err_probe(dev, ret, "cannot deassert reset control\n");
> +	if (pvt->rst) {
> +		ret = pvt_reset_control_deassert(dev, pvt);
> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +					     "cannot deassert reset control\n");
> +	}
>  
>  	ret = regmap_read(pvt->c_map, PVT_IP_CONFIG, &val);
>  	if(ret < 0)
diff mbox series

Patch

diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
index 41e3d3b54baf..19ec9fb91202 100644
--- a/drivers/hwmon/mr75203.c
+++ b/drivers/hwmon/mr75203.c
@@ -551,14 +551,17 @@  static int mr75203_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	pvt->rst = devm_reset_control_get_exclusive(dev, NULL);
+	pvt->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
 	if (IS_ERR(pvt->rst))
 		return dev_err_probe(dev, PTR_ERR(pvt->rst),
 				     "failed to get reset control\n");
 
-	ret = pvt_reset_control_deassert(dev, pvt);
-	if (ret)
-		return dev_err_probe(dev, ret, "cannot deassert reset control\n");
+	if (pvt->rst) {
+		ret = pvt_reset_control_deassert(dev, pvt);
+		if (ret)
+			return dev_err_probe(dev, ret,
+					     "cannot deassert reset control\n");
+	}
 
 	ret = regmap_read(pvt->c_map, PVT_IP_CONFIG, &val);
 	if(ret < 0)