From patchwork Thu Mar 31 10:11:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 8710731 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 3852D9F36E for ; Thu, 31 Mar 2016 10:11:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57CF8201F5 for ; Thu, 31 Mar 2016 10:11:57 +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 73E1C2026C for ; Thu, 31 Mar 2016 10:11:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1alZZx-0001XF-Bp; Thu, 31 Mar 2016 10:11:53 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1alZZw-0001X6-3s for tpmdd-devel@lists.sourceforge.net; Thu, 31 Mar 2016 10:11:52 +0000 X-ACL-Warn: Received: from mga04.intel.com ([192.55.52.120]) by sog-mx-3.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1alZZv-0004QG-4f for tpmdd-devel@lists.sourceforge.net; Thu, 31 Mar 2016 10:11:52 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 31 Mar 2016 03:11:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,421,1455004800"; d="scan'208";a="922481903" Received: from jsakkine-mobl1.tm.intel.com (HELO localhost) ([10.237.50.180]) by orsmga001.jf.intel.com with ESMTP; 31 Mar 2016 03:11:43 -0700 From: Jarkko Sakkinen To: Peter Huewe Date: Thu, 31 Mar 2016 13:11:27 +0300 Message-Id: <1459419087-20487-1-git-send-email-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.7.4 X-Spam-Score: -1.0 (-) X-Headers-End: 1alZZv-0004QG-4f Cc: open list , "moderated list:TPM DEVICE DRIVER" , Christophe Ricard Subject: [tpmdd-devel] [PATCH] tpm: cleanup tpm_tis_remove() 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=-7.9 required=5.0 tests=BAYES_00, HK_RANDOM_ENVFROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Created a local variable for the register in order to clean up experession where TPM_GLOBAL_INT_ENABLE is cleared. This expression is horrible to read and makes changing the function uncomfortable because like easily surpass 80 characters. Signed-off-by: Jarkko Sakkinen Tested-by: Christophe Ricard --- drivers/char/tpm/tpm_tis.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 068f021..ce2b984 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -658,15 +658,14 @@ MODULE_PARM_DESC(interrupts, "Enable interrupts"); static void tpm_tis_remove(struct tpm_chip *chip) { + void __iomem *reg = chip->vendor.iobase + + TPM_INT_ENABLE(chip->vendor.locality); + if (chip->flags & TPM_CHIP_FLAG_TPM2) tpm2_shutdown(chip, TPM2_SU_CLEAR); - iowrite32(~TPM_GLOBAL_INT_ENABLE & - ioread32(chip->vendor.iobase + - TPM_INT_ENABLE(chip->vendor. - locality)), - chip->vendor.iobase + - TPM_INT_ENABLE(chip->vendor.locality)); + iowrite32(~TPM_GLOBAL_INT_ENABLE & ioread32(reg), reg); + release_locality(chip, chip->vendor.locality, 1); }