From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>,
Daniel Scally <djrscally@gmail.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Hans de Goede <hdegoede@redhat.com>,
linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH v2 1/6] device property: Helper to match multiple connections
Date: Sun, 20 Feb 2022 13:16:46 +0200 [thread overview]
Message-ID: <YhIjHjMrhUpM0ucV@smile.fi.intel.com> (raw)
In-Reply-To: <Yg/s3eKB2wLEQTgY@ripper>
On Fri, Feb 18, 2022 at 11:00:45AM -0800, Bjorn Andersson wrote:
> On Wed 09 Feb 04:30 PST 2022, Andy Shevchenko wrote:
> > On Mon, Feb 07, 2022 at 07:19:39PM -0800, Bjorn Andersson wrote:
...
> > > +int fwnode_connection_find_matches(struct fwnode_handle *fwnode,
> > > + const char *con_id, void *data,
> > > + devcon_match_fn_t match,
> > > + void **matches, unsigned int matches_len)
> > > +{
> > > + unsigned int count;
> > > +
> > > + if (!fwnode || !match || !matches)
> >
> > !matches case may be still useful to get the count and allocate memory by
> > caller. Please, consider this case.
> >
>
> As discussed in previous version, and described in the commit message,
> the returned value of "match" is a opaque pointer to something which
> has to be passed back to the caller in order to be cleaned up.
>
> E.g. the typec mux code returns a pointer to a typec_mux/switch object
> with a refcounted struct device within, or an ERR_PTR().
>
> So unfortunately we can must gather the results into matches and pass it
> back to the caller to take consume or clean up.
It's fine. You have **matches, means pointer of an opaque pointer.
What I'm talking about is memory allocation for and array of _pointers_.
That's what caller very much aware of and can allocate on heap. So, please
consider this case.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-02-20 11:17 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 3:19 [PATCH v2 0/6] typec: mux: Introduce support for multiple TypeC muxes Bjorn Andersson
2022-02-08 3:19 ` [PATCH v2 1/6] device property: Helper to match multiple connections Bjorn Andersson
2022-02-09 12:30 ` Andy Shevchenko
2022-02-18 19:00 ` Bjorn Andersson
2022-02-20 11:16 ` Andy Shevchenko [this message]
2022-02-21 4:55 ` Bjorn Andersson
2022-02-21 17:19 ` Andy Shevchenko
2022-02-21 19:08 ` Bjorn Andersson
2022-02-08 3:19 ` [PATCH v2 2/6] device property: Use multi-connection matchers for single case Bjorn Andersson
2022-02-08 3:19 ` [PATCH v2 3/6] typec: mux: Introduce indirection Bjorn Andersson
2022-02-18 10:39 ` Heikki Krogerus
2022-02-08 3:19 ` [PATCH v2 4/6] typec: mux: Allow multiple mux_devs per mux Bjorn Andersson
2022-02-18 10:40 ` Heikki Krogerus
2022-02-08 3:19 ` [PATCH v2 5/6] dt-bindings: usb: Add binding for fcs,fsa4480 Bjorn Andersson
2022-02-11 16:35 ` Rob Herring
2022-02-08 3:19 ` [PATCH v2 6/6] usb: typec: mux: Add On Semi fsa4480 driver Bjorn Andersson
2022-02-08 13:24 ` Andy Shevchenko
2022-02-10 10:00 ` [PATCH v2 0/6] typec: mux: Introduce support for multiple TypeC muxes Hans de Goede
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=YhIjHjMrhUpM0ucV@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=djrscally@gmail.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=hdegoede@redhat.com \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox