diff mbox series

hw/sd/omap_mmc: Use device_cold_reset() instead of device_legacy_reset()

Message ID 20210430222348.8514-1-peter.maydell@linaro.org
State Superseded
Headers show
Series hw/sd/omap_mmc: Use device_cold_reset() instead of device_legacy_reset() | expand

Commit Message

Peter Maydell April 30, 2021, 10:23 p.m. UTC
The omap_mmc_reset() function resets its SD card via
device_legacy_reset().  We know that the SD card does not have a qbus
of its own, so the new device_cold_reset() function (which resets
both the device and its child buses) is equivalent here to
device_legacy_reset() and we can just switch to the new API.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
cc'ing Markus who was interested in conversions away from
the legacy API. As warned, the conversion patch itself is
not very interesting as the difficulty is all in confirming
that the device being reset has no qbuses...

 hw/sd/omap_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

Markus Armbruster May 1, 2021, 5:55 a.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> The omap_mmc_reset() function resets its SD card via

> device_legacy_reset().  We know that the SD card does not have a qbus

> of its own, so the new device_cold_reset() function (which resets

> both the device and its child buses) is equivalent here to

> device_legacy_reset() and we can just switch to the new API.

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

> cc'ing Markus who was interested in conversions away from

> the legacy API. As warned, the conversion patch itself is

> not very interesting as the difficulty is all in confirming

> that the device being reset has no qbuses...


The commit messsage makes this helpful.  Thanks!

I wonder whether we should add a hint to device_legacy_reset()'s
comment.
Philippe Mathieu-Daudé May 1, 2021, 9:45 a.m. UTC | #2
On 5/1/21 7:55 AM, Markus Armbruster wrote:
> Peter Maydell <peter.maydell@linaro.org> writes:

> 

>> The omap_mmc_reset() function resets its SD card via

>> device_legacy_reset().  We know that the SD card does not have a qbus

>> of its own, so the new device_cold_reset() function (which resets

>> both the device and its child buses) is equivalent here to

>> device_legacy_reset() and we can just switch to the new API.

>>

>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


>> ---

>> cc'ing Markus who was interested in conversions away from

>> the legacy API. As warned, the conversion patch itself is

>> not very interesting as the difficulty is all in confirming

>> that the device being reset has no qbuses...

> 

> The commit messsage makes this helpful.  Thanks!


Looking in archives, Damien did convert devices in v3:
https://www.mail-archive.com/qemu-devel@nongnu.org/msg634100.html

But it got lost after telling him cold/warn was not enough,
and better would be a multi-phase reset. Full thread:
https://www.mail-archive.com/qemu-block@nongnu.org/msg54084.html

> I wonder whether we should add a hint to device_legacy_reset()'s

> comment.


I'd rather convert and remove device_legacy_reset().

Regards,

Phil.
diff mbox series

Patch

diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c
index 1f946908fe1..b67def63813 100644
--- a/hw/sd/omap_mmc.c
+++ b/hw/sd/omap_mmc.c
@@ -318,7 +318,7 @@  void omap_mmc_reset(struct omap_mmc_s *host)
      * into any bus, and we must reset it manually. When omap_mmc is
      * QOMified this must move into the QOM reset function.
      */
-    device_legacy_reset(DEVICE(host->card));
+    device_cold_reset(DEVICE(host->card));
 }
 
 static uint64_t omap_mmc_read(void *opaque, hwaddr offset,