Commit 8dcd1987 authored by Christophe Ricard's avatar Christophe Ricard Committed by Peter Huewe

tpm/tpm_i2c_stm_st33: Few code cleanup

Cleanup code indentation, braces, test variable when NULL.
Reviewed-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
parent e8f6f3b4
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* @Synopsis: * @Synopsis:
* 09/15/2010: First shot driver tpm_tis driver for * 09/15/2010: First shot driver tpm_tis driver for
lpc is used as model. * lpc is used as model.
*/ */
#include <linux/pci.h> #include <linux/pci.h>
...@@ -429,8 +429,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -429,8 +429,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
wait_for_stat(chip, wait_for_stat(chip,
TPM_STS_DATA_AVAIL | TPM_STS_VALID, TPM_STS_DATA_AVAIL | TPM_STS_VALID,
chip->vendor.timeout_c, chip->vendor.timeout_c,
&chip->vendor.read_queue) &chip->vendor.read_queue) == 0) {
== 0) {
burstcnt = get_burstcount(chip); burstcnt = get_burstcount(chip);
if (burstcnt < 0) if (burstcnt < 0)
return burstcnt; return burstcnt;
...@@ -482,7 +481,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, ...@@ -482,7 +481,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
struct i2c_client *client; struct i2c_client *client;
struct tpm_stm_dev *tpm_dev; struct tpm_stm_dev *tpm_dev;
if (chip == NULL) if (!chip)
return -EBUSY; return -EBUSY;
if (len < TPM_HEADER_SIZE) if (len < TPM_HEADER_SIZE)
return -EBUSY; return -EBUSY;
...@@ -559,7 +558,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf, ...@@ -559,7 +558,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
int size = 0; int size = 0;
int expected; int expected;
if (chip == NULL) if (!chip)
return -EBUSY; return -EBUSY;
if (count < TPM_HEADER_SIZE) { if (count < TPM_HEADER_SIZE) {
...@@ -662,9 +661,9 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client, ...@@ -662,9 +661,9 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
int ret; int ret;
pdata = client->dev.platform_data; pdata = client->dev.platform_data;
if (pdata == NULL) { if (!pdata) {
pr_err("No platform data\n"); dev_err(chip->dev, "No platform data\n");
return -EINVAL; return -ENODEV;
} }
/* store for late use */ /* store for late use */
...@@ -695,13 +694,13 @@ static int ...@@ -695,13 +694,13 @@ static int
tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
{ {
int ret; int ret;
u8 intmask; u8 intmask = 0;
struct tpm_chip *chip; struct tpm_chip *chip;
struct st33zp24_platform_data *platform_data; struct st33zp24_platform_data *platform_data;
struct tpm_stm_dev *tpm_dev; struct tpm_stm_dev *tpm_dev;
if (client == NULL) { if (!client) {
pr_info("%s: i2c client is NULL. Device not accessible.\n", dev_info(&client->dev, "%s: i2c client is NULL. Device not accessible.\n",
__func__); __func__);
return -ENODEV; return -ENODEV;
} }
...@@ -805,7 +804,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -805,7 +804,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* /*
* tpm_stm_i2c_remove remove the TPM device * tpm_stm_i2c_remove remove the TPM device
* @param: client, the i2c_client drescription (TPM I2C description). * @param: client, the i2c_client drescription (TPM I2C description).
clear_bit(0, &chip->is_open); * clear_bit(0, &chip->is_open);
* @return: 0 in case of success. * @return: 0 in case of success.
*/ */
static int tpm_stm_i2c_remove(struct i2c_client *client) static int tpm_stm_i2c_remove(struct i2c_client *client)
...@@ -835,6 +834,7 @@ static int tpm_stm_i2c_pm_suspend(struct device *dev) ...@@ -835,6 +834,7 @@ static int tpm_stm_i2c_pm_suspend(struct device *dev)
gpio_set_value(pin_infos->io_lpcpd, 0); gpio_set_value(pin_infos->io_lpcpd, 0);
else else
ret = tpm_pm_suspend(dev); ret = tpm_pm_suspend(dev);
return ret; return ret;
} /* tpm_stm_i2c_suspend() */ } /* tpm_stm_i2c_suspend() */
...@@ -869,6 +869,7 @@ static const struct i2c_device_id tpm_stm_i2c_id[] = { ...@@ -869,6 +869,7 @@ static const struct i2c_device_id tpm_stm_i2c_id[] = {
{TPM_ST33_I2C, 0}, {TPM_ST33_I2C, 0},
{} {}
}; };
MODULE_DEVICE_TABLE(i2c, tpm_stm_i2c_id);
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct of_device_id of_st33zp24_i2c_match[] = { static const struct of_device_id of_st33zp24_i2c_match[] = {
...@@ -878,7 +879,6 @@ static const struct of_device_id of_st33zp24_i2c_match[] = { ...@@ -878,7 +879,6 @@ static const struct of_device_id of_st33zp24_i2c_match[] = {
MODULE_DEVICE_TABLE(of, of_st33zp24_i2c_match); MODULE_DEVICE_TABLE(of, of_st33zp24_i2c_match);
#endif #endif
MODULE_DEVICE_TABLE(i2c, tpm_stm_i2c_id);
static SIMPLE_DEV_PM_OPS(tpm_stm_i2c_ops, tpm_stm_i2c_pm_suspend, static SIMPLE_DEV_PM_OPS(tpm_stm_i2c_ops, tpm_stm_i2c_pm_suspend,
tpm_stm_i2c_pm_resume); tpm_stm_i2c_pm_resume);
static struct i2c_driver tpm_stm_i2c_driver = { static struct i2c_driver tpm_stm_i2c_driver = {
......
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