public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: Brian Masney <bmasney@redhat.com>, Jeffrey Hugo <quic_jhugo@quicinc.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
	quic_omprsing@quicinc.com, neil.armstrong@linaro.org,
	quic_bjorande@quicinc.com, linux-arm-msm@vger.kernel.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] crypto: qcom-rng: fix support for ACPI-based systems
Date: Thu, 29 Aug 2024 12:58:29 -0300	[thread overview]
Message-ID: <20240829155829.GA6489@eaf> (raw)
In-Reply-To: <20240829012005.382715-3-bmasney@redhat.com>

Hi,

thanks for the patch. I have one doubt:

On Wed, Aug 28, 2024 at 09:20:05PM -0400, Brian Masney wrote:
> The qcom-rng driver supports both ACPI and device tree based systems.
> ACPI support was broken when the hw_random interface support was added.
> Let's go ahead and fix this by checking has_acpi_companion().
> 
> This fix was boot tested on a Qualcomm Amberwing server.
> 
> Fixes: f29cd5bb64c2 ("crypto: qcom-rng - Add hw_random interface support")
> Signed-off-by: Brian Masney <bmasney@redhat.com>
> ---
>  drivers/crypto/qcom-rng.c | 36 ++++++++++++++++++++----------------
>  1 file changed, 20 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c
> index 4ed545001b77..470062cb258c 100644
> --- a/drivers/crypto/qcom-rng.c
> +++ b/drivers/crypto/qcom-rng.c
> @@ -176,6 +176,21 @@ static struct rng_alg qcom_rng_alg = {
>  	}
>  };
>  
> +static struct qcom_rng_match_data qcom_prng_match_data = {
> +	.skip_init = false,

So with acpi, skip_init will be set to false now, right? But before
f29cd5bb64c2 broke it, skip_init used to be set to true. Was that wrong
before, or now?

Ernesto

> +	.hwrng_support = false,
> +};
> +
> +static struct qcom_rng_match_data qcom_prng_ee_match_data = {
> +	.skip_init = true,
> +	.hwrng_support = false,
> +};
> +
> +static struct qcom_rng_match_data qcom_trng_match_data = {
> +	.skip_init = true,
> +	.hwrng_support = true,
> +};
> +
>  static int qcom_rng_probe(struct platform_device *pdev)
>  {
>  	struct qcom_rng *rng;
> @@ -196,7 +211,11 @@ static int qcom_rng_probe(struct platform_device *pdev)
>  	if (IS_ERR(rng->clk))
>  		return PTR_ERR(rng->clk);
>  
> -	rng->match_data = (struct qcom_rng_match_data *)of_device_get_match_data(&pdev->dev);
> +	if (has_acpi_companion(&pdev->dev))
> +		rng->match_data = &qcom_prng_match_data;
> +	else
> +		rng->match_data =
> +			(struct qcom_rng_match_data *)of_device_get_match_data(&pdev->dev);
>  
>  	qcom_rng_dev = rng;
>  	ret = crypto_register_rng(&qcom_rng_alg);
> @@ -231,21 +250,6 @@ static void qcom_rng_remove(struct platform_device *pdev)
>  	qcom_rng_dev = NULL;
>  }
>  
> -static struct qcom_rng_match_data qcom_prng_match_data = {
> -	.skip_init = false,
> -	.hwrng_support = false,
> -};
> -
> -static struct qcom_rng_match_data qcom_prng_ee_match_data = {
> -	.skip_init = true,
> -	.hwrng_support = false,
> -};
> -
> -static struct qcom_rng_match_data qcom_trng_match_data = {
> -	.skip_init = true,
> -	.hwrng_support = true,
> -};
> -
>  static const struct acpi_device_id __maybe_unused qcom_rng_acpi_match[] = {
>  	{ .id = "QCOM8160", .driver_data = 1 },
>  	{}
> -- 
> 2.46.0
> 

  parent reply	other threads:[~2024-08-29 15:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29  1:20 [PATCH 0/2] crypto: qcom-rng: fix support for ACPI-based systems Brian Masney
2024-08-29  1:20 ` [PATCH 1/2] crypto: qcom-rng: rename *_of_data to *_match_data Brian Masney
2024-08-29  1:20 ` [PATCH 2/2] crypto: qcom-rng: fix support for ACPI-based systems Brian Masney
2024-08-29 10:18   ` Dmitry Baryshkov
2024-08-29 15:58   ` Ernesto A. Fernández [this message]
2024-08-29 16:13     ` Brian Masney
2024-08-29  1:32 ` [PATCH 0/2] " Brian Masney

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=20240829155829.GA6489@eaf \
    --to=ernesto.mnd.fernandez@gmail.com \
    --cc=bmasney@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_jhugo@quicinc.com \
    --cc=quic_omprsing@quicinc.com \
    /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