All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: use of_mdio_parse_addr
@ 2017-05-31 19:43 Jon Mason
  2017-05-31 20:01 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jon Mason @ 2017-05-31 19:43 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, bcm-kernel-feedback-list

use of_mdio_parse_addr() in place of an OF read of reg and a bounds
check (which is litterally the exact same thing that
of_mdio_parse_addr() does)

Signed-off-by: Jon Mason <jon.mason@broadcom.com>
---
 drivers/net/phy/mdio_bus.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index 8e73f5f36e71..d4782e902e2e 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -263,21 +263,10 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus,
 
 	for_each_available_child_of_node(bus->dev.of_node, child) {
 		int addr;
-		int ret;
 
-		ret = of_property_read_u32(child, "reg", &addr);
-		if (ret < 0) {
-			dev_err(dev, "%s has invalid MDIO address\n",
-				child->full_name);
+		addr = of_mdio_parse_addr(dev, child);
+		if (addr < 0)
 			continue;
-		}
-
-		/* A MDIO device must have a reg property in the range [0-31] */
-		if (addr >= PHY_MAX_ADDR) {
-			dev_err(dev, "%s MDIO address %i is too large\n",
-				child->full_name, addr);
-			continue;
-		}
 
 		if (addr == mdiodev->addr) {
 			dev->of_node = child;
-- 
2.7.4

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-05-31 19:43 [PATCH net-next] net: phy: use of_mdio_parse_addr Jon Mason
@ 2017-05-31 20:01 ` Andrew Lunn
  2017-05-31 20:01 ` Florian Fainelli
  2017-06-02 18:22 ` David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2017-05-31 20:01 UTC (permalink / raw)
  To: Jon Mason
  Cc: Florian Fainelli, netdev, linux-kernel, bcm-kernel-feedback-list

On Wed, May 31, 2017 at 03:43:30PM -0400, Jon Mason wrote:
> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-05-31 19:43 [PATCH net-next] net: phy: use of_mdio_parse_addr Jon Mason
  2017-05-31 20:01 ` Andrew Lunn
@ 2017-05-31 20:01 ` Florian Fainelli
  2017-06-02 18:22 ` David Miller
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2017-05-31 20:01 UTC (permalink / raw)
  To: Jon Mason, Andrew Lunn, Florian Fainelli
  Cc: netdev, linux-kernel, bcm-kernel-feedback-list

On 05/31/2017 12:43 PM, Jon Mason wrote:
> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-05-31 19:43 [PATCH net-next] net: phy: use of_mdio_parse_addr Jon Mason
  2017-05-31 20:01 ` Andrew Lunn
  2017-05-31 20:01 ` Florian Fainelli
@ 2017-06-02 18:22 ` David Miller
  2017-06-07 16:18   ` Liviu Dudau
  2 siblings, 1 reply; 8+ messages in thread
From: David Miller @ 2017-06-02 18:22 UTC (permalink / raw)
  To: jon.mason
  Cc: andrew, f.fainelli, netdev, linux-kernel, bcm-kernel-feedback-list

From: Jon Mason <jon.mason@broadcom.com>
Date: Wed, 31 May 2017 15:43:30 -0400

> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> check (which is litterally the exact same thing that
> of_mdio_parse_addr() does)
> 
> Signed-off-by: Jon Mason <jon.mason@broadcom.com>

Applied, thanks Jon.

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-06-02 18:22 ` David Miller
@ 2017-06-07 16:18   ` Liviu Dudau
  2017-06-07 20:53     ` Jon Mason
  2017-06-09  9:00     ` Michael Ellerman
  0 siblings, 2 replies; 8+ messages in thread
From: Liviu Dudau @ 2017-06-07 16:18 UTC (permalink / raw)
  To: David Miller
  Cc: jon.mason, andrew, f.fainelli, netdev, linux-kernel,
	bcm-kernel-feedback-list

On Fri, Jun 02, 2017 at 02:22:51PM -0400, David Miller wrote:
> From: Jon Mason <jon.mason@broadcom.com>
> Date: Wed, 31 May 2017 15:43:30 -0400
> 
> > use of_mdio_parse_addr() in place of an OF read of reg and a bounds
> > check (which is litterally the exact same thing that
> > of_mdio_parse_addr() does)
> > 
> > Signed-off-by: Jon Mason <jon.mason@broadcom.com>
> 
> Applied, thanks Jon.

This makes linux-next fail the modules_install target as depmod detects 2 circular
dependencies. Reverting this patch fixes the issue.

depmod: ERROR: Cycle detected: libphy -> of_mdio -> fixed_phy -> libphy
depmod: ERROR: Cycle detected: libphy -> of_mdio -> libphy
depmod: ERROR: Found 3 modules in dependency cycles!
make[1]: *** [/home/dliviu/devel/kernel/Makefile:1245: _modinst_post] Error 1

This is on an ARCH=arm build, build I doubt it makes a difference. Let me know if
you need some .config values in order to reproduce.

Best regards,
Liviu

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-06-07 16:18   ` Liviu Dudau
@ 2017-06-07 20:53     ` Jon Mason
  2017-06-07 20:54       ` Florian Fainelli
  2017-06-09  9:00     ` Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Jon Mason @ 2017-06-07 20:53 UTC (permalink / raw)
  To: Liviu Dudau
  Cc: David Miller, Andrew Lunn, Florian Fainelli, Network Development,
	open list, BCM Kernel Feedback

On Wed, Jun 7, 2017 at 12:18 PM, Liviu Dudau <liviu@dudau.co.uk> wrote:
> On Fri, Jun 02, 2017 at 02:22:51PM -0400, David Miller wrote:
>> From: Jon Mason <jon.mason@broadcom.com>
>> Date: Wed, 31 May 2017 15:43:30 -0400
>>
>> > use of_mdio_parse_addr() in place of an OF read of reg and a bounds
>> > check (which is litterally the exact same thing that
>> > of_mdio_parse_addr() does)
>> >
>> > Signed-off-by: Jon Mason <jon.mason@broadcom.com>
>>
>> Applied, thanks Jon.
>
> This makes linux-next fail the modules_install target as depmod detects 2 circular
> dependencies. Reverting this patch fixes the issue.
>
> depmod: ERROR: Cycle detected: libphy -> of_mdio -> fixed_phy -> libphy
> depmod: ERROR: Cycle detected: libphy -> of_mdio -> libphy
> depmod: ERROR: Found 3 modules in dependency cycles!
> make[1]: *** [/home/dliviu/devel/kernel/Makefile:1245: _modinst_post] Error 1

I did not test this as modules.  Sorry.

It would be ugly to duplicate the code in both place, and the code in
question does not seem to really need to be in a C file.  Perhaps it
can be moved to a header file as an inline function, which would solve
this dependency.  Would this be acceptable?

Thanks,
Jon

>
> This is on an ARCH=arm build, build I doubt it makes a difference. Let me know if
> you need some .config values in order to reproduce.
>
> Best regards,
> Liviu
>

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-06-07 20:53     ` Jon Mason
@ 2017-06-07 20:54       ` Florian Fainelli
  0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2017-06-07 20:54 UTC (permalink / raw)
  To: Jon Mason, Liviu Dudau
  Cc: David Miller, Andrew Lunn, Florian Fainelli, Network Development,
	open list, BCM Kernel Feedback

On 06/07/2017 01:53 PM, Jon Mason wrote:
> On Wed, Jun 7, 2017 at 12:18 PM, Liviu Dudau <liviu@dudau.co.uk> wrote:
>> On Fri, Jun 02, 2017 at 02:22:51PM -0400, David Miller wrote:
>>> From: Jon Mason <jon.mason@broadcom.com>
>>> Date: Wed, 31 May 2017 15:43:30 -0400
>>>
>>>> use of_mdio_parse_addr() in place of an OF read of reg and a bounds
>>>> check (which is litterally the exact same thing that
>>>> of_mdio_parse_addr() does)
>>>>
>>>> Signed-off-by: Jon Mason <jon.mason@broadcom.com>
>>>
>>> Applied, thanks Jon.
>>
>> This makes linux-next fail the modules_install target as depmod detects 2 circular
>> dependencies. Reverting this patch fixes the issue.
>>
>> depmod: ERROR: Cycle detected: libphy -> of_mdio -> fixed_phy -> libphy
>> depmod: ERROR: Cycle detected: libphy -> of_mdio -> libphy
>> depmod: ERROR: Found 3 modules in dependency cycles!
>> make[1]: *** [/home/dliviu/devel/kernel/Makefile:1245: _modinst_post] Error 1
> 
> I did not test this as modules.  Sorry.
> 
> It would be ugly to duplicate the code in both place, and the code in
> question does not seem to really need to be in a C file.  Perhaps it
> can be moved to a header file as an inline function, which would solve
> this dependency.  Would this be acceptable?

You read my mind, was just going to suggest doing that.
-- 
Florian

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

* Re: [PATCH net-next] net: phy: use of_mdio_parse_addr
  2017-06-07 16:18   ` Liviu Dudau
  2017-06-07 20:53     ` Jon Mason
@ 2017-06-09  9:00     ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2017-06-09  9:00 UTC (permalink / raw)
  To: Liviu Dudau, David Miller
  Cc: jon.mason, andrew, f.fainelli, netdev, linux-kernel,
	bcm-kernel-feedback-list

Liviu Dudau <liviu@dudau.co.uk> writes:

> On Fri, Jun 02, 2017 at 02:22:51PM -0400, David Miller wrote:
>> From: Jon Mason <jon.mason@broadcom.com>
>> Date: Wed, 31 May 2017 15:43:30 -0400
>> 
>> > use of_mdio_parse_addr() in place of an OF read of reg and a bounds
>> > check (which is litterally the exact same thing that
>> > of_mdio_parse_addr() does)
>> > 
>> > Signed-off-by: Jon Mason <jon.mason@broadcom.com>
>> 
>> Applied, thanks Jon.
>
> This makes linux-next fail the modules_install target as depmod detects 2 circular
> dependencies. Reverting this patch fixes the issue.
>
> depmod: ERROR: Cycle detected: libphy -> of_mdio -> fixed_phy -> libphy
> depmod: ERROR: Cycle detected: libphy -> of_mdio -> libphy
> depmod: ERROR: Found 3 modules in dependency cycles!
> make[1]: *** [/home/dliviu/devel/kernel/Makefile:1245: _modinst_post] Error 1
>
> This is on an ARCH=arm build, build I doubt it makes a difference. Let me know if
> you need some .config values in order to reproduce.

Same happens on 32-bit powerpc.

cheers

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

end of thread, other threads:[~2017-06-09  9:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-31 19:43 [PATCH net-next] net: phy: use of_mdio_parse_addr Jon Mason
2017-05-31 20:01 ` Andrew Lunn
2017-05-31 20:01 ` Florian Fainelli
2017-06-02 18:22 ` David Miller
2017-06-07 16:18   ` Liviu Dudau
2017-06-07 20:53     ` Jon Mason
2017-06-07 20:54       ` Florian Fainelli
2017-06-09  9:00     ` Michael Ellerman

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.