public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Antheas Kapenekakis <lkml@antheas.dev>
Cc: platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
	 linux-doc@vger.kernel.org, linux-pm@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>,
	 Jean Delvare <jdelvare@suse.com>,
	Jonathan Corbet <corbet@lwn.net>,
	 Joaquin Ignacio Aramendia <samsagax@gmail.com>,
	Derek J Clark <derekjohn.clark@gmail.com>,
	 Kevin Greenberg <kdgreenberg234@protonmail.com>,
	Joshua Tam <csinaction@pm.me>,
	 Parth Menon <parthasarathymenon@gmail.com>,
	Eileen <eileen@one-netbook.com>,
	linux-kernel@vger.kernel.org,  sre@kernel.org
Subject: Re: [PATCH v5 13/13] platform/x86: oxpec: Add charge threshold and behaviour to OneXPlayer
Date: Mon, 17 Mar 2025 22:02:04 +0100	[thread overview]
Message-ID: <a764ce58-27a8-44f1-b60e-c6a6d4233977@t-8ch.de> (raw)
In-Reply-To: <CAGwozwEqjoW-6J8rzm9HcJ0W1DVvzzPkPRzsKZE62gk3Q1ewSA@mail.gmail.com>

On 2025-03-17 19:20:46+0100, Antheas Kapenekakis wrote:
> On Mon, 17 Mar 2025 at 19:13, Thomas Weißschuh <linux@weissschuh.net> wrote:
> > On 2025-03-17 16:53:49+0100, Antheas Kapenekakis wrote:

> > > @@ -60,6 +61,7 @@ enum oxp_board {
> > >  };
> > >
> > >  static enum oxp_board board;
> > > +static struct device *oxp_dev;
> >
> > Using a global variable is ugly.
> > An explicit parameter passed through
> > battery_hook_register() -> add_battery()
> > would be nicer.
> > It would require changes to the core code and all its users, though.
> 
> I debated doing this. Unfortunately, this driver uses a global
> variable already (see board), so introducing a struct here seemed a
> bit excessive.
> 
> During a refactor, removing the board global variable would introduce
> a features struct, which can then be used for the battery hook.
> 
> So I think they should be done together in a future series.

Fine by me.

<snip>

> > > +static int oxp_add_battery(struct power_supply *battery, struct acpi_battery_hook *hook)
> > > +{
> > > +     /* OneXPlayer devices only have one battery. */
> > > +     if (strcmp(battery->desc->name, "BAT0") != 0 &&
> > > +         strcmp(battery->desc->name, "BAT1") != 0 &&
> > > +         strcmp(battery->desc->name, "BATC") != 0 &&
> > > +         strcmp(battery->desc->name, "BATT") != 0)
> > > +             return -ENODEV;
> >
> > If they only have one battery, why is the check necessary?
> 
> Leftover from when I modelled the battery hook from asus-wmi. If the
> battery hook only runs for system batteries and not e.g., for
> peripherals, I will remove this.

The battery hook runs for all batteries discovered through ACPI.
These should only be system batteries.

> > > +
> > > +     return power_supply_register_extension(battery, &oxp_psy_ext, oxp_dev, NULL);
> > > +}
> > > +
> > > +static int oxp_remove_battery(struct power_supply *battery, struct acpi_battery_hook *hook)
> > > +{
> > > +     power_supply_unregister_extension(battery, &oxp_psy_ext);
> > > +     return 0;
> > > +}
> > > +
> > > +static struct acpi_battery_hook battery_hook = {
> > > +     .add_battery = oxp_add_battery,
> > > +     .remove_battery = oxp_remove_battery,
> > > +     .name = "OneXPlayer Battery",
> >
> > This struct can also be aligned.
> 
> Can you expand on that?

It is about lining up the "=" characters all in one vertical line.
Same as in oxp_psy_ext;

<snip>

  reply	other threads:[~2025-03-17 21:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17 15:53 [PATCH v5 00/13] hwmon: (oxpsensors) Add devices, features, fix ABI and move to platform/x86 Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 01/13] hwmon: (oxp-sensors) Distinguish the X1 variants Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 02/13] hwmon: (oxp-sensors) Add all OneXFly variants Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 03/13] platform/x86: oxpec: Move hwmon/oxp-sensors to platform/x86 Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 04/13] ABI: testing: add tt_toggle and tt_led entries Antheas Kapenekakis
2025-03-17 17:53   ` Thomas Weißschuh
2025-03-17 21:58   ` Mario Limonciello
2025-03-17 15:53 ` [PATCH v5 05/13] platform/x86: oxpec: Rename ec group to tt_toggle Antheas Kapenekakis
2025-03-17 17:54   ` Thomas Weißschuh
2025-03-17 15:53 ` [PATCH v5 06/13] platform/x86: oxpec: Add turbo led support to X1 devices Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 07/13] platform/x86: oxpec: Move pwm_enable read to its own function Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 08/13] platform/x86: oxpec: Move pwm value read/write to separate functions Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 09/13] platform/x86: oxpec: Move fan speed read to separate function Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 10/13] platform/x86: oxpec: Adhere to sysfs-class-hwmon and enable pwm on 2 Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 11/13] platform/x86: oxpec: Follow reverse xmas convention for tt_toggle Antheas Kapenekakis
2025-03-17 15:53 ` [PATCH v5 12/13] power: supply: add inhibit-charge-awake to charge_behaviour Antheas Kapenekakis
2025-03-17 16:11   ` Hans de Goede
2025-03-17 17:57   ` Thomas Weißschuh
2025-03-17 15:53 ` [PATCH v5 13/13] platform/x86: oxpec: Add charge threshold and behaviour to OneXPlayer Antheas Kapenekakis
2025-03-17 18:12   ` Thomas Weißschuh
2025-03-17 18:20     ` Antheas Kapenekakis
2025-03-17 21:02       ` Thomas Weißschuh [this message]
2025-03-17 21:03         ` Antheas Kapenekakis
2025-03-17 16:02 ` [PATCH v5 00/13] hwmon: (oxpsensors) Add devices, features, fix ABI and move to platform/x86 Antheas Kapenekakis

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=a764ce58-27a8-44f1-b60e-c6a6d4233977@t-8ch.de \
    --to=linux@weissschuh.net \
    --cc=corbet@lwn.net \
    --cc=csinaction@pm.me \
    --cc=derekjohn.clark@gmail.com \
    --cc=eileen@one-netbook.com \
    --cc=jdelvare@suse.com \
    --cc=kdgreenberg234@protonmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lkml@antheas.dev \
    --cc=parthasarathymenon@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=samsagax@gmail.com \
    --cc=sre@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