[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29b89807-6ff6-34c3-53c2-e56825a6977f@nxp.com>
Date: Thu, 7 Jan 2021 19:15:51 +0200
From: Laurentiu Tudor <laurentiu.tudor@....com>
To: Ioana Ciornei <ciorneiioana@...il.com>, davem@...emloft.net,
kuba@...nel.org, netdev@...r.kernel.org
Cc: Ioana Ciornei <ioana.ciornei@....com>
Subject: Re: [PATCH 3/6] bus: fsl-mc: return -EPROBE_DEFER when a device is
not yet discovered
On 1/7/2021 5:36 PM, Ioana Ciornei wrote:
> From: Ioana Ciornei <ioana.ciornei@....com>
>
> The fsl_mc_get_endpoint() should return a pointer to the connected
> fsl_mc device, if there is one. By interrogating the MC firmware, we
> know if there is an endpoint or not so when the endpoint device is
> actually searched on the fsl-mc bus and not found we are hitting the
> case in which the device has not been yet discovered by the bus.
>
> Return -EPROBE_DEFER so that callers can differentiate this case.
>
> Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
Acked-by: Laurentiu Tudor <laurentiu.tudor@....com>
---
Best Regards, Laurentiu
> ---
> drivers/bus/fsl-mc/fsl-mc-bus.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 34811db074b7..28d5da1c011c 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -936,6 +936,15 @@ struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev)
> endpoint_desc.id = endpoint2.id;
> endpoint = fsl_mc_device_lookup(&endpoint_desc, mc_bus_dev);
>
> + /*
> + * We know that the device has an endpoint because we verified by
> + * interrogating the firmware. This is the case when the device was not
> + * yet discovered by the fsl-mc bus, thus the lookup returned NULL.
> + * Differentiate this case by returning EPROBE_DEFER.
> + */
> + if (!endpoint)
> + return ERR_PTR(-EPROBE_DEFER);
> +
> return endpoint;
> }
> EXPORT_SYMBOL_GPL(fsl_mc_get_endpoint);
>
Powered by blists - more mailing lists