aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>2013-09-22 18:03:28 -0400
committerPeter Huewe <peterhuewe@gmx.de>2013-10-22 13:42:38 -0400
commitcb996158dfe8a31377700f46b7f3d69ddc5ae1e4 (patch)
tree7dcb44245682f9c56cc1bb14b42edb0928dd9f3b /drivers/char/tpm
parentd0a40174efb0b9d232ccd1cf127cb90a2120f55b (diff)
tpm: st33: Remove chip->data_buffer access from this driver
For some reason this driver thinks that chip->data_buffer needs to be set before it can call tpm_pm_*. This is not true. data_buffer is used only by /dev/tpmX, which is why it is managed exclusively by the fops functions. Cc: Mathias Leblanc <mathias.leblanc@st.com> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c8
1 files changed, 0 insertions, 8 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 1c68d9317aba..b2390b6173e7 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -805,24 +805,18 @@ static int tpm_st33_i2c_remove(struct i2c_client *client)
805#ifdef CONFIG_PM_SLEEP 805#ifdef CONFIG_PM_SLEEP
806/* 806/*
807 * tpm_st33_i2c_pm_suspend suspend the TPM device 807 * tpm_st33_i2c_pm_suspend suspend the TPM device
808 * Added: Work around when suspend and no tpm application is running, suspend
809 * may fail because chip->data_buffer is not set (only set in tpm_open in Linux
810 * TPM core)
811 * @param: client, the i2c_client drescription (TPM I2C description). 808 * @param: client, the i2c_client drescription (TPM I2C description).
812 * @param: mesg, the power management message. 809 * @param: mesg, the power management message.
813 * @return: 0 in case of success. 810 * @return: 0 in case of success.
814 */ 811 */
815static int tpm_st33_i2c_pm_suspend(struct device *dev) 812static int tpm_st33_i2c_pm_suspend(struct device *dev)
816{ 813{
817 struct tpm_chip *chip = dev_get_drvdata(dev);
818 struct st33zp24_platform_data *pin_infos = dev->platform_data; 814 struct st33zp24_platform_data *pin_infos = dev->platform_data;
819 int ret = 0; 815 int ret = 0;
820 816
821 if (power_mgt) { 817 if (power_mgt) {
822 gpio_set_value(pin_infos->io_lpcpd, 0); 818 gpio_set_value(pin_infos->io_lpcpd, 0);
823 } else { 819 } else {
824 if (chip->data_buffer == NULL)
825 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
826 ret = tpm_pm_suspend(dev); 820 ret = tpm_pm_suspend(dev);
827 } 821 }
828 return ret; 822 return ret;
@@ -847,8 +841,6 @@ static int tpm_st33_i2c_pm_resume(struct device *dev)
847 TPM_STS_VALID) == TPM_STS_VALID, 841 TPM_STS_VALID) == TPM_STS_VALID,
848 chip->vendor.timeout_b); 842 chip->vendor.timeout_b);
849 } else { 843 } else {
850 if (chip->data_buffer == NULL)
851 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
852 ret = tpm_pm_resume(dev); 844 ret = tpm_pm_resume(dev);
853 if (!ret) 845 if (!ret)
854 tpm_do_selftest(chip); 846 tpm_do_selftest(chip);