Skip to content

Commit

Permalink
net: axinet: Use of_property_read_u32 instead of open-coding it
Browse files Browse the repository at this point in the history
Use of_property_read_u32 instead of of_get_property with return value
checks and endianness conversion.

Signed-off-by: Tobias Klauser <[email protected]>
Reviewed-by: Sören Brinkmann <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
tklauser authored and davem330 committed Sep 24, 2015
1 parent e734a42 commit 729bf32
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
{
int ret;
u32 clk_div, host_clock;
u32 *property_p;
struct mii_bus *bus;
struct resource res;
struct device_node *np1;
Expand Down Expand Up @@ -168,8 +167,7 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
clk_div = DEFAULT_CLOCK_DIVISOR;
goto issue;
}
property_p = (u32 *) of_get_property(np1, "clock-frequency", NULL);
if (!property_p) {
if (of_property_read_u32(np1, "clock-frequency", &host_clock)) {
netdev_warn(lp->ndev, "clock-frequency property not found.\n");
netdev_warn(lp->ndev,
"Setting MDIO clock divisor to default %d\n",
Expand All @@ -179,7 +177,6 @@ int axienet_mdio_setup(struct axienet_local *lp, struct device_node *np)
goto issue;
}

host_clock = be32_to_cpup(property_p);
clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1;
/* If there is any remainder from the division of
* fHOST / (MAX_MDIO_FREQ * 2), then we need to add
Expand Down

0 comments on commit 729bf32

Please sign in to comment.