lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a764ce58-27a8-44f1-b60e-c6a6d4233977@t-8ch.de>
Date: Mon, 17 Mar 2025 22:02:04 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Antheas Kapenekakis <lkml@...heas.dev>
Cc: platform-driver-x86@...r.kernel.org, linux-hwmon@...r.kernel.org, 
	linux-doc@...r.kernel.org, linux-pm@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>, 
	Jean Delvare <jdelvare@...e.com>, Jonathan Corbet <corbet@....net>, 
	Joaquin Ignacio Aramendia <samsagax@...il.com>, Derek J Clark <derekjohn.clark@...il.com>, 
	Kevin Greenberg <kdgreenberg234@...tonmail.com>, Joshua Tam <csinaction@...me>, 
	Parth Menon <parthasarathymenon@...il.com>, Eileen <eileen@...-netbook.com>, linux-kernel@...r.kernel.org, 
	sre@...nel.org
Subject: Re: [PATCH v5 13/13] platform/x86: oxpec: Add charge threshold and
 behaviour to OneXPlayer

On 2025-03-17 19:20:46+0100, Antheas Kapenekakis wrote:
> On Mon, 17 Mar 2025 at 19:13, Thomas Weißschuh <linux@...ssschuh.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>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ