[PATCH] watchdog: imx2_wdg: Save the actual timeout value

Guenter Roeck linux at roeck-us.net
Sat Jun 15 08:26:27 PDT 2024


On 6/15/24 07:18, Guenter Roeck wrote:
> On 6/15/24 07:10, LongQiang wrote:
>> When setting the timeout, the effective timeout value should be saved.
>> Otherwise, the illegal timeout will take effect at 'start'.
>>
>> Signed-off-by: LongQiang <lqking7735 at 163.com>
>> ---
>>   drivers/watchdog/imx2_wdt.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
>> index 42e8ffae18dd..d4a4d4c58c3f 100644
>> --- a/drivers/watchdog/imx2_wdt.c
>> +++ b/drivers/watchdog/imx2_wdt.c
>> @@ -196,7 +196,7 @@ static int imx2_wdt_set_timeout(struct watchdog_device *wdog,
>>       actual = min(new_timeout, IMX2_WDT_MAX_TIME);
>>       __imx2_wdt_set_timeout(wdog, actual);
>> -    wdog->timeout = new_timeout;
>> +    wdog->timeout = actual;
>>       return 0;
>>   }
> No, that would be wrong.
> 
To add more detail, ->timeout is the soft timeout, handled by the watchdog
core. The start function calls imx2_wdt_set_timeout() again, which will set
the chip timeout to no more than IMX2_WDT_MAX_TIME. So the claim that
"the illegal timeout will take effect at 'start'" is simply not correct.

Guenter




More information about the linux-arm-kernel mailing list