All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Yoder <key@linux.vnet.ibm.com>
To: Peter Huewe <peterhuewe@gmx.de>
Cc: Mathias LEBLANC <Mathias.LEBLANC@st.com>,
	Jean-Luc BLANC <jean-luc.blanc@st.com>,
	"Sirrix@jasper.es" <Sirrix@jasper.es>,
	linux-kernel@vger.kernel.org, Rajiv Andrade <mail@srajiv.net>,
	"tpmdd-devel@lists.sourceforge.net" 
	<tpmdd-devel@lists.sourceforge.net>,
	Kent Yoder <shpedoikal@gmail.com>
Subject: Re: [PATCH] char/tpm: Use struct dev_pm_ops for power management
Date: Thu, 6 Dec 2012 10:27:02 -0600	[thread overview]
Message-ID: <20121206162702.GC27430@ennui.austin.ibm.com> (raw)
In-Reply-To: <1354753251-27561-1-git-send-email-peterhuewe@gmx.de>

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.
> 
> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>

  One minor tweak, the PM funcs need to be inside CONFIG_PM_SLEEP to
avoid warnings when compiled without PM support.  Applied with that
change only.

Thanks Peter!
Kent

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


  parent reply	other threads:[~2012-12-06 16:28 UTC|newest]

Thread overview: 33+ 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 ` [PATCH 1/1] TPM: STMicroelectronics ST33 I2C KERNEL 3.x.x Kent Yoder
2012-11-27  8:44   ` 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 [this message]
2012-12-08  3:55                               ` Peter Hüwe
  -- strict thread matches above, loose matches on Subject: below --
2012-08-03 20:38 [PATCH] char/tpm: Fix compile error if CONFIG_PM is not set in tpm_i2c_infineon Kent Yoder
2012-08-06  7:58 ` [PATCH] char/tpm: Use struct dev_pm_ops for power management Peter Huewe
2012-08-06 19:29   ` Kent Yoder
2012-08-07  7:30     ` Peter.Huewe

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=20121206162702.GC27430@ennui.austin.ibm.com \
    --to=key@linux.vnet.ibm.com \
    --cc=Mathias.LEBLANC@st.com \
    --cc=Sirrix@jasper.es \
    --cc=jean-luc.blanc@st.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@srajiv.net \
    --cc=peterhuewe@gmx.de \
    --cc=shpedoikal@gmail.com \
    --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.