From patchwork Mon Dec 25 02:22:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 10132231 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 906986037D for ; Mon, 25 Dec 2017 02:23:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83EE6289EA for ; Mon, 25 Dec 2017 02:23:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 784E128C8E; Mon, 25 Dec 2017 02:23:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20F09289EA for ; Mon, 25 Dec 2017 02:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751443AbdLYCXf (ORCPT ); Sun, 24 Dec 2017 21:23:35 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33119 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbdLYCW5 (ORCPT ); Sun, 24 Dec 2017 21:22:57 -0500 Received: by mail-wm0-f65.google.com with SMTP id g130so31968747wme.0 for ; Sun, 24 Dec 2017 18:22:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VdLMyGvgmaduTU05CVQyKcKovxI1+kbU0lI3nyh72ro=; b=qZ2B+gx6t4WwREqphV9V9G6n76B1Oypbc5b8+9GqkC4MLvGpTXov60CsgAoP5hZzfe OcrTRzceXHxHX3DJqhGlB3LRBuwnROCDXpJWyW7pv3ay/MUvzr3hrsCr5VRiuhYeHHKY IpBjW4E7IxT3OXwBTzr52IAU7NQQC/k+1uQvm6AEWcABx0PApsqLs9kIHY2Ci9X4iUlO IdGUUgFrwa8pNxVwA9E2yU8ZaU7ZQEkg6UEWic0TkOoYrXGrckipfmJCAkVSKqyC57ms 5emNvB6lpHNba9zRjYcemzb3sQWVaTZLUyMNVZ8/nsFZcOpsXWKQuSDN350SXBk4ip/o LWEQ== X-Gm-Message-State: AKGB3mIDdbiPwb+zUf//09svQP+kQPLLGXTbuAmuIg7Pez0jf6DknuKn E02dtAO30jvPydZcP6C6ielQSg== X-Google-Smtp-Source: ACJfBov3UC3o2B5fc7fk987upnmH2SSJGv5PDjYSE5g/KunBIe+IZDBbNXPx+F4vnw6lVEYBPbuwqw== X-Received: by 10.28.185.68 with SMTP id j65mr17237502wmf.135.1514168576371; Sun, 24 Dec 2017 18:22:56 -0800 (PST) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id v10sm7635011wra.15.2017.12.24.18.22.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Dec 2017 18:22:55 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: James Ettle , Hans de Goede , Azhar Shaikh , Javier Martinez Canillas , Jason Gunthorpe , linux-integrity@vger.kernel.org, Peter Huewe , Jarkko Sakkinen Subject: [PATCH v2 1/3] tpm: delete the TPM_TIS_CLK_ENABLE flag Date: Mon, 25 Dec 2017 03:22:49 +0100 Message-Id: <20171225022251.6464-2-javierm@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171225022251.6464-1-javierm@redhat.com> References: <20171225022251.6464-1-javierm@redhat.com> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This flag is only used to warn if CLKRUN_EN wasn't disabled on Braswell systems, but the only way this can happen is if the code is not correct. So it's an unnecessary check that just makes the code harder to read. Suggested-by: Jarkko Sakkinen Signed-off-by: Javier Martinez Canillas Reviewed-by: Jarkko Sakkinen Tested-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_tis.c | 15 --------------- drivers/char/tpm/tpm_tis_core.c | 2 -- drivers/char/tpm/tpm_tis_core.h | 1 - 3 files changed, 18 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index c847fc69a2fc..4b73e28458e3 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -138,9 +138,6 @@ static int tpm_tcg_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len, { struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - if (is_bsw() && !(data->flags & TPM_TIS_CLK_ENABLE)) - WARN(1, "CLKRUN not enabled!\n"); - while (len--) *result++ = ioread8(phy->iobase + addr); @@ -152,9 +149,6 @@ static int tpm_tcg_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len, { struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - if (is_bsw() && !(data->flags & TPM_TIS_CLK_ENABLE)) - WARN(1, "CLKRUN not enabled!\n"); - while (len--) iowrite8(*value++, phy->iobase + addr); @@ -165,9 +159,6 @@ static int tpm_tcg_read16(struct tpm_tis_data *data, u32 addr, u16 *result) { struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - if (is_bsw() && !(data->flags & TPM_TIS_CLK_ENABLE)) - WARN(1, "CLKRUN not enabled!\n"); - *result = ioread16(phy->iobase + addr); return 0; @@ -177,9 +168,6 @@ static int tpm_tcg_read32(struct tpm_tis_data *data, u32 addr, u32 *result) { struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - if (is_bsw() && !(data->flags & TPM_TIS_CLK_ENABLE)) - WARN(1, "CLKRUN not enabled!\n"); - *result = ioread32(phy->iobase + addr); return 0; @@ -189,9 +177,6 @@ static int tpm_tcg_write32(struct tpm_tis_data *data, u32 addr, u32 value) { struct tpm_tis_tcg_phy *phy = to_tpm_tis_tcg_phy(data); - if (is_bsw() && !(data->flags & TPM_TIS_CLK_ENABLE)) - WARN(1, "CLKRUN not enabled!\n"); - iowrite32(value, phy->iobase + addr); return 0; diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index dc3600fc79b7..f2bd99fa8352 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -751,7 +751,6 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value) return; if (value) { - data->flags |= TPM_TIS_CLK_ENABLE; data->clkrun_enabled++; if (data->clkrun_enabled > 1) return; @@ -782,7 +781,6 @@ static void tpm_tis_clkrun_enable(struct tpm_chip *chip, bool value) * sure LPC clock is running before sending any TPM command. */ outb(0xCC, 0x80); - data->flags &= ~TPM_TIS_CLK_ENABLE; } } diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h index afc50cde1ba6..d5c6a2e952b3 100644 --- a/drivers/char/tpm/tpm_tis_core.h +++ b/drivers/char/tpm/tpm_tis_core.h @@ -86,7 +86,6 @@ enum tis_defaults { enum tpm_tis_flags { TPM_TIS_ITPM_WORKAROUND = BIT(0), - TPM_TIS_CLK_ENABLE = BIT(1), }; struct tpm_tis_data {