]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tpm: add module_put wrapper
authorMimi Zohar <zohar@linux.vnet.ibm.com>
Tue, 23 Nov 2010 22:50:32 +0000 (17:50 -0500)
committerJames Morris <jmorris@namei.org>
Sun, 28 Nov 2010 21:55:19 +0000 (08:55 +1100)
For readability, define a tpm_chip_put() wrapper to call module_put().
Replace existing module_put() calls with the wrapper.

(Change based on trusted/encrypted patchset review by David Howells.)

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: David Safford <safford@watson.ibm.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Signed-off-by: James Morris <jmorris@namei.org>
drivers/char/tpm/tpm.c
drivers/char/tpm/tpm.h

index 7c4133582dbae484f449d49f97b2ee0f179a9891..26c09f3b4a74344ccd66dd0b3b6ceca4fc72c135 100644 (file)
@@ -736,7 +736,7 @@ int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf)
        if (chip == NULL)
                return -ENODEV;
        rc = __tpm_pcr_read(chip, pcr_idx, res_buf);
-       module_put(chip->dev->driver->owner);
+       tpm_chip_put(chip);
        return rc;
 }
 EXPORT_SYMBOL_GPL(tpm_pcr_read);
@@ -775,7 +775,7 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash)
        rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE,
                          "attempting extend a PCR value");
 
-       module_put(chip->dev->driver->owner);
+       tpm_chip_put(chip);
        return rc;
 }
 EXPORT_SYMBOL_GPL(tpm_pcr_extend);
index 792868d24f2a0f2ad6bc21a4967ace01a2f84d92..72ddb031b69a24e425a22d5892283b91f6cc1eec 100644 (file)
@@ -113,6 +113,11 @@ struct tpm_chip {
 
 #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
 
+static inline void tpm_chip_put(struct tpm_chip *chip)
+{
+       module_put(chip->dev->driver->owner);
+}
+
 static inline int tpm_read_index(int base, int index)
 {
        outb(index, base);