]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
thunderbolt: Hide switch attributes that are not set
authorMika Westerberg <mika.westerberg@linux.intel.com>
Tue, 11 Sep 2018 12:34:23 +0000 (15:34 +0300)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 26 Aug 2019 09:14:56 +0000 (12:14 +0300)
Thunderbolt host routers may not always contain DROM that includes
device identification information. This is mostly needed for Ice Lake
systems but some Falcon Ridge controllers on PCs also do not have DROM.

In that case hide the identification attributes.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Tested-by: Mario Limonciello <mario.limonciello@dell.com>
drivers/thunderbolt/switch.c

index 64f845fe4690d3e471efe3d84c3033d43a5faca5..bd3eaaf34ea11ce71772de76121c854a55691b07 100644 (file)
@@ -1337,7 +1337,19 @@ static umode_t switch_attr_is_visible(struct kobject *kobj,
        struct device *dev = container_of(kobj, struct device, kobj);
        struct tb_switch *sw = tb_to_switch(dev);
 
-       if (attr == &dev_attr_key.attr) {
+       if (attr == &dev_attr_device.attr) {
+               if (!sw->device)
+                       return 0;
+       } else if (attr == &dev_attr_device_name.attr) {
+               if (!sw->device_name)
+                       return 0;
+       } else if (attr == &dev_attr_vendor.attr)  {
+               if (!sw->vendor)
+                       return 0;
+       } else if (attr == &dev_attr_vendor_name.attr)  {
+               if (!sw->vendor_name)
+                       return 0;
+       } else if (attr == &dev_attr_key.attr) {
                if (tb_route(sw) &&
                    sw->tb->security_level == TB_SECURITY_SECURE &&
                    sw->security_level == TB_SECURITY_SECURE)