Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1390483

Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus
Date 2016-04-28 21:50 +0200
Message-ID <rt06L-1ay-15@gated-at.bofh.it> (permalink)
References <rt06L-1ay-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus David Miller <davem@davemloft.net> - 2016-04-28 21:50 +0200
  Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus David Miller <davem@davemloft.net> - 2016-04-28 23:50 +0200
  Re: [PATCH] net: davinci_mdio: Set of_node in the mdio bus Andrew Lunn <andrew@lunn.ch> - 2016-04-29 01:20 +0200

csiph-web