All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH] adp1653: make ->power() method optional
Date: Thu, 18 Aug 2011 13:53:56 +0300	[thread overview]
Message-ID: <20110818105355.GC8872@valkosipuli.localdomain> (raw)
In-Reply-To: <1313663450.25065.4.camel@smile>

On Thu, Aug 18, 2011 at 01:30:50PM +0300, Andy Shevchenko wrote:
> On Thu, 2011-08-18 at 12:21 +0300, Sakari Ailus wrote: 
> > On Thu, Aug 18, 2011 at 11:53:03AM +0300, Andy Shevchenko wrote:
> > > The ->power() could be absent or not used on some platforms. This patch makes
> > > its presence optional.
> > 
> > Hi Andy,
> > 
> > Thanks for the patch!
> > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Cc: Sakari Ailus <sakari.ailus@iki.fi>
> > > ---
> > >  drivers/media/video/adp1653.c |    3 +++
> > >  1 files changed, 3 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/media/video/adp1653.c b/drivers/media/video/adp1653.c
> > > index 0fd9579..65f6f3f 100644
> > > --- a/drivers/media/video/adp1653.c
> > > +++ b/drivers/media/video/adp1653.c
> > > @@ -309,6 +309,9 @@ __adp1653_set_power(struct adp1653_flash *flash, int on)
> > >  {
> > >  	int ret;
> > >  
> > > +	if (flash->platform_data->power == NULL)
> > > +		return 0;
> > > +
> > >  	ret = flash->platform_data->power(&flash->subdev, on);
> > >  	if (ret < 0)
> > >  		return ret;
> 
> > How about doing this in adp1653_set_power() instead of
> > __adp1653_set_power()? At least I don't see any ill effects from this.
> > There's no need to keep track of the power state (flash->power_count) if
> > there isn't one. :-)
> It was my first assumption. However, the __adp1653_set_power() is used
> directly from suspend/resume methods.

It is but it won't get called: power_count will be always zero when the
power() callback doesn't exist.

-- 
Sakari Ailus
sakari.ailus@iki.fi

  reply	other threads:[~2011-08-18 10:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18  8:53 [PATCH] adp1653: make ->power() method optional Andy Shevchenko
2011-08-18  9:21 ` Sakari Ailus
2011-08-18 10:30   ` Andy Shevchenko
2011-08-18 10:53     ` Sakari Ailus [this message]
2011-08-18 11:00       ` Andy Shevchenko
2011-08-18 11:22   ` [PATCHv2] " Andy Shevchenko
2011-08-18 11:32     ` Andy Shevchenko
2011-08-18 11:51       ` Sakari Ailus
2011-08-18 13:32         ` Andy Shevchenko
2011-08-18 13:55           ` Sakari Ailus
2011-08-18 14:08             ` Sakari Ailus
2011-08-18 17:13           ` Sylwester Nawrocki
2011-08-18 19:02             ` Sakari Ailus
2011-08-18 20:59               ` Sylwester Nawrocki
2011-08-19 16:16                 ` Sakari Ailus
2011-08-19 20:24                   ` Sakari Ailus
2011-08-19 20:30                   ` Sylwester Nawrocki
2011-09-06 13:09           ` Sakari Ailus

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=20110818105355.GC8872@valkosipuli.localdomain \
    --to=sakari.ailus@iki.fi \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-media@vger.kernel.org \
    /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 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.