diff mbox

[v2,04/10] tpm/tpm_i2c_stm_st33: Replace access to io_lpcpd from struct st33zp24_platform_data to tpm_stm_dev

Message ID 1421187198-8503-5-git-send-email-christophe-h.ricard@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christophe Ricard Jan. 13, 2015, 10:13 p.m. UTC
io_lpcpd is accessible from struct tpm_stm_dev.
struct st33zp24_platform_data is only valid when using static platform
configuration data, not when using dts.

Reviewed-by: Jasob Gunthorpe <jason.gunthorpe@obsidianresearch.com>
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
---
 drivers/char/tpm/tpm_i2c_stm_st33.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Peter Huewe Jan. 17, 2015, 1:44 p.m. UTC | #1
Am Dienstag, 13. Januar 2015, 23:13:12 schrieb Christophe Ricard:
> io_lpcpd is accessible from struct tpm_stm_dev.
> struct st33zp24_platform_data is only valid when using static platform
> configuration data, not when using dts.
> 
> Reviewed-by: Jasob Gunthorpe <jason.gunthorpe@obsidianresearch.com>
> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
> ---
>  drivers/char/tpm/tpm_i2c_stm_st33.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c
> b/drivers/char/tpm/tpm_i2c_stm_st33.c index d12d507..9d3c9c8 100644
> --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
> +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
> @@ -834,11 +834,14 @@ static int tpm_stm_i2c_remove(struct i2c_client
> *client) */
>  static int tpm_stm_i2c_pm_suspend(struct device *dev)
>  {
> -	struct st33zp24_platform_data *pin_infos = dev->platform_data;
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
> +	struct tpm_stm_dev *tpm_dev;
>  	int ret = 0;
> 
> -	if (gpio_is_valid(pin_infos->io_lpcpd))
> -		gpio_set_value(pin_infos->io_lpcpd, 0);
> +	tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
> +
> +	if (gpio_is_valid(tpm_dev->io_lpcpd))
> +		gpio_set_value(tpm_dev->io_lpcpd, 0);
>  	else
>  		ret = tpm_pm_suspend(dev);

patch is not self contained and fails to build.

drivers/char/tpm/tpm_i2c_stm_st33.c: In function 'tpm_stm_i2c_pm_resume':
drivers/char/tpm/tpm_i2c_stm_st33.c:864:20: error: 'pin_infos' undeclared 
(first use in this function)
  if (gpio_is_valid(pin_infos->io_lpcpd)) {
                    ^
drivers/char/tpm/tpm_i2c_stm_st33.c:864:20: note: each undeclared identifier 
is reported only once for each function it appears in
scripts/Makefile.build:263: recipe for target 
'drivers/char/tpm/tpm_i2c_stm_st33.o' failed
make[3]: *** [drivers/char/tpm/tpm_i2c_stm_st33.o] Error 1

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index d12d507..9d3c9c8 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -834,11 +834,14 @@  static int tpm_stm_i2c_remove(struct i2c_client *client)
  */
 static int tpm_stm_i2c_pm_suspend(struct device *dev)
 {
-	struct st33zp24_platform_data *pin_infos = dev->platform_data;
+	struct tpm_chip *chip = dev_get_drvdata(dev);
+	struct tpm_stm_dev *tpm_dev;
 	int ret = 0;
 
-	if (gpio_is_valid(pin_infos->io_lpcpd))
-		gpio_set_value(pin_infos->io_lpcpd, 0);
+	tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
+
+	if (gpio_is_valid(tpm_dev->io_lpcpd))
+		gpio_set_value(tpm_dev->io_lpcpd, 0);
 	else
 		ret = tpm_pm_suspend(dev);
 
@@ -853,12 +856,13 @@  static int tpm_stm_i2c_pm_suspend(struct device *dev)
 static int tpm_stm_i2c_pm_resume(struct device *dev)
 {
 	struct tpm_chip *chip = dev_get_drvdata(dev);
-	struct st33zp24_platform_data *pin_infos = dev->platform_data;
-
+	struct tpm_stm_dev *tpm_dev;
 	int ret = 0;
 
+	tpm_dev = (struct tpm_stm_dev *)TPM_VPRIV(chip);
+
 	if (gpio_is_valid(pin_infos->io_lpcpd)) {
-		gpio_set_value(pin_infos->io_lpcpd, 1);
+		gpio_set_value(tpm_dev->io_lpcpd, 1);
 		ret = wait_for_stat(chip,
 				TPM_STS_VALID, chip->vendor.timeout_b,
 				&chip->vendor.read_queue, false);