All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Selhorst <tpm@selhorst.net>
To: TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>,
	linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] - TPM save state before suspending to ram
Date: Thu, 03 Jan 2008 21:44:15 +0100	[thread overview]
Message-ID: <477D491F.1060001@selhorst.net> (raw)

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);



             reply	other threads:[~2008-01-03 20:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 20:44 Marcel Selhorst [this message]
2008-01-04 16:39 ` [PATCH] - TPM save state before suspending to ram 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

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=477D491F.1060001@selhorst.net \
    --to=tpm@selhorst.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.