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: 604045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 ozlabs.org (Postfix) with ESMTPS id 3qbL0H4BRyz9sD1 for ; Thu, 31 Mar 2016 21:11:59 +1100 (AEDT) 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-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 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 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); }