Commit d589fd42 authored by Mika Westerberg's avatar Mika Westerberg
Browse files

thunderbolt: Check Intel vendor ID in tb_switch_get_generation()



Only Intel made Thunderbolt 1-3 devices so to avoid possible confusion
check for the Intel vendor ID before deciding the device generation.
While there move the USB4 check to happen first.

Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 408e1d96
Loading
Loading
Loading
Loading
+38 −37
Original line number Diff line number Diff line
@@ -2188,6 +2188,10 @@ struct device_type tb_switch_type = {

static int tb_switch_get_generation(struct tb_switch *sw)
{
	if (tb_switch_is_usb4(sw))
		return 4;

	if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
		switch (sw->config.device_id) {
		case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE:
		case PCI_DEVICE_ID_INTEL_EAGLE_RIDGE:
@@ -2215,20 +2219,17 @@ static int tb_switch_get_generation(struct tb_switch *sw)
		case PCI_DEVICE_ID_INTEL_ICL_NHI0:
		case PCI_DEVICE_ID_INTEL_ICL_NHI1:
			return 3;

	default:
		if (tb_switch_is_usb4(sw))
			return 4;
		}
	}

	/*
		 * For unknown switches assume generation to be 1 to be
		 * on the safe side.
	 * For unknown switches assume generation to be 1 to be on the
	 * safe side.
	 */
	tb_sw_warn(sw, "unsupported switch device id %#x\n",
		   sw->config.device_id);
	return 1;
}
}

static bool tb_switch_exceeds_max_depth(const struct tb_switch *sw, int depth)
{