All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH 0/2] dw9714 fixes, cleanups
@ 2018-01-02 11:12 Sakari Ailus
  2018-01-02 11:12 ` [RESEND PATCH 1/2] dw9714: Call pm_runtime_idle() at the end of probe() Sakari Ailus
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sakari Ailus @ 2018-01-02 11:12 UTC (permalink / raw)
  To: linux-media; +Cc: rajmohan.mani

Hi,

(Fixed Raj's e-mail.)

The two patches address a small bug in dw9714 driver and clean it up a
little, too.

Raj: could you let me know if they work for you? Thanks.


Sakari Ailus (2):
  dw9714: Call pm_runtime_idle() at the end of probe()
  dw9714: Remove client field in driver's struct

 drivers/media/i2c/dw9714.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RESEND PATCH 1/2] dw9714: Call pm_runtime_idle() at the end of probe()
  2018-01-02 11:12 [RESEND PATCH 0/2] dw9714 fixes, cleanups Sakari Ailus
@ 2018-01-02 11:12 ` Sakari Ailus
  2018-01-02 11:12 ` [RESEND PATCH 2/2] dw9714: Remove client field in driver's struct Sakari Ailus
  2018-01-05  1:22 ` [RESEND PATCH 0/2] dw9714 fixes, cleanups Mani, Rajmohan
  2 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2018-01-02 11:12 UTC (permalink / raw)
  To: linux-media; +Cc: rajmohan.mani

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 <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/dw9714.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c
index ed01e8b..7832210 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;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [RESEND PATCH 2/2] dw9714: Remove client field in driver's struct
  2018-01-02 11:12 [RESEND PATCH 0/2] dw9714 fixes, cleanups Sakari Ailus
  2018-01-02 11:12 ` [RESEND PATCH 1/2] dw9714: Call pm_runtime_idle() at the end of probe() Sakari Ailus
@ 2018-01-02 11:12 ` Sakari Ailus
  2018-01-05  1:22 ` [RESEND PATCH 0/2] dw9714 fixes, cleanups Mani, Rajmohan
  2 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2018-01-02 11:12 UTC (permalink / raw)
  To: linux-media; +Cc: rajmohan.mani

The client field in driver's struct is redundant. Remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/dw9714.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c
index 7832210..57460da 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;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [RESEND PATCH 0/2] dw9714 fixes, cleanups
  2018-01-02 11:12 [RESEND PATCH 0/2] dw9714 fixes, cleanups Sakari Ailus
  2018-01-02 11:12 ` [RESEND PATCH 1/2] dw9714: Call pm_runtime_idle() at the end of probe() Sakari Ailus
  2018-01-02 11:12 ` [RESEND PATCH 2/2] dw9714: Remove client field in driver's struct Sakari Ailus
@ 2018-01-05  1:22 ` Mani, Rajmohan
  2018-01-05  8:10   ` Sakari Ailus
  2 siblings, 1 reply; 5+ messages in thread
From: Mani, Rajmohan @ 2018-01-05  1:22 UTC (permalink / raw)
  To: Sakari Ailus, linux-media

Hi Sakari,

Thanks for the patches.

> -----Original Message-----
> From: Sakari Ailus [mailto:sakari.ailus@linux.intel.com]
> Sent: Tuesday, January 02, 2018 3:12 AM
> To: linux-media@vger.kernel.org
> Cc: Mani, Rajmohan <rajmohan.mani@intel.com>
> Subject: [RESEND PATCH 0/2] dw9714 fixes, cleanups
> 
> Hi,
> 
> (Fixed Raj's e-mail.)
> 
> The two patches address a small bug in dw9714 driver and clean it up a little,
> too.
> 
> Raj: could you let me know if they work for you? Thanks.
> 

These patches work fine.

> 
> Sakari Ailus (2):
>   dw9714: Call pm_runtime_idle() at the end of probe()
>   dw9714: Remove client field in driver's struct
> 
>  drivers/media/i2c/dw9714.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH 0/2] dw9714 fixes, cleanups
  2018-01-05  1:22 ` [RESEND PATCH 0/2] dw9714 fixes, cleanups Mani, Rajmohan
@ 2018-01-05  8:10   ` Sakari Ailus
  0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2018-01-05  8:10 UTC (permalink / raw)
  To: Mani, Rajmohan; +Cc: linux-media

On Fri, Jan 05, 2018 at 01:22:54AM +0000, Mani, Rajmohan wrote:
> > The two patches address a small bug in dw9714 driver and clean it up a little,
> > too.
> > 
> > Raj: could you let me know if they work for you? Thanks.
> > 
> 
> These patches work fine.

Thanks! I'll add:

Tested-by: Rajmohan Mani <rajmohan.mani@intel.com>

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-05  8:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-02 11:12 [RESEND PATCH 0/2] dw9714 fixes, cleanups Sakari Ailus
2018-01-02 11:12 ` [RESEND PATCH 1/2] dw9714: Call pm_runtime_idle() at the end of probe() Sakari Ailus
2018-01-02 11:12 ` [RESEND PATCH 2/2] dw9714: Remove client field in driver's struct Sakari Ailus
2018-01-05  1:22 ` [RESEND PATCH 0/2] dw9714 fixes, cleanups Mani, Rajmohan
2018-01-05  8:10   ` Sakari Ailus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.