RE: [PATCH v4 3/3] pps: clients: gpio: release pins to an inactive state on remove and shutdown
From: Farber, Eliav
Date: Tue Sep 22 2026 - 06:17:40 EST
On Mon, Sep 22, 2026 at 09:40:00AM +0200, Rodolfo Giometti wrote:
> On Sat, Sep 19, 2026 at 05:11:57PM +0000, Eliav Farber wrote:
> > +static void pps_gpio_shutdown(struct platform_device *pdev)
> > +{
> > + struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> > +
> > + /*
> > + * The kernel keeps running after device_shutdown() (e.g. to load and
> > + * start a kexec image), so quiesce the hardware before touching the
> > + * mux: free the IRQ and stop the echo timer first, then release the
> > + * pins last, so no callback can drive a pin after it is handed back.
> > + * The PPS source is left registered; that is a remove-time concern.
> > + */
> > + free_irq(data->irq, data);
> > + timer_delete_sync(&data->echo_timer);
> > + gpiod_set_value(data->echo_pin, 0);
> > + pps_gpio_release_pins(&pdev->dev);
> > +}
>
> The timer_delete_sync() worries me a little, though. timer_setup()
> only runs when data->echo_pin is set, so on a board without echo-gpios
> this touches a timer_list that was never initialised.
>
> Would you mind guarding it with if (data->echo_pin)? [...]
> Whether you want to give remove() the same guard while you are there is
> up to you -- it is pre-existing, so I would not insist on it in this
> series.
Done in v5. shutdown() now guards the echo teardown with data->echo_pin,
and I fixed remove() too -- as a separate preparatory patch, since it is
pre-existing (Fixes: fde046a8c490, which had dropped that guard). It also
trips debug_assert_init() under CONFIG_DEBUG_OBJECTS_TIMERS, not just an
uninitialised-timer concern.
Thanks,
Eliav