diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2016-02-29 14:53:02 +0100 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-25 16:26:35 +0200 |
commit | 15516788e581eb32ec1c50e5f00aba3faf95d817 (patch) | |
tree | fc21e9a76367a73ba36b1e9315ca8fd741c544d8 /drivers/char/tpm/tpm-interface.c | |
parent | tpm: Split out the devm stuff from tpmm_chip_alloc (diff) | |
download | linux-15516788e581eb32ec1c50e5f00aba3faf95d817.tar.xz linux-15516788e581eb32ec1c50e5f00aba3faf95d817.zip |
tpm: Replace device number bitmap with IDR
Replace the device number bitmap with IDR. Extend the number of devices we
can create to 64k.
Since an IDR allows us to associate a pointer with an ID, we use this now
to rewrite tpm_chip_find_get() to simply look up the chip pointer by the
given device ID.
Protect the IDR calls with a mutex.
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm-interface.c')
-rw-r--r-- | drivers/char/tpm/tpm-interface.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 5caf15421ef7..5397b64b6c96 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -1139,6 +1139,7 @@ static int __init tpm_init(void) static void __exit tpm_exit(void) { + idr_destroy(&dev_nums_idr); class_destroy(tpm_class); unregister_chrdev_region(tpm_devt, TPM_NUM_DEVICES); } |