LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Daniel Scally <djrscally@gmail.com>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
rafael@kernel.org, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint()
Date: Fri, 30 Jul 2021 14:34:31 +0300 [thread overview]
Message-ID: <YQPjxzpfGn0csS+S@smile.fi.intel.com> (raw)
In-Reply-To: <acf4838d-3c70-20c1-5fce-ee36765b06c4@gmail.com>
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);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-07-30 11:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-22 20:19 [PATCH 0/2] Check for endpoints in fwnode->secondary more sensibly Daniel Scally
2021-07-22 20:19 ` [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint() Daniel Scally
2021-07-23 12:32 ` Andy Shevchenko
2021-07-23 13:04 ` Daniel Scally
2021-07-30 11:34 ` Andy Shevchenko [this message]
2021-07-31 21:36 ` Daniel Scally
2021-07-22 20:19 ` [PATCH 2/2] Revert "media: device property: Call fwnode_graph_get_endpoint_by_id() for fwnode->secondary" Daniel Scally
2021-07-23 12:33 ` [PATCH 0/2] Check for endpoints in fwnode->secondary more sensibly Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YQPjxzpfGn0csS+S@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=djrscally@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--subject='Re: [PATCH 1/2] device property: Check fwnode->secondary in fwnode_graph_get_next_endpoint()' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).