All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: Linux PM mailing list <linux-pm@lists.linux-foundation.org>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s3c-adc-battery: Add naive POWER_SUPPLY_PROP_PRESENT implementation
Date: Thu, 10 Nov 2011 17:30:52 +0400	[thread overview]
Message-ID: <20111110133052.GA31381@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1320923106.2594.0.camel@anarsoul-laptop.Home>

On Thu, Nov 10, 2011 at 02:05:06PM +0300, Vasily Khoruzhick wrote:
> On Thu, 2011-11-10 at 09:56 +0100, Heiko Stübner wrote:
> > Userspace programs like upower seem to depend on the presence of the
> > POWER_SUPPLY_PROP_PRESENT property.
> > 
> > The real presence of the battery cannot be sensed and all other
> > routines of s3c-adc-battery simply expect it to be present.
> > 
> > Therefore we simply return 1, unless the battery struct is not present at all.
> 
> Looks OK for me,
> 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>

I disagree. If the driver behaves like the hardware does not support
hot-pluggable cells, then present property is not necessary.

Upowerd should look at the 'present' only if it is there; and if it
is not, cells assumed to be always present.

[..]
> >  	if (!bat) {
> > +		if (psp == POWER_SUPPLY_PROP_PRESENT) {
> > +			val->intval = 0;
> > +			return 0;
> > +		}
> > +
> >  		dev_err(psy->dev, "%s: no battery infos ?!\n", __func__);

And in this case that dev_err() tells that either hardware does not
support hot-pluggable cells, or driver does not handle this case; which
is actually the same from the userspace point of view.

So, the problem is in upowerd, not this driver.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-pm

WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Vasily Khoruzhick <anarsoul@gmail.com>
Cc: "Heiko Stübner" <heiko@sntech.de>,
	"David Woodhouse" <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org,
	"Linux PM mailing list" <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH] s3c-adc-battery: Add naive POWER_SUPPLY_PROP_PRESENT implementation
Date: Thu, 10 Nov 2011 17:30:52 +0400	[thread overview]
Message-ID: <20111110133052.GA31381@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1320923106.2594.0.camel@anarsoul-laptop.Home>

On Thu, Nov 10, 2011 at 02:05:06PM +0300, Vasily Khoruzhick wrote:
> On Thu, 2011-11-10 at 09:56 +0100, Heiko Stübner wrote:
> > Userspace programs like upower seem to depend on the presence of the
> > POWER_SUPPLY_PROP_PRESENT property.
> > 
> > The real presence of the battery cannot be sensed and all other
> > routines of s3c-adc-battery simply expect it to be present.
> > 
> > Therefore we simply return 1, unless the battery struct is not present at all.
> 
> Looks OK for me,
> 
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>

I disagree. If the driver behaves like the hardware does not support
hot-pluggable cells, then present property is not necessary.

Upowerd should look at the 'present' only if it is there; and if it
is not, cells assumed to be always present.

[..]
> >  	if (!bat) {
> > +		if (psp == POWER_SUPPLY_PROP_PRESENT) {
> > +			val->intval = 0;
> > +			return 0;
> > +		}
> > +
> >  		dev_err(psy->dev, "%s: no battery infos ?!\n", __func__);

And in this case that dev_err() tells that either hardware does not
support hot-pluggable cells, or driver does not handle this case; which
is actually the same from the userspace point of view.

So, the problem is in upowerd, not this driver.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

  reply	other threads:[~2011-11-10 13:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10  8:56 [PATCH] s3c-adc-battery: Add naive POWER_SUPPLY_PROP_PRESENT implementation Heiko Stübner
2011-11-10 11:05 ` Vasily Khoruzhick
2011-11-10 11:05 ` Vasily Khoruzhick
2011-11-10 13:30   ` Anton Vorontsov [this message]
2011-11-10 13:30     ` Anton Vorontsov
2011-11-11 15:18     ` Heiko Stübner
2011-11-11 15:18     ` Heiko Stübner
  -- strict thread matches above, loose matches on Subject: below --
2011-11-10  8:56 Heiko Stübner

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=20111110133052.GA31381@oksana.dev.rtsoft.ru \
    --to=cbouatmailru@gmail.com \
    --cc=anarsoul@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.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.