netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: Linux.HWI@garmin.com
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 15:44:10 -0400 (EDT)	[thread overview]
Message-ID: <20160428.154410.1087934312951322476.davem@davemloft.net> (raw)
In-Reply-To: <1461595571-11438-1-git-send-email-Linux.HWI@garmin.com>

From: "J.D. Schroeder" <Linux.HWI@garmin.com>
Date: Mon, 25 Apr 2016 09:46:11 -0500

> From: "J.D. Schroeder" <jay.schroeder@garmin.com>
> 
> Assigns the of_node from the platform device to the of_node of the
> mdio bus so that it can be used in the mdio driver to properly match
> a bus in the DT with a phandle in of_mdio_find_bus().
> 
> Signed-off-by: J.D. Schroeder <jay.schroeder@garmin.com>
> Signed-off-by: Ben McCauley <ben.mccauley@garmin.com>
> ---
>  drivers/net/ethernet/ti/davinci_mdio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index 4e7c9b9..b5e5f37 100644
> --- 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.

I'm not applying this, sorry.

  reply	other threads:[~2016-04-28 19:44 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 [this message]
2016-04-28 21:39   ` J.D. Schroeder
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=20160428.154410.1087934312951322476.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Grygorii.Strashko@linaro.org \
    --cc=Linux.HWI@garmin.com \
    --cc=ben.mccauley@garmin.com \
    --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;
as well as URLs for NNTP newsgroup(s).