Skip to contentSkip to conversation

usb: xhci: pci: Only create Intel mux device when it's needed

PATCH New Heikki Krogerus 1 participant 1 message Sep 3, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH 4/8 usb: xhci: pci: Only create Intel mux device when it's needed

Quoted 8 lines · Andy Shevchenko
Quoted 5 lines · Heikki Krogerus

Only create thre Intel role mux device if the platform has USB peripheral controller PCI device.

While here, enable the role mux on Apollo Lake platforms.

Quoted 13 lines

Review

Quoted 10 lines
(quoted diff) +10 -0
+static int xhci_pci_board_has_udc(void)
+{
+       struct pci_dev *udc = pci_get_class(PCI_CLASS_SERIAL_USB_DEVICE, NULL);
+
+       if (udc) {
+               pci_dev_put(udc);
+               return true;
+       }
+       return false;
+}

Looks like a code duplication with patch 3. Does it make sense to have this in some header (usb.h?)?

I don't know. The check is very PCI specific. I'm not sure ush.h would be appropriate place for it. I don't know where should it go?

Right now the check is only needed on Intel CHT (in both patches), so I figured that it's better wait for an other user before introducing a helper for it. Would that make sense?

Thanks,