[PATCH v2 2/3] watchdog: stm32_iwdg: Add pretimeout support

Marek Vasut marex at denx.de
Fri Sep 1 13:59:21 PDT 2023


On 8/6/23 16:19, Guenter Roeck wrote:
> On Wed, May 17, 2023 at 09:43:48PM +0200, Marek Vasut wrote:
>> The STM32MP15xx IWDG adds registers which permit this IP to generate
>> pretimeout interrupt. This interrupt can also be used to wake the CPU
>> from suspend. Implement support for generating this interrupt and let
>> userspace configure the pretimeout. In case the pretimeout is not
>> configured by user, set pretimeout to half of the WDT timeout cycle.

[...]

>>   static int stm32_iwdg_probe(struct platform_device *pdev)
>>   {
>>   	struct device *dev = &pdev->dev;
>> @@ -253,6 +340,11 @@ static int stm32_iwdg_probe(struct platform_device *pdev)
>>   	wdd->max_hw_heartbeat_ms = ((RLR_MAX + 1) * wdt->data->max_prescaler *
>>   				    1000) / wdt->rate;
>>   
>> +	/* Initialize IRQ, this might override wdd->info, hence it is here. */
>> +	ret = stm32_iwdg_irq_init(pdev, wdt);
>> +	if (ret)
>> +		return ret;
>> +
> 
> What if the interrupt fires for whatever reason and the watchdog
> isn't registered yet and the driver data is not set and the
> watchdog core doesn't know about the watchdog ?

That cannot happen since the pretimeout IRQ was not configured yet.
That can only happen once the core is aware of the WDT and calls 
set_pretimeout .



More information about the linux-arm-kernel mailing list