public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] - TPM save state before suspending to ram
@ 2008-01-03 20:44 Marcel Selhorst
  2008-01-04 16:39 ` Pavel Machek
  0 siblings, 1 reply; 9+ messages in thread
From: Marcel Selhorst @ 2008-01-03 20:44 UTC (permalink / raw)
  To: TPM Device Driver List, linux-kernel; +Cc: Andrew Morton

Dear list,

this patch fixes a bug, that prevents the TPM chip to resume correctly from a
suspended state.

Signed-off-by: Marcel Selhorst <tpm@selhorst.net>
---
--- linux-tpm/drivers/char/tpm/tpm.c	2008-01-03 20:44:43.000000000 +0100
+++ linux/drivers/char/tpm/tpm.c	2008-01-03 21:08:13.000000000 +0100
@@ -1041,7 +1041,7 @@ void tpm_remove_hardware(struct device *
 }
 EXPORT_SYMBOL_GPL(tpm_remove_hardware);

-static u8 savestate[] = {
+static const u8 savestate[] = {
 	0, 193,			/* TPM_TAG_RQU_COMMAND */
 	0, 0, 0, 10,		/* blob length (in bytes) */
 	0, 0, 0, 152		/* TPM_ORD_SaveState */
@@ -1053,11 +1053,13 @@ static u8 savestate[] = {
  */
 int tpm_pm_suspend(struct device *dev, pm_message_t pm_state)
 {
+	u8 data[max_t(int, max(ARRAY_SIZE(savestate), ARRAY_SIZE(savestate)), 10)];
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 	if (chip == NULL)
 		return -ENODEV;

-	tpm_transmit(chip, savestate, sizeof(savestate));
+	memcpy(data, savestate, sizeof(savestate));
+	tpm_transmit(chip, data, sizeof(data));
 	return 0;
 }
 EXPORT_SYMBOL_GPL(tpm_pm_suspend);



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-01-14 22:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-03 20:44 [PATCH] - TPM save state before suspending to ram Marcel Selhorst
2008-01-04 16:39 ` Pavel Machek
2008-01-04 20:09   ` [tpmdd-devel] " Kent Yoder
2008-01-04 23:29     ` Marcel Selhorst
2008-01-04 23:44     ` Pavel Machek
2008-01-05  4:54       ` David Smith
2008-01-14 21:40         ` Rafael J. Wysocki
2008-01-14 21:52           ` Andrew Morton
2008-01-14 22:09             ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox