From: Hui Wang <jason77.wang@gmail.com>
To: mkl@pengutronix.de, davem@davemloft.net, shawn.guo@linaro.org,
wg@grandegger.com
Cc: linux-can@vger.kernel.org
Subject: [PATCH] can: flexcan: use of_property_read_u32 to avoid endian problem
Date: Thu, 28 Jun 2012 10:58:57 +0800 [thread overview]
Message-ID: <1340852337-19840-1-git-send-email-jason77.wang@gmail.com> (raw)
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
next reply other threads:[~2012-06-28 2:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 2:58 Hui Wang [this message]
2012-06-28 3:32 ` [PATCH] can: flexcan: use of_property_read_u32 to avoid endian problem Shawn Guo
2012-06-28 5:06 ` Oliver Hartkopp
2012-06-28 5:18 ` Hui Wang
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=1340852337-19840-1-git-send-email-jason77.wang@gmail.com \
--to=jason77.wang@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-can@vger.kernel.org \
--cc=mkl@pengutronix.de \
--cc=shawn.guo@linaro.org \
--cc=wg@grandegger.com \
/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).