linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Yoder <key@linux.vnet.ibm.com>
To: Mathias Leblanc <mathias.leblanc@st.com>
Cc: Rajiv Andrade <mail@srajiv.net>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	Sirrix AG <tpmdd@sirrix.com>,
	tpmdd-devel@lists.sourceforge.net,
	Debora Velarde <debora@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org,
	Jean-Luc Blanc <jean-luc.blanc@st.com>
Subject: Re: [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x
Date: Mon, 26 Nov 2012 11:46:32 -0600	[thread overview]
Message-ID: <20121126174632.GA12737@ennui.austin.ibm.com> (raw)
In-Reply-To: <1353363322-2923-1-git-send-email-mathias.leblanc@st.com>

Hi Mathias,

On Mon, Nov 19, 2012 at 11:15:21PM +0100, Mathias Leblanc wrote:
>  * STMicroelectronics version 1.2.0, Copyright (C) 2010
>  * STMicroelectronics comes with ABSOLUTELY NO WARRANTY.
>  * This is free software, and you are welcome to redistribute it
>  * under certain conditions.
> 
> This is the driver for TPM chip from ST Microelectronics.
> 
> If you have a TPM security chip from STMicroelectronics working with
> an I2C, in menuconfig or .config choose the tpm driver on
> device --> tpm and activate the protocol of your choice before compiling
> the kernel.
> The driver will be accessible from within Linux.
> 
> Tested on linux x86/x64, beagleboard REV B & XM REV C and CHROMIUM OS
> on kernel 3.x.x
> 
> Signed-off-by: Mathias Leblanc <mathias.leblanc@st.com>
> ---
>  drivers/char/tpm/tpm_stm_st33_i2c.c  |  903 ++++++++++++++++++++++++++++++++++
>  drivers/char/tpm/tpm_stm_st33_i2c.h  |   81 +++
>  include/linux/i2c/tpm_stm_st33_i2c.h |   47 ++
>  3 files changed, 1031 insertions(+)
>  create mode 100644 drivers/char/tpm/tpm_stm_st33_i2c.c
>  create mode 100644 drivers/char/tpm/tpm_stm_st33_i2c.h
>  create mode 100644 include/linux/i2c/tpm_stm_st33_i2c.h

  I'm still getting the compiler errors I mentioned earlier. I've fixed
them up with the patch below (plus some formatting), all except for the
tpm_continue_selftest_nocheck() problem. Do you really need to call
continue selftest on resume?  That strikes me as out of place here.
What's making the call to the TPM to start the self test in that case?

Please test with the patch below.

Thanks,
Kent


diff --git a/drivers/char/tpm/tpm_stm_st33_i2c.c b/drivers/char/tpm/tpm_stm_st33_i2c.c
index 52f3380..67f81b6 100644
--- a/drivers/char/tpm/tpm_stm_st33_i2c.c
+++ b/drivers/char/tpm/tpm_stm_st33_i2c.c
@@ -722,7 +722,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
 			goto _irq_set;
 
 		intmask = TPM_GLOBAL_INT_ENABLE;
-		err = I2C_WRITE_DATA(client, TPM_INT_ENABLE + 3, &intmask, 1);
+		err = I2C_WRITE_DATA(client, (TPM_INT_ENABLE + 3), &intmask, 1);
 		if (err < 0)
 			goto _irq_set;
 
@@ -820,10 +820,10 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
 
 	if (power_mgt)
 		gpio_set_value(pin_infos->io_lpcpd, 0);
-	else{
+	else {
 		if (chip->data_buffer == NULL)
 			chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
-		ret = tpm_pm_suspend(&client->dev, mesg);
+		ret = tpm_pm_suspend(&client->dev);
 	}
 	return ret;
 }				/* tpm_st33_i2c_suspend() */
@@ -848,12 +848,12 @@ static int tpm_st33_i2c_pm_resume(struct i2c_client *client)
 					  (chip->vendor.status(chip) &&
 					  TPM_STS_VALID) == TPM_STS_VALID,
 					  chip->vendor.timeout_b);
-	} else{
-	if (chip->data_buffer == NULL)
-		chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
-	ret = tpm_pm_resume(&client->dev);
-	if (!ret)
-		tpm_continue_selftest_nocheck(chip);
+	} else {
+		if (chip->data_buffer == NULL)
+			chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
+		ret = tpm_pm_resume(&client->dev);
+		if (!ret)
+			tpm_continue_selftest_nocheck(chip);
 	}
 	return ret;
 }				/* tpm_st33_i2c_pm_resume() */


  parent reply	other threads:[~2012-11-26 17:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 22:15 [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x Mathias Leblanc
2012-11-19 22:15 ` [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 2.6 Mathias Leblanc
2012-11-26 17:46 ` Kent Yoder [this message]
2012-11-27  8:44   ` [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x Mathias LEBLANC
2012-11-27 14:48     ` [tpmdd-devel] " Kent Yoder
2012-11-28  8:54       ` Mathias LEBLANC
2012-11-28 15:31         ` Kent Yoder
2012-11-28 17:48           ` Mathias LEBLANC
2012-11-28 19:04             ` Kent Yoder
2012-11-29  0:04             ` Peter Hüwe
2012-12-05 16:11               ` Mathias LEBLANC
2012-12-05 17:13                 ` Kent Yoder
2012-12-05 17:45                   ` Kent Yoder
2012-12-05 18:07                     ` Kent Yoder
2012-12-05 20:20                       ` Peter Hüwe
2012-12-05 21:00                         ` Kent Yoder
2012-12-05 21:39                           ` Peter Hüwe
2012-12-05 21:14                       ` Peter Hüwe
2012-12-05 23:09                         ` Kent Yoder
2012-12-06  0:10                           ` Peter Hüwe
2012-12-06 15:06                             ` Kent Yoder
2012-12-08  4:00                               ` [tpmdd-devel] [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x OOPS! Peter Hüwe
     [not found]                                 ` <20130108172053.GA11223@ennui.austin.ibm.com>
2013-01-09 14:31                                   ` Mathias LEBLANC
2013-01-09 19:41                                     ` Peter Hüwe
2013-01-22 23:30                                       ` 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=20121126174632.GA12737@ennui.austin.ibm.com \
    --to=key@linux.vnet.ibm.com \
    --cc=debora@linux.vnet.ibm.com \
    --cc=jean-luc.blanc@st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@srajiv.net \
    --cc=mathias.leblanc@st.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    --cc=tpmdd@sirrix.com \
    /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).