From patchwork Wed Dec 20 11:35:36 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: 10125535 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 0DF986057F for ; Wed, 20 Dec 2017 11:37:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 081F529612 for ; Wed, 20 Dec 2017 11:37:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F105C29711; Wed, 20 Dec 2017 11:37:08 +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 A556E29612 for ; Wed, 20 Dec 2017 11:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755224AbdLTLg3 (ORCPT ); Wed, 20 Dec 2017 06:36:29 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:46344 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754985AbdLTLft (ORCPT ); Wed, 20 Dec 2017 06:35:49 -0500 Received: by mail-wm0-f66.google.com with SMTP id r78so9275971wme.5 for ; Wed, 20 Dec 2017 03:35:49 -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=OA85g2nqSI0L8eFdNIC+PrU6ddBVrWvTG3vVDR7SkTM=; b=YGsC6VIGr9KpP5PH0PPMrQp5zmUrfdmc2id36uT9woy3dahVqTWF8f0CknxAdQ1hFU hjACf0LrjO/gne7gfZphGhfgkPzmGyw0SQu0Si5clKD6Liqtx3eKHNdugO2bQg18YA0E hptFaYp/o2+YQD25sfh7+wCeyAODvAUiCwy0TV8mURji05qZtxENSrU7H/gulizy5RpZ COXwnUnUA+8JnEj2hHUG0H+124NHoTGlHoNh5LbedHMtZoba0DQT6VislJEsF7uFRr5D dCHvMuJnWVtqsc9qCzECYd/CuFJ8MIxFGT8esRqzHR3q05mBO8U5WxBeAGT5My7h05rb AHBA== X-Gm-Message-State: AKGB3mKRsK91ksFN5lQaNeYZmZxeAy79smpn+Qw5SFHFsl+CKEJWvUAH RwW3qXNBwpxKj4rXaa3rx0njUw== X-Google-Smtp-Source: ACJfBouLtc+nccpLec5OxOYAgKysrmKMViY00LAeLgcHQUIu1xvAkzCeE1C75Gvv0nHSQdJkSYzVpg== X-Received: by 10.28.214.136 with SMTP id n130mr6235208wmg.23.1513769748726; Wed, 20 Dec 2017 03:35:48 -0800 (PST) Received: from minerva.home ([90.77.100.34]) by smtp.gmail.com with ESMTPSA id b18sm18353767wra.44.2017.12.20.03.35.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Dec 2017 03:35:48 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: James Ettle , Hans de Goede , Azhar Shaikh , Javier Martinez Canillas , Arnd Bergmann , Jarkko Sakkinen , Peter Huewe , Jason Gunthorpe , Greg Kroah-Hartman , linux-integrity@vger.kernel.org Subject: [PATCH 2/4] tpm: delete the TPM_TIS_CLK_ENABLE flag Date: Wed, 20 Dec 2017 12:35:36 +0100 Message-Id: <20171220113538.16099-3-javierm@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171220113538.16099-1-javierm@redhat.com> References: <20171220113538.16099-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 d29add49b033..d0ad9a89b02b 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 3455abbb2035..09da1e1adc40 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -746,7 +746,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; @@ -777,7 +776,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 {