Linux Hardware Monitor development
 help / color / mirror / Atom feed
* Unknown values check in acpi_power_meter
@ 2026-11-23 10:06 Jean Delvare
  0 siblings, 0 replies; only message in thread
From: Jean Delvare @ 2026-11-23 10:06 UTC (permalink / raw)
  To: linux-hwmon; +Cc: Guenter Roeck

Hi all,

I have a concern about the following construct found in the
acpi_power_meter driver:

> /*
>  * ACPI integers can either be 32-bit or 64-bit wide, so
>  * we have to check for both values.
>  */
> static bool acpi_power_meter_is_unknown(u64 val)
> {
> 	return val == U32_MAX || val == U64_MAX;
> }

If the implementation is returning 64-bit values on a given system,
then only U64_MAX means that a value is unknown; U32_MAX is a regular
number as any other and should not be handled as an error case.

Don't we have a way to figure out whether a given ACPI integer object
is a 32-bit or 64-bit value, and only compare the result with the one
appropriate special value which means unknown for that integer size?

Thanks,
-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23 10:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 10:06 Unknown values check in acpi_power_meter Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox