linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Huewe <peter.huewe@infineon.com>
To: Kent Yoder <key@linux.vnet.ibm.com>, <jmorris@namei.org>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-security-module@vger.kernel.org>,
	<tpmdd-devel@lists.sourceforge.net>,
	Bryan Freed <bfreed@chromium.org>,
	David Safford <safford@linux.vnet.ibm.com>, <hpa@linux.intel.com>,
	Peter Huewe <peter.huewe@infineon.com>
Subject: [PATCH] char/tpm: Use struct dev_pm_ops for power management.
Date: Mon, 6 Aug 2012 09:58:59 +0200	[thread overview]
Message-ID: <1344239939-5752-1-git-send-email-peter.huewe@infineon.com> (raw)
In-Reply-To: <20120803203836.GA11918@linux.vnet.ibm.com>

Make the tpm_i2c_infineon driver define its PM callbacks trough a
struct dev_pm_ops by using SIMPLE_DEV_PM_OPS instead of coding it
explicitly.

This simplifies the code and allows the driver to use tpm_pm_suspend()
and tpm_pm_resume() as its PM callbacks directly, without defining its
own PM callback routines.

Signed-off-by: Peter Huewe <peter.huewe@infineon.com>
---
Thanks Kent and Rafael - much better this way ;)

 drivers/char/tpm/tpm_i2c_infineon.c |   30 +-----------------------------
 1 files changed, 1 insertions(+), 29 deletions(-)

diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 1794a09..65761b6 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -655,35 +655,7 @@ static const struct i2c_device_id tpm_tis_i2c_table[] = {
 };
 
 MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_table);
-
-#ifdef CONFIG_PM
-/* NOTE:
- * Suspend does currently not work Nvidias Tegra2 Platform
- * but works fine on Beagleboard (arm omap).
- *
- * This function will block System Suspend if TPM is not initialized,
- * however the TPM is usually initialized by BIOS/u-boot or by sending
- * a TPM_Startup command.
- */
-static int tpm_tis_i2c_suspend(struct device *dev)
-{
-	return tpm_pm_suspend(dev, dev->power.power_state);
-}
-
-static int tpm_tis_i2c_resume(struct device *dev)
-{
-	return tpm_pm_resume(dev);
-}
-
-static const struct dev_pm_ops tpm_tis_i2c_ops = {
-	.suspend = tpm_tis_i2c_suspend,
-	.resume = tpm_tis_i2c_resume,
-};
-#else
-#define tpm_tis_i2c_suspend NULL
-#define tpm_tis_i2c_resume NULL
-#define tpm_tis_i2c_ops NULL
-#endif
+static SIMPLE_DEV_PM_OPS(tpm_tis_i2c_ops, tpm_pm_suspend, tpm_pm_resume);
 
 static int __devinit tpm_tis_i2c_probe(struct i2c_client *client,
 			     const struct i2c_device_id *id)
-- 
1.7.6.msysgit.0


  reply	other threads:[~2012-08-06  7:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120730210522.GA23790@linux.vnet.ibm.com>
2012-08-03  4:40 ` New TPM driver, hwrng driver and fixes (2) James Morris
2012-08-03  4:45   ` James Morris
2012-08-03  7:42     ` Peter.Huewe
2012-08-03 14:51     ` [PATCH] char/tpm: Fix compile error if CONFIG_PM is not set in tpm_i2c_infineon Peter Huewe
2012-08-03 20:38       ` Kent Yoder
2012-08-06  7:58         ` Peter Huewe [this message]
2012-08-06 19:29           ` [PATCH] char/tpm: Use struct dev_pm_ops for power management Kent Yoder
2012-08-07  7:30             ` Peter.Huewe
2012-08-07  9:42             ` [PATCH] char/tpm: Add new driver for Infineon I2C TIS TPM Peter Huewe
2012-12-05 23:09 [tpmdd-devel] [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x Kent Yoder
2012-12-06  0:20 ` [PATCH] char/tpm: Use struct dev_pm_ops for power management Peter Huewe
2012-12-06 15:07   ` Kent Yoder
2012-12-10 18:11     ` Mathias LEBLANC
2012-12-06 16:27   ` Kent Yoder
2012-12-08  3:55     ` 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=1344239939-5752-1-git-send-email-peter.huewe@infineon.com \
    --to=peter.huewe@infineon.com \
    --cc=bfreed@chromium.org \
    --cc=hpa@linux.intel.com \
    --cc=jmorris@namei.org \
    --cc=key@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=safford@linux.vnet.ibm.com \
    --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;
as well as URLs for NNTP newsgroup(s).