diff mbox series

[v1,2/2] hwmon: (acpi_power_meter) Fix fail to load module on platform without _PMD method

Message ID 20241107032626.16682-3-lihuisong@huawei.com
State Accepted
Commit fabb1f813ec05975fd3428e72a62ef9f855fd3b4
Headers show
Series Add _TZD method for ACPI thermal | expand

Commit Message

lihuisong (C) Nov. 7, 2024, 3:26 a.m. UTC
As ACPI spec said, _PMD method is optional. The acpi_power_meter
shouldn't fail to load when the platform hasn't _PMD method.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
---
 drivers/hwmon/acpi_power_meter.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Nov. 7, 2024, 10:55 a.m. UTC | #1
On Thu, Nov 7, 2024 at 4:37 AM Huisong Li <lihuisong@huawei.com> wrote:
>
> As ACPI spec said, _PMD method is optional. The acpi_power_meter
> shouldn't fail to load when the platform hasn't _PMD method.
>
> Signed-off-by: Huisong Li <lihuisong@huawei.com>

How exactly is this related to the first patch?

> ---
>  drivers/hwmon/acpi_power_meter.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
> index 6c8a9c863528..2f1c9d97ad21 100644
> --- a/drivers/hwmon/acpi_power_meter.c
> +++ b/drivers/hwmon/acpi_power_meter.c
> @@ -680,8 +680,9 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
>  {
>         int res = 0;
>
> +       /* _PMD method is optional. */
>         res = read_domain_devices(resource);
> -       if (res)
> +       if (res != -ENODEV)
>                 return res;
>
>         if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
> --
> 2.22.0
>
>
lihuisong (C) Nov. 7, 2024, 12:07 p.m. UTC | #2
在 2024/11/7 18:55, Rafael J. Wysocki 写道:
> On Thu, Nov 7, 2024 at 4:37 AM Huisong Li <lihuisong@huawei.com> wrote:
>> As ACPI spec said, _PMD method is optional. The acpi_power_meter
>> shouldn't fail to load when the platform hasn't _PMD method.
>>
>> Signed-off-by: Huisong Li <lihuisong@huawei.com>
> How exactly is this related to the first patch?
They're not related, they're just similar.
Sorry, I should separate them😂
Should I resend them now?
>
>> ---
>>   drivers/hwmon/acpi_power_meter.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
>> index 6c8a9c863528..2f1c9d97ad21 100644
>> --- a/drivers/hwmon/acpi_power_meter.c
>> +++ b/drivers/hwmon/acpi_power_meter.c
>> @@ -680,8 +680,9 @@ static int setup_attrs(struct acpi_power_meter_resource *resource)
>>   {
>>          int res = 0;
>>
>> +       /* _PMD method is optional. */
>>          res = read_domain_devices(resource);
>> -       if (res)
>> +       if (res != -ENODEV)
>>                  return res;
>>
>>          if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
>> --
>> 2.22.0
>>
>>
> .
diff mbox series

Patch

diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 6c8a9c863528..2f1c9d97ad21 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -680,8 +680,9 @@  static int setup_attrs(struct acpi_power_meter_resource *resource)
 {
 	int res = 0;
 
+	/* _PMD method is optional. */
 	res = read_domain_devices(resource);
-	if (res)
+	if (res != -ENODEV)
 		return res;
 
 	if (resource->caps.flags & POWER_METER_CAN_MEASURE) {