From patchwork Wed Mar 23 05:10:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 601106 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 3qVHhX5jwsz9sRB for ; Wed, 23 Mar 2016 16:10:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aib4E-0008UD-GF; Wed, 23 Mar 2016 05:10:50 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1aib4D-0008U6-FA for tpmdd-devel@lists.sourceforge.net; Wed, 23 Mar 2016 05:10:49 +0000 X-ACL-Warn: Received: from mga11.intel.com ([192.55.52.93]) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1aib4C-0006oC-La for tpmdd-devel@lists.sourceforge.net; Wed, 23 Mar 2016 05:10:49 +0000 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 22 Mar 2016 22:10:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,380,1455004800"; d="scan'208";a="674200999" Received: from jkotka-mobl4.ger.corp.intel.com (HELO localhost) ([10.252.7.242]) by FMSMGA003.fm.intel.com with ESMTP; 22 Mar 2016 22:10:33 -0700 From: Jarkko Sakkinen To: Peter Huewe Date: Wed, 23 Mar 2016 07:10:22 +0200 Message-Id: <1458709822-6677-1-git-send-email-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.7.3 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1aib4C-0006oC-La Cc: "moderated list:TPM DEVICE DRIVER" , open list Subject: [tpmdd-devel] [PATCH] tpm_atmel: drop tpm_atmel specific fields from tpm_vendor_specific 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 Introduced a private struct tpm_atmel_priv that contains the variables have_region and region_size that were previously located in struct tpm_vendor_specific. These fields were only used by tpm_atmel. Signed-off-by: Jarkko Sakkinen --- drivers/char/tpm/tpm.h | 3 --- drivers/char/tpm/tpm_atmel.c | 23 +++++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 4764545..cbab4e9 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -136,9 +136,6 @@ struct tpm_vendor_specific { int irq; - int region_size; - int have_region; - struct list_head list; int locality; unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */ diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index a48a878..affc04b 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c @@ -35,6 +35,11 @@ enum tpm_atmel_read_status { ATML_STATUS_READY = 0x08 }; +struct tpm_atmel_priv { + int region_size; + int have_region; +}; + static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) { u8 status, *hdr = buf; @@ -136,12 +141,13 @@ static struct platform_device *pdev; static void atml_plat_remove(void) { struct tpm_chip *chip = dev_get_drvdata(&pdev->dev); + struct tpm_atmel_priv *priv = chip->vendor.priv; if (chip) { tpm_chip_unregister(chip); - if (chip->vendor.have_region) + if (priv->have_region) atmel_release_region(chip->vendor.base, - chip->vendor.region_size); + priv->region_size); atmel_put_base_addr(chip->vendor.iobase); platform_device_unregister(pdev); } @@ -163,6 +169,7 @@ static int __init init_atmel(void) int have_region, region_size; unsigned long base; struct tpm_chip *chip; + struct tpm_atmel_priv *priv; rc = platform_driver_register(&atml_drv); if (rc) @@ -183,6 +190,15 @@ static int __init init_atmel(void) goto err_rel_reg; } + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) { + rc = -ENOMEM; + goto err_unreg_dev; + } + + priv->have_region = have_region; + priv->region_size = region_size; + chip = tpmm_chip_alloc(&pdev->dev, &tpm_atmel); if (IS_ERR(chip)) { rc = PTR_ERR(chip); @@ -191,8 +207,7 @@ static int __init init_atmel(void) chip->vendor.iobase = iobase; chip->vendor.base = base; - chip->vendor.have_region = have_region; - chip->vendor.region_size = region_size; + chip->vendor.priv = priv; rc = tpm_chip_register(chip); if (rc)