diff options
author | Stefan Berger <stefanb@linux.vnet.ibm.com> | 2016-02-29 08:53:01 -0500 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-25 10:26:35 -0400 |
commit | 2072df40ec19d9703adfcdbd15f30c879bb65b2a (patch) | |
tree | 0c2891821b65b34151f0a299d739b793d1f4d91a | |
parent | 4e26195f240d73150e8308ae42874702e3df8d2c (diff) |
tpm: Get rid of module locking
Now that the tpm core has strong locking around 'ops' it is possible
to remove a TPM driver, module and all, even while user space still
has things like /dev/tpmX open. For consistency and simplicity, drop
the module locking entirely.
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>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
-rw-r--r-- | drivers/char/tpm/tpm-chip.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 5793ea1b454c..66367286deea 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c | |||
@@ -57,9 +57,6 @@ int tpm_try_get_ops(struct tpm_chip *chip) | |||
57 | if (!chip->ops) | 57 | if (!chip->ops) |
58 | goto out_lock; | 58 | goto out_lock; |
59 | 59 | ||
60 | if (!try_module_get(chip->dev.parent->driver->owner)) | ||
61 | goto out_lock; | ||
62 | |||
63 | return 0; | 60 | return 0; |
64 | out_lock: | 61 | out_lock: |
65 | up_read(&chip->ops_sem); | 62 | up_read(&chip->ops_sem); |
@@ -77,7 +74,6 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops); | |||
77 | */ | 74 | */ |
78 | void tpm_put_ops(struct tpm_chip *chip) | 75 | void tpm_put_ops(struct tpm_chip *chip) |
79 | { | 76 | { |
80 | module_put(chip->dev.parent->driver->owner); | ||
81 | up_read(&chip->ops_sem); | 77 | up_read(&chip->ops_sem); |
82 | put_device(&chip->dev); | 78 | put_device(&chip->dev); |
83 | } | 79 | } |
@@ -183,7 +179,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev, | |||
183 | goto out; | 179 | goto out; |
184 | 180 | ||
185 | cdev_init(&chip->cdev, &tpm_fops); | 181 | cdev_init(&chip->cdev, &tpm_fops); |
186 | chip->cdev.owner = dev->driver->owner; | 182 | chip->cdev.owner = THIS_MODULE; |
187 | chip->cdev.kobj.parent = &chip->dev.kobj; | 183 | chip->cdev.kobj.parent = &chip->dev.kobj; |
188 | 184 | ||
189 | rc = devm_add_action(dev, (void (*)(void *)) put_device, &chip->dev); | 185 | rc = devm_add_action(dev, (void (*)(void *)) put_device, &chip->dev); |