On Sat May 17 13:41:02 2025 +0200, Hans de Goede wrote:
> Move the suspend()/resume() functions to above gc0310_detect() and rename
> the functions to power_off()/power_on().
> 
> No functional changes, this is a preparation patch for reworking
> the runtime-pm handling in probe() and remove().
> 
> Signed-off-by: Hans de Goede <ha...@kernel.org>
> Reviewed-by: Andy Shevchenko <a...@kernel.org>
> Link: https://lore.kernel.org/r/20250517114106.43494-20-ha...@kernel.org
> Signed-off-by: Mauro Carvalho Chehab <mchehab+hua...@kernel.org>

Patch committed.

Thanks,
Mauro Carvalho Chehab

 drivers/staging/media/atomisp/i2c/atomisp-gc0310.c | 51 +++++++++++-----------
 1 file changed, 26 insertions(+), 25 deletions(-)

---

diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c 
b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
index 44e834c608f4..c4d85d65737c 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
@@ -383,6 +383,30 @@ static int gc0310_get_selection(struct v4l2_subdev *sd,
        return 0;
 }
 
+static int gc0310_power_off(struct device *dev)
+{
+       struct v4l2_subdev *sd = dev_get_drvdata(dev);
+       struct gc0310_device *sensor = to_gc0310_sensor(sd);
+
+       gpiod_set_value_cansleep(sensor->powerdown, 1);
+       gpiod_set_value_cansleep(sensor->reset, 1);
+       return 0;
+}
+
+static int gc0310_power_on(struct device *dev)
+{
+       struct v4l2_subdev *sd = dev_get_drvdata(dev);
+       struct gc0310_device *sensor = to_gc0310_sensor(sd);
+
+       fsleep(10 * USEC_PER_MSEC);
+       gpiod_set_value_cansleep(sensor->reset, 0);
+       fsleep(10 * USEC_PER_MSEC);
+       gpiod_set_value_cansleep(sensor->powerdown, 0);
+       fsleep(10 * USEC_PER_MSEC);
+
+       return 0;
+}
+
 static int gc0310_detect(struct gc0310_device *sensor)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
@@ -764,31 +788,8 @@ static int gc0310_probe(struct i2c_client *client)
        return 0;
 }
 
-static int gc0310_suspend(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct gc0310_device *sensor = to_gc0310_sensor(sd);
-
-       gpiod_set_value_cansleep(sensor->powerdown, 1);
-       gpiod_set_value_cansleep(sensor->reset, 1);
-       return 0;
-}
-
-static int gc0310_resume(struct device *dev)
-{
-       struct v4l2_subdev *sd = dev_get_drvdata(dev);
-       struct gc0310_device *sensor = to_gc0310_sensor(sd);
-
-       fsleep(10 * USEC_PER_MSEC);
-       gpiod_set_value_cansleep(sensor->reset, 0);
-       fsleep(10 * USEC_PER_MSEC);
-       gpiod_set_value_cansleep(sensor->powerdown, 0);
-       fsleep(10 * USEC_PER_MSEC);
-
-       return 0;
-}
-
-static DEFINE_RUNTIME_DEV_PM_OPS(gc0310_pm_ops, gc0310_suspend, gc0310_resume, 
NULL);
+static DEFINE_RUNTIME_DEV_PM_OPS(gc0310_pm_ops,
+                                gc0310_power_off, gc0310_power_on, NULL);
 
 static const struct acpi_device_id gc0310_acpi_match[] = {
        {"INT0310"},

Reply via email to