Commit d4593353 authored by Peter Huewe's avatar Peter Huewe Committed by Kent Yoder

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: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarKent Yoder <key@linux.vnet.ibm.com>
parent 2bfee22f
...@@ -818,6 +818,7 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client) ...@@ -818,6 +818,7 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
/* /*
* tpm_st33_i2c_pm_suspend suspend the TPM device * tpm_st33_i2c_pm_suspend suspend the TPM device
* Added: Work around when suspend and no tpm application is running, suspend * 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,12 +828,10 @@ static __devexit int tpm_st33_i2c_remove(struct i2c_client *client)
* @param: mesg, the power management message. * @param: mesg, the power management message.
* @return: 0 in case of success. * @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 *chip = dev_get_drvdata(dev);
(struct tpm_chip *)i2c_get_clientdata(client); struct st33zp24_platform_data *pin_infos = dev->platform_data;
struct st33zp24_platform_data *pin_infos =
((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
int ret = 0; int ret = 0;
if (power_mgt) if (power_mgt)
...@@ -840,7 +839,7 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg) ...@@ -840,7 +839,7 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg)
else{ else{
if (chip->data_buffer == NULL) if (chip->data_buffer == NULL)
chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
ret = tpm_pm_suspend(&client->dev); ret = tpm_pm_suspend(dev);
} }
return ret; return ret;
} /* tpm_st33_i2c_suspend() */ } /* tpm_st33_i2c_suspend() */
...@@ -850,12 +849,10 @@ static int tpm_st33_i2c_pm_suspend(struct i2c_client *client, pm_message_t mesg) ...@@ -850,12 +849,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). * @param: client, the i2c_client drescription (TPM I2C description).
* @return: 0 in case of success. * @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 *chip = dev_get_drvdata(dev);
(struct tpm_chip *)i2c_get_clientdata(client); struct st33zp24_platform_data *pin_infos = dev->platform_data;
struct st33zp24_platform_data *pin_infos =
((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
int ret = 0; int ret = 0;
...@@ -868,29 +865,28 @@ static int tpm_st33_i2c_pm_resume(struct i2c_client *client) ...@@ -868,29 +865,28 @@ static int tpm_st33_i2c_pm_resume(struct i2c_client *client)
} else{ } else{
if (chip->data_buffer == NULL) if (chip->data_buffer == NULL)
chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
ret = tpm_pm_resume(&client->dev); ret = tpm_pm_resume(dev);
if (!ret) if (!ret)
tpm_do_selftest(chip); tpm_do_selftest(chip);
} }
return ret; return ret;
} /* tpm_st33_i2c_pm_resume() */ } /* tpm_st33_i2c_pm_resume() */
#endif
static const struct i2c_device_id tpm_st33_i2c_id[] = { static const struct i2c_device_id tpm_st33_i2c_id[] = {
{TPM_ST33_I2C, 0}, {TPM_ST33_I2C, 0},
{} {}
}; };
MODULE_DEVICE_TABLE(i2c, 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 = { static struct i2c_driver tpm_st33_i2c_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = TPM_ST33_I2C, .name = TPM_ST33_I2C,
.pm = &tpm_st33_i2c_ops,
}, },
.probe = tpm_st33_i2c_probe, .probe = tpm_st33_i2c_probe,
.remove = tpm_st33_i2c_remove, .remove = tpm_st33_i2c_remove,
.resume = tpm_st33_i2c_pm_resume,
.suspend = tpm_st33_i2c_pm_suspend,
.id_table = tpm_st33_i2c_id .id_table = tpm_st33_i2c_id
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment