diff mbox

tpm: Fix suspend regression

Message ID 1462892834-5631-1-git-send-email-stefanb@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Berger May 10, 2016, 3:07 p.m. UTC
Fix the suspend regression due to wrong way of retrieving
the chip from the parent device.

Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm-interface.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jason Gunthorpe May 10, 2016, 4:52 p.m. UTC | #1
On Tue, May 10, 2016 at 11:07:14AM -0400, Stefan Berger wrote:
> Fix the suspend regression due to wrong way of retrieving
> the chip from the parent device.

Yep, that is it, commentary needs a tweak though:

Fix the susped regression due to the wrong way of retrieving the
chip. The suspend functions are attached to the hardware device,
not the chip and thus must rely on drvdata.

> Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM Core")
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Jason

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Stefan Berger May 10, 2016, 5:38 p.m. UTC | #2
Jason Gunthorpe <jgunthorpe@obsidianresearch.com> wrote on 05/10/2016 
12:52:51 PM:

> 
> On Tue, May 10, 2016 at 11:07:14AM -0400, Stefan Berger wrote:
> > Fix the suspend regression due to wrong way of retrieving
> > the chip from the parent device.
> 
> Yep, that is it, commentary needs a tweak though:
> 
> Fix the susped regression due to the wrong way of retrieving the
> chip. The suspend functions are attached to the hardware device,
> not the chip and thus must rely on drvdata.
> 
> > Reported-by: Jeremiah Mahler <jmmahler@gmail.com>
> > Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> > Tested-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
> 
> Fixes: e89f8b1ade9cc1a ("tpm: Remove all uses of drvdata from the TPM 
Core")
> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Thanks. I'll post v2 tomorrow in case I can collect some more Tested-by's.

   Stefan
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 080dade..5e3c1b6 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -934,7 +934,7 @@  static struct tpm_input_header savestate_header = {
  */
 int tpm_pm_suspend(struct device *dev)
 {
-	struct tpm_chip *chip = to_tpm_chip(dev);
+	struct tpm_chip *chip = dev_get_drvdata(dev);
 	struct tpm_cmd_t cmd;
 	int rc, try;
 
@@ -995,7 +995,7 @@  EXPORT_SYMBOL_GPL(tpm_pm_suspend);
  */
 int tpm_pm_resume(struct device *dev)
 {
-	struct tpm_chip *chip = to_tpm_chip(dev);
+	struct tpm_chip *chip = dev_get_drvdata(dev);
 
 	if (chip == NULL)
 		return -ENODEV;