Re: [RFC PATCH v1 12/38] coco: host: arm64: CCA host platform device driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 29 Jul 2025 20:22:43 -0300
Jason Gunthorpe <jgg@xxxxxxxx> wrote:

> 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..

Sure, that would be fine for now.  If we end up with a large complex flow that
happens to have a tsm_register() in amongst various managed resources
we can revisit.  If they all end up looking like this then a manual call
in remove is fine.

> 
> Jason





[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux