[PATCH v2 5/7] usb: onboard-hub: Bail out if peer hub is already probed

Abbarapu, Venkatesh venkatesh.abbarapu at amd.com
Tue Oct 1 07:20:09 CEST 2024


Hi Marek,

> -----Original Message-----
> From: Marek Vasut <marex at denx.de>
> Sent: Saturday, September 28, 2024 2:12 AM
> To: Abbarapu, Venkatesh <venkatesh.abbarapu at amd.com>; u-boot at lists.denx.de
> Cc: Simek, Michal <michal.simek at amd.com>; fabrice.gasnier at foss.st.com; git
> (AMD-Xilinx) <git at amd.com>
> Subject: Re: [PATCH v2 5/7] usb: onboard-hub: Bail out if peer hub is already probed
> 
> On 9/27/24 9:01 AM, Venkatesh Yadav Abbarapu wrote:
> > The .bind function is implemented to bind the correct "half" of the
> > hub that the driver wants to bind, and returning -ENODEV for the other
> > "half".
> >
> > Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> > ---
> >   common/usb_onboard_hub.c | 20 ++++++++++++++++++++
> >   1 file changed, 20 insertions(+)
> >
> > diff --git a/common/usb_onboard_hub.c b/common/usb_onboard_hub.c index
> > 00808ed45e..9c50ca09c9 100644
> > --- a/common/usb_onboard_hub.c
> > +++ b/common/usb_onboard_hub.c
> > @@ -162,6 +162,25 @@ err:
> >   	return ret;
> >   }
> >
> > +static int usb_onboard_hub_bind(struct udevice *dev) {
> > +	struct ofnode_phandle_args phandle;
> > +	const void *fdt = gd->fdt_blob;
> > +	int ret, off;
> > +
> > +	if (dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0,
> > +&phandle)) {
> 
> Return the error code:
> 
> ret = dev_read_phandle_with_args()
> if (ret) {
> ...
> return ret;
> }
> 
> > +		dev_err(dev, "peer-hub not specified\n");
> > +		return -ENOENT;
> > +	}
> > +
> > +	off = ofnode_to_offset(phandle.node);
> > +	ret = fdt_node_check_compatible(fdt, off, "usb424,5744");
> 
> return fdt_node_check_compatible(...);
The return value of fdt_node_check_compatible is "0" in success case and "1" in failure.
I can't return fdt_node_check_compatible() directly as need to return -ENODEV for other half of the hub.

Thanks
Venkatesh


More information about the U-Boot mailing list