aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Huewe <peterhuewe@gmx.de>2013-02-28 17:15:48 -0500
committerKent Yoder <key@linux.vnet.ibm.com>2013-04-12 13:17:28 -0400
commit2d089f82aeb59fd58f33f2bbf4288e4049426e17 (patch)
tree4dcf81cdbcfdd8ba83b106e67d75bb89e9a65253 /drivers
parent958d2c2f4ad905e3ffa1711d19184d21d9b00cc1 (diff)
tpm/tpm_i2c_stm_st33: formatting and white space changes
Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Kent Yoder <key@linux.vnet.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 1f5f71e14abe..743ffecebcb1 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -178,7 +178,7 @@ static long _wait_for_interrupt_serirq_timeout(struct tpm_chip *chip,
178 struct i2c_client *client; 178 struct i2c_client *client;
179 struct st33zp24_platform_data *pin_infos; 179 struct st33zp24_platform_data *pin_infos;
180 180
181 client = (struct i2c_client *) TPM_VPRIV(chip); 181 client = (struct i2c_client *)TPM_VPRIV(chip);
182 pin_infos = client->dev.platform_data; 182 pin_infos = client->dev.platform_data;
183 183
184 status = wait_for_completion_interruptible_timeout( 184 status = wait_for_completion_interruptible_timeout(
@@ -197,12 +197,12 @@ static int wait_for_serirq_timeout(struct tpm_chip *chip, bool condition,
197 int status = 2; 197 int status = 2;
198 struct i2c_client *client; 198 struct i2c_client *client;
199 199
200 client = (struct i2c_client *) TPM_VPRIV(chip); 200 client = (struct i2c_client *)TPM_VPRIV(chip);
201 201
202 status = _wait_for_interrupt_serirq_timeout(chip, timeout); 202 status = _wait_for_interrupt_serirq_timeout(chip, timeout);
203 if (!status) { 203 if (!status) {
204 status = -EBUSY; 204 status = -EBUSY;
205 } else{ 205 } else {
206 clear_interruption(client); 206 clear_interruption(client);
207 if (condition) 207 if (condition)
208 status = 1; 208 status = 1;
@@ -219,7 +219,7 @@ static void tpm_stm_i2c_cancel(struct tpm_chip *chip)
219 struct i2c_client *client; 219 struct i2c_client *client;
220 u8 data; 220 u8 data;
221 221
222 client = (struct i2c_client *) TPM_VPRIV(chip); 222 client = (struct i2c_client *)TPM_VPRIV(chip);
223 223
224 data = TPM_STS_COMMAND_READY; 224 data = TPM_STS_COMMAND_READY;
225 I2C_WRITE_DATA(client, TPM_STS, &data, 1); 225 I2C_WRITE_DATA(client, TPM_STS, &data, 1);
@@ -236,7 +236,7 @@ static u8 tpm_stm_i2c_status(struct tpm_chip *chip)
236{ 236{
237 struct i2c_client *client; 237 struct i2c_client *client;
238 u8 data; 238 u8 data;
239 client = (struct i2c_client *) TPM_VPRIV(chip); 239 client = (struct i2c_client *)TPM_VPRIV(chip);
240 240
241 I2C_READ_DATA(client, TPM_STS, &data, 1); 241 I2C_READ_DATA(client, TPM_STS, &data, 1);
242 return data; 242 return data;
@@ -254,7 +254,7 @@ static int check_locality(struct tpm_chip *chip)
254 u8 data; 254 u8 data;
255 u8 status; 255 u8 status;
256 256
257 client = (struct i2c_client *) TPM_VPRIV(chip); 257 client = (struct i2c_client *)TPM_VPRIV(chip);
258 258
259 status = I2C_READ_DATA(client, TPM_ACCESS, &data, 1); 259 status = I2C_READ_DATA(client, TPM_ACCESS, &data, 1);
260 if (status && (data & 260 if (status && (data &
@@ -278,7 +278,7 @@ static int request_locality(struct tpm_chip *chip)
278 struct i2c_client *client; 278 struct i2c_client *client;
279 u8 data; 279 u8 data;
280 280
281 client = (struct i2c_client *) TPM_VPRIV(chip); 281 client = (struct i2c_client *)TPM_VPRIV(chip);
282 282
283 if (check_locality(chip) == chip->vendor.locality) 283 if (check_locality(chip) == chip->vendor.locality)
284 return chip->vendor.locality; 284 return chip->vendor.locality;
@@ -294,7 +294,7 @@ static int request_locality(struct tpm_chip *chip)
294 chip->vendor.timeout_a); 294 chip->vendor.timeout_a);
295 if (rc > 0) 295 if (rc > 0)
296 return chip->vendor.locality; 296 return chip->vendor.locality;
297 } else{ 297 } else {
298 stop = jiffies + chip->vendor.timeout_a; 298 stop = jiffies + chip->vendor.timeout_a;
299 do { 299 do {
300 if (check_locality(chip) >= 0) 300 if (check_locality(chip) >= 0)
@@ -316,7 +316,7 @@ static void release_locality(struct tpm_chip *chip)
316 struct i2c_client *client; 316 struct i2c_client *client;
317 u8 data; 317 u8 data;
318 318
319 client = (struct i2c_client *) TPM_VPRIV(chip); 319 client = (struct i2c_client *)TPM_VPRIV(chip);
320 data = TPM_ACCESS_ACTIVE_LOCALITY; 320 data = TPM_ACCESS_ACTIVE_LOCALITY;
321 321
322 I2C_WRITE_DATA(client, TPM_ACCESS, &data, 1); 322 I2C_WRITE_DATA(client, TPM_ACCESS, &data, 1);
@@ -333,7 +333,7 @@ static int get_burstcount(struct tpm_chip *chip)
333 int burstcnt, status; 333 int burstcnt, status;
334 u8 tpm_reg, temp; 334 u8 tpm_reg, temp;
335 335
336 struct i2c_client *client = (struct i2c_client *) TPM_VPRIV(chip); 336 struct i2c_client *client = (struct i2c_client *)TPM_VPRIV(chip);
337 337
338 stop = jiffies + chip->vendor.timeout_d; 338 stop = jiffies + chip->vendor.timeout_d;
339 do { 339 do {
@@ -379,7 +379,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
379 mask), timeout); 379 mask), timeout);
380 if (rc > 0) 380 if (rc > 0)
381 return 0; 381 return 0;
382 } else{ 382 } else {
383 stop = jiffies + timeout; 383 stop = jiffies + timeout;
384 do { 384 do {
385 msleep(TPM_TIMEOUT); 385 msleep(TPM_TIMEOUT);
@@ -403,7 +403,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
403 int size = 0, burstcnt, len; 403 int size = 0, burstcnt, len;
404 struct i2c_client *client; 404 struct i2c_client *client;
405 405
406 client = (struct i2c_client *) TPM_VPRIV(chip); 406 client = (struct i2c_client *)TPM_VPRIV(chip);
407 407
408 while (size < count && 408 while (size < count &&
409 wait_for_stat(chip, 409 wait_for_stat(chip,
@@ -433,7 +433,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
433 433
434 disable_irq_nosync(irq); 434 disable_irq_nosync(irq);
435 435
436 client = (struct i2c_client *) TPM_VPRIV(chip); 436 client = (struct i2c_client *)TPM_VPRIV(chip);
437 pin_infos = client->dev.platform_data; 437 pin_infos = client->dev.platform_data;
438 438
439 complete(&pin_infos->irq_detection); 439 complete(&pin_infos->irq_detection);
@@ -453,8 +453,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
453static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, 453static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
454 size_t len) 454 size_t len)
455{ 455{
456 u32 status, 456 u32 status, burstcnt = 0, i, size;
457 burstcnt = 0, i, size;
458 int ret; 457 int ret;
459 u8 data; 458 u8 data;
460 struct i2c_client *client; 459 struct i2c_client *client;
@@ -483,7 +482,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
483 } 482 }
484 } 483 }
485 484
486 for (i = 0 ; i < len - 1 ;) { 485 for (i = 0; i < len - 1;) {
487 burstcnt = get_burstcount(chip); 486 burstcnt = get_burstcount(chip);
488 size = min_t(int, len - i - 1, burstcnt); 487 size = min_t(int, len - i - 1, burstcnt);
489 ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); 488 ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
@@ -547,7 +546,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
547 goto out; 546 goto out;
548 } 547 }
549 548
550 expected = be32_to_cpu(*(__be32 *) (buf + 2)); 549 expected = be32_to_cpu(*(__be32 *)(buf + 2));
551 if (expected > count) { 550 if (expected > count) {
552 size = -EIO; 551 size = -EIO;
553 goto out; 552 goto out;
@@ -569,7 +568,7 @@ out:
569 568
570static bool tpm_st33_i2c_req_canceled(struct tpm_chip *chip, u8 status) 569static bool tpm_st33_i2c_req_canceled(struct tpm_chip *chip, u8 status)
571{ 570{
572 return (status == TPM_STS_COMMAND_READY); 571 return (status == TPM_STS_COMMAND_READY);
573} 572}
574 573
575static const struct file_operations tpm_st33_i2c_fops = { 574static const struct file_operations tpm_st33_i2c_fops = {
@@ -617,7 +616,7 @@ static struct tpm_vendor_specific st_i2c_tpm = {
617 .miscdev = {.fops = &tpm_st33_i2c_fops,}, 616 .miscdev = {.fops = &tpm_st33_i2c_fops,},
618}; 617};
619 618
620static int interrupts ; 619static int interrupts;
621module_param(interrupts, int, 0444); 620module_param(interrupts, int, 0444);
622MODULE_PARM_DESC(interrupts, "Enable interrupts"); 621MODULE_PARM_DESC(interrupts, "Enable interrupts");
623 622
@@ -714,7 +713,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
714 "TPM SERIRQ management", chip); 713 "TPM SERIRQ management", chip);
715 if (err < 0) { 714 if (err < 0) {
716 dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", 715 dev_err(chip->dev , "TPM SERIRQ signals %d not available\n",
717 gpio_to_irq(platform_data->io_serirq)); 716 gpio_to_irq(platform_data->io_serirq));
718 goto _irq_set; 717 goto _irq_set;
719 } 718 }
720 719
@@ -754,7 +753,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
754 dev_info(chip->dev, "TPM I2C Initialized\n"); 753 dev_info(chip->dev, "TPM I2C Initialized\n");
755 return 0; 754 return 0;
756_irq_set: 755_irq_set:
757 free_irq(gpio_to_irq(platform_data->io_serirq), (void *) chip); 756 free_irq(gpio_to_irq(platform_data->io_serirq), (void *)chip);
758_gpio_init2: 757_gpio_init2:
759 if (interrupts) 758 if (interrupts)
760 gpio_free(platform_data->io_serirq); 759 gpio_free(platform_data->io_serirq);
@@ -784,7 +783,7 @@ static int tpm_st33_i2c_remove(struct i2c_client *client)
784{ 783{
785 struct tpm_chip *chip = (struct tpm_chip *)i2c_get_clientdata(client); 784 struct tpm_chip *chip = (struct tpm_chip *)i2c_get_clientdata(client);
786 struct st33zp24_platform_data *pin_infos = 785 struct st33zp24_platform_data *pin_infos =
787 ((struct i2c_client *) TPM_VPRIV(chip))->dev.platform_data; 786 ((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
788 787
789 if (pin_infos != NULL) { 788 if (pin_infos != NULL) {
790 free_irq(pin_infos->io_serirq, chip); 789 free_irq(pin_infos->io_serirq, chip);
@@ -823,9 +822,9 @@ static int tpm_st33_i2c_pm_suspend(struct device *dev)
823 struct st33zp24_platform_data *pin_infos = dev->platform_data; 822 struct st33zp24_platform_data *pin_infos = dev->platform_data;
824 int ret = 0; 823 int ret = 0;
825 824
826 if (power_mgt) 825 if (power_mgt) {
827 gpio_set_value(pin_infos->io_lpcpd, 0); 826 gpio_set_value(pin_infos->io_lpcpd, 0);
828 else{ 827 } else {
829 if (chip->data_buffer == NULL) 828 if (chip->data_buffer == NULL)
830 chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; 829 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
831 ret = tpm_pm_suspend(dev); 830 ret = tpm_pm_suspend(dev);
@@ -851,12 +850,12 @@ static int tpm_st33_i2c_pm_resume(struct device *dev)
851 (chip->vendor.status(chip) & 850 (chip->vendor.status(chip) &
852 TPM_STS_VALID) == TPM_STS_VALID, 851 TPM_STS_VALID) == TPM_STS_VALID,
853 chip->vendor.timeout_b); 852 chip->vendor.timeout_b);
854 } else{ 853 } else {
855 if (chip->data_buffer == NULL) 854 if (chip->data_buffer == NULL)
856 chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; 855 chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
857 ret = tpm_pm_resume(dev); 856 ret = tpm_pm_resume(dev);
858 if (!ret) 857 if (!ret)
859 tpm_do_selftest(chip); 858 tpm_do_selftest(chip);
860 } 859 }
861 return ret; 860 return ret;
862} /* tpm_st33_i2c_pm_resume() */ 861} /* tpm_st33_i2c_pm_resume() */
@@ -867,7 +866,8 @@ static const struct i2c_device_id tpm_st33_i2c_id[] = {
867 {} 866 {}
868}; 867};
869MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id); 868MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id);
870static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend, tpm_st33_i2c_pm_resume); 869static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend,
870 tpm_st33_i2c_pm_resume);
871static struct i2c_driver tpm_st33_i2c_driver = { 871static struct i2c_driver tpm_st33_i2c_driver = {
872 .driver = { 872 .driver = {
873 .owner = THIS_MODULE, 873 .owner = THIS_MODULE,