summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_i2c_stm_st33.c
Commit message (Collapse)AuthorAgeFilesLines
* tpm: Use the ops structure instead of a copy in tpm_vendor_specificJason Gunthorpe2014-01-061-2/+2
| | | | | | | | | | This builds on the last commit to use the ops structure in the core and reduce the size of tpm_vendor_specific. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Reviewed-by: Ashley Lai <adlai@linux.vnet.ibm.com> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm: Create a tpm_class_ops structure and use it in the driversJason Gunthorpe2014-01-061-1/+1
| | | | | | | | | | | | | This replaces the static initialization of a tpm_vendor_specific structure in the drivers with the standard Linux idiom of providing a const structure of function pointers. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Reviewed-by: Ashley Lai <adlai@linux.vnet.ibm.com> [phuewe: did apply manually due to commit 191ffc6bde3 tpm/tpm_i2c_atmel: fix coccinelle warnings] Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm: Pull all driver sysfs code into tpm-sysfs.cJason Gunthorpe2014-01-061-25/+0
| | | | | | | | | | | | | | | | | The tpm core now sets up and controls all sysfs attributes, instead of having each driver have a unique take on it. All drivers now now have a uniform set of attributes, and no sysfs related entry points are exported from the tpm core module. This also uses the new method used to declare sysfs attributes with DEVICE_ATTR_RO and 'struct attribute *' Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> [phuewe: had to apply the tpm_i2c_atmel part manually due to commit 191ffc6bde3fc tpm/tpm_i2c_atmel: fix coccinelle warnings] Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm: Pull everything related to /dev/tpmX into tpm-dev.cJason Gunthorpe2014-01-061-10/+0
| | | | | | | | | | | | | | | | | CLASS-dev.c is a common idiom for Linux subsystems This pulls all the code related to the miscdev into tpm-dev.c and makes it static. The identical file_operation structs in the drivers are purged and the tpm common code unconditionally creates the miscdev. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Reviewed-by: Ashley Lai <adlai@linux.vnet.ibm.com> [phuewe: tpm_dev_release is now used only in this file, thus the EXPORT_SYMBOL can be dropped and the function be marked as static. It has no other in-kernel users] Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm/tpm_i2c_stm_st33: Check return code of get_burstcountPeter Huewe2014-01-061-1/+6
| | | | | | | | | | | | | | | | | | | | | | The 'get_burstcount' function can in some circumstances 'return -EBUSY' which in tpm_stm_i2c_send is stored in an 'u32 burstcnt' thus converting the signed value into an unsigned value, resulting in 'burstcnt' being huge. Changing the type to u32 only does not solve the problem as the signed value is converted to an unsigned in I2C_WRITE_DATA, resulting in the same effect. Thus -> Change type of burstcnt to u32 (the return type of get_burstcount) -> Add a check for the return value of 'get_burstcount' and propagate a potential error. This makes also sense in the 'I2C_READ_DATA' case, where the there is no signed/unsigned conversion. found by coverity Cc: stable@vger.kernel.org Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm: Remove tpm_show_caps_1_2Jason Gunthorpe2013-10-221-1/+1
| | | | | | | | | | | | | | | The version of the TPM should not depend on the bus it is connected through. 1.1, 1.2 and soon 2.0 TPMS will be all be able to use the same bus interfaces. Make tpm_show_caps try the 1.2 capability first. If that fails then fall back to the 1.1 capability. This effectively auto-detects what interface the TPM supports at run-time. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Reviewed-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm: st33: Remove chip->data_buffer access from this driverJason Gunthorpe2013-10-221-8/+0
| | | | | | | | | | | 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>
* tpm: Remove redundant dev_set_drvdataJason Gunthorpe2013-10-221-2/+0
| | | | | | | | | | | | | | | TPM drivers should not call dev_set_drvdata (or aliases), only the core code is allowed to call dev_set_drvdata, and it does it during tpm_register_hardware. These extra sets are harmless, but are an anti-pattern that many drivers have copied. Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com> Reviewed-by: Peter Huewe <peterhuewe@gmx.de> Acked-by: Ashley Lai <adlai@linux.vnet.ibm.com> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
* tpm_i2c_stm_st33: Remove duplicate inclusion of header filesSachin Kamat2013-04-121-2/+0
| | | | | | | module.h and sched.h were included twice. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm/tpm_i2c_stm_st33: formatting and white space changesPeter Huewe2013-04-121-31/+31
| | | | | Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: drop temporary variable for return valuePeter Huewe2013-02-051-3/+1
| | | | | | | | We don't need a temporary variable just to store the return value which gets return in the next statement. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: remove dead assignment in tpm_st33_i2c_probePeter Huewe2013-02-051-2/+0
| | | | | | | | | Err is never read before it is assigned again -> remove the dead assigment. Found with clang static analyzer Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: Remove __devexit attributePeter Huewe2013-02-051-1/+1
| | | | | | | With the HOTPLUG changes 3.8 this attribute is going away. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm/tpm_i2c_stm_st33: Don't use memcpy for one byte assignmentPeter Huewe2013-02-051-4/+2
| | | | | | | | | We don't need to call memcpy for one byte, but assign it directly. And to make the offset clearer we use the array syntax on the subsequent call to memset to make the relationship clearer. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm_i2c_stm_st33: removed unused variables/codeKent Yoder2013-02-051-17/+1
| | | | | | Reported-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm: Fix cancellation of TPM commands (polling mode)Stefan Berger2013-02-051-1/+6
| | | | | | | | | | | | | | | | On one of my machines the cancellation of TPM commands does not work. The reason is that by writing into sysfs 'cancel' the tpm_tis_ready call causes the status flag TPM_STS_VALID to be set in the statusregister. However, the TIS driver seems to wait for TPM_STS_COMMAND_READY. Once a 2nd time sysfs 'cancel' is written to, the TPM_STS_COMMAND_READY flag also gets set, resulting in TPM_STS_VALID|TPM_STS_COMMAND_READY to be read from the status register. This patch now converts req_canceled into a function to enable more complex comparisons against possible cancellation status codes. Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* tpm_i2c_stm_st33: fix oops when i2c client is unavailableKent Yoder2013-02-051-5/+11
| | | | | | | | | | | | | When no i2c bus exists, user-space can cause an oops by triggering a device probe through a message sent to an i2c "new_device" sysfs entry. Adding a check for a NULL i2c client structure in the probe function closes the hole. This patch also fixes accessing the NULL client struct in the print function call reporting the error. Reported-by: Peter Hüwe <PeterHuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
* char/tpm: Use struct dev_pm_ops for power managementPeter Huewe2013-02-051-16/+12
| | | | | | | | 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>
* tpm: rename STM driver to match other i2c driversKent Yoder2013-02-051-0/+902
Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud