aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorKylene Jo Hall <kjhall@us.ibm.com>2006-04-22 05:37:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-04-22 12:19:53 -0400
commite0dd03caf20d040a0a86b6bd74028ec9bda545f5 (patch)
treefe65a043531f3b896f5dba08bbb8ae385332f7d1 /drivers/char/tpm/tpm.c
parent90dda520c1962d55a0e1d2571deed0d75fd6d6f1 (diff)
[PATCH] tpm: return chip from tpm_register_hardware
Changes in the 1.2 TPM Specification make it necessary to update some fields of the chip structure in the initialization function after it is registered with tpm.c thus tpm_register_hardware was modified to return a pointer to the structure. This patch makes that change and the associated changes in tpm_atmel and tpm_nsc. The changes to tpm_infineon will be coming in a patch from Marcel Selhorst. Signed-off-by: Kylene Hall <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 50013eb8cf1e..5e58296f2832 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -544,7 +544,8 @@ EXPORT_SYMBOL_GPL(tpm_pm_resume);
544 * upon errant exit from this function specific probe function should call 544 * upon errant exit from this function specific probe function should call
545 * pci_disable_device 545 * pci_disable_device
546 */ 546 */
547int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry) 547struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vendor_specific
548 *entry)
548{ 549{
549#define DEVNAME_SIZE 7 550#define DEVNAME_SIZE 7
550 551
@@ -555,7 +556,7 @@ int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry)
555 /* Driver specific per-device data */ 556 /* Driver specific per-device data */
556 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 557 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
557 if (chip == NULL) 558 if (chip == NULL)
558 return -ENOMEM; 559 return NULL;
559 560
560 init_MUTEX(&chip->buffer_mutex); 561 init_MUTEX(&chip->buffer_mutex);
561 init_MUTEX(&chip->tpm_mutex); 562 init_MUTEX(&chip->tpm_mutex);
@@ -584,7 +585,7 @@ dev_num_search_complete:
584 if (chip->dev_num < 0) { 585 if (chip->dev_num < 0) {
585 dev_err(dev, "No available tpm device numbers\n"); 586 dev_err(dev, "No available tpm device numbers\n");
586 kfree(chip); 587 kfree(chip);
587 return -ENODEV; 588 return NULL;
588 } else if (chip->dev_num == 0) 589 } else if (chip->dev_num == 0)
589 chip->vendor.miscdev.minor = TPM_MINOR; 590 chip->vendor.miscdev.minor = TPM_MINOR;
590 else 591 else
@@ -605,7 +606,7 @@ dev_num_search_complete:
605 put_device(dev); 606 put_device(dev);
606 kfree(chip); 607 kfree(chip);
607 dev_mask[i] &= !(1 << j); 608 dev_mask[i] &= !(1 << j);
608 return -ENODEV; 609 return NULL;
609 } 610 }
610 611
611 spin_lock(&driver_lock); 612 spin_lock(&driver_lock);
@@ -620,7 +621,7 @@ dev_num_search_complete:
620 621
621 chip->bios_dir = tpm_bios_log_setup(devname); 622 chip->bios_dir = tpm_bios_log_setup(devname);
622 623
623 return 0; 624 return chip;
624} 625}
625EXPORT_SYMBOL_GPL(tpm_register_hardware); 626EXPORT_SYMBOL_GPL(tpm_register_hardware);
626 627