Skip to contentSkip to conversation

can: mpc5xxx_can.c: Fix build failure

PATCH Applied Anatolij Gustschin 4 participants 6 messages May 31, 2010 – Jun 1, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 can: mpc5xxx_can.c: Fix build failure

Fixes build error caused by the OF device_node pointer being moved into struct device.

Cc Wolfgang Grandegger <[email protected]>
Cc Grant Likely <[email protected]>
---
 drivers/net/can/mscan/mpc5xxx_can.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +4 -4
index 8af8442..f48deaf 100644
@@ -152,7 +152,7 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	}
 
 	/* Determine the MSCAN device index from the physical address */
-	pval = of_get_property(ofdev->node, "reg", &plen);
+	pval = of_get_property(ofdev->dev.of_node, "reg", &plen);
 	BUG_ON(!pval || plen < sizeof(*pval));
 	clockidx = (*pval & 0x80) ? 1 : 0;
 	if (*pval & 0x2000)
@@ -168,11 +168,11 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	 */
 	if (clock_name && !strcmp(clock_name, "ip")) {
 		*mscan_clksrc = MSCAN_CLKSRC_IPS;
-		freq = mpc5xxx_get_bus_frequency(ofdev->node);
+		freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
 	} else {
 		*mscan_clksrc = MSCAN_CLKSRC_BUS;
 
-		pval = of_get_property(ofdev->node,
+		pval = of_get_property(ofdev->dev.of_node,
 				       "fsl,mscan-clock-divider", &plen);
 		if (pval && plen == sizeof(*pval))
 			clockdiv = *pval;
@@ -251,7 +251,7 @@ static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
 				       const struct of_device_id *id)
 {
 	struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
-	struct device_node *np = ofdev->node;
+	struct device_node *np = ofdev->dev.of_node;
 	struct net_device *dev;
 	struct mscan_priv *priv;
 	void __iomem *base;
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Anatolij,

Quoted 38 lines · Anatolij Gustschin

Fixes build error caused by the OF device_node pointer being moved into struct device.

Cc Wolfgang Grandegger <[email protected]>
Cc Grant Likely <[email protected]>
---
 drivers/net/can/mscan/mpc5xxx_can.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +3 -3
index 8af8442..f48deaf 100644
@@ -152,7 +152,7 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	}
 
 	/* Determine the MSCAN device index from the physical address */
-	pval = of_get_property(ofdev->node, "reg", &plen);
+	pval = of_get_property(ofdev->dev.of_node, "reg", &plen);
 	BUG_ON(!pval || plen < sizeof(*pval));
 	clockidx = (*pval & 0x80) ? 1 : 0;
 	if (*pval & 0x2000)
@@ -168,11 +168,11 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	 */
 	if (clock_name && !strcmp(clock_name, "ip")) {
 		*mscan_clksrc = MSCAN_CLKSRC_IPS;
-		freq = mpc5xxx_get_bus_frequency(ofdev->node);
+		freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
 	} else {
 		*mscan_clksrc = MSCAN_CLKSRC_BUS;
 
-		pval = of_get_property(ofdev->node,
+		pval = of_get_property(ofdev->dev.of_node,
 				       "fsl,mscan-clock-divider", &plen);
 		if (pval && plen == sizeof(*pval))
 			clockdiv = *pval;

drivers/net/can/mscan/mpc5xxx_can.c static int __devinit mpc5xxx_can_probe(struct of_device *ofdev, · line 257

Quoted 8 lines
drivers/net/can/mscan/mpc5xxx_can.c +1 -1
@@ -251,7 +251,7 @@ static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
 				       const struct of_device_id *id)
 {
 	struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
-	struct device_node *np = ofdev->node;
+	struct device_node *np = ofdev->dev.of_node;
 	struct net_device *dev;
 	struct mscan_priv *priv;
 	void __iomem *base;

The patch seems incomplete. I get at least one more warning (because I'm compiling for 52xx, I guess):

CC drivers/net/can/mscan/mpc5xxx_can.o
drivers/net/can/mscan/mpc5xxx_can.c: In function 'mpc52xx_can_get_clock':
drivers/net/can/mscan/mpc5xxx_can.c:76: error: 'struct of_device' has no member named 'node'

Should I send v2? Thanks for fixing that. I also checked the sja1000_of_platform driver, which was converted correctly.

Wolfgang.

#2 lore raw

Hi Wolfgang,

On Mon, 31 May 2010 20:27:01 +0200
Wolfgang Grandegger <[email protected]> wrote:
...

Quoted 4 lines
Quoted 4 lines
drivers/net/can/mscan/mpc5xxx_can.c +0 -0
@@ -251,7 +251,7 @@ static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
 				       const struct of_device_id *id)
 {
 	struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
Quoted 8 lines

drivers/net/can/mscan/mpc5xxx_can.c static int __devinit mpc5xxx_can_probe(struct of_device *ofdev, · line 257

Quoted 5 lines
drivers/net/can/mscan/mpc5xxx_can.c +1 -1
-	struct device_node *np = ofdev->node;
+	struct device_node *np = ofdev->dev.of_node;
 	struct net_device *dev;
 	struct mscan_priv *priv;
 	void __iomem *base;

The patch seems incomplete. I get at least one more warning (because I'm compiling for 52xx, I guess):

Yes, this is true. Unfortunately I didn't compile for 5200 and the issue didn't show up.

Quoted 6 lines

CC drivers/net/can/mscan/mpc5xxx_can.o
drivers/net/can/mscan/mpc5xxx_can.c: In function 'mpc52xx_can_get_clock':
drivers/net/can/mscan/mpc5xxx_can.c:76: error: 'struct of_device' has no member named 'node'

Should I send v2? Thanks for fixing that. I also checked the sja1000_of_platform driver, which was converted correctly.

I will send v2 patch shortly. Thanks for reporting!

Anatolij

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer Applied
#5 lore raw

From: Wolfgang Grandegger <[email protected]>
Date: Tue, 01 Jun 2010 08:20:50 +0200

Quoted 12 lines · Wolfgang Grandegger
Quoted 9 lines

Hi Anatolij,

Quoted 6 lines · Anatolij Gustschin

Fixes build error caused by the OF device_node pointer being moved into struct device.

Cc Wolfgang Grandegger <[email protected]>
Cc Grant Likely <[email protected]>

Applied, thanks.

#6 lore raw

PATCH v2 1/1 can: mpc5xxx_can.c: Fix build failure

In reply to Anatolij Gustschin

Fixes build error caused by the OF device_node pointer being moved into struct device.

Cc Wolfgang Grandegger <[email protected]>
Cc Grant Likely <[email protected]>

---
v1 -> v2:
- also fix building for mpc5200 which also didn't work as reported by Wolfgang.

 drivers/net/can/mscan/mpc5xxx_can.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/can/mscan/mpc5xxx_can.c +5 -5
index 8af8442..af75393 100644
@@ -73,7 +73,7 @@ static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev,
 	else
 		*mscan_clksrc = MSCAN_CLKSRC_XTAL;
 
-	freq = mpc5xxx_get_bus_frequency(ofdev->node);
+	freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
 	if (!freq)
 		return 0;
 
@@ -152,7 +152,7 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	}
 
 	/* Determine the MSCAN device index from the physical address */
-	pval = of_get_property(ofdev->node, "reg", &plen);
+	pval = of_get_property(ofdev->dev.of_node, "reg", &plen);
 	BUG_ON(!pval || plen < sizeof(*pval));
 	clockidx = (*pval & 0x80) ? 1 : 0;
 	if (*pval & 0x2000)
@@ -168,11 +168,11 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
 	 */
 	if (clock_name && !strcmp(clock_name, "ip")) {
 		*mscan_clksrc = MSCAN_CLKSRC_IPS;
-		freq = mpc5xxx_get_bus_frequency(ofdev->node);
+		freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node);
 	} else {
 		*mscan_clksrc = MSCAN_CLKSRC_BUS;
 
-		pval = of_get_property(ofdev->node,
+		pval = of_get_property(ofdev->dev.of_node,
 				       "fsl,mscan-clock-divider", &plen);
 		if (pval && plen == sizeof(*pval))
 			clockdiv = *pval;
@@ -251,7 +251,7 @@ static int __devinit mpc5xxx_can_probe(struct of_device *ofdev,
 				       const struct of_device_id *id)
 {
 	struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
-	struct device_node *np = ofdev->node;
+	struct device_node *np = ofdev->dev.of_node;
 	struct net_device *dev;
 	struct mscan_priv *priv;
 	void __iomem *base;
Signature · 1 line
1.7.0.4