aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2012-12-05 19:20:51 -0500
committerKent Yoder <key@linux.vnet.ibm.com>2013-02-05 10:38:23 -0500
commitd459335381eca1cb91fefb87021d3d172342e55a (patch)
tree4a112cf8541962ef7d62a2e750e7b6a38be23a4d /drivers/char
parent2bfee22f6c60e046f6b04f2d4855fddac1f67290 (diff)
char/tpm: Use struct dev_pm_ops for power management
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> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index cf4f42e3e83d..24a33e08d0c6 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -818,6 +818,7 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client)
818 return 0; 818 return 0;
819} 819}
820 820
821#ifdef CONFIG_PM_SLEEP
821/* 822/*
822 * tpm_st33_i2c_pm_suspend suspend the TPM device 823 * tpm_st33_i2c_pm_suspend suspend the TPM device
823 * Added: Work around when suspend and no tpm application is running, suspend 824 * Added: Work around when suspend and no tpm application is running, suspend
@@ -827,12 +828,10 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client)
827 * @param: mesg, the power management message. 828 * @param: mesg, the power management message.
828 * @return: 0 in case of success. 829 * @return: 0 in case of success.
829 */ 830 */
830static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg) 831static int tpm_st33_i2c_pm_suspend(struct device *dev)
831{ 832{
832 struct tpm_chip *chip = 833 struct tpm_chip *chip = dev_get_drvdata(dev);
833 (struct tpm_chip *)i2c_get_clientdata(client); 834 struct st33zp24_platform_data *pin_infos = dev->platform_data;
834 struct st33zp24_platform_data *pin_infos =
835 ((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
836 int ret = 0; 835 int ret = 0;
837 836
838 if (power_mgt) 837 if (power_mgt)
@@ -840,7 +839,7 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
840 else{ 839 else{
841 if (chip->data_buffer == NULL) 840 if (chip->data_buffer == NULL)
842 chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; 841 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
843 ret = tpm_pm_suspend(&client->dev); 842 ret = tpm_pm_suspend(dev);
844 } 843 }
845 return ret; 844 return ret;
846} /* tpm_st33_i2c_suspend() */ 845} /* tpm_st33_i2c_suspend() */
@@ -850,12 +849,10 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
850 * @param: client, the i2c_client drescription (TPM I2C description). 849 * @param: client, the i2c_client drescription (TPM I2C description).
851 * @return: 0 in case of success. 850 * @return: 0 in case of success.
852 */ 851 */
853static int tpm_st33_i2c_pm_resume(struct i2c_client *client) 852static int tpm_st33_i2c_pm_resume(struct device *dev)
854{ 853{
855 struct tpm_chip *chip = 854 struct tpm_chip *chip = dev_get_drvdata(dev);
856 (struct tpm_chip *)i2c_get_clientdata(client); 855 struct st33zp24_platform_data *pin_infos = dev->platform_data;
857 struct st33zp24_platform_data *pin_infos =
858 ((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
859 856
860 int ret = 0; 857 int ret = 0;
861 858
@@ -868,29 +865,28 @@ static int tpm_st33_i2c_pm_resume(struct i2c_client *client)
868 } else{ 865 } else{
869 if (chip->data_buffer == NULL) 866 if (chip->data_buffer == NULL)
870 chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; 867 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
871 ret = tpm_pm_resume(&client->dev); 868 ret = tpm_pm_resume(dev);
872 if (!ret) 869 if (!ret)
873 tpm_do_selftest(chip); 870 tpm_do_selftest(chip);
874 } 871 }
875 return ret; 872 return ret;
876} /* tpm_st33_i2c_pm_resume() */ 873} /* tpm_st33_i2c_pm_resume() */
874#endif
877 875
878static const struct i2c_device_id tpm_st33_i2c_id[] = { 876static const struct i2c_device_id tpm_st33_i2c_id[] = {
879 {TPM_ST33_I2C, 0}, 877 {TPM_ST33_I2C, 0},
880 {} 878 {}
881}; 879};
882
883MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id); 880MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id);
884 881static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend, tpm_st33_i2c_pm_resume);
885static struct i2c_driver tpm_st33_i2c_driver = { 882static struct i2c_driver tpm_st33_i2c_driver = {
886 .driver = { 883 .driver = {
887 .owner = THIS_MODULE, 884 .owner = THIS_MODULE,
888 .name = TPM_ST33_I2C, 885 .name = TPM_ST33_I2C,
886 .pm = &tpm_st33_i2c_ops,
889 }, 887 },
890 .probe = tpm_st33_i2c_probe, 888 .probe = tpm_st33_i2c_probe,
891 .remove = tpm_st33_i2c_remove, 889 .remove = tpm_st33_i2c_remove,
892 .resume = tpm_st33_i2c_pm_resume,
893 .suspend = tpm_st33_i2c_pm_suspend,
894 .id_table = tpm_st33_i2c_id 890 .id_table = tpm_st33_i2c_id
895}; 891};
896 892