* [PATCH] base: core: Remove WARN_ON from link dependencies check
@ 2018-07-12 8:06 Benjamin Gaignard
2018-07-12 8:55 ` Greg KH
2018-07-13 16:14 ` Mark Brown
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Gaignard @ 2018-07-12 8:06 UTC (permalink / raw)
To: gregkh, broonie, p.paillet, linux-kernel, m.szyprowski; +Cc: Benjamin Gaignard
In some cases the link between between customer and supplier
already exist. Do not warn about already existing dependencies
because device_link_add() take care of this case.
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] base: core: Remove WARN_ON from link dependencies check
2018-07-12 8:06 [PATCH] base: core: Remove WARN_ON from link dependencies check Benjamin Gaignard
@ 2018-07-12 8:55 ` Greg KH
2018-07-12 9:18 ` Benjamin Gaignard
2018-07-13 16:14 ` Mark Brown
1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2018-07-12 8:55 UTC (permalink / raw)
To: Benjamin Gaignard, Rafael J. Wysocki
Cc: broonie, p.paillet, linux-kernel, m.szyprowski, Benjamin Gaignard
On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote:
> In some cases the link between between customer and supplier
> already exist. Do not warn about already existing dependencies
> because device_link_add() take care of this case.
Why would a link already exist that is asked to be created again? What
code path causes this?
>
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
> 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;
Both of these WARN_ON are for valid code? That feels really odd to me,
I need more explanation here please.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] base: core: Remove WARN_ON from link dependencies check
2018-07-12 8:55 ` Greg KH
@ 2018-07-12 9:18 ` Benjamin Gaignard
2018-07-12 10:25 ` Mark Brown
2018-07-16 9:45 ` Rafael J. Wysocki
0 siblings, 2 replies; 6+ messages in thread
From: Benjamin Gaignard @ 2018-07-12 9:18 UTC (permalink / raw)
To: Greg KH
Cc: Rafael J. Wysocki, Mark Brown, pascal paillet,
Linux Kernel Mailing List, Marek Szyprowski, Benjamin Gaignard
2018-07-12 10:55 GMT+02:00 Greg KH <gregkh@linuxfoundation.org>:
> On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote:
>> In some cases the link between between customer and supplier
>> already exist. Do not warn about already existing dependencies
>> because device_link_add() take care of this case.
>
> Why would a link already exist that is asked to be created again? What
> code path causes this?
It could happen that the link exist because a device use it parent as supplier.
That case has been describe by Marek in this thread (I forgot to add
it in the commit message, sorry):
https://lkml.org/lkml/2018/7/9/356
>
>>
>> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
>> ---
>> 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;
>
> Both of these WARN_ON are for valid code? That feels really odd to me,
> I need more explanation here please.
The documentation of the function is clear about return values:
"Check if @target depends on @dev or any device dependent on it (its
child or ts consumer etc). Return 1 if that is the case or 0
otherwise."
so, for me, not need to warn user about something that is expected.
Benjamin
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] base: core: Remove WARN_ON from link dependencies check
2018-07-12 9:18 ` Benjamin Gaignard
@ 2018-07-12 10:25 ` Mark Brown
2018-07-16 9:45 ` Rafael J. Wysocki
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2018-07-12 10:25 UTC (permalink / raw)
To: Benjamin Gaignard
Cc: Greg KH, Rafael J. Wysocki, pascal paillet,
Linux Kernel Mailing List, Marek Szyprowski, Benjamin Gaignard
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
On Thu, Jul 12, 2018 at 11:18:26AM +0200, Benjamin Gaignard wrote:
> 2018-07-12 10:55 GMT+02:00 Greg KH <gregkh@linuxfoundation.org>:
> > Why would a link already exist that is asked to be created again? What
> > code path causes this?
> It could happen that the link exist because a device use it parent as supplier.
> That case has been describe by Marek in this thread (I forgot to add
> it in the commit message, sorry):
> https://lkml.org/lkml/2018/7/9/356
If we don't remove the warning then we'd need to have some way for
generic code to check if a link that it wants to create exists already
since if more than one thing adds links there's always a chance that two
of them will come up with the same idea for a link. We could export
device_is_dependent() and have them check that, or add a new flag that
skips the check for example. This is however probably going to affect a
reasonable percentage of potential users.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] base: core: Remove WARN_ON from link dependencies check
2018-07-12 8:06 [PATCH] base: core: Remove WARN_ON from link dependencies check Benjamin Gaignard
2018-07-12 8:55 ` Greg KH
@ 2018-07-13 16:14 ` Mark Brown
1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2018-07-13 16:14 UTC (permalink / raw)
To: Benjamin Gaignard
Cc: gregkh, p.paillet, linux-kernel, m.szyprowski, Benjamin Gaignard
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote:
> In some cases the link between between customer and supplier
> already exist. Do not warn about already existing dependencies
> because device_link_add() take care of this case.
Reviwed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] base: core: Remove WARN_ON from link dependencies check
2018-07-12 9:18 ` Benjamin Gaignard
2018-07-12 10:25 ` Mark Brown
@ 2018-07-16 9:45 ` Rafael J. Wysocki
1 sibling, 0 replies; 6+ messages in thread
From: Rafael J. Wysocki @ 2018-07-16 9:45 UTC (permalink / raw)
To: Benjamin Gaignard
Cc: Greg KH, Mark Brown, pascal paillet, Linux Kernel Mailing List,
Marek Szyprowski, Benjamin Gaignard
On Thursday, July 12, 2018 11:18:26 AM CEST Benjamin Gaignard wrote:
> 2018-07-12 10:55 GMT+02:00 Greg KH <gregkh@linuxfoundation.org>:
> > On Thu, Jul 12, 2018 at 10:06:23AM +0200, Benjamin Gaignard wrote:
> >> In some cases the link between between customer and supplier
> >> already exist. Do not warn about already existing dependencies
> >> because device_link_add() take care of this case.
> >
> > Why would a link already exist that is asked to be created again? What
> > code path causes this?
>
> It could happen that the link exist because a device use it parent as supplier.
> That case has been describe by Marek in this thread (I forgot to add
> it in the commit message, sorry):
> https://lkml.org/lkml/2018/7/9/356
So please add this information to the patch changelog and resend.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-16 9:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 8:06 [PATCH] base: core: Remove WARN_ON from link dependencies check Benjamin Gaignard
2018-07-12 8:55 ` Greg KH
2018-07-12 9:18 ` Benjamin Gaignard
2018-07-12 10:25 ` Mark Brown
2018-07-16 9:45 ` Rafael J. Wysocki
2018-07-13 16:14 ` Mark Brown
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).