From patchwork Thu Jan 14 16:01:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 8033901 Return-Path: X-Original-To: patchwork-tpmdd-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DB9BA9F744 for ; Thu, 14 Jan 2016 16:03:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EAFD2042B for ; Thu, 14 Jan 2016 16:03:31 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E84520459 for ; Thu, 14 Jan 2016 16:03:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aJkMu-0003mQ-QK; Thu, 14 Jan 2016 16:03:24 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aJkMt-0003mG-L1 for tpmdd-devel@lists.sourceforge.net; Thu, 14 Jan 2016 16:03:23 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of us.ibm.com designates 32.97.110.159 as permitted sender) client-ip=32.97.110.159; envelope-from=stefanb@us.ibm.com; helo=e38.co.us.ibm.com; Received: from e38.co.us.ibm.com ([32.97.110.159]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1aJkMr-0007fw-Kf for tpmdd-devel@lists.sourceforge.net; Thu, 14 Jan 2016 16:03:23 +0000 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Jan 2016 09:03:15 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 14 Jan 2016 09:03:13 -0700 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: stefanb@us.ibm.com X-IBM-RcptTo: tpmdd-devel@lists.sourceforge.net Received: from b01cxnp22034.gho.pok.ibm.com (b01cxnp22034.gho.pok.ibm.com [9.57.198.24]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 12C423E40054 for ; Thu, 14 Jan 2016 09:03:12 -0700 (MST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0EG3BW928180712 for ; Thu, 14 Jan 2016 16:03:11 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0EG3Afd024858 for ; Thu, 14 Jan 2016 11:03:11 -0500 Received: from sbct-3.watson.ibm.com (sbct-3.watson.ibm.com [9.2.141.158]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0EG21A0011081; Thu, 14 Jan 2016 11:02:01 -0500 From: Stefan Berger To: tpmdd-devel@lists.sourceforge.net Date: Thu, 14 Jan 2016 11:01:55 -0500 Message-Id: <1452787318-29610-2-git-send-email-stefanb@us.ibm.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1452787318-29610-1-git-send-email-stefanb@us.ibm.com> References: <1452787318-29610-1-git-send-email-stefanb@us.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16011416-0029-0000-0000-00000F9F6A97 X-Spam-Score: -1.5 (-) X-Headers-End: 1aJkMr-0007fw-Kf Cc: dhowells@redhat.com, dwmw2@infradead.org Subject: [tpmdd-devel] [RFC PATCH 1/4] New flags for TPM chip avoiding filesystem registrations X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, HK_RANDOM_ENVFROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Berger Introduce 2 new flags that prevent the registration of TPM devices with sysfs and securityfs. None of the exising devices set these flags. Signed-off-by: Stefan Berger --- drivers/char/tpm/tpm-chip.c | 14 +++++++++----- drivers/char/tpm/tpm.h | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index fbd75c5..f2da376 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c @@ -182,11 +182,14 @@ static int tpm1_chip_register(struct tpm_chip *chip) if (chip->flags & TPM_CHIP_FLAG_TPM2) return 0; - rc = tpm_sysfs_add_device(chip); - if (rc) - return rc; + if (!(chip->flags & TPM_CHIP_FLAG_NO_SYSFS)) { + rc = tpm_sysfs_add_device(chip); + if (rc) + return rc; + } - chip->bios_dir = tpm_bios_log_setup(chip->devname); + if (!(chip->flags & TPM_CHIP_FLAG_NO_LOG)) + chip->bios_dir = tpm_bios_log_setup(chip->devname); return 0; } @@ -199,7 +202,8 @@ static void tpm1_chip_unregister(struct tpm_chip *chip) if (chip->bios_dir) tpm_bios_log_teardown(chip->bios_dir); - tpm_sysfs_del_device(chip); + if (!(chip->flags & TPM_CHIP_FLAG_NO_SYSFS)) + tpm_sysfs_del_device(chip); } /* diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index a4257a3..dfa755b 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -168,6 +168,8 @@ struct tpm_vendor_specific { enum tpm_chip_flags { TPM_CHIP_FLAG_REGISTERED = BIT(0), TPM_CHIP_FLAG_TPM2 = BIT(1), + TPM_CHIP_FLAG_NO_SYSFS = BIT(3), + TPM_CHIP_FLAG_NO_LOG = BIT(4), }; struct tpm_chip {