public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/1] as3645a: Remove set_power() from platform data
Date: Wed, 23 May 2012 13:00:08 +0200	[thread overview]
Message-ID: <5818890.hvZb7JEbAH@avalon> (raw)
In-Reply-To: <1337137969-30575-1-git-send-email-sakari.ailus@iki.fi>

Hi Sakari,

Thanks for the patch.

On Wednesday 16 May 2012 06:12:49 Sakari Ailus wrote:
> The chip is typically powered constantly and no board uses the set_power()
> callback. Remove it.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
>  drivers/media/video/as3645a.c |   39 +++++++++----------------------------
>  include/media/as3645a.h       |    1 -
>  2 files changed, 9 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/media/video/as3645a.c b/drivers/media/video/as3645a.c
> index c4b0357..7454660 100644
> --- a/drivers/media/video/as3645a.c
> +++ b/drivers/media/video/as3645a.c
> @@ -512,31 +512,6 @@ static int as3645a_setup(struct as3645a *flash)
>  	return ret & ~AS_FAULT_INFO_LED_AMOUNT ? -EIO : 0;
>  }
> 
> -static int __as3645a_set_power(struct as3645a *flash, int on)
> -{
> -	int ret;
> -
> -	if (!on)
> -		as3645a_set_control(flash, AS_MODE_EXT_TORCH, false);
> -
> -	if (flash->pdata->set_power) {
> -		ret = flash->pdata->set_power(&flash->subdev, on);
> -		if (ret < 0)
> -			return ret;
> -	}
> -
> -	if (!on)
> -		return 0;
> -
> -	ret = as3645a_setup(flash);
> -	if (ret < 0) {
> -		if (flash->pdata->set_power)
> -			flash->pdata->set_power(&flash->subdev, 0);
> -	}
> -
> -	return ret;
> -}
> -
>  static int as3645a_set_power(struct v4l2_subdev *sd, int on)
>  {
>  	struct as3645a *flash = to_as3645a(sd);
> @@ -545,9 +520,13 @@ static int as3645a_set_power(struct v4l2_subdev *sd,
> int on) mutex_lock(&flash->power_lock);
> 
>  	if (flash->power_count == !on) {
> -		ret = __as3645a_set_power(flash, !!on);
> -		if (ret < 0)
> -			goto done;
> +		if (!on) {
> +			as3645a_set_control(flash, AS_MODE_EXT_TORCH, false);
> +		} else {
> +			ret = as3645a_setup(flash);
> +			if (ret < 0)
> +				goto done;
> +		}
>  	}
> 

If the chip is powered on constantly, why do we need a .s_power() subdev 
operation at all ?

>  	flash->power_count += on ? 1 : -1;
> @@ -675,7 +654,7 @@ static int as3645a_suspend(struct device *dev)
>  	if (flash->power_count == 0)
>  		return 0;
> 
> -	rval = __as3645a_set_power(flash, 0);
> +	rval = as3645a_set_control(flash, AS_MODE_EXT_TORCH, false);
> 
>  	dev_dbg(&client->dev, "Suspend %s\n", rval < 0 ? "failed" : "ok");
> 
> @@ -692,7 +671,7 @@ static int as3645a_resume(struct device *dev)
>  	if (flash->power_count == 0)
>  		return 0;
> 
> -	rval = __as3645a_set_power(flash, 1);
> +	rval = as3645a_setup(flash);
> 
>  	dev_dbg(&client->dev, "Resume %s\n", rval < 0 ? "fail" : "ok");
> 
> diff --git a/include/media/as3645a.h b/include/media/as3645a.h
> index 5075496..a83ab3a 100644
> --- a/include/media/as3645a.h
> +++ b/include/media/as3645a.h
> @@ -57,7 +57,6 @@
>   * @timeout_max:	Max flash timeout (us, <= AS3645A_FLASH_TIMEOUT_MAX)
>   */
>  struct as3645a_platform_data {
> -	int (*set_power)(struct v4l2_subdev *subdev, int on);
>  	unsigned int vref;
>  	unsigned int peak;
>  	bool ext_strobe;

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-05-23 10:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16  3:12 [PATCH 1/1] as3645a: Remove set_power() from platform data Sakari Ailus
2012-05-23 11:00 ` Laurent Pinchart [this message]
2012-05-23 11:19   ` Sakari Ailus
2012-05-23 11:31     ` Laurent Pinchart
2012-05-23 12:06       ` Sakari Ailus
2013-11-02 21:43         ` Sakari Ailus
2013-11-04 14:26           ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5818890.hvZb7JEbAH@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox