Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610Ab0KXCTs (ORCPT ); Tue, 23 Nov 2010 21:19:48 -0500 Received: from adelie.canonical.com ([91.189.90.139]:45454 "EHLO adelie.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071Ab0KXCTq (ORCPT ); Tue, 23 Nov 2010 21:19:46 -0500 Date: Tue, 23 Nov 2010 20:19:33 -0600 From: Serge Hallyn To: Mimi Zohar Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@linux-nfs.org, linux-crypto@vger.kernel.org, David Howells , Jason Gunthorpe , James Morris , David Safford , Rajiv Andrade , Mimi Zohar Subject: Re: [PATCH v1.5 2/5] tpm: add module_put wrapper Message-ID: <20101124021933.GB25766@tiny> References: <1290552635-3356-1-git-send-email-zohar@linux.vnet.ibm.com> <1290552635-3356-3-git-send-email-zohar@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1290552635-3356-3-git-send-email-zohar@linux.vnet.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2342 Lines: 69 Quoting Mimi Zohar (zohar@linux.vnet.ibm.com): > 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 > Signed-off-by: David Safford > Acked-by: David Howells Hard to object to this one :) Acked-by: Serge E. Hallyn > --- > drivers/char/tpm/tpm.c | 4 ++-- > 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 7c41335..26c09f3 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) > 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); > diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h > index 792868d..72ddb03 100644 > --- a/drivers/char/tpm/tpm.h > +++ b/drivers/char/tpm/tpm.h > @@ -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); > -- > 1.7.2.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/