xhci-dbg.c 759 B

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * xHCI host controller driver
  4. *
  5. * Copyright (C) 2008 Intel Corp.
  6. *
  7. * Author: Sarah Sharp
  8. * Some code borrowed from the Linux EHCI driver.
  9. */
  10. #include "xhci.h"
  11. char *xhci_get_slot_state(struct xhci_hcd *xhci,
  12. struct xhci_container_ctx *ctx)
  13. {
  14. struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx);
  15. int state = GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state));
  16. return xhci_slot_state_string(state);
  17. }
  18. void xhci_dbg_trace(struct xhci_hcd *xhci, void (*trace)(struct va_format *),
  19. const char *fmt, ...)
  20. {
  21. struct va_format vaf;
  22. va_list args;
  23. va_start(args, fmt);
  24. vaf.fmt = fmt;
  25. vaf.va = &args;
  26. xhci_dbg(xhci, "%pV\n", &vaf);
  27. trace(&vaf);
  28. va_end(args);
  29. }
  30. EXPORT_SYMBOL_GPL(xhci_dbg_trace);