diff mbox

[v2] tpm: Allow tpm_tis drivers to set hwrng quality.

Message ID 20180629081258.155228-1-louiscollard@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Louis Collard June 29, 2018, 8:12 a.m. UTC
Adds plumbing required for drivers based on tpm_tis to set hwrng quality.

Signed-off-by: Louis Collard <louiscollard@chromium.org>
---
Changes since v1:
- based on (hopefully!) correct git tree

 drivers/char/tpm/tpm_tis_core.c | 2 ++
 drivers/char/tpm/tpm_tis_core.h | 1 +
 2 files changed, 3 insertions(+)

Comments

Louis Collard June 29, 2018, 8:18 a.m. UTC | #1
On Fri, Jun 29, 2018 at 4:12 PM, Louis Collard
<louiscollard@chromium.org> wrote:
> Adds plumbing required for drivers based on tpm_tis to set hwrng quality.
>
> Signed-off-by: Louis Collard <louiscollard@chromium.org>
> ---
> Changes since v1:
> - based on (hopefully!) correct git tree
>
>  drivers/char/tpm/tpm_tis_core.c | 2 ++
>  drivers/char/tpm/tpm_tis_core.h | 1 +
>  2 files changed, 3 insertions(+)
>
> diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
> index 8b46aaa9e049..d2345d9fd7b5 100644
> --- a/drivers/char/tpm/tpm_tis_core.c
> +++ b/drivers/char/tpm/tpm_tis_core.c
> @@ -875,6 +875,8 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
>         chip->acpi_dev_handle = acpi_dev_handle;
>  #endif
>
> +       chip->hwrng.quality = priv->rng_quality;
> +
>         /* Maximum timeouts */
>         chip->timeout_a = msecs_to_jiffies(TIS_TIMEOUT_A_MAX);
>         chip->timeout_b = msecs_to_jiffies(TIS_TIMEOUT_B_MAX);
> diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
> index f6e1dbe212a7..f48125f1e6e0 100644
> --- a/drivers/char/tpm/tpm_tis_core.h
> +++ b/drivers/char/tpm/tpm_tis_core.h
> @@ -99,6 +99,7 @@ struct tpm_tis_data {
>         wait_queue_head_t int_queue;
>         wait_queue_head_t read_queue;
>         const struct tpm_tis_phy_ops *phy_ops;
> +       unsigned short rng_quality;
>  };
>
>  struct tpm_tis_phy_ops {
> --
> 2.13.5
>

So sorry for the double-send (and hope I am not making it worse by
sending this!)
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index 8b46aaa9e049..d2345d9fd7b5 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -875,6 +875,8 @@  int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	chip->acpi_dev_handle = acpi_dev_handle;
 #endif
 
+	chip->hwrng.quality = priv->rng_quality;
+
 	/* Maximum timeouts */
 	chip->timeout_a = msecs_to_jiffies(TIS_TIMEOUT_A_MAX);
 	chip->timeout_b = msecs_to_jiffies(TIS_TIMEOUT_B_MAX);
diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
index f6e1dbe212a7..f48125f1e6e0 100644
--- a/drivers/char/tpm/tpm_tis_core.h
+++ b/drivers/char/tpm/tpm_tis_core.h
@@ -99,6 +99,7 @@  struct tpm_tis_data {
 	wait_queue_head_t int_queue;
 	wait_queue_head_t read_queue;
 	const struct tpm_tis_phy_ops *phy_ops;
+	unsigned short rng_quality;
 };
 
 struct tpm_tis_phy_ops {