mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Huewe <peterhuewe@gmx.de>
To: tpmdd-devel@lists.sourceforge.net
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Use devm_ioremap_resource to reserve resource
Date: Tue, 22 Jul 2014 01:26:05 +0200	[thread overview]
Message-ID: <1405985165-9631-1-git-send-email-peterhuewe@gmx.de> (raw)

Unfortunately the tpm_tis driver did never call request_region for its
adress space - now since we've got devm_ioremap_resource we can simply
remove all the stuff and do everything in one call.

Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/char/tpm/tpm_tis.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 2c46734..a79be26 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -534,13 +534,14 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 	u32 vendor, intfcaps, intmask;
 	int rc, i, irq_s, irq_e, probe;
 	struct tpm_chip *chip;
+	struct resource res = DEFINE_RES_MEM_NAMED(start, len, "tpm_tis");
 
 	if (!(chip = tpm_register_hardware(dev, &tpm_tis)))
 		return -ENODEV;
 
-	chip->vendor.iobase = ioremap(start, len);
-	if (!chip->vendor.iobase) {
-		rc = -EIO;
+	chip->vendor.iobase = devm_ioremap_resource(dev, &res);
+	if (IS_ERR(chip->vendor.iobase)) {
+		rc = PTR_ERR(chip->vendor.iobase);
 		goto out_err;
 	}
 
@@ -727,8 +728,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
 
 	return 0;
 out_err:
-	if (chip->vendor.iobase)
-		iounmap(chip->vendor.iobase);
 	tpm_remove_hardware(chip->dev);
 	return rc;
 }
@@ -891,7 +890,6 @@ static void __exit cleanup_tis(void)
 		release_locality(chip, chip->vendor.locality, 1);
 		if (chip->vendor.irq)
 			free_irq(chip->vendor.irq, chip);
-		iounmap(i->iobase);
 		list_del(&i->list);
 	}
 	mutex_unlock(&tis_lock);
-- 
1.8.5.5


             reply	other threads:[~2014-07-21 23:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 23:26 Peter Huewe [this message]
2014-07-21 23:43 ` [tpmdd-devel] " Jason Gunthorpe
2014-07-22  0:02   ` Peter Hüwe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405985165-9631-1-git-send-email-peterhuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®