From fa4293346bd470bfabbd7b69616c7d2608404f52 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Tue, 2 Jan 2018 05:51:57 -0500 Subject: media: dw9714: Call pm_runtime_idle() at the end of probe() Call pm_runtime_idle() at the end of the driver's probe() function to enable the device to reach low power state once probe() finishes. Signed-off-by: Sakari Ailus Tested-by: Rajmohan Mani Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/dw9714.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/media/i2c/dw9714.c') diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index ed01e8bd4331..78322102fa3f 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -183,6 +183,7 @@ static int dw9714_probe(struct i2c_client *client) pm_runtime_set_active(&client->dev); pm_runtime_enable(&client->dev); + pm_runtime_idle(&client->dev); return 0; -- cgit From a69e99723f146a98d8fae203c6021050faeeec4e Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Tue, 2 Jan 2018 05:55:17 -0500 Subject: media: dw9714: Remove client field in driver's struct The client field in driver's struct is redundant. Remove it. Signed-off-by: Sakari Ailus Tested-by: Rajmohan Mani Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/dw9714.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'drivers/media/i2c/dw9714.c') diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 78322102fa3f..57460dadddd1 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -42,7 +42,6 @@ /* dw9714 device structure */ struct dw9714_device { - struct i2c_client *client; struct v4l2_ctrl_handler ctrls_vcm; struct v4l2_subdev sd; u16 current_val; @@ -73,7 +72,7 @@ static int dw9714_i2c_write(struct i2c_client *client, u16 data) static int dw9714_t_focus_vcm(struct dw9714_device *dw9714_dev, u16 val) { - struct i2c_client *client = dw9714_dev->client; + struct i2c_client *client = v4l2_get_subdevdata(&dw9714_dev->sd); dw9714_dev->current_val = val; @@ -96,13 +95,11 @@ static const struct v4l2_ctrl_ops dw9714_vcm_ctrl_ops = { static int dw9714_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - struct dw9714_device *dw9714_dev = sd_to_dw9714_vcm(sd); - struct device *dev = &dw9714_dev->client->dev; int rval; - rval = pm_runtime_get_sync(dev); + rval = pm_runtime_get_sync(sd->dev); if (rval < 0) { - pm_runtime_put_noidle(dev); + pm_runtime_put_noidle(sd->dev); return rval; } @@ -111,10 +108,7 @@ static int dw9714_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) static int dw9714_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - struct dw9714_device *dw9714_dev = sd_to_dw9714_vcm(sd); - struct device *dev = &dw9714_dev->client->dev; - - pm_runtime_put(dev); + pm_runtime_put(sd->dev); return 0; } @@ -137,7 +131,6 @@ static int dw9714_init_controls(struct dw9714_device *dev_vcm) { struct v4l2_ctrl_handler *hdl = &dev_vcm->ctrls_vcm; const struct v4l2_ctrl_ops *ops = &dw9714_vcm_ctrl_ops; - struct i2c_client *client = dev_vcm->client; v4l2_ctrl_handler_init(hdl, 1); @@ -145,7 +138,7 @@ static int dw9714_init_controls(struct dw9714_device *dev_vcm) 0, DW9714_MAX_FOCUS_POS, DW9714_FOCUS_STEPS, 0); if (hdl->error) - dev_err(&client->dev, "%s fail error: 0x%x\n", + dev_err(dev_vcm->sd.dev, "%s fail error: 0x%x\n", __func__, hdl->error); dev_vcm->sd.ctrl_handler = hdl; return hdl->error; @@ -161,8 +154,6 @@ static int dw9714_probe(struct i2c_client *client) if (dw9714_dev == NULL) return -ENOMEM; - dw9714_dev->client = client; - v4l2_i2c_subdev_init(&dw9714_dev->sd, client, &dw9714_ops); dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; dw9714_dev->sd.internal_ops = &dw9714_int_ops; -- cgit From a4a02b6ec31668f6bc8823c94b3b4ea854dae605 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 23 Jan 2018 07:46:07 -0500 Subject: media: dw9714: annotate a __be16 integer value As warned: drivers/media/i2c/dw9714.c: warning: incorrect type in initializer (different base types): => 64:19 Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/dw9714.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/media/i2c/dw9714.c') diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 57460dadddd1..8dbbf0f917df 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -60,7 +60,7 @@ static inline struct dw9714_device *sd_to_dw9714_vcm(struct v4l2_subdev *subdev) static int dw9714_i2c_write(struct i2c_client *client, u16 data) { int ret; - u16 val = cpu_to_be16(data); + __be16 val = cpu_to_be16(data); ret = i2c_master_send(client, (const char *)&val, sizeof(val)); if (ret != sizeof(val)) { -- cgit