[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250730112804.00002629@huawei.com>
Date: Wed, 30 Jul 2025 11:28:04 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@...nel.org>,
<linux-coco@...ts.linux.dev>, <kvmarm@...ts.linux.dev>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>, <aik@....com>,
<lukas@...ner.de>, Samuel Ortiz <sameo@...osinc.com>, Xu Yilun
<yilun.xu@...ux.intel.com>, Suzuki K Poulose <Suzuki.Poulose@....com>, Steven
Price <steven.price@....com>, Catalin Marinas <catalin.marinas@....com>, Marc
Zyngier <maz@...nel.org>, Will Deacon <will@...nel.org>, Oliver Upton
<oliver.upton@...ux.dev>
Subject: Re: [RFC PATCH v1 12/38] coco: host: arm64: CCA host platform
device driver
On Tue, 29 Jul 2025 20:22:43 -0300
Jason Gunthorpe <jgg@...pe.ca> 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
Powered by blists - more mailing lists