lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 10 Dec 2012 19:11:30 +0100
From:	Mathias LEBLANC <Mathias.LEBLANC@...com>
To:	Kent Yoder <key@...ux.vnet.ibm.com>,
	Peter Huewe <peterhuewe@....de>
Cc:	Jean-Luc BLANC <jean-luc.blanc@...com>,
	"Sirrix@...per.es" <Sirrix@...per.es>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Rajiv Andrade <mail@...jiv.net>,
	"tpmdd-devel@...ts.sourceforge.net" 
	<tpmdd-devel@...ts.sourceforge.net>,
	Kent Yoder <shpedoikal@...il.com>
Subject: RE: [PATCH] char/tpm: Use struct dev_pm_ops for power management

Hi Kent, Peter,

I am never in my office Thursday and Friday, I just saw your emails today.
I will transfer the tpm_i2c_stm_st33.h code to tpm_i2c_stm_st33.c
@Peter: I tested your patch and activate the CONFIG_PM_SLEEP in the kernel compilation.
Thanks Peter!

About:
"Not sure how easy this will be considering these routines are 
> > i2c-specific -- they don't just call the tpm_tpm_* functions like 
> > the other drivers."
We have created another function similar to the tpm_* functions, to ensure the good work of the tpm on each platform for each case.
But anyway , we use the tpm_* function in them.

Thanks,
Mathias Leblanc

-----Original Message-----
From: Kent Yoder [mailto:key@...ux.vnet.ibm.com] 
Sent: 06 December, 2012 16:08
To: Peter Huewe
Cc: Mathias LEBLANC; Jean-Luc BLANC; Sirrix@...per.es; linux-kernel@...r.kernel.org; Rajiv Andrade; tpmdd-devel@...ts.sourceforge.net; Kent Yoder
Subject: Re: [PATCH] char/tpm: Use struct dev_pm_ops for power management

On Thu, Dec 06, 2012 at 01:20:51AM +0100, Peter Huewe wrote:
> This patch converts the suspend and resume functions for
> tpm_i2c_stm_st33 to the new dev_pm_ops.

  Ignore my last mail. I'll take a look at this.

Thanks,
Kent

> Signed-off-by: Peter Huewe <peterhuewe@....de>
> ---
> Note:
> I'm sending this patch on behalf of myself only and nobody else, 
> especially not my employer - and I'm doing this in my spare time.
> I have to inform you that I'm working for a direct competitor of the 
> driver author, but I'm not using any knowledge that is considered secret in any way.
> I have a personal interest in the TPM subsystem and want to keep it as clean as possible.
> 
> 
>  drivers/char/tpm/tpm_i2c_stm_st33.c |   25 ++++++++++---------------
>  1 files changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c 
> b/drivers/char/tpm/tpm_i2c_stm_st33.c
> index b11201f..ecbb81e 100644
> --- a/drivers/char/tpm/tpm_i2c_stm_st33.c
> +++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
> @@ -826,12 +826,10 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client)
>   * @param: mesg, the power management message.
>   * @return: 0 in case of success.
>   */
> -static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, 
> pm_message_t mesg)
> +static int tpm_st33_i2c_pm_suspend(struct device *dev)
>  {
> -	struct tpm_chip *chip =
> -	    (struct tpm_chip *)i2c_get_clientdata(client);
> -	struct st33zp24_platform_data *pin_infos =
> -		((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
> +	struct st33zp24_platform_data *pin_infos = dev->platform_data;
>  	int ret = 0;
> 
>  	if (power_mgt)
> @@ -839,7 +837,7 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
>  	else{
>  		if (chip->data_buffer == NULL)
>  			chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
> -		ret = tpm_pm_suspend(&client->dev);
> +		ret = tpm_pm_suspend(dev);
>  	}
>  	return ret;
>  }				/* tpm_st33_i2c_suspend() */
> @@ -849,12 +847,10 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
>   * @param: client, the i2c_client drescription (TPM I2C description).
>   * @return: 0 in case of success.
>   */
> -static int tpm_st33_i2c_pm_resume(struct i2c_client *client)
> +static int tpm_st33_i2c_pm_resume(struct device *dev)
>  {
> -	struct tpm_chip *chip =
> -	    (struct tpm_chip *)i2c_get_clientdata(client);
> -	struct st33zp24_platform_data *pin_infos =
> -		((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
> +	struct tpm_chip *chip = dev_get_drvdata(dev);
> +	struct st33zp24_platform_data *pin_infos = dev->platform_data;
> 
>  	int ret = 0;
> 
> @@ -867,7 +863,7 @@ static int tpm_st33_i2c_pm_resume(struct i2c_client *client)
>  	} else{
>  	if (chip->data_buffer == NULL)
>  		chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
> -	ret = tpm_pm_resume(&client->dev);
> +	ret = tpm_pm_resume(dev);
>  	if (!ret)
>  		tpm_do_selftest(chip);
>  	}
> @@ -880,16 +876,15 @@ static const struct i2c_device_id 
> tpm_st33_i2c_id[] = {  };
> 
>  MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id);
> -
> +static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend, 
> +tpm_st33_i2c_pm_resume);
>  static struct i2c_driver tpm_st33_i2c_driver = {
>  	.driver = {
>  		   .owner = THIS_MODULE,
>  		   .name = TPM_ST33_I2C,
> +		   .pm = &tpm_st33_i2c_ops,
>  		   },
>  	.probe = tpm_st33_i2c_probe,
>  	.remove = tpm_st33_i2c_remove,
> -	.resume = tpm_st33_i2c_pm_resume,
> -	.suspend = tpm_st33_i2c_pm_suspend,
>  	.id_table = tpm_st33_i2c_id
>  };
> 
> --
> 1.7.8.6
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ