All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
@ 2015-09-22 11:41 ` Tobias Klauser
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2015-09-22 11:41 UTC (permalink / raw)
  To: David S. Miller, Michal Simek
  Cc: Sören Brinkmann, linux-kernel, linux-arm-kernel

Use of_property_read_u32 to read the "clock-frequency" property instead
of using of_get_property with return value checks.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
index 8cf9d4f..415de1e 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
@@ -59,16 +59,15 @@ static int temac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
 int temac_mdio_setup(struct temac_local *lp, struct device_node *np)
 {
 	struct mii_bus *bus;
-	const u32 *bus_hz;
+	u32 bus_hz;
 	int clk_div;
-	int rc, size;
+	int rc;
 	struct resource res;
 
 	/* Calculate a reasonable divisor for the clock rate */
 	clk_div = 0x3f; /* worst-case default setting */
-	bus_hz = of_get_property(np, "clock-frequency", &size);
-	if (bus_hz && size >= sizeof(*bus_hz)) {
-		clk_div = (*bus_hz) / (2500 * 1000 * 2) - 1;
+	if (of_property_read_u32(np, "clock-frequency", &bus_hz) == 0) {
+		clk_div = bus_hz / (2500 * 1000 * 2) - 1;
 		if (clk_div < 1)
 			clk_div = 1;
 		if (clk_div > 0x3f)
-- 
2.5.0



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

* [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
@ 2015-09-22 11:41 ` Tobias Klauser
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2015-09-22 11:41 UTC (permalink / raw)
  To: linux-arm-kernel

Use of_property_read_u32 to read the "clock-frequency" property instead
of using of_get_property with return value checks.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
index 8cf9d4f..415de1e 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
@@ -59,16 +59,15 @@ static int temac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
 int temac_mdio_setup(struct temac_local *lp, struct device_node *np)
 {
 	struct mii_bus *bus;
-	const u32 *bus_hz;
+	u32 bus_hz;
 	int clk_div;
-	int rc, size;
+	int rc;
 	struct resource res;
 
 	/* Calculate a reasonable divisor for the clock rate */
 	clk_div = 0x3f; /* worst-case default setting */
-	bus_hz = of_get_property(np, "clock-frequency", &size);
-	if (bus_hz && size >= sizeof(*bus_hz)) {
-		clk_div = (*bus_hz) / (2500 * 1000 * 2) - 1;
+	if (of_property_read_u32(np, "clock-frequency", &bus_hz) == 0) {
+		clk_div = bus_hz / (2500 * 1000 * 2) - 1;
 		if (clk_div < 1)
 			clk_div = 1;
 		if (clk_div > 0x3f)
-- 
2.5.0

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

* Re: [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
  2015-09-22 11:41 ` Tobias Klauser
@ 2015-09-22 14:59   ` Sören Brinkmann
  -1 siblings, 0 replies; 8+ messages in thread
From: Sören Brinkmann @ 2015-09-22 14:59 UTC (permalink / raw)
  To: Tobias Klauser
  Cc: David S. Miller, Michal Simek, linux-kernel, linux-arm-kernel

On Tue, 2015-09-22 at 01:41PM +0200, Tobias Klauser wrote:
> Use of_property_read_u32 to read the "clock-frequency" property instead
> of using of_get_property with return value checks.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com>

	Sören

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

* [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
@ 2015-09-22 14:59   ` Sören Brinkmann
  0 siblings, 0 replies; 8+ messages in thread
From: Sören Brinkmann @ 2015-09-22 14:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2015-09-22 at 01:41PM +0200, Tobias Klauser wrote:
> Use of_property_read_u32 to read the "clock-frequency" property instead
> of using of_get_property with return value checks.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: S?ren Brinkmann <soren.brinkmann@xilinx.com>

	S?ren

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

* [PATCH v2] net: ll_temac: Use of_property_read_u32 instead of open-coding it
  2015-09-22 11:41 ` Tobias Klauser
@ 2015-09-23  7:20   ` Tobias Klauser
  -1 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2015-09-23  7:20 UTC (permalink / raw)
  To: David S. Miller, Michal Simek
  Cc: Sören Brinkmann, netdev, linux-kernel, linux-arm-kernel

Use of_property_read_u32 to read the "clock-frequency" property instead
of using of_get_property with return value checks.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
---
v2: Resending with Cc to netdev

 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
index 8cf9d4f..415de1e 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
@@ -59,16 +59,15 @@ static int temac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
 int temac_mdio_setup(struct temac_local *lp, struct device_node *np)
 {
 	struct mii_bus *bus;
-	const u32 *bus_hz;
+	u32 bus_hz;
 	int clk_div;
-	int rc, size;
+	int rc;
 	struct resource res;
 
 	/* Calculate a reasonable divisor for the clock rate */
 	clk_div = 0x3f; /* worst-case default setting */
-	bus_hz = of_get_property(np, "clock-frequency", &size);
-	if (bus_hz && size >= sizeof(*bus_hz)) {
-		clk_div = (*bus_hz) / (2500 * 1000 * 2) - 1;
+	if (of_property_read_u32(np, "clock-frequency", &bus_hz) == 0) {
+		clk_div = bus_hz / (2500 * 1000 * 2) - 1;
 		if (clk_div < 1)
 			clk_div = 1;
 		if (clk_div > 0x3f)
-- 
2.5.0



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

* [PATCH v2] net: ll_temac: Use of_property_read_u32 instead of open-coding it
@ 2015-09-23  7:20   ` Tobias Klauser
  0 siblings, 0 replies; 8+ messages in thread
From: Tobias Klauser @ 2015-09-23  7:20 UTC (permalink / raw)
  To: linux-arm-kernel

Use of_property_read_u32 to read the "clock-frequency" property instead
of using of_get_property with return value checks.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: S?ren Brinkmann <soren.brinkmann@xilinx.com>
---
v2: Resending with Cc to netdev

 drivers/net/ethernet/xilinx/ll_temac_mdio.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_mdio.c b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
index 8cf9d4f..415de1e 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_mdio.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_mdio.c
@@ -59,16 +59,15 @@ static int temac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
 int temac_mdio_setup(struct temac_local *lp, struct device_node *np)
 {
 	struct mii_bus *bus;
-	const u32 *bus_hz;
+	u32 bus_hz;
 	int clk_div;
-	int rc, size;
+	int rc;
 	struct resource res;
 
 	/* Calculate a reasonable divisor for the clock rate */
 	clk_div = 0x3f; /* worst-case default setting */
-	bus_hz = of_get_property(np, "clock-frequency", &size);
-	if (bus_hz && size >= sizeof(*bus_hz)) {
-		clk_div = (*bus_hz) / (2500 * 1000 * 2) - 1;
+	if (of_property_read_u32(np, "clock-frequency", &bus_hz) == 0) {
+		clk_div = bus_hz / (2500 * 1000 * 2) - 1;
 		if (clk_div < 1)
 			clk_div = 1;
 		if (clk_div > 0x3f)
-- 
2.5.0

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

* Re: [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
  2015-09-22 11:41 ` Tobias Klauser
@ 2015-09-24 21:30   ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-09-24 21:30 UTC (permalink / raw)
  To: tklauser; +Cc: michal.simek, soren.brinkmann, linux-kernel, linux-arm-kernel

From: Tobias Klauser <tklauser@distanz.ch>
Date: Tue, 22 Sep 2015 13:41:57 +0200

> Use of_property_read_u32 to read the "clock-frequency" property instead
> of using of_get_property with return value checks.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Applied to net-next.

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

* [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it
@ 2015-09-24 21:30   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-09-24 21:30 UTC (permalink / raw)
  To: linux-arm-kernel

From: Tobias Klauser <tklauser@distanz.ch>
Date: Tue, 22 Sep 2015 13:41:57 +0200

> Use of_property_read_u32 to read the "clock-frequency" property instead
> of using of_get_property with return value checks.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Applied to net-next.

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

end of thread, other threads:[~2015-09-24 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22 11:41 [PATCH] net: ll_temac: Use of_property_read_u32 instead of open-coding it Tobias Klauser
2015-09-22 11:41 ` Tobias Klauser
2015-09-22 14:59 ` Sören Brinkmann
2015-09-22 14:59   ` Sören Brinkmann
2015-09-23  7:20 ` [PATCH v2] " Tobias Klauser
2015-09-23  7:20   ` Tobias Klauser
2015-09-24 21:30 ` [PATCH] " David Miller
2015-09-24 21:30   ` David Miller

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.