seq_printf(s, "port[%d] available bw: %d%%.\n", i,
ctx->bytes[i]);
err_out:
+ if (ret == -EIO) {
+ seq_puts(s, "Get Port Bandwidth failed\n");
+ ret = 0;
+ }
pm_runtime_put_sync(dev);
xhci_free_port_bw_ctx(xhci, ctx);
return ret;
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_SUPER, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_SS), s);
return ret;
}
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_HIGH, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_HS), s);
return ret;
}
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_FULL, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_FS), s);
return ret;
}
}
EXPORT_SYMBOL_GPL(xhci_reset_bandwidth);
-/* Get the available bandwidth of the ports under the xhci roothub */
+/*
+ * Get the available bandwidth of the ports under the xhci roothub.
+ * EIO means the command failed: command not implemented or unsupported
+ * speed (TRB Error), some ASMedia complete with Parameter Error when
+ * querying the root hub (slot_id = 0), or other error or timeout.
+ */
int xhci_get_port_bandwidth(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
u8 dev_speed)
{
spin_unlock_irqrestore(&xhci->lock, flags);
wait_for_completion(cmd->completion);
+ if (cmd->status != COMP_SUCCESS)
+ ret = -EIO;
err_out:
kfree(cmd->completion);
kfree(cmd);