Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3164037ybi; Fri, 5 Jul 2019 03:01:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqz/iV8yODrLmlr/weuRaWpMPro7nqqw3dvTftP3tFGvFmbNoTVfVjUb0w6G+gzjG1KNVKDz X-Received: by 2002:a17:90a:9a8d:: with SMTP id e13mr4354302pjp.77.1562320873212; Fri, 05 Jul 2019 03:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320873; cv=none; d=google.com; s=arc-20160816; b=wosjfLXE/P3C7eoiiIIE9CKG4GWM9cRRASZdHYFrGkrGfHKw3wK+uX9q/oF5n12v0K RbQnPQ8Y2YfYUszXjVMKKmiVSt2B8lGR2e0MMSDB/Ssb7dZBQ5FPcXFcs0SQV/EKYbph 5fYrAL+EWmvS6FEaEMaU7zrFTRwqJt8VkNKRhhypWAm9r4gG5A8SYNcOcVF2KXr8x7FS 3YNOtpAKqYGOV0qYzvbSWI1Dkf4MHAfTcR6eQI/Z6sTA7axfcpX1ZfsvoUP8HgNJQUP5 dvV3L1CiZogOs0sIijQEt/ESXFq7fJ0seqHIc8IkuhCVXInWwF+L4OBxOZEwhFD72Dn9 WA8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=pK48qWr6IX8OcdTtBHIfXTw/psBMMqs07RTnmbAL+dw=; b=amcTua9dGW53STKkFhTOJ0doZsnXsWRZjgEVvx6hCZnfL+lMfsBZbsb6Nm7w7CbLz2 eb9Wc4nMJbG0VnXMs2GmsO839HwSbB0Rou1K+O66WhgbkE+2C+ZwHRmOO1GHftCI04Il r6XuCIQ1DAKdvaptIZv4ghVvh6mH20Uh7MhFYnxIR0nfMEX0CW+P31zMWThtew1KvN3w WfSjvJdaICRlAMRddTefWb4RUxK4oEWuJ/z1eTCD69c/Fc35RwbNpS0E0+5AcVsdbXzY 4z0c8MpQXkHXIER8A+epuPResX2+UpEhsApCw1dqu2N8p/L0H9LssFL/JG1DvkXWQT33 TiLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si9036036pfm.135.2019.07.05.03.00.58; Fri, 05 Jul 2019 03:01:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727720AbfGEJ6X (ORCPT + 99 others); Fri, 5 Jul 2019 05:58:23 -0400 Received: from mga18.intel.com ([134.134.136.126]:42367 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728446AbfGEJ6I (ORCPT ); Fri, 5 Jul 2019 05:58:08 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 02:58:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="166448218" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 05 Jul 2019 02:58:04 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 0AD0E445; Fri, 5 Jul 2019 12:58:01 +0300 (EEST) From: Mika Westerberg To: linux-kernel@vger.kernel.org Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Len Brown , Lukas Wunner , Mario.Limonciello@dell.com, Anthony Wong , Mika Westerberg , linux-acpi@vger.kernel.org Subject: [PATCH 5/8] thunderbolt: Hide switch attributes that are not set Date: Fri, 5 Jul 2019 12:57:57 +0300 Message-Id: <20190705095800.43534-6-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190705095800.43534-1-mika.westerberg@linux.intel.com> References: <20190705095800.43534-1-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/thunderbolt/switch.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index eac62ff1b85c..e84067084dcd 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -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) -- 2.20.1