* [PATCH 0/2] of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO()
@ 2016-03-11 22:11 Sergei Shtylyov
2016-03-11 22:12 ` [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL() Sergei Shtylyov
2016-03-11 22:13 ` [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO() Sergei Shtylyov
0 siblings, 2 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2016-03-11 22:11 UTC (permalink / raw)
To: grant.likely, robh+dt, devicetree, f.fainelli, netdev,
frowand.list
Hello.
Here's the set of 2 patches against DaveM's 'net-next.git' repo. They
replace the patch posted earlier today which was clearly insufficient...
[1/2] of_mdio: use IS_ERR_OR_NULL()
[2/2] of_mdio: use PTR_ERR_OR_ZERO()
MBR, Sergei
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
2016-03-11 22:11 [PATCH 0/2] of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO() Sergei Shtylyov
@ 2016-03-11 22:12 ` Sergei Shtylyov
2016-03-11 22:48 ` Florian Fainelli
[not found] ` <3305414.rAFdOb57tB-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
2016-03-11 22:13 ` [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO() Sergei Shtylyov
1 sibling, 2 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2016-03-11 22:12 UTC (permalink / raw)
To: grant.likely, robh+dt, devicetree, f.fainelli, netdev,
frowand.list
IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
just call it directly...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/of/of_mdio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: net-next/drivers/of/of_mdio.c
===================================================================
--- net-next.orig/drivers/of/of_mdio.c
+++ net-next/drivers/of/of_mdio.c
@@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
else
phy = get_phy_device(mdio, addr, is_c45);
- if (!phy || IS_ERR(phy))
+ if (IS_ERR_OR_NULL(phy))
return 1;
rc = irq_of_parse_and_map(child, 0);
@@ -98,7 +98,7 @@ static int of_mdiobus_register_device(st
int rc;
mdiodev = mdio_device_create(mdio, addr);
- if (!mdiodev || IS_ERR(mdiodev))
+ if (IS_ERR_OR_NULL(mdiodev))
return 1;
/* Associate the OF node with the device structure so it
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO()
2016-03-11 22:11 [PATCH 0/2] of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO() Sergei Shtylyov
2016-03-11 22:12 ` [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL() Sergei Shtylyov
@ 2016-03-11 22:13 ` Sergei Shtylyov
2016-03-11 22:49 ` Florian Fainelli
2016-03-11 23:02 ` Vladimir Zapolskiy
1 sibling, 2 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2016-03-11 22:13 UTC (permalink / raw)
To: grant.likely, robh+dt, devicetree, f.fainelli, netdev,
frowand.list
PTR_ERR_OR_ZERO() is open coded in of_phy_register_fixed_link(), so just
call it directly...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/of/of_mdio.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: net-next/drivers/of/of_mdio.c
===================================================================
--- net-next.orig/drivers/of/of_mdio.c
+++ net-next/drivers/of/of_mdio.c
@@ -412,7 +412,7 @@ int of_phy_register_fixed_link(struct de
if (strcmp(managed, "in-band-status") == 0) {
/* status is zeroed, namely its .link member */
phy = fixed_phy_register(PHY_POLL, &status, -1, np);
- return IS_ERR(phy) ? PTR_ERR(phy) : 0;
+ return PTR_ERR_OR_ZERO(phy);
}
}
@@ -434,7 +434,7 @@ int of_phy_register_fixed_link(struct de
return -EPROBE_DEFER;
phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np);
- return IS_ERR(phy) ? PTR_ERR(phy) : 0;
+ return PTR_ERR_OR_ZERO(phy);
}
/* Old binding */
@@ -446,7 +446,7 @@ int of_phy_register_fixed_link(struct de
status.pause = be32_to_cpu(fixed_link_prop[3]);
status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
phy = fixed_phy_register(PHY_POLL, &status, -1, np);
- return IS_ERR(phy) ? PTR_ERR(phy) : 0;
+ return PTR_ERR_OR_ZERO(phy);
}
return -ENODEV;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
2016-03-11 22:12 ` [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL() Sergei Shtylyov
@ 2016-03-11 22:48 ` Florian Fainelli
[not found] ` <3305414.rAFdOb57tB-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
1 sibling, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2016-03-11 22:48 UTC (permalink / raw)
To: Sergei Shtylyov, grant.likely, robh+dt, devicetree, netdev,
frowand.list
On 11/03/16 14:12, Sergei Shtylyov wrote:
> IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
> just call it directly...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO()
2016-03-11 22:13 ` [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO() Sergei Shtylyov
@ 2016-03-11 22:49 ` Florian Fainelli
2016-03-11 23:02 ` Vladimir Zapolskiy
1 sibling, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2016-03-11 22:49 UTC (permalink / raw)
To: Sergei Shtylyov, grant.likely, robh+dt, devicetree, netdev,
frowand.list
On 11/03/16 14:13, Sergei Shtylyov wrote:
> PTR_ERR_OR_ZERO() is open coded in of_phy_register_fixed_link(), so just
> call it directly...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
[not found] ` <3305414.rAFdOb57tB-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
@ 2016-03-11 22:53 ` Vladimir Zapolskiy
2016-03-11 23:03 ` Florian Fainelli
0 siblings, 1 reply; 8+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-11 22:53 UTC (permalink / raw)
To: Sergei Shtylyov, grant.likely-QSEj5FYQhm4dnm+yROfE0A,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
frowand.list-Re5JQEeQqe8AvxtiuMwx3w
Hello Sergei,
On 12.03.2016 00:12, Sergei Shtylyov wrote:
> IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
> just call it directly...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
>
> ---
> drivers/of/of_mdio.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: net-next/drivers/of/of_mdio.c
> ===================================================================
> --- net-next.orig/drivers/of/of_mdio.c
> +++ net-next/drivers/of/of_mdio.c
> @@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
> phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
> else
> phy = get_phy_device(mdio, addr, is_c45);
> - if (!phy || IS_ERR(phy))
> + if (IS_ERR_OR_NULL(phy))
> return 1;
>
> rc = irq_of_parse_and_map(child, 0);
> @@ -98,7 +98,7 @@ static int of_mdiobus_register_device(st
> int rc;
>
> mdiodev = mdio_device_create(mdio, addr);
> - if (!mdiodev || IS_ERR(mdiodev))
> + if (IS_ERR_OR_NULL(mdiodev))
> return 1;
>
I don't see how it is possible for mdio_device_create() to return NULL,
instead of this change consider to remove if (!mdiodev) check.
> /* Associate the OF node with the device structure so it
>
--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO()
2016-03-11 22:13 ` [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO() Sergei Shtylyov
2016-03-11 22:49 ` Florian Fainelli
@ 2016-03-11 23:02 ` Vladimir Zapolskiy
1 sibling, 0 replies; 8+ messages in thread
From: Vladimir Zapolskiy @ 2016-03-11 23:02 UTC (permalink / raw)
To: Sergei Shtylyov, grant.likely, robh+dt, devicetree, f.fainelli,
netdev, frowand.list
Hello Sergei,
On 12.03.2016 00:13, Sergei Shtylyov wrote:
> PTR_ERR_OR_ZERO() is open coded in of_phy_register_fixed_link(), so just
> call it directly...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> drivers/of/of_mdio.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Index: net-next/drivers/of/of_mdio.c
> ===================================================================
> --- net-next.orig/drivers/of/of_mdio.c
> +++ net-next/drivers/of/of_mdio.c
> @@ -412,7 +412,7 @@ int of_phy_register_fixed_link(struct de
> if (strcmp(managed, "in-band-status") == 0) {
> /* status is zeroed, namely its .link member */
> phy = fixed_phy_register(PHY_POLL, &status, -1, np);
> - return IS_ERR(phy) ? PTR_ERR(phy) : 0;
> + return PTR_ERR_OR_ZERO(phy);
> }
> }
>
> @@ -434,7 +434,7 @@ int of_phy_register_fixed_link(struct de
> return -EPROBE_DEFER;
>
> phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np);
> - return IS_ERR(phy) ? PTR_ERR(phy) : 0;
> + return PTR_ERR_OR_ZERO(phy);
> }
>
> /* Old binding */
> @@ -446,7 +446,7 @@ int of_phy_register_fixed_link(struct de
> status.pause = be32_to_cpu(fixed_link_prop[3]);
> status.asym_pause = be32_to_cpu(fixed_link_prop[4]);
> phy = fixed_phy_register(PHY_POLL, &status, -1, np);
> - return IS_ERR(phy) ? PTR_ERR(phy) : 0;
> + return PTR_ERR_OR_ZERO(phy);
> }
>
> return -ENODEV;
>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL()
2016-03-11 22:53 ` Vladimir Zapolskiy
@ 2016-03-11 23:03 ` Florian Fainelli
0 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2016-03-11 23:03 UTC (permalink / raw)
To: Vladimir Zapolskiy, Sergei Shtylyov, grant.likely, robh+dt,
devicetree, netdev, frowand.list
On 11/03/16 14:53, Vladimir Zapolskiy wrote:
> Hello Sergei,
>
> On 12.03.2016 00:12, Sergei Shtylyov wrote:
>> IS_ERR_OR_NULL() is open coded in of_mdiobus_register_{phy|device}(), so
>> just call it directly...
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
>> ---
>> drivers/of/of_mdio.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Index: net-next/drivers/of/of_mdio.c
>> ===================================================================
>> --- net-next.orig/drivers/of/of_mdio.c
>> +++ net-next/drivers/of/of_mdio.c
>> @@ -56,7 +56,7 @@ static int of_mdiobus_register_phy(struc
>> phy = phy_device_create(mdio, addr, phy_id, 0, NULL);
>> else
>> phy = get_phy_device(mdio, addr, is_c45);
>> - if (!phy || IS_ERR(phy))
>> + if (IS_ERR_OR_NULL(phy))
>> return 1;
>>
>> rc = irq_of_parse_and_map(child, 0);
>> @@ -98,7 +98,7 @@ static int of_mdiobus_register_device(st
>> int rc;
>>
>> mdiodev = mdio_device_create(mdio, addr);
>> - if (!mdiodev || IS_ERR(mdiodev))
>> + if (IS_ERR_OR_NULL(mdiodev))
>> return 1;
>>
>
> I don't see how it is possible for mdio_device_create() to return NULL,
> instead of this change consider to remove if (!mdiodev) check.
Good point, worst case we return PTR_ERR(-ENOMEM).
--
Florian
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-11 23:03 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 22:11 [PATCH 0/2] of_mdio: use IS_ERR_OR_NULL() and PTR_ERR_OR_ZERO() Sergei Shtylyov
2016-03-11 22:12 ` [PATCH 1/2] of_mdio: use IS_ERR_OR_NULL() Sergei Shtylyov
2016-03-11 22:48 ` Florian Fainelli
[not found] ` <3305414.rAFdOb57tB-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>
2016-03-11 22:53 ` Vladimir Zapolskiy
2016-03-11 23:03 ` Florian Fainelli
2016-03-11 22:13 ` [PATCH 2/2] of_mdio: use PTR_ERR_OR_ZERO() Sergei Shtylyov
2016-03-11 22:49 ` Florian Fainelli
2016-03-11 23:02 ` Vladimir Zapolskiy
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).