On Tue, Jul 29, 2025 at 06:22:44PM +0100, Jonathan Cameron wrote: > > +} > > > +static void cca_tsm_remove(void *tsm_core) > > +{ > > + tsm_unregister(tsm_core); > > +} > > + > > +static int cca_tsm_probe(struct platform_device *pdev) > > +{ > > + struct tsm_core_dev *tsm_core; > > + > > + tsm_core = tsm_register(&pdev->dev, NULL, &cca_pci_ops); > > + if (IS_ERR(tsm_core)) > > + return PTR_ERR(tsm_core); > > + > > + return devm_add_action_or_reset(&pdev->dev, cca_tsm_remove, tsm_core); > > So this makes two with the one in Dan's test code. > devm_tsm_register() seems to be a useful generic thing to add (implementation > being exactly what you have here. Pelase no, this is insane, you have a probed driver with a probe/remove function pairing already. Why on earth would you use devm just to call a remove function :( Just put tsm_unregister() in the normal driver remove like it is supposed to be done and use the drvdata to pass the tsm_core_dev pointer. It is easy and normal, look at fwctl for a very simple example. devm is useful to solve complex things, these trivial things should be done normally.. Jason