From: Guenter Roeck <linux@roeck-us.net>
To: Huisong Li <lihuisong@huawei.com>,
linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jdelvare@suse.com, liuyonglong@huawei.com,
zhanjie9@hisilicon.com, zhenglifeng1@huawei.com
Subject: Re: [PATCH v1 4/4] hwmon: (acpi_power_meter) Add the print of no notification that hardware limit is enforced
Date: Mon, 25 Nov 2024 08:13:16 -0800 [thread overview]
Message-ID: <f7274b8d-cb91-4975-be94-69f041e9c4ee@roeck-us.net> (raw)
In-Reply-To: <20241125093415.21719-5-lihuisong@huawei.com>
On 11/25/24 01:34, Huisong Li wrote:
> As ACPI spec said, the bit3 of the supported capabilities in _PMC indicates
> that the power meter supports notifications when the hardware limit is
> enforced. If one platform doesn't report this bit, but support hardware
> forced limit through some out-of-band mechanism. Driver wouldn't receive
> the related notifications to notify the OSPM to re-read the hardware limit.
> So add the print of no notifcation that hardware limit is enforced.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> ---
> drivers/hwmon/acpi_power_meter.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
> index 3500859ff0bf..d3f144986fae 100644
> --- a/drivers/hwmon/acpi_power_meter.c
> +++ b/drivers/hwmon/acpi_power_meter.c
> @@ -712,6 +712,10 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
> goto skip_unsafe_cap;
> }
>
> + if (resource->caps.flags & POWER_METER_CAN_NOTIFY == 0)
== has higher precedence than &, so this expression will never be true.
And, indeed:
drivers/hwmon/acpi_power_meter.c: In function ‘setup_attrs’:
drivers/hwmon/acpi_power_meter.c:701:42: error: suggest parentheses around comparison in operand of ‘&’
> + dev_info(&resource->acpi_dev->dev,
> + "no notifcation when the hardware limit is enforced.\n");
> +
> if (resource->caps.configurable_cap)
> res = register_attrs(resource, rw_cap_attrs);
> else
On top of that, I don't see the value in this patch.
Overall, really, this driver could benefit from a complete overhaul.
Its use of the deprecated hwmon_device_register() should tell it all.
There is lots of questionable code, such as the unprotected calls to
remove_attrs() followed by setup_attrs() in the notification handler.
Any updates should be limited to bug fixes and not try to make minor
improvements for little if any gain.
Guenter
next prev parent reply other threads:[~2024-11-25 16:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 9:34 [PATCH v1 0/4] hwmon: (acpi_power_meter) Some trival optimizations Huisong Li
2024-11-25 9:34 ` [PATCH v1 1/4] hwmon: (acpi_power_meter) Fix using uninitialized variables Huisong Li
2024-11-25 16:03 ` Guenter Roeck
2024-11-26 1:56 ` lihuisong (C)
2024-11-26 4:04 ` Guenter Roeck
2024-11-26 7:03 ` lihuisong (C)
2024-11-26 16:19 ` Guenter Roeck
2024-11-27 2:29 ` lihuisong (C)
2024-11-27 3:43 ` lihuisong (C)
2024-12-11 7:41 ` lihuisong (C)
2024-12-12 1:51 ` Guenter Roeck
2024-12-12 3:00 ` lihuisong (C)
2024-12-19 3:45 ` lihuisong (C)
2024-12-19 3:50 ` Guenter Roeck
2024-12-20 6:00 ` lihuisong (C)
2024-11-25 9:34 ` [PATCH v1 2/4] hwmon: (acpi_power_meter) Fix update the power trip points on failure Huisong Li
2024-11-25 15:22 ` Guenter Roeck
2024-11-26 1:59 ` lihuisong (C)
2024-11-25 9:34 ` [PATCH v1 3/4] hwmon: (acpi_power_meter) Remove redundant 'sensors_valid' variable Huisong Li
2024-11-25 15:38 ` Guenter Roeck
2024-11-26 2:25 ` lihuisong (C)
2024-11-25 9:34 ` [PATCH v1 4/4] hwmon: (acpi_power_meter) Add the print of no notification that hardware limit is enforced Huisong Li
2024-11-25 16:13 ` Guenter Roeck [this message]
2024-11-26 3:15 ` lihuisong (C)
2024-11-26 4:06 ` Guenter Roeck
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=f7274b8d-cb91-4975-be94-69f041e9c4ee@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=lihuisong@huawei.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuyonglong@huawei.com \
--cc=zhanjie9@hisilicon.com \
--cc=zhenglifeng1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox