2017-12-14 00:36:48

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v2 03/16] remoteproc: introduce rproc_add_carveout function

On Thu 30 Nov 08:46 PST 2017, Loic Pallardy wrote:
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index f23daf9..279320a 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -737,6 +737,7 @@ static int rproc_handle_carveout(struct rproc *rproc,
> carveout->dma = dma;
> carveout->da = rsc->da;
> carveout->release = rproc_release_carveout;
> + carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED;

I don't fancy the (ab)use of priv to keep track of this, I also don't
see that it's ever used. Please drop it.

[..]
> +int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem)
> +{
> + if (!rproc || !mem)
> + return -EINVAL;

I don't see this function doing more than adding the item to the list of
carveouts, which can't fail. So let's just rely on the user calling it
with valid references and make it return void.

> +
> + mem->priv = (void *)CARVEOUT_EXTERNAL;
> +
> + list_add_tail(&mem->node, &rproc->carveouts);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(rproc_add_carveout);

Regards,
Bjorn


2018-01-12 07:46:04

by Loic Pallardy

[permalink] [raw]
Subject: RE: [PATCH v2 03/16] remoteproc: introduce rproc_add_carveout function



> -----Original Message-----
> From: Bjorn Andersson [mailto:[email protected]]
> Sent: Thursday, December 14, 2017 1:37 AM
> To: Loic PALLARDY <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; Arnaud POULIQUEN <[email protected]>;
> [email protected]
> Subject: Re: [PATCH v2 03/16] remoteproc: introduce rproc_add_carveout
> function
>
> On Thu 30 Nov 08:46 PST 2017, Loic Pallardy wrote:
> > diff --git a/drivers/remoteproc/remoteproc_core.c
> b/drivers/remoteproc/remoteproc_core.c
> > index f23daf9..279320a 100644
> > --- a/drivers/remoteproc/remoteproc_core.c
> > +++ b/drivers/remoteproc/remoteproc_core.c
> > @@ -737,6 +737,7 @@ static int rproc_handle_carveout(struct rproc
> *rproc,
> > carveout->dma = dma;
> > carveout->da = rsc->da;
> > carveout->release = rproc_release_carveout;
> > + carveout->priv = (void *)CARVEOUT_RSC_ALLOCATED;
>
> I don't fancy the (ab)use of priv to keep track of this, I also don't
> see that it's ever used. Please drop it.
It was to distinguish carveout defined from resource table and carveout registered by driver.
But agree about priv field usage
>
> [..]
> > +int rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry
> *mem)
> > +{
> > + if (!rproc || !mem)
> > + return -EINVAL;
>
> I don't see this function doing more than adding the item to the list of
> carveouts, which can't fail. So let's just rely on the user calling it
> with valid references and make it return void.
Ok

>
> > +
> > + mem->priv = (void *)CARVEOUT_EXTERNAL;
> > +
> > + list_add_tail(&mem->node, &rproc->carveouts);
> > +
> > + return 0;
> > +}
> > +EXPORT_SYMBOL(rproc_add_carveout);
>
> Regards,
> Bjorn