* [PATCH] ACPI: CPPC: fix bug that causes the value written in cpc register to be wrong.
@ 2024-11-13 2:49 Lifeng Zheng
2024-11-13 7:05 ` Clément Léger
0 siblings, 1 reply; 3+ messages in thread
From: Lifeng Zheng @ 2024-11-13 2:49 UTC (permalink / raw)
To: rafael, lenb
Cc: linux-acpi, linux-kernel, zhanjie9, lihuisong, fanghao11, cleger,
zhenglifeng1
With these codes, the value written in cpc register will be the result of
the OR operatiion on input value and prev_val. This will causes the value
to be wrong.
Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
---
drivers/acpi/cppc_acpi.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 01192fd047a6..f69ef7cc0caf 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1146,7 +1146,6 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
return -EFAULT;
}
val = MASK_VAL_WRITE(reg, prev_val, val);
- val |= prev_val;
}
switch (size) {
--
2.33.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPI: CPPC: fix bug that causes the value written in cpc register to be wrong.
2024-11-13 2:49 [PATCH] ACPI: CPPC: fix bug that causes the value written in cpc register to be wrong Lifeng Zheng
@ 2024-11-13 7:05 ` Clément Léger
2024-11-13 7:23 ` zhenglifeng (A)
0 siblings, 1 reply; 3+ messages in thread
From: Clément Léger @ 2024-11-13 7:05 UTC (permalink / raw)
To: Lifeng Zheng, rafael, lenb
Cc: linux-acpi, linux-kernel, zhanjie9, lihuisong, fanghao11
On 13/11/2024 03:49, Lifeng Zheng wrote:
> With these codes, the value written in cpc register will be the result of
> the OR operatiion on input value and prev_val. This will causes the value
> to be wrong.
>
> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
> ---
> drivers/acpi/cppc_acpi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 01192fd047a6..f69ef7cc0caf 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -1146,7 +1146,6 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
> return -EFAULT;
> }
> val = MASK_VAL_WRITE(reg, prev_val, val);
> - val |= prev_val;
Hi Lifeng,
Indeed, MASK_VAL_WRITE() already takes care of ORing prev_val with the
register mask. You can also add a Fixes:
Fixes: 60949b7b8054 ("ACPI: CPPC: Fix MASK_VAL() usage")
Thanks,
Clément
> }
>
> switch (size) {
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] ACPI: CPPC: fix bug that causes the value written in cpc register to be wrong.
2024-11-13 7:05 ` Clément Léger
@ 2024-11-13 7:23 ` zhenglifeng (A)
0 siblings, 0 replies; 3+ messages in thread
From: zhenglifeng (A) @ 2024-11-13 7:23 UTC (permalink / raw)
To: Clément Léger, rafael, lenb
Cc: linux-acpi, linux-kernel, zhanjie9, lihuisong, fanghao11
On 2024/11/13 15:05, Clément Léger wrote:
>
>
> On 13/11/2024 03:49, Lifeng Zheng wrote:
>> With these codes, the value written in cpc register will be the result of
>> the OR operatiion on input value and prev_val. This will causes the value
>> to be wrong.
>>
>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>> ---
>> drivers/acpi/cppc_acpi.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
>> index 01192fd047a6..f69ef7cc0caf 100644
>> --- a/drivers/acpi/cppc_acpi.c
>> +++ b/drivers/acpi/cppc_acpi.c
>> @@ -1146,7 +1146,6 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)
>> return -EFAULT;
>> }
>> val = MASK_VAL_WRITE(reg, prev_val, val);
>> - val |= prev_val;
>
> Hi Lifeng,
>
> Indeed, MASK_VAL_WRITE() already takes care of ORing prev_val with the
> register mask. You can also add a Fixes:
>
> Fixes: 60949b7b8054 ("ACPI: CPPC: Fix MASK_VAL() usage")
>
> Thanks,
>
> Clément
>
>> }
>>
>> switch (size) {
>
Thanks for reminder. I'll add this Fixes and resend this patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-13 7:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-13 2:49 [PATCH] ACPI: CPPC: fix bug that causes the value written in cpc register to be wrong Lifeng Zheng
2024-11-13 7:05 ` Clément Léger
2024-11-13 7:23 ` zhenglifeng (A)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®