diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2018-01-16 13:28:16 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2018-01-16 13:28:16 +0000 |
commit | 1c92c50543332f7432269a9a317c8c7e4c6618ea (patch) | |
tree | 012f0c74362ddaaf75fd193454806b0b9f41be14 /hw/sd | |
parent | b635d98cf323ec7f9e639d52a0e0d29fa7b33e38 (diff) | |
download | qemu-1c92c50543332f7432269a9a317c8c7e4c6618ea.zip qemu-1c92c50543332f7432269a9a317c8c7e4c6618ea.tar.gz qemu-1c92c50543332f7432269a9a317c8c7e4c6618ea.tar.bz2 |
sdhci: refactor common sysbus/pci class_init() into sdhci_common_class_init()
Now both inherited classes appear as DEVICE_CATEGORY_STORAGE.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20180115182436.2066-5-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/sd')
-rw-r--r-- | hw/sd/sdhci.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index c0b4b84..15d0961 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -1273,6 +1273,15 @@ const VMStateDescription sdhci_vmstate = { }, }; +static void sdhci_common_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); + dc->vmsd = &sdhci_vmstate; + dc->reset = sdhci_poweron_reset; +} + /* --- qdev PCI --- */ static Property sdhci_pci_properties[] = { @@ -1310,10 +1319,9 @@ static void sdhci_pci_class_init(ObjectClass *klass, void *data) k->vendor_id = PCI_VENDOR_ID_REDHAT; k->device_id = PCI_DEVICE_ID_REDHAT_SDHCI; k->class_id = PCI_CLASS_SYSTEM_SDHCI; - set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); - dc->vmsd = &sdhci_vmstate; dc->props = sdhci_pci_properties; - dc->reset = sdhci_poweron_reset; + + sdhci_common_class_init(klass, data); } static const TypeInfo sdhci_pci_info = { @@ -1366,10 +1374,10 @@ static void sdhci_sysbus_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - dc->vmsd = &sdhci_vmstate; dc->props = sdhci_sysbus_properties; dc->realize = sdhci_sysbus_realize; - dc->reset = sdhci_poweron_reset; + + sdhci_common_class_init(klass, data); } static const TypeInfo sdhci_sysbus_info = { |