linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: kieran.bingham+renesas@ideasonboard.com,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: linux-renesas-soc@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Jacopo Mondi" <jacopo@jmondi.org>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	sakari.ailus@iki.fi, "Hans Verkuil" <hverkuil@xs4all.nl>,
	"Hyun Kwon" <hyunk@xilinx.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Jacopo Mondi" <jacopo+renesas@jmondi.org>,
	"Laurent Pinchart" <laurent.pinchart+renesas@ideasonboard.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: Re: [PATCH v9 2/4] media: i2c: Add MAX9286 driver
Date: Thu, 14 May 2020 13:27:01 +0100	[thread overview]
Message-ID: <d4d0e298-b863-8c6e-c9d7-ba861a98359e@ideasonboard.com> (raw)
In-Reply-To: <f46ed5fc-4eb0-8841-25b8-ef6c45e7ac87@ideasonboard.com>

Hi Mani,

On 14/05/2020 12:47, Kieran Bingham wrote:
> On 14/05/2020 11:13, Manivannan Sadhasivam wrote:
>> Hi Kieran,
<snip>

>>>>> +static int max9286_parse_dt(struct max9286_priv *priv)
>>>>> +{
>>>>> +	struct device *dev = &priv->client->dev;
>>>>> +	struct device_node *i2c_mux;
>>>>> +	struct device_node *node = NULL;
>>>>> +	unsigned int i2c_mux_mask = 0;
>>>>> +
>>>>> +	of_node_get(dev->of_node);
>>>>
>>>> Why this is needed?
>>>
>>> Hrm .. I recall adding it to solve dt reference balancing.
>>>
>>> I wish I'd added a comment at the time ... as I can't recall the details
>>> now.
>>>
>>
>> I understand that it is for the refcount balancing but I certainly don't see
>> a need for it.
> 
> I'll go through and try to validate this again now.

Aha, that's why:

 *	of_find_node_by_name - Find a node by its "name" property
 *	@from:	The node to start searching from or NULL; the node
 *		you pass will not be searched, only the next one
 *		will. Typically, you pass what the previous call
 *		returned. of_node_put() will be called on @from.
 *	@name:	The name string to match against

I'll add a comment to state that it is to balance the of_node_put during
of_find_node_by_name().

--
Kieran


>>>>> +	i2c_mux = of_find_node_by_name(dev->of_node, "i2c-mux");
>>>>> +	if (!i2c_mux) {
>>>>> +		dev_err(dev, "Failed to find i2c-mux node\n");
>>>>> +		of_node_put(dev->of_node);
>>>>> +		return -EINVAL;
>>>>> +	}
>>>>> +
>> [...]
>>>>
-- 
Regards
--
Kieran

  reply	other threads:[~2020-05-14 12:27 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 15:51 [PATCH v9 0/4] MAX9286 GMSL Support (+RDACM20) Kieran Bingham
2020-05-12 15:51 ` [PATCH v9 1/4] dt-bindings: media: i2c: Add bindings for Maxim Integrated MAX9286 Kieran Bingham
2020-05-12 22:33   ` Rob Herring
2020-05-12 22:36   ` Rob Herring
2020-05-13 12:28     ` Jacopo Mondi
2020-05-12 15:51 ` [PATCH v9 2/4] media: i2c: Add MAX9286 driver Kieran Bingham
2020-05-12 17:40   ` Manivannan Sadhasivam
2020-05-14  9:53     ` Kieran Bingham
2020-05-14  9:59       ` Manivannan Sadhasivam
2020-05-14 10:05         ` Kieran Bingham
2020-05-12 18:17   ` Manivannan Sadhasivam
2020-05-14 10:02     ` Kieran Bingham
2020-05-14 10:13       ` Manivannan Sadhasivam
2020-05-14 11:47         ` Kieran Bingham
2020-05-14 11:59           ` Geert Uytterhoeven
2020-05-14 12:48             ` Manivannan Sadhasivam
2020-05-14 13:50               ` Kieran Bingham
2020-05-14 11:47         ` Kieran Bingham
2020-05-14 12:27           ` Kieran Bingham [this message]
2020-05-14 12:54             ` Manivannan Sadhasivam
2020-05-16 21:51   ` Sakari Ailus
2020-05-18 11:45     ` Kieran Bingham
2020-05-18 12:38       ` Jacopo Mondi
2020-05-18 13:09         ` Kieran Bingham
2020-05-19  8:10       ` Sakari Ailus
2020-05-19  8:55         ` Kieran Bingham
2020-05-19  9:03           ` Sakari Ailus
2020-05-20  0:50       ` Laurent Pinchart
2020-05-26  8:54         ` Sakari Ailus
2020-05-12 15:51 ` [PATCH v9 3/4] dt-bindings: media: i2c: Add bindings for IMI RDACM2x Kieran Bingham
2020-05-12 15:51 ` [PATCH v9 4/4] media: i2c: Add RDACM20 driver Kieran Bingham
2020-05-16 22:36   ` Sakari Ailus
2020-05-18  7:35     ` Jacopo Mondi

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=d4d0e298-b863-8c6e-c9d7-ba861a98359e@ideasonboard.com \
    --to=kieran.bingham@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil@xs4all.nl \
    --cc=hyunk@xilinx.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jacopo@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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).