Skip to contentSkip to conversation

base: core: Remove WARN_ON from link dependencies check

PATCH Superseded Benjamin Gaignard 3 participants 4 messages Jul 16, 2018 Driver core

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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 it parent as supplier [1]. Do not warn about already existing dependencies because device_link_add() take care of this case.

[1] https://lkml.org/lkml/2018/7/9/356

---
 drivers/base/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/core.c +2 -2
index df3e1a44707a..fcdc17f0f349 100644
@@ -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);
Signature · 1 line
2.15.0
#1 lore raw
Quoted 2 lines · CEST Benjamin Gaignard

In some cases the link between between customer and supplier already exist, for example when a device use it parent as supplier [1].

I think this should be "its parent as a supplier".

Quoted 2 lines

Do not warn about already existing dependencies because device_link_add() take care of this case.

"device_link_add() takes care of"

Quoted 1 line

[1] https://lkml.org/lkml/2018/7/9/356

There is the Link: tag for links and it is better to not use lkml.org as it is not reliable enough. You can use lore.kernel.org/lkml/ instead.

Quoted 30 lines
---
 drivers/base/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/core.c +2 -2
index df3e1a44707a..fcdc17f0f349 100644
@@ -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);
maintainer
#2 lore raw
Quoted 9 lines · Rafael J. Wysocki
Quoted 2 lines · CEST Benjamin Gaignard

In some cases the link between between customer and supplier already exist, for example when a device use it parent as supplier [1].

I think this should be "its parent as a supplier".

Quoted 2 lines

Do not warn about already existing dependencies because device_link_add() take care of this case.

Quoted 6 lines

"device_link_add() takes care of"

Quoted 1 line

[1] https://lkml.org/lkml/2018/7/9/356

There is the Link: tag for links and it is better to not use lkml.org as it is not reliable enough. You can use lore.kernel.org/lkml/ instead.

Even better, use:
lkml.kernel.org/r/[message-id]

thanks,

greg k-h

#3 lore raw
Quoted 12 lines · CEST Greg KH
Quoted 11 lines · Rafael J. Wysocki
Quoted 2 lines · CEST Benjamin Gaignard

In some cases the link between between customer and supplier already exist, for example when a device use it parent as supplier [1].

I think this should be "its parent as a supplier".

Quoted 2 lines

Do not warn about already existing dependencies because device_link_add() take care of this case.

"device_link_add() takes care of"

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

[1] https://lkml.org/lkml/2018/7/9/356

There is the Link: tag for links and it is better to not use lkml.org as it is not reliable enough. You can use lore.kernel.org/lkml/ instead.

Even better, use:
lkml.kernel.org/r/[message-id]

Where [message-id] is the value of the Message-Id: header (without the enclosing <>) of the target e-mail message (that you can find by looking at the raw message).

Thanks,
Rafael