lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1344239939-5752-1-git-send-email-peter.huewe@infineon.com>
Date:	Mon, 6 Aug 2012 09:58:59 +0200
From:	Peter Huewe <peter.huewe@...ineon.com>
To:	Kent Yoder <key@...ux.vnet.ibm.com>, <jmorris@...ei.org>
CC:	<linux-kernel@...r.kernel.org>,
	<linux-security-module@...r.kernel.org>,
	<tpmdd-devel@...ts.sourceforge.net>,
	Bryan Freed <bfreed@...omium.org>,
	David Safford <safford@...ux.vnet.ibm.com>,
	<hpa@...ux.intel.com>, Peter Huewe <peter.huewe@...ineon.com>
Subject: [PATCH] char/tpm: Use struct dev_pm_ops for power management.

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@...ineon.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ