usb: quiet peer failure warning, disable poweroff
In the case where platform firmware has specified conflicting values for port locations it is confusing and otherwise not helpful to throw a backtrace. Instead, include enough information to determine that firmware has done something wrong and globally disable port poweroff. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b658b8f5c0
commit
6c79fe4afc
1 changed files with 18 additions and 4 deletions
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "hub.h"
|
#include "hub.h"
|
||||||
|
|
||||||
|
static int usb_port_block_power_off;
|
||||||
|
|
||||||
static const struct attribute_group *port_dev_group[];
|
static const struct attribute_group *port_dev_group[];
|
||||||
|
|
||||||
static ssize_t connect_type_show(struct device *dev,
|
static ssize_t connect_type_show(struct device *dev,
|
||||||
|
@ -142,6 +144,9 @@ static int usb_port_runtime_suspend(struct device *dev)
|
||||||
== PM_QOS_FLAGS_ALL)
|
== PM_QOS_FLAGS_ALL)
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
|
|
||||||
|
if (usb_port_block_power_off)
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
usb_autopm_get_interface(intf);
|
usb_autopm_get_interface(intf);
|
||||||
retval = usb_hub_set_port_power(hdev, hub, port1, false);
|
retval = usb_hub_set_port_power(hdev, hub, port1, false);
|
||||||
usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
|
usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
|
||||||
|
@ -190,11 +195,19 @@ static int link_peers(struct usb_port *left, struct usb_port *right)
|
||||||
if (left->peer || right->peer) {
|
if (left->peer || right->peer) {
|
||||||
struct usb_port *lpeer = left->peer;
|
struct usb_port *lpeer = left->peer;
|
||||||
struct usb_port *rpeer = right->peer;
|
struct usb_port *rpeer = right->peer;
|
||||||
|
char *method;
|
||||||
|
|
||||||
WARN(1, "failed to peer %s and %s (%s -> %p) (%s -> %p)\n",
|
if (left->location && left->location == right->location)
|
||||||
dev_name(&left->dev), dev_name(&right->dev),
|
method = "location";
|
||||||
dev_name(&left->dev), lpeer,
|
else
|
||||||
dev_name(&right->dev), rpeer);
|
method = "default";
|
||||||
|
|
||||||
|
pr_warn("usb: failed to peer %s and %s by %s (%s:%s) (%s:%s)\n",
|
||||||
|
dev_name(&left->dev), dev_name(&right->dev), method,
|
||||||
|
dev_name(&left->dev),
|
||||||
|
lpeer ? dev_name(&lpeer->dev) : "none",
|
||||||
|
dev_name(&right->dev),
|
||||||
|
rpeer ? dev_name(&rpeer->dev) : "none");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +264,7 @@ static void link_peers_report(struct usb_port *left, struct usb_port *right)
|
||||||
dev_warn(&left->dev, "failed to peer to %s (%d)\n",
|
dev_warn(&left->dev, "failed to peer to %s (%d)\n",
|
||||||
dev_name(&right->dev), rc);
|
dev_name(&right->dev), rc);
|
||||||
pr_warn_once("usb: port power management may be unreliable\n");
|
pr_warn_once("usb: port power management may be unreliable\n");
|
||||||
|
usb_port_block_power_off = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue