From: Jason Gunthorpe <jgg@ziepe.ca>
To: Azhar Shaikh <azhar.shaikh@intel.com>
Cc: jarkko.sakkinen@intel.com, linux-integrity@vger.kernel.org
Subject: Re: [PATCH RFC] tpm: Keep CLKRUN enabled throughout the duration of transmit_cmd()
Date: Mon, 6 Nov 2017 10:07:41 -0700 [thread overview]
Message-ID: <20171106170741.GH26011@ziepe.ca> (raw)
In-Reply-To: <1509751809-148601-1-git-send-email-azhar.shaikh@intel.com>
On Fri, Nov 03, 2017 at 04:30:09PM -0700, Azhar Shaikh wrote:
> @@ -413,6 +413,8 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
> if (chip->dev.parent)
> pm_runtime_get_sync(chip->dev.parent);
>
> + chip->ops->clk_toggle(chip, true);
You added this new op to the general code, but only updated two
drivers, surely this makes all the other tis drivers oops as
clk_toggle will be NULL?
Suggest checking for NULL before calling.
> +#ifdef CONFIG_X86
This is a good place to use IS_ENABLED instead of ifdef:
> +/**
> + * tpm_tis_clkrun_toggle() - Keep clkrun protocol disabled for entire duration
> + * of a single TPM command
> + * @chip: TPM chip to use
> + * @value: 1 - Disable CLKRUN protocol, so that clocks are free running
> + * 0 - Enable CLKRUN protocol
> + */
> +static void tpm_tis_clkrun_toggle(struct tpm_chip *chip, bool value)
> +{
> + struct tpm_tis_data *data = dev_get_drvdata(&chip->dev);
if (!IS_ENABLED(CONFIG_X86))
return;
> +
> + if (value) {
> + tpm_platform_begin_xfer(data);
> + data->flags |= TPM_TIS_CLK_ENABLE;
> + } else {
> + data->flags &= ~TPM_TIS_CLK_ENABLE;
> + tpm_platform_end_xfer(data);
> + }
> +}
> +#else
> +static void tpm_tis_clkrun_toggle(struct tpm_chip *chip, bool value)
> +{
> +}
> +#endif
> +#ifdef CONFIG_X86
> +void tpm_platform_begin_xfer(struct tpm_tis_data *data);
> +void tpm_platform_end_xfer(struct tpm_tis_data *data);
> +#else
> +void tpm_platform_begin_xfer(struct tpm_tis_data *data)
> +{
> +}
> +void tpm_platform_end_xfer(struct tpm_tis_data *data)
> +{
> +}
These empty stubs need inlines
Why are you using a mixture of callbacks and linked functions to solve
this problem?
Can't you do everything with callbacks?
Jason
next prev parent reply other threads:[~2017-11-06 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 23:30 [PATCH RFC] tpm: Keep CLKRUN enabled throughout the duration of transmit_cmd() Azhar Shaikh
2017-11-06 17:07 ` Jason Gunthorpe [this message]
2017-11-06 22:11 ` Shaikh, Azhar
2017-11-06 22:39 ` Jason Gunthorpe
2017-11-06 23:31 ` Shaikh, Azhar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171106170741.GH26011@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=azhar.shaikh@intel.com \
--cc=jarkko.sakkinen@intel.com \
--cc=linux-integrity@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox