All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] can: flexcan: use of_property_read_u32 to avoid endian problem
@ 2012-06-28  2:58 Hui Wang
  2012-06-28  3:32 ` Shawn Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Hui Wang @ 2012-06-28  2:58 UTC (permalink / raw)
  To: mkl, davem, shawn.guo, wg; +Cc: linux-can

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: linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
---
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(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 38c0690..f63f826 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -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);
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-28  5:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-28  2:58 [PATCH] can: flexcan: use of_property_read_u32 to avoid endian problem Hui Wang
2012-06-28  3:32 ` Shawn Guo
2012-06-28  5:06   ` Oliver Hartkopp
2012-06-28  5:18     ` Hui Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.