thunderbolt: Check for Intel vendor ID when identifying controller
authorMika Westerberg <mika.westerberg@linux.intel.com>
Sat, 25 Jul 2020 07:40:47 +0000 (10:40 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 3 Sep 2020 09:21:08 +0000 (12:21 +0300)
With USB4 there will be other vendors so make sure the current checks
for different Intel controllers will not accidentally match those.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/thunderbolt/tb.h

index 6aee18b..664a861 100644 (file)
@@ -697,59 +697,65 @@ static inline struct tb_switch *tb_switch_parent(struct tb_switch *sw)
 
 static inline bool tb_switch_is_light_ridge(const struct tb_switch *sw)
 {
-       return sw->config.device_id == PCI_DEVICE_ID_INTEL_LIGHT_RIDGE;
+       return sw->config.vendor_id == PCI_VENDOR_ID_INTEL &&
+              sw->config.device_id == PCI_DEVICE_ID_INTEL_LIGHT_RIDGE;
 }
 
 static inline bool tb_switch_is_eagle_ridge(const struct tb_switch *sw)
 {
-       return sw->config.device_id == PCI_DEVICE_ID_INTEL_EAGLE_RIDGE;
+       return sw->config.vendor_id == PCI_VENDOR_ID_INTEL &&
+              sw->config.device_id == PCI_DEVICE_ID_INTEL_EAGLE_RIDGE;
 }
 
 static inline bool tb_switch_is_cactus_ridge(const struct tb_switch *sw)
 {
-       switch (sw->config.device_id) {
-       case PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C:
-       case PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C:
-               return true;
-       default:
-               return false;
+       if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
+               switch (sw->config.device_id) {
+               case PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C:
+               case PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C:
+                       return true;
+               }
        }
+       return false;
 }
 
 static inline bool tb_switch_is_falcon_ridge(const struct tb_switch *sw)
 {
-       switch (sw->config.device_id) {
-       case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE:
-               return true;
-       default:
-               return false;
+       if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
+               switch (sw->config.device_id) {
+               case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE:
+                       return true;
+               }
        }
+       return false;
 }
 
 static inline bool tb_switch_is_alpine_ridge(const struct tb_switch *sw)
 {
-       switch (sw->config.device_id) {
-       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_BRIDGE:
-               return true;
-       default:
-               return false;
+       if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
+               switch (sw->config.device_id) {
+               case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_BRIDGE:
+                       return true;
+               }
        }
+       return false;
 }
 
 static inline bool tb_switch_is_titan_ridge(const struct tb_switch *sw)
 {
-       switch (sw->config.device_id) {
-       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_BRIDGE:
-       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE:
-               return true;
-       default:
-               return false;
+       if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
+               switch (sw->config.device_id) {
+               case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_BRIDGE:
+               case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE:
+                       return true;
+               }
        }
+       return false;
 }
 
 /**