aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-12-01 13:32:57 -0500
committerPeter Huewe <peterhuewe@gmx.de>2015-01-17 08:00:08 -0500
commit8dcd19874f31b7a806a2a2b129e94882918c3aaf (patch)
treec06763b45cf13c2fb811cc2867b204a795e255cf
parente8f6f3b4d69956f66bba14a4d33aadf1fb209050 (diff)
tpm/tpm_i2c_stm_st33: Few code cleanup
Cleanup code indentation, braces, test variable when NULL. Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 3f722630ff92..a444cd3cb17d 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -26,7 +26,7 @@
26 * 26 *
27 * @Synopsis: 27 * @Synopsis:
28 * 09/15/2010: First shot driver tpm_tis driver for 28 * 09/15/2010: First shot driver tpm_tis driver for
29 lpc is used as model. 29 * lpc is used as model.
30 */ 30 */
31 31
32#include <linux/pci.h> 32#include <linux/pci.h>
@@ -393,7 +393,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
393 long ret; 393 long ret;
394 u8 status; 394 u8 status;
395 395
396 if (chip->vendor.irq) { 396 if (chip->vendor.irq) {
397 ret = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status 397 ret = wait_for_serirq_timeout(chip, ((tpm_stm_i2c_status
398 (chip) & mask) == 398 (chip) & mask) ==
399 mask), timeout); 399 mask), timeout);
@@ -429,8 +429,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
429 wait_for_stat(chip, 429 wait_for_stat(chip,
430 TPM_STS_DATA_AVAIL | TPM_STS_VALID, 430 TPM_STS_DATA_AVAIL | TPM_STS_VALID,
431 chip->vendor.timeout_c, 431 chip->vendor.timeout_c,
432 &chip->vendor.read_queue) 432 &chip->vendor.read_queue) == 0) {
433 == 0) {
434 burstcnt = get_burstcount(chip); 433 burstcnt = get_burstcount(chip);
435 if (burstcnt < 0) 434 if (burstcnt < 0)
436 return burstcnt; 435 return burstcnt;
@@ -482,7 +481,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
482 struct i2c_client *client; 481 struct i2c_client *client;
483 struct tpm_stm_dev *tpm_dev; 482 struct tpm_stm_dev *tpm_dev;
484 483
485 if (chip == NULL) 484 if (!chip)
486 return -EBUSY; 485 return -EBUSY;
487 if (len < TPM_HEADER_SIZE) 486 if (len < TPM_HEADER_SIZE)
488 return -EBUSY; 487 return -EBUSY;
@@ -559,7 +558,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
559 int size = 0; 558 int size = 0;
560 int expected; 559 int expected;
561 560
562 if (chip == NULL) 561 if (!chip)
563 return -EBUSY; 562 return -EBUSY;
564 563
565 if (count < TPM_HEADER_SIZE) { 564 if (count < TPM_HEADER_SIZE) {
@@ -580,7 +579,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
580 } 579 }
581 580
582 size += recv_data(chip, &buf[TPM_HEADER_SIZE], 581 size += recv_data(chip, &buf[TPM_HEADER_SIZE],
583 expected - TPM_HEADER_SIZE); 582 expected - TPM_HEADER_SIZE);
584 if (size < expected) { 583 if (size < expected) {
585 dev_err(chip->dev, "Unable to read remainder of result\n"); 584 dev_err(chip->dev, "Unable to read remainder of result\n");
586 size = -ETIME; 585 size = -ETIME;
@@ -662,9 +661,9 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
662 int ret; 661 int ret;
663 662
664 pdata = client->dev.platform_data; 663 pdata = client->dev.platform_data;
665 if (pdata == NULL) { 664 if (!pdata) {
666 pr_err("No platform data\n"); 665 dev_err(chip->dev, "No platform data\n");
667 return -EINVAL; 666 return -ENODEV;
668 } 667 }
669 668
670 /* store for late use */ 669 /* store for late use */
@@ -695,13 +694,13 @@ static int
695tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) 694tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
696{ 695{
697 int ret; 696 int ret;
698 u8 intmask; 697 u8 intmask = 0;
699 struct tpm_chip *chip; 698 struct tpm_chip *chip;
700 struct st33zp24_platform_data *platform_data; 699 struct st33zp24_platform_data *platform_data;
701 struct tpm_stm_dev *tpm_dev; 700 struct tpm_stm_dev *tpm_dev;
702 701
703 if (client == NULL) { 702 if (!client) {
704 pr_info("%s: i2c client is NULL. Device not accessible.\n", 703 dev_info(&client->dev, "%s: i2c client is NULL. Device not accessible.\n",
705 __func__); 704 __func__);
706 return -ENODEV; 705 return -ENODEV;
707 } 706 }
@@ -805,7 +804,7 @@ _tpm_clean_answer:
805/* 804/*
806 * tpm_stm_i2c_remove remove the TPM device 805 * tpm_stm_i2c_remove remove the TPM device
807 * @param: client, the i2c_client drescription (TPM I2C description). 806 * @param: client, the i2c_client drescription (TPM I2C description).
808 clear_bit(0, &chip->is_open); 807 * clear_bit(0, &chip->is_open);
809 * @return: 0 in case of success. 808 * @return: 0 in case of success.
810 */ 809 */
811static int tpm_stm_i2c_remove(struct i2c_client *client) 810static int tpm_stm_i2c_remove(struct i2c_client *client)
@@ -835,6 +834,7 @@ static int tpm_stm_i2c_pm_suspend(struct device *dev)
835 gpio_set_value(pin_infos->io_lpcpd, 0); 834 gpio_set_value(pin_infos->io_lpcpd, 0);
836 else 835 else
837 ret = tpm_pm_suspend(dev); 836 ret = tpm_pm_suspend(dev);
837
838 return ret; 838 return ret;
839} /* tpm_stm_i2c_suspend() */ 839} /* tpm_stm_i2c_suspend() */
840 840
@@ -869,6 +869,7 @@ static const struct i2c_device_id tpm_stm_i2c_id[] = {
869 {TPM_ST33_I2C, 0}, 869 {TPM_ST33_I2C, 0},
870 {} 870 {}
871}; 871};
872MODULE_DEVICE_TABLE(i2c, tpm_stm_i2c_id);
872 873
873#ifdef CONFIG_OF 874#ifdef CONFIG_OF
874static const struct of_device_id of_st33zp24_i2c_match[] = { 875static const struct of_device_id of_st33zp24_i2c_match[] = {
@@ -878,7 +879,6 @@ static const struct of_device_id of_st33zp24_i2c_match[] = {
878MODULE_DEVICE_TABLE(of, of_st33zp24_i2c_match); 879MODULE_DEVICE_TABLE(of, of_st33zp24_i2c_match);
879#endif 880#endif
880 881
881MODULE_DEVICE_TABLE(i2c, tpm_stm_i2c_id);
882static SIMPLE_DEV_PM_OPS(tpm_stm_i2c_ops, tpm_stm_i2c_pm_suspend, 882static SIMPLE_DEV_PM_OPS(tpm_stm_i2c_ops, tpm_stm_i2c_pm_suspend,
883 tpm_stm_i2c_pm_resume); 883 tpm_stm_i2c_pm_resume);
884static struct i2c_driver tpm_stm_i2c_driver = { 884static struct i2c_driver tpm_stm_i2c_driver = {
@@ -887,7 +887,7 @@ static struct i2c_driver tpm_stm_i2c_driver = {
887 .name = TPM_ST33_I2C, 887 .name = TPM_ST33_I2C,
888 .pm = &tpm_stm_i2c_ops, 888 .pm = &tpm_stm_i2c_ops,
889 .of_match_table = of_match_ptr(of_st33zp24_i2c_match), 889 .of_match_table = of_match_ptr(of_st33zp24_i2c_match),
890 }, 890 },
891 .probe = tpm_stm_i2c_probe, 891 .probe = tpm_stm_i2c_probe,
892 .remove = tpm_stm_i2c_remove, 892 .remove = tpm_stm_i2c_remove,
893 .id_table = tpm_stm_i2c_id 893 .id_table = tpm_stm_i2c_id