2018-07-16 11:39:31

by Benjamin Gaignard

[permalink] [raw]
Subject: [PATCH v3] base: core: Remove WARN_ON from link dependencies check

In some cases the link between between customer and supplier
already exist, for example when a device use its parent as a supplier.
Do not warn about already existing dependencies because device_link_add()
takes care of this case.

Link: http://lkml.kernel.org/r/20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d~-rzycA5Rg0378203782eucas1p1C@eucas1p1.samsung.com

Reported-by: Marek Szyprowski <[email protected]>
Reviewed-by: Mark Brown <[email protected]>
Signed-off-by: Benjamin Gaignard <[email protected]>
---
drivers/base/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index df3e1a44707a..fcdc17f0f349 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -105,7 +105,7 @@ static int device_is_dependent(struct device *dev, void *target)
struct device_link *link;
int ret;

- if (WARN_ON(dev == target))
+ if (dev == target)
return 1;

ret = device_for_each_child(dev, target, device_is_dependent);
@@ -113,7 +113,7 @@ static int device_is_dependent(struct device *dev, void *target)
return ret;

list_for_each_entry(link, &dev->links.consumers, s_node) {
- if (WARN_ON(link->consumer == target))
+ if (link->consumer == target)
return 1;

ret = device_is_dependent(link->consumer, target);
--
2.15.0



2018-07-17 09:59:28

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3] base: core: Remove WARN_ON from link dependencies check

On Monday, July 16, 2018 1:37:44 PM CEST Benjamin Gaignard wrote:
> In some cases the link between between customer and supplier
> already exist, for example when a device use its parent as a supplier.
> Do not warn about already existing dependencies because device_link_add()
> takes care of this case.
>
> Link: http://lkml.kernel.org/r/20180709111753eucas1p1f32e66fb2f7ea3216097cd72a132355d~-rzycA5Rg0378203782eucas1p1C@eucas1p1.samsung.com
>
> Reported-by: Marek Szyprowski <[email protected]>
> Reviewed-by: Mark Brown <[email protected]>
> Signed-off-by: Benjamin Gaignard <[email protected]>

That's better. :-)

Reviewed-by: Rafael J. Wysocki <[email protected]>

> ---
> drivers/base/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index df3e1a44707a..fcdc17f0f349 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -105,7 +105,7 @@ static int device_is_dependent(struct device *dev, void *target)
> struct device_link *link;
> int ret;
>
> - if (WARN_ON(dev == target))
> + if (dev == target)
> return 1;
>
> ret = device_for_each_child(dev, target, device_is_dependent);
> @@ -113,7 +113,7 @@ static int device_is_dependent(struct device *dev, void *target)
> return ret;
>
> list_for_each_entry(link, &dev->links.consumers, s_node) {
> - if (WARN_ON(link->consumer == target))
> + if (link->consumer == target)
> return 1;
>
> ret = device_is_dependent(link->consumer, target);
>