From: Ognjen Galic <smclt30p@gmail.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Jonathan Corbet <corbet@lwn.net>, Len Brown <lenb@kernel.org>,
Darren Hart <dvhart@infradead.org>,
Andy Shevchenko <andy@infradead.org>,
Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
ibm-acpi-devel@lists.sourceforge.net
Subject: Re: [PATCH v2] thinkpad_acpi: Support the battery wear control
Date: Mon, 4 Dec 2017 20:55:24 +0100 [thread overview]
Message-ID: <20171204195524.GA25730@thinkpad> (raw)
In-Reply-To: <3171660.sUGE0a2FEN@aspire.rjw.lan>
On Mon, Dec 04, 2017 at 03:53:32PM +0100, Rafael J. Wysocki wrote:
> Not really.
>
> This is generic code, so no thinkpad_acpi-specific stuff in this file, please,
> even under #ifdefs.
>
I have some ideas, and I want your confirmation if that would be
acceptable.
Can I do this:
Expose a new API from battery.c for platform specific hooks:
struct battery_hook {
int (*add_battery)(struct acpi_battery* battery);
int (*remove_battery)(struct acpi_battery *battery);
};
battery_hook_register(struct battery_hook *hook)
battery_hook_unregister(struct battery_hook *hook)
When that hook is invoked from some other module, battery.c
calls the add_battery method for each battery that is added and
remove_battery for each battery that is removed.
battery.c would keep a list of the battery_hook structs and invoke
the add_battery and remove_battery methods as batteries get added
and removed.
With this API, we can add more hooks for battery features in
the future, not just the ThinkPad hooks.
I hope you like the proposal :)
next prev parent reply other threads:[~2017-12-04 19:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-03 22:56 [PATCH v2] thinkad_acpi: Support the battery wear control Ognjen Galic
2017-12-04 14:53 ` Rafael J. Wysocki
2017-12-04 19:55 ` Ognjen Galic [this message]
2017-12-09 10:03 ` [PATCH v2] thinkpad_acpi: " Pavel Machek
2017-12-09 10:29 ` Ognjen Galić
2017-12-09 10:38 ` Pavel Machek
2017-12-09 11:06 ` Ognjen Galić
2017-12-05 14:22 ` [PATCH v2] thinkad_acpi: " Christoph Böhmwalder
2017-12-05 22:23 ` Julian Andres Klode
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=20171204195524.GA25730@thinkpad \
--to=smclt30p@gmail.com \
--cc=andy@infradead.org \
--cc=corbet@lwn.net \
--cc=dvhart@infradead.org \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=ibm-acpi@hmh.eng.br \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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.