public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J.D. Schroeder" <Linux.HWI@garmin.com>
To: David Miller <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<Grygorii.Strashko@linaro.org>, <jay.schroeder@garmin.com>,
	<ben.mccauley@garmin.com>
Subject: Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus
Date: Thu, 28 Apr 2016 16:39:36 -0500	[thread overview]
Message-ID: <57228318.90600@garmin.com> (raw)
In-Reply-To: <20160428.154410.1087934312951322476.davem@davemloft.net>

On 04/28/2016 02:44 PM, David Miller wrote:
>> --- a/drivers/net/ethernet/ti/davinci_mdio.c
>> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
>> @@ -343,6 +343,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
>>  		if (davinci_mdio_probe_dt(&data->pdata, pdev))
>>  			data->pdata = default_pdata;
>>  		snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s", pdev->name);
>> +		data->bus->dev.of_node = dev->of_node;
>>  	} else {
>>  		data->pdata = pdata ? (*pdata) : default_pdata;
>>  		snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s-%x",
> 
> You can't do this.
> 
> First of all, of_node objects are reference counted.  So even if this was a
> legal thing to do you would have to drop the reference to the existing of_node
> pointer and gain a reference to dev->of_node.
> 
> But even more importantly, it is the job of the bus driver to set that
> bus->dev.of_node correctly, you should never override it in a driver like
> this.

David, thanks for your review. I understand your point about the reference count.

One thing to note is that it is always null for the davinci mdio bus when
going through this path. I'm not trying to override it. I'm trying to make
sure it has a way to find the davinci mdio bus. Do you see the problem I'm
trying to solve?

Is there another way to be able to make the of_mdio_find_bus() call be able to
find the davinci mdio bus?

Thanks,
JD

  reply	other threads:[~2016-04-28 21:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-25 14:46 [PATCH] net: davinci_mdio: Set of_node in the mdio bus J.D. Schroeder
2016-04-28 19:44 ` David Miller
2016-04-28 21:39   ` J.D. Schroeder [this message]
2016-04-28 21:48     ` David Miller
2016-04-28 23:19     ` Andrew Lunn

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=57228318.90600@garmin.com \
    --to=linux.hwi@garmin.com \
    --cc=Grygorii.Strashko@linaro.org \
    --cc=ben.mccauley@garmin.com \
    --cc=davem@davemloft.net \
    --cc=jay.schroeder@garmin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.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