Message ID | 5FFFAD06ADE1CA4381B3F0F7C6AF582898918B@ORSMSX109.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Dec 21, 2017 at 09:54:26PM +0000, Shaikh, Azhar wrote: > Yes, I checked this part. What I was referring to is any other > callback function similar to clk_enable if gets added in future and > then needs to Access ops even after it is set to NULL... You can't call callback functions after tpm_unregister_chip, it isn't allowed. This is a special case where we know the specific implementation of this specific callback is OK. > But yes I get your point now. > > So do you mean something like this? Yes Jason
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index d9099281fc2e..1187e72483f2 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c @@ -716,8 +716,7 @@ void tpm_tis_remove(struct tpm_chip *chip) u32 interrupt; int rc; - if (chip->ops->clk_enable != NULL) - chip->ops->clk_enable(chip, true); + tpm_tis_clkrun_enable(chip, true); rc = tpm_tis_read32(priv, reg, &interrupt); if (rc < 0) @@ -725,14 +724,8 @@ void tpm_tis_remove(struct tpm_chip *chip) tpm_tis_write32(priv, reg, ~TPM_GLOBAL_INT_ENABLE & interrupt); - if (chip->ops->clk_enable != NULL) - chip->ops->clk_enable(chip, false); + tpm_tis_clkrun_enable(chip, false); - if (chip->flags & TPM_CHIP_FLAG_DO_NOT_CLEAR_OPS) { - down_write(&chip->ops_sem); - chip->ops = NULL; - up_write(&chip->ops_sem); - } if (priv->ilb_base_addr) iounmap(priv->ilb_base_addr); }