diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2010-11-23 17:50:32 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-11-28 16:55:19 -0500 |
commit | a0e39349d80d8b5deeb264fb190bd064f7063252 (patch) | |
tree | 51269aaf15b299c2afcb1bb53bf95580769fc22a /drivers/char/tpm | |
parent | dc88e46029486ed475c71fe1bb696d39511ac8fe (diff) |
tpm: add module_put wrapper
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>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r-- | drivers/char/tpm/tpm.c | 4 | ||||
-rw-r--r-- | drivers/char/tpm/tpm.h | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 7c4133582dba..26c09f3b4a74 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -736,7 +736,7 @@ int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) | |||
736 | if (chip == NULL) | 736 | if (chip == NULL) |
737 | return -ENODEV; | 737 | return -ENODEV; |
738 | rc = __tpm_pcr_read(chip, pcr_idx, res_buf); | 738 | rc = __tpm_pcr_read(chip, pcr_idx, res_buf); |
739 | module_put(chip->dev->driver->owner); | 739 | tpm_chip_put(chip); |
740 | return rc; | 740 | return rc; |
741 | } | 741 | } |
742 | EXPORT_SYMBOL_GPL(tpm_pcr_read); | 742 | EXPORT_SYMBOL_GPL(tpm_pcr_read); |
@@ -775,7 +775,7 @@ int tpm_pcr_extend(u32 chip_num, int pcr_idx, const u8 *hash) | |||
775 | rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, | 775 | rc = transmit_cmd(chip, &cmd, EXTEND_PCR_RESULT_SIZE, |
776 | "attempting extend a PCR value"); | 776 | "attempting extend a PCR value"); |
777 | 777 | ||
778 | module_put(chip->dev->driver->owner); | 778 | tpm_chip_put(chip); |
779 | return rc; | 779 | return rc; |
780 | } | 780 | } |
781 | EXPORT_SYMBOL_GPL(tpm_pcr_extend); | 781 | EXPORT_SYMBOL_GPL(tpm_pcr_extend); |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 792868d24f2a..72ddb031b69a 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -113,6 +113,11 @@ struct tpm_chip { | |||
113 | 113 | ||
114 | #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor) | 114 | #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor) |
115 | 115 | ||
116 | static inline void tpm_chip_put(struct tpm_chip *chip) | ||
117 | { | ||
118 | module_put(chip->dev->driver->owner); | ||
119 | } | ||
120 | |||
116 | static inline int tpm_read_index(int base, int index) | 121 | static inline int tpm_read_index(int base, int index) |
117 | { | 122 | { |
118 | outb(index, base); | 123 | outb(index, base); |