#define VHCI_HC_PORTS 8
 #endif
 
+/* Each VHCI has 2 hubs (USB2 and USB3), each has VHCI_HC_PORTS ports */
+#define VHCI_PORTS     (VHCI_HC_PORTS*2)
+
 #ifdef CONFIG_USBIP_VHCI_NR_HCS
 #define VHCI_NR_HCS CONFIG_USBIP_VHCI_NR_HCS
 #else
 
 static inline int port_to_pdev_nr(__u32 port)
 {
-       return port / (VHCI_HC_PORTS * 2);
+       return port / VHCI_PORTS;
 }
 
 static inline struct vhci_hcd *hcd_to_vhci_hcd(struct usb_hcd *hcd)
 
 
                spin_lock(&vdev->ud.lock);
                port_show_vhci(&out, HUB_SPEED_HIGH,
-                              pdev_nr * VHCI_HC_PORTS * 2 + i, vdev);
+                              pdev_nr * VHCI_PORTS + i, vdev);
                spin_unlock(&vdev->ud.lock);
        }
 
 
                spin_lock(&vdev->ud.lock);
                port_show_vhci(&out, HUB_SPEED_SUPER,
-                              pdev_nr * VHCI_HC_PORTS * 2 + VHCI_HC_PORTS + i, vdev);
+                              pdev_nr * VHCI_PORTS + VHCI_HC_PORTS + i, vdev);
                spin_unlock(&vdev->ud.lock);
        }
 
 
        for (i = 0; i < VHCI_HC_PORTS; i++) {
                out += sprintf(out, "hs  %04u %03u ",
-                                   (pdev_nr * VHCI_HC_PORTS * 2) + i,
+                                   (pdev_nr * VHCI_PORTS) + i,
                                    VDEV_ST_NOTASSIGNED);
                out += sprintf(out, "000 00000000 0000000000000000 0-0");
                out += sprintf(out, "\n");
 
        for (i = 0; i < VHCI_HC_PORTS; i++) {
                out += sprintf(out, "ss  %04u %03u ",
-                                   (pdev_nr * VHCI_HC_PORTS * 2) + VHCI_HC_PORTS + i,
+                                   (pdev_nr * VHCI_PORTS) + VHCI_HC_PORTS + i,
                                    VDEV_ST_NOTASSIGNED);
                out += sprintf(out, "000 00000000 0000000000000000 0-0");
                out += sprintf(out, "\n");
        /*
         * Half the ports are for SPEED_HIGH and half for SPEED_SUPER, thus the * 2.
         */
-       out += sprintf(out, "%d\n", VHCI_HC_PORTS * vhci_num_controllers * 2);
+       out += sprintf(out, "%d\n", VHCI_PORTS * vhci_num_controllers);
        return out - s;
 }
 static DEVICE_ATTR_RO(nports);