All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] acpi: dptf_power: Add DPTF power participant
Date: Mon, 27 Jun 2016 03:45:10 +0200	[thread overview]
Message-ID: <CAJZ5v0hR9E-pLkkvbSLwLG8A1ECCVa=+45YJ1+L1cjXHaPaLtg@mail.gmail.com> (raw)
In-Reply-To: <1466991116.5580.11.camel@linux.intel.com>

On Mon, Jun 27, 2016 at 3:31 AM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Fri, 2016-06-24 at 02:26 +0200, Rafael J. Wysocki wrote:
>> > > >
>> On Fri, Jun 24, 2016 at 1:19 AM, Srinivas Pandruvada
>> <srinivas.pandruvada@linux.intel.com> wrote:
>> > On Fri, 2016-06-24 at 00:31 +0200, Rafael J. Wysocki wrote:
>> > > On Thu, Jun 23, 2016 at 11:42 PM, Srinivas Pandruvada
>> > > <srinivas.pandruvada@linux.intel.com> wrote:
> [...]
>
>> I think what you need is that if acpi_battery is bound to at least
>> one
>> device, you don't want to bind dptf_power to anything.  Conversely,
>> if
>> dptf_power has been bound to at least one device, you don't want to
>> bind acpi_battery to anything.
>>
>> That may be achieved with a lock and two counters, one (A)
>> incremented
>> only by acpi_battery and the other (B) incremented only by dptf_power
>> and such that you can't increment A if B is different from 0 and you
>> can't increment B if A is different from 0.  Of course, each driver
>> would need to specify which counter it wants to use (A or B), so that
>> would take an additional argument to acpi_battery_common_add() and an
>> additional field in struct acpi_battery (for the remove operation).
>>
>> With that, I think it should only be possible to build both
>> acpi_battery and dptf_power if they are both modules.  IOW,
>> DPTF_POWER
>> should depend on (!ACPI_BATTERY || ACPI_BATTERY=m) or similar.  And
>> if
>> they are both modules, let user space manage that.
>>
>> And the waiting itself doesn't add any value then IMO.
> Yes. I think the best solution is not to let define DPTF_POWER when the
> ACPI_BATTERY is defined same as my first version of the patch or let
> both add as there is no harm as they will show same levels. The reason
> is:
> We have some devices with two ACPI_BATTERIES (primary and
> secondary/backup) and they must be presented as two power supply
> devices to user space. In those devices DPTF_POWER may be equivalent to
> only one of the ACPI_BATTERY (Will point to same battery for Battery
> levels). So we can't simply refuse to add ACPI_BATTERY device addition
> because DPTF_POWER device is registered before.

OK

Say dptf_power points to the same battery device as acpi_battery.  Is
there any way to tell when that happens?

  reply	other threads:[~2016-06-27  1:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 21:42 [PATCH v3 0/3] DPTF Platform power participant driver Srinivas Pandruvada
2016-06-23 21:42 ` [PATCH v3 1/3] acpi: battery: Split battery driver for reuse by DPTF power participant Srinivas Pandruvada
2016-06-23 21:42 ` [PATCH v3 2/3] acpi: dptf_power: Add " Srinivas Pandruvada
2016-06-23 22:31   ` Rafael J. Wysocki
2016-06-23 23:19     ` Srinivas Pandruvada
2016-06-24  0:26       ` Rafael J. Wysocki
2016-06-27  1:31         ` Srinivas Pandruvada
2016-06-27  1:45           ` Rafael J. Wysocki [this message]
2016-06-27  8:42             ` Zheng, Lv
2016-06-27 18:09             ` Srinivas Pandruvada
2016-06-23 21:42 ` [PATCH v3 3/3] acpi: battery_common: battery present status for INT3407 Srinivas Pandruvada

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='CAJZ5v0hR9E-pLkkvbSLwLG8A1ECCVa=+45YJ1+L1cjXHaPaLtg@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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.