hw/sd: Use the QOM BUS() macro to access BusState.qbus

Rather than looking inside the definition of a BusState with "s->bus.qbus",
use the QOM prefered style: "BUS(&s->bus)".

This patch was generated using the following Coccinelle script:

    // Use BUS() macros to access BusState.qbus
    @use_bus_macro_to_access_qbus@
    expression obj;
    identifier bus;
    @@
    -&obj->bus.qbus
    +BUS(&obj->bus)

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190528164020.32250-6-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Philippe Mathieu-Daudé 2019-05-28 18:40:15 +02:00 committed by Laurent Vivier
parent 0ce5e0201f
commit 6afa968a93
2 changed files with 2 additions and 2 deletions

View file

@ -277,7 +277,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
/* FIXME use a qdev drive property instead of drive_get_next() */
dinfo = drive_get_next(IF_SD);
blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &err);
object_property_set_bool(OBJECT(carddev), true, "realized", &err);
if (err) {

View file

@ -249,7 +249,7 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
/* Create and plug in the sd card */
/* FIXME use a qdev drive property instead of drive_get_next() */
dinfo = drive_get_next(IF_SD);
carddev = qdev_create(&s->sdbus.qbus, TYPE_SD_CARD);
carddev = qdev_create(BUS(&s->sdbus), TYPE_SD_CARD);
if (dinfo) {
qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
}