Message ID | 1460323386-16892-6-git-send-email-christophe-h.ricard@st.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Sun, Apr 10, 2016 at 11:23:01PM +0200, Christophe Ricard wrote: > +static int tpm_tis_post_probe(struct tpm_chip *chip) > +{ > + int probe; > + > + if (!itpm) { Please get rid of the itpm global while you are at it. Jason ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/ gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
On Sun, Apr 10, 2016 at 05:43:33PM -0600, Jason Gunthorpe wrote: > On Sun, Apr 10, 2016 at 11:23:01PM +0200, Christophe Ricard wrote: > > > +static int tpm_tis_post_probe(struct tpm_chip *chip) > > +{ > > + int probe; > > + > > + if (!itpm) { > > Please get rid of the itpm global while you are at it. Sorry, I keep forgetting this ugly thing is a module option. Sigh. Jason ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 5b3eb26..2267093 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -96,6 +96,7 @@ struct tpm_info { struct tpm_tis_phy_ops { u8 data_expect_mask; u8 data_expect_val; + int (*post_probe)(struct tpm_chip *chip); }; struct priv_data { @@ -619,6 +620,7 @@ static const struct tpm_class_ops tpm_tis = { static struct tpm_tis_phy_ops tis_phy_ops = { .data_expect_mask = TPM_STS_DATA_EXPECT, .data_expect_val = TPM_STS_DATA_EXPECT, + .post_probe = tpm_tis_post_probe, }; static int tpm_mem_read_bytes(struct tpm_chip *chip, u32 addr, u16 len, @@ -810,6 +812,23 @@ static void tpm_tis_probe_irq(struct tpm_chip *chip, u32 intmask) return; } +static int tpm_tis_post_probe(struct tpm_chip *chip) +{ + int probe; + + if (!itpm) { + probe = probe_itpm(chip); + if (probe < 0) + return -ENODEV; + itpm = !!probe; + } + + if (itpm) + dev_info(chip->dev.parent, "Intel iTPM workaround enabled\n"); + + return 0; +} + static bool interrupts = true; module_param(interrupts, bool, 0444); MODULE_PARM_DESC(interrupts, "Enable interrupts"); @@ -906,19 +925,14 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info, (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2", vendor >> 16, rid); - if (!itpm) { - probe = probe_itpm(chip); - if (probe < 0) { + if (priv->phy_ops && priv->phy_ops->post_probe) { + rc = priv->phy_ops->post_probe(chip); + if (rc < 0) { rc = -ENODEV; goto out_err; } - itpm = !!probe; } - if (itpm) - dev_info(dev, "Intel iTPM workaround enabled\n"); - - /* Figure out the capabilities */ rc = tpm_read32(chip, TPM_INTF_CAPS(priv->locality), &intfcaps); if (rc < 0)
Add post_probe phy handler in order to execute additional proprietary operations after tpm2_probe. For the case of tpm_tis using LPC, itpm workaround probing. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> --- drivers/char/tpm/tpm_tis.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)