diff mbox series

[v5,12/13] media: i2c: imx214: Fix clock handling on probe error or remove

Message ID 20241217-imx214-v5-12-387f52adef4d@apitzsch.eu
State Superseded
Headers show
Series [v5,01/13] media: i2c: imx214: Use subdev active state | expand

Commit Message

André Apitzsch via B4 Relay Dec. 17, 2024, 9:39 p.m. UTC
From: André Apitzsch <git@apitzsch.eu>

The driver should disable or unprepare the clock on probe error and on
removing the module.

Remove regulator_bulk_disable(), because it is called by
imx214_power_off().

Signed-off-by: André Apitzsch <git@apitzsch.eu>
---
 drivers/media/i2c/imx214.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ricardo Ribalda Delgado Dec. 19, 2024, 12:24 p.m. UTC | #1
On Tue, Dec 17, 2024 at 10:40 PM André Apitzsch via B4 Relay
<devnull+git.apitzsch.eu@kernel.org> wrote:
>
> From: André Apitzsch <git@apitzsch.eu>
>
> The driver should disable or unprepare the clock on probe error and on
> removing the module.
>
> Remove regulator_bulk_disable(), because it is called by
> imx214_power_off().
>
> Signed-off-by: André Apitzsch <git@apitzsch.eu>
Acked-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
>  drivers/media/i2c/imx214.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index 96d05acfeb66480770bb6291027dd023fdccb649..e8d35f8b0f8b57d64f03ff6f5ed9eac51a671e8e 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -1340,7 +1340,7 @@ static int imx214_probe(struct i2c_client *client)
>         v4l2_ctrl_handler_free(&imx214->ctrls);
>  error_power_off:
>         pm_runtime_disable(imx214->dev);
> -       regulator_bulk_disable(IMX214_NUM_SUPPLIES, imx214->supplies);
> +       imx214_power_off(dev);
>
>         return ret;
>  }
> @@ -1356,6 +1356,8 @@ static void imx214_remove(struct i2c_client *client)
>         v4l2_ctrl_handler_free(&imx214->ctrls);
>
>         pm_runtime_disable(&client->dev);
> +       if (!pm_runtime_status_suspended(&client->dev))
> +               imx214_power_off(&client->dev);
>         pm_runtime_set_suspended(&client->dev);
>  }
>
>
> --
> 2.47.1
>
>
>
diff mbox series

Patch

diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
index 96d05acfeb66480770bb6291027dd023fdccb649..e8d35f8b0f8b57d64f03ff6f5ed9eac51a671e8e 100644
--- a/drivers/media/i2c/imx214.c
+++ b/drivers/media/i2c/imx214.c
@@ -1340,7 +1340,7 @@  static int imx214_probe(struct i2c_client *client)
 	v4l2_ctrl_handler_free(&imx214->ctrls);
 error_power_off:
 	pm_runtime_disable(imx214->dev);
-	regulator_bulk_disable(IMX214_NUM_SUPPLIES, imx214->supplies);
+	imx214_power_off(dev);
 
 	return ret;
 }
@@ -1356,6 +1356,8 @@  static void imx214_remove(struct i2c_client *client)
 	v4l2_ctrl_handler_free(&imx214->ctrls);
 
 	pm_runtime_disable(&client->dev);
+	if (!pm_runtime_status_suspended(&client->dev))
+		imx214_power_off(&client->dev);
 	pm_runtime_set_suspended(&client->dev);
 }