[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFLoDVHB0ywv6LYXXUM26KHB8spp3phkPGADXqhps6Z0cre0QA@mail.gmail.com>
Date: Sat, 31 Jul 2021 22:36:14 +0100
From: Daniel Scally <djrscally@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>
Subject: Re: [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint()
On Fri, Jul 30, 2021 at 12:34 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> On Fri, Jul 23, 2021 at 02:04:59PM +0100, Daniel Scally wrote:
> >
> > On 23/07/2021 13:32, Andy Shevchenko wrote:
> > > On Thu, Jul 22, 2021 at 09:19:28PM +0100, Daniel Scally wrote:
> > >> Sensor drivers often check for an endpoint to make sure that they're
> > >> connected to a consuming device like a CIO2 during .probe(). Some of
> > >> those endpoints might be in the form of software_nodes assigned as
> > >> a secondary to the device's fwnode_handle. Account for this possibility
> > >> in fwnode_graph_get_next_endpoint() to avoid having to do it in the
> > >> sensor drivers themselves.
> > > ...
> > >
> > >> + ep = fwnode_call_ptr_op(parent, graph_get_next_endpoint, prev);
> > >> +
> > >> + if (IS_ERR_OR_NULL(ep) && !IS_ERR_OR_NULL(parent) &&
> > >> + !IS_ERR_OR_NULL(parent->secondary))
> > > Nit-pick, I would put it like:
> > >
> > > if (!IS_ERR_OR_NULL(parent->secondary) && !IS_ERR_OR_NULL(parent) &&
> > > IS_ERR_OR_NULL(ep))
> > >
> > > or
> > >
> > > if (IS_ERR_OR_NULL(ep) &&
> > > !IS_ERR_OR_NULL(parent->secondary) && !IS_ERR_OR_NULL(parent))
> > >
> > > for the sake of logical split.
> >
> >
> > OK; I'll do the second one, feel like it's better to have ep as the
> > first check.
>
> Fine, but also I have just noticed that parent should be checked before
> parent->secondary.
>
> Something like this
>
> if (IS_ERR_OR_NULL(ep) &&
> !IS_ERR_OR_NULL(parent) && IS_ERR_OR_NULL(parent->secondary))
>
> > >> + ep = fwnode_graph_get_next_endpoint(parent->secondary, NULL);
Yes, no problem. I'll send a v2 when I can, It will likely be another
week or so though, my computer's in a cardboard box.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Powered by blists - more mailing lists