linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff LaBundy <jeff@labundy.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: robh+dt@kernel.org, linux-input@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 01/11] Input: iqs7222 - drop unused device node references
Date: Fri, 9 Sep 2022 19:00:53 -0500	[thread overview]
Message-ID: <YxvTtW/NkQQ7aGNF@nixie71> (raw)
In-Reply-To: <YxrDJYOsllUDqiod@google.com>

Hi Dmitry,

On Thu, Sep 08, 2022 at 09:37:57PM -0700, Dmitry Torokhov wrote:
> On Thu, Sep 08, 2022 at 09:04:06PM -0500, Jeff LaBundy wrote:
> > Hi Dmitry,
> > 
> > Thank you for taking a look.
> > 
> > On Thu, Sep 08, 2022 at 02:17:21PM -0700, Dmitry Torokhov wrote:
> > > On Thu, Sep 08, 2022 at 08:15:38AM -0500, Jeff LaBundy wrote:
> > > > Each call to device/fwnode_get_named_child_node() must be matched
> > > > with a call to fwnode_handle_put() once the corresponding node is
> > > > no longer in use. This ensures a reference count remains balanced
> > > > in the case of dynamic device tree support.
> > > > 
> > > > Currently, the driver never calls fwnode_handle_put(). This patch
> > > > adds the missing calls.
> > > 
> > > Hmm, dev_fwnode() however does not do that, which means that
> > > iqs7222_parse_props() has different refounting, depending on what is
> > > being fetched. I think we need to start there.
> > 
> > Right, but none of the callers that prompt iqs7222_parse_props() to
> > use dev_fwnode() follow with fwnode_handle_put().
> 
> I think this is a problem that code has to be aware of that and behave
> differently. I'd recommend bumping up refcount in dev_fwnode() path so
> that all callers would behave uniformly. 

Agreed, right now the problem is that not all callers have a node to
put. So, I think the solution is to more thoughtfully encapsulate all
of this such that the caller is always responsible for passing a node,
iqs7222_parse_props() bumps the refcount of whatever it is fetching,
and the caller is always responsible for dropping the node.

This way, callers of iqs7222_parse_props() need not be burdened with
what it chooses to do under the hood.

> 
> Thanks.
> 
> -- 
> Dmitry

Kind regards,
Jeff LaBundy

  reply	other threads:[~2022-09-10  0:01 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08 13:15 [PATCH 00/11] Additional fixes for Azoteq IQS7222A/B/C Jeff LaBundy
2022-09-08 13:15 ` [PATCH 01/11] Input: iqs7222 - drop unused device node references Jeff LaBundy
2022-09-08 21:17   ` Dmitry Torokhov
2022-09-09  2:04     ` Jeff LaBundy
2022-09-09  4:37       ` Dmitry Torokhov
2022-09-10  0:00         ` Jeff LaBundy [this message]
2022-09-08 13:15 ` [PATCH 02/11] Input: iqs7222 - report malformed properties Jeff LaBundy
2022-09-08 21:21   ` Dmitry Torokhov
2022-09-09  2:08     ` Jeff LaBundy
2022-09-09  4:42       ` Dmitry Torokhov
2022-09-10  0:04         ` Jeff LaBundy
2022-09-08 13:15 ` [PATCH 03/11] dt-bindings: input: iqs7222: Correct minimum slider size Jeff LaBundy
2022-09-13 11:37   ` Rob Herring
2022-09-08 13:15 ` [PATCH 04/11] Input: iqs7222 - protect against undefined " Jeff LaBundy
2022-09-08 13:15 ` [PATCH 05/11] Input: iqs7222 - trim force communication command Jeff LaBundy
2022-09-08 21:24   ` Dmitry Torokhov
2022-09-13 21:24     ` Jeff LaBundy
2022-09-14 10:10       ` Dmitry Torokhov
2022-09-08 13:15 ` [PATCH 06/11] Input: iqs7222 - avoid sending empty SYN_REPORT events Jeff LaBundy
2022-09-14 10:10   ` Dmitry Torokhov
2022-09-08 13:15 ` [PATCH 07/11] Input: iqs7222 - set all ULP entry masks by default Jeff LaBundy
2022-09-14 10:10   ` Dmitry Torokhov
2022-09-08 13:15 ` [PATCH 08/11] Input: iqs7222 - allow 'linux,code' to be optional Jeff LaBundy
2022-09-08 13:15 ` [PATCH 09/11] dt-bindings: input: iqs7222: Allow " Jeff LaBundy
2022-09-13 11:42   ` Rob Herring
2022-09-13 13:47     ` Jeff LaBundy
2022-09-08 13:15 ` [PATCH 10/11] dt-bindings: input: iqs7222: Add support for IQS7222A v1.13+ Jeff LaBundy
2022-09-13 11:44   ` Rob Herring
2022-09-08 13:15 ` [PATCH 11/11] Input: iqs7222 - add " Jeff LaBundy

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=YxvTtW/NkQQ7aGNF@nixie71 \
    --to=jeff@labundy.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).