[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d4d0e298-b863-8c6e-c9d7-ba861a98359e@ideasonboard.com>
Date: Thu, 14 May 2020 13:27:01 +0100
From: Kieran Bingham <kieran.bingham@...asonboard.com>
To: kieran.bingham+renesas@...asonboard.com,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc: linux-renesas-soc@...r.kernel.org, linux-media@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Jacopo Mondi <jacopo@...ndi.org>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
sakari.ailus@....fi, Hans Verkuil <hverkuil@...all.nl>,
Hyun Kwon <hyunk@...inx.com>, Rob Herring <robh+dt@...nel.org>,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Niklas Söderlund
<niklas.soderlund+renesas@...natech.se>
Subject: Re: [PATCH v9 2/4] media: i2c: Add MAX9286 driver
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
Powered by blists - more mailing lists