public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Dave Jones <davej@redhat.com>
Cc: linux-acpi <linux-acpi@vger.kernel.org>,
	"Brown, Len" <len.brown@intel.com>
Subject: Re: [PATCH] Check battery after resume
Date: Fri, 04 Aug 2006 15:46:31 +0200	[thread overview]
Message-ID: <1154699191.4302.610.camel@queen.suse.de> (raw)
In-Reply-To: <20060803190220.GD11577@redhat.com>

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.

   Thomas


  reply	other threads:[~2006-08-04 13:42 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 [this message]
2006-08-04 17:09     ` Dave Jones
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=1154699191.4302.610.camel@queen.suse.de \
    --to=trenn@suse.de \
    --cc=davej@redhat.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox