Skip to content

Commit

Permalink
can: flexcan: use of_property_read_u32 to get DT entry value
Browse files Browse the repository at this point in the history
of_property_read_u32() can auto handle endian problems, use this
function can make code clean and simple.

No need to check return value here since the following got value
check will handle this.

Cc: linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Hui Wang <jason77.wang@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Hui Wang authored and Marc Kleine-Budde committed Jul 2, 2012
1 parent 8b7b736 commit afc016d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 __be32 *clock_freq_p;

clock_freq_p = of_get_property(pdev->dev.of_node,
"clock-frequency", NULL);
if (clock_freq_p)
clock_freq = be32_to_cpup(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);
Expand Down

0 comments on commit afc016d

Please sign in to comment.