All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Thomas Renninger <trenn@suse.de>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
	"Brown, Len" <len.brown@intel.com>
Subject: Re: [PATCH] Check battery after resume
Date: Fri, 4 Aug 2006 13:09:19 -0400	[thread overview]
Message-ID: <20060804170919.GL7265@redhat.com> (raw)
In-Reply-To: <1154699191.4302.610.camel@queen.suse.de>

On Fri, Aug 04, 2006 at 03:46:31PM +0200, Thomas Renninger wrote:
 > On Thu, 2006-08-03 at 15:02 -0400, Dave Jones wrote:
 > > On Thu, Aug 03, 2006 at 07:17:37PM +0200, Thomas Renninger wrote:
 > > 
 > >  > +/* 
 > >  > + * returns:
 > >  > + *   0 on success
 > >  > + *  <0 on failure
 > >  > + *   1 if new battery found
 > >  > + *   2 if battery got removed
 > >  > + */
 > > 
 > > Why make this so complicated...
 > > 
 > >  > +	result = acpi_battery_check(battery);
 > >  > +	if (result > 0){
 > >  > +		acpi_bus_generate_event(device,
 > >  > +					ACPI_NOTIFY_DEVICE_CHECK,
 > >  > +					battery->flags.present);
 > >  > +	}
 > >  > +	return 0;
 > >  > +}
 > > 
 > > When we simply treat the result as a boolean ?
 > 
 > The return value is used to:
 >    check for error                       <0
 >    success, no battery insertion/removal 0
 >    battery insertion/removal             >0  (1/2)
 > 
 > The latter one is needed to inform userspace to reread complete battery
 > information (possibly from other BATx dir) if battery has been
 > inserted/removed.

The code cares about 2 possible states 'is there a battery added/removed'.
Yet there are 4 possible states for no obvious reason.
acpi_battery_check code could just as easily return
0=nothing changed, 1=battery added/removed, as you don't distinguish
between states '1' and '2' anyway.

		Dave

-- 
http://www.codemonkey.org.uk

  reply	other threads:[~2006-08-04 17:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-03 17:17 [PATCH] Check battery after resume Thomas Renninger
2006-08-03 19:02 ` Dave Jones
2006-08-04 13:46   ` Thomas Renninger
2006-08-04 17:09     ` Dave Jones [this message]
2006-08-07 15:22       ` Thomas Renninger

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=20060804170919.GL7265@redhat.com \
    --to=davej@redhat.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=trenn@suse.de \
    /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.