All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PATCH 2/6] allwinner-i2c, adm1272: Use device_cold_reset() for software-triggered reset
Date: Fri, 12 Apr 2024 17:08:05 +0100	[thread overview]
Message-ID: <20240412160809.1260625-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20240412160809.1260625-1-peter.maydell@linaro.org>

Rather than directly calling the device's implementation of its 'hold'
reset phase, call device_cold_reset(). This means we don't have to
adjust this callsite when we add another argument to the function
signature for the hold and exit reset methods.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/i2c/allwinner-i2c.c | 3 +--
 hw/sensor/adm1272.c    | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/hw/i2c/allwinner-i2c.c b/hw/i2c/allwinner-i2c.c
index 8abcc39a5c2..96c20c86372 100644
--- a/hw/i2c/allwinner-i2c.c
+++ b/hw/i2c/allwinner-i2c.c
@@ -385,8 +385,7 @@ static void allwinner_i2c_write(void *opaque, hwaddr offset,
         break;
     case TWI_SRST_REG:
         if (((value & TWI_SRST_MASK) == 0) && (s->srst & TWI_SRST_MASK)) {
-            /* Perform reset */
-            allwinner_i2c_reset_hold(OBJECT(s));
+            device_cold_reset(DEVICE(s));
         }
         s->srst = value & TWI_SRST_MASK;
         break;
diff --git a/hw/sensor/adm1272.c b/hw/sensor/adm1272.c
index 1f7c8abb838..a19557ec9ea 100644
--- a/hw/sensor/adm1272.c
+++ b/hw/sensor/adm1272.c
@@ -386,7 +386,7 @@ static int adm1272_write_data(PMBusDevice *pmdev, const uint8_t *buf,
         break;
 
     case ADM1272_MFR_POWER_CYCLE:
-        adm1272_exit_reset((Object *)s);
+        device_cold_reset(DEVICE(s));
         break;
 
     case ADM1272_HYSTERESIS_LOW:
-- 
2.34.1



  parent reply	other threads:[~2024-04-12 16:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 16:08 [PATCH 0/6] reset: Add RESET_TYPE_SNAPSHOT_LOAD Peter Maydell
2024-04-12 16:08 ` [PATCH 1/6] hw/misc: Don't special case RESET_TYPE_COLD in npcm7xx_clk, gcr Peter Maydell
2024-04-12 17:21   ` Richard Henderson
2024-04-12 17:32   ` Philippe Mathieu-Daudé
2024-04-16  9:08   ` Luc Michel
2024-04-12 16:08 ` Peter Maydell [this message]
2024-04-12 17:22   ` [PATCH 2/6] allwinner-i2c, adm1272: Use device_cold_reset() for software-triggered reset Richard Henderson
2024-04-16  9:09   ` Luc Michel
2024-04-12 16:08 ` [PATCH 3/6] scripts/coccinelle: New script to add ResetType to hold and exit phases Peter Maydell
2024-04-16  9:10   ` Luc Michel
2024-04-12 16:08 ` [PATCH 4/6] hw, target: Add ResetType argument to hold and exit phase methods Peter Maydell
2024-04-12 16:49   ` Edgar E. Iglesias
2024-04-12 17:27   ` Richard Henderson
2024-04-16  9:10   ` Luc Michel
2024-04-12 16:08 ` [PATCH 5/6] docs/devel/reset: Update to new API for " Peter Maydell
2024-04-12 17:27   ` Richard Henderson
2024-04-12 17:29   ` Philippe Mathieu-Daudé
2024-04-16  9:10   ` Luc Michel
2024-04-12 16:08 ` [PATCH 6/6] reset: Add RESET_TYPE_SNAPSHOT_LOAD Peter Maydell
2024-04-12 17:30   ` Richard Henderson
2024-04-12 17:31   ` Philippe Mathieu-Daudé
2024-04-16  9:21   ` Luc Michel

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=20240412160809.1260625-3-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 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.