All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Menon <armenon@redhat.com>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: qemu-devel@nongnu.org, marcandre.lureau@redhat.com
Subject: Re: [PATCH v2 5/6] tests: Check whether the I2C master flag is set
Date: Wed, 29 Apr 2026 18:43:34 +0530	[thread overview]
Message-ID: <afID_pQ_OkmqrABE@fedora> (raw)
In-Reply-To: <20260429121743.1346635-6-stefanb@linux.ibm.com>

Hi,

On Wed, Apr 29, 2026 at 12:17:42PM +0000, Stefan Berger wrote:
> Replace the 'once' variable with a check for whether the master flag is
> set so that the flag can be set when needed.
> 
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> ---
>  tests/qtest/qtest_aspeed.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/qtest/qtest_aspeed.c b/tests/qtest/qtest_aspeed.c
> index f6da9adea9..7bf5abb9be 100644
> --- a/tests/qtest/qtest_aspeed.c
> +++ b/tests/qtest/qtest_aspeed.c
> @@ -15,18 +15,21 @@
>  #include "qtest_aspeed.h"
>  #include "hw/i2c/aspeed_i2c.h"
>  
> +static bool aspeed_i2c_is_master_enabled(QTestState *s, uint32_t baseaddr)
> +{
> +    return qtest_readl(s, baseaddr + A_I2CC_FUN_CTRL) & A_I2CD_MASTER_EN;
> +}
> +
>  static void aspeed_i2c_startup(QTestState *s, uint32_t baseaddr,
>                                 uint8_t slave_addr, uint8_t reg)
>  {
>      uint32_t v;
> -    static int once;
>  
> -    if (!once) {
> +    if (!aspeed_i2c_is_master_enabled(s, baseaddr)) {
>          /* one time: enable master */
>         qtest_writel(s, baseaddr + A_I2CC_FUN_CTRL, 0);
>         v = qtest_readl(s, baseaddr + A_I2CC_FUN_CTRL) | A_I2CD_MASTER_EN;
>         qtest_writel(s, baseaddr + A_I2CC_FUN_CTRL, v);
> -       once = 1;
>      }
>  
>      /* select device */
> -- 
> 2.43.0
> 

Reviewed-by: Arun Menon <armenon@redhat.com>

Regards,
Arun Menon



  reply	other threads:[~2026-04-29 13:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29 12:17 [PATCH v2 0/6] Add test case for TPM over I2C with swtpm Stefan Berger
2026-04-29 12:17 ` [PATCH v2 1/6] tests: Move TPM I2C bus read/write functions to common files Stefan Berger
2026-04-29 12:17 ` [PATCH v2 2/6] tests: Have TPM I2C read/write functions take QTestState as first parameter Stefan Berger
2026-04-29 12:17 ` [PATCH v2 3/6] tests: Convert string arrays to byte arrays Stefan Berger
2026-04-29 13:12   ` Arun Menon
2026-04-29 12:17 ` [PATCH v2 4/6] tests: Rename id of tpmdev to tpm0 Stefan Berger
2026-04-29 12:17 ` [PATCH v2 5/6] tests: Check whether the I2C master flag is set Stefan Berger
2026-04-29 13:13   ` Arun Menon [this message]
2026-04-29 12:17 ` [PATCH v2 6/6] tests: Add a TPM TIS I2C swtpm test Stefan Berger

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=afID_pQ_OkmqrABE@fedora \
    --to=armenon@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.