Skip to contentSkip to conversation

can: flexcan: use of_property_read_u32 to avoid endian problem

PATCH In review Hui Wang 3 participants 4 messages Jun 28, 2012 CAN network drivers

lore
Share & tools
lore

Hui Wang

author
#0 lore raw

PATCH 1/1 can: flexcan: use of_property_read_u32 to avoid endian problem

Use of_property_read_u32() to get DT value can avoid endian problems, this is needed since this driver can run on powerpc (be) and arm (le).

No need to check ret value here since we will check the got value to verify if users pass a valid value in the DT.

Cc Marc Kleine-Budde <[email protected]>
Cc David S. Miller <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Wolfgang Grandegger <[email protected]>

---
This is the patch to replace the one "can: flexcan: use be32_to_cpup to handle the value of dt entry", if you already applied that patch and can't revert, please ignore this patch and let me know,i will prepare an incremental patch basing on that one.

 drivers/net/can/flexcan.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/net/can/flexcan.c +3 -8
index 38c0690..f63f826 100644
@@ -938,14 +938,9 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	if (IS_ERR(pinctrl))
 		return PTR_ERR(pinctrl);
 
-	if (pdev->dev.of_node) {
-		const u32 *clock_freq_p;
-
-		clock_freq_p = of_get_property(pdev->dev.of_node,
-						"clock-frequency", NULL);
-		if (clock_freq_p)
-			clock_freq = *clock_freq_p;
-	}
+	if (pdev->dev.of_node)
+		of_property_read_u32(pdev->dev.of_node,
+						"clock-frequency", &clock_freq);
 
 	if (!clock_freq) {
 		clk = clk_get(&pdev->dev, NULL);
Signature · 1 line
1.7.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Hui Wang

Use of_property_read_u32() to get DT value can avoid endian problems, this is needed since this driver can run on powerpc (be) and arm (le).

No need to check ret value here since we will check the got value to verify if users pass a valid value in the DT.

Cc Marc Kleine-Budde <[email protected]>
Cc David S. Miller <[email protected]>
Cc Shawn Guo <[email protected]>
Quoted 2 lines
Cc Wolfgang Grandegger <[email protected]>
#2 lore raw

The first patch (you wanted to superseed) has already been pulled from Dave Miller, see:

http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=commitdiff;h=85f2f834e85517307f13e30e630a5fc86f757cb5

If you want to update your patch you need to do this based on your already accepted patch.

Regards,
Oliver

Btw. no need to put Dave Miller in all your CAN-related postings in CC. He get's hundreds of mails each day ...

Quoted 20 lines · Shawn Guo
Quoted 10 lines · Hui Wang

Use of_property_read_u32() to get DT value can avoid endian problems, this is needed since this driver can run on powerpc (be) and arm (le).

No need to check ret value here since we will check the got value to verify if users pass a valid value in the DT.

Cc Marc Kleine-Budde <[email protected]>
Cc David S. Miller <[email protected]>
Cc Shawn Guo <[email protected]>
Quoted 2 lines
Cc Wolfgang Grandegger <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#3 lore raw
Quoted 8 lines · Oliver Hartkopp

The first patch (you wanted to superseed) has already been pulled from Dave Miller, see:

http://git.kernel.org/?p=linux/kernel/git/davem/net.git;a=commitdiff;h=85f2f834e85517307f13e30e630a5fc86f757cb5

If you want to update your patch you need to do this based on your already accepted patch.

Got it, i will generate an incremental patch basing on it.

Quoted 6 lines

Regards,
Oliver

Btw. no need to put Dave Miller in all your CAN-related postings in CC. He get's hundreds of mails each day ...

OK.

Regards,
Hui.

Quoted 31 lines · Shawn Guo
Quoted 26 lines · Hui Wang
Quoted 4 lines

Use of_property_read_u32() to get DT value can avoid endian problems, this is needed since this driver can run on powerpc (be) and arm (le).

Quoted 8 lines

No need to check ret value here since we will check the got value to verify if users pass a valid value in the DT.

Cc Marc Kleine-Budde <[email protected]>
Cc David S. Miller <[email protected]>
Cc Shawn Guo <[email protected]>
Quoted 3 lines
Cc Wolfgang Grandegger <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html