* [PATCH] hw/arm/aspeed: Do not create and attach empty SD cards by default
@ 2020-07-05 17:34 Philippe Mathieu-Daudé
2020-07-13 12:20 ` Cédric Le Goater
0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-05 17:34 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Andrew Jeffery, Eddie James,
Philippe Mathieu-Daudé,
qemu-arm, Cédric Le Goater, Joel Stanley
Since added in commit 2bea128c3d, each SDHCI is wired with a SD
card, using empty card when no block drive provided. This is not
the desired behavior. The SDHCI exposes a SD bus to plug cards
on, if no card available, it is fine to have an unplugged bus.
Avoid creating unnecessary SD card device when no block drive
provided.
Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Cc: Eddie James <eajames@linux.ibm.com>
Cc: Cédric Le Goater <clg@kaod.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Andrew Jeffery <andrew@aj.id.au>
---
hw/arm/aspeed.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 379f9672a5..11521c4be1 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -246,11 +246,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
{
DeviceState *card;
- card = qdev_new(TYPE_SD_CARD);
- if (dinfo) {
- qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
- &error_fatal);
+ if (!dinfo) {
+ return;
}
+ card = qdev_new(TYPE_SD_CARD);
+ qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
+ &error_fatal);
qdev_realize_and_unref(card,
qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
&error_fatal);
--
2.21.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/arm/aspeed: Do not create and attach empty SD cards by default
2020-07-05 17:34 [PATCH] hw/arm/aspeed: Do not create and attach empty SD cards by default Philippe Mathieu-Daudé
@ 2020-07-13 12:20 ` Cédric Le Goater
2020-07-13 12:24 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Cédric Le Goater @ 2020-07-13 12:20 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Andrew Jeffery, Peter Maydell, qemu-arm, Eddie James, Joel Stanley
On 7/5/20 7:34 PM, Philippe Mathieu-Daudé wrote:
> Since added in commit 2bea128c3d, each SDHCI is wired with a SD
> card, using empty card when no block drive provided. This is not
> the desired behavior. The SDHCI exposes a SD bus to plug cards
> on, if no card available, it is fine to have an unplugged bus.
>
> Avoid creating unnecessary SD card device when no block drive
> provided.
>
> Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Thanks,
C.
> ---
> Cc: Eddie James <eajames@linux.ibm.com>
> Cc: Cédric Le Goater <clg@kaod.org>
> Cc: Joel Stanley <joel@jms.id.au>
> Cc: Andrew Jeffery <andrew@aj.id.au>
> ---
> hw/arm/aspeed.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 379f9672a5..11521c4be1 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -246,11 +246,12 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
> {
> DeviceState *card;
>
> - card = qdev_new(TYPE_SD_CARD);
> - if (dinfo) {
> - qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
> - &error_fatal);
> + if (!dinfo) {
> + return;
> }
> + card = qdev_new(TYPE_SD_CARD);
> + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
> + &error_fatal);
> qdev_realize_and_unref(card,
> qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
> &error_fatal);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/arm/aspeed: Do not create and attach empty SD cards by default
2020-07-13 12:20 ` Cédric Le Goater
@ 2020-07-13 12:24 ` Peter Maydell
0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2020-07-13 12:24 UTC (permalink / raw)
To: Cédric Le Goater
Cc: Andrew Jeffery, Eddie James, Philippe Mathieu-Daudé,
QEMU Developers, qemu-arm, Joel Stanley
On Mon, 13 Jul 2020 at 13:20, Cédric Le Goater <clg@kaod.org> wrote:
>
> On 7/5/20 7:34 PM, Philippe Mathieu-Daudé wrote:
> > Since added in commit 2bea128c3d, each SDHCI is wired with a SD
> > card, using empty card when no block drive provided. This is not
> > the desired behavior. The SDHCI exposes a SD bus to plug cards
> > on, if no card available, it is fine to have an unplugged bus.
> >
> > Avoid creating unnecessary SD card device when no block drive
> > provided.
> >
> > Fixes: 2bea128c3d ("hw/sd/aspeed_sdhci: New device")
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
> Reviewed-by: Cédric Le Goater <clg@kaod.org>
Applied to target-arm.next for 5.1, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-13 12:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-05 17:34 [PATCH] hw/arm/aspeed: Do not create and attach empty SD cards by default Philippe Mathieu-Daudé
2020-07-13 12:20 ` Cédric Le Goater
2020-07-13 12:24 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).