aboutsummaryrefslogtreecommitdiff
path: root/hw/misc/imx_ccm.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-26 21:50:54 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:06:05 +0200
commitbcb34c7a61bce00136d42442c592011e56d87161 (patch)
treeb620986c021e5a4a651345dcb3ed2b6777c9d78e /hw/misc/imx_ccm.c
parent5ff94a61c461111e25b67c7b9cabef035aa30225 (diff)
downloadqemu-bcb34c7a61bce00136d42442c592011e56d87161.zip
qemu-bcb34c7a61bce00136d42442c592011e56d87161.tar.gz
qemu-bcb34c7a61bce00136d42442c592011e56d87161.tar.bz2
imx_ccm: QOM cast cleanup
Introduce type constant and use QOM casts. Acked-by: Peter Chubb <peter.chubb@nicta.com.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/misc/imx_ccm.c')
-rw-r--r--hw/misc/imx_ccm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/misc/imx_ccm.c b/hw/misc/imx_ccm.c
index 816d5e8..63e33a4 100644
--- a/hw/misc/imx_ccm.c
+++ b/hw/misc/imx_ccm.c
@@ -29,8 +29,12 @@ do { printf("imx_ccm: " fmt , ##args); } while (0)
static int imx_ccm_post_load(void *opaque, int version_id);
-typedef struct {
- SysBusDevice busdev;
+#define TYPE_IMX_CCM "imx_ccm"
+#define IMX_CCM(obj) OBJECT_CHECK(IMXCCMState, (obj), TYPE_IMX_CCM)
+
+typedef struct IMXCCMState {
+ SysBusDevice parent_obj;
+
MemoryRegion iomem;
uint32_t ccmr;
@@ -108,7 +112,7 @@ static const VMStateDescription vmstate_imx_ccm = {
uint32_t imx_clock_frequency(DeviceState *dev, IMXClk clock)
{
- IMXCCMState *s = container_of(dev, IMXCCMState, busdev.qdev);
+ IMXCCMState *s = IMX_CCM(dev);
switch (clock) {
case NOCLK:
@@ -178,7 +182,7 @@ static void update_clocks(IMXCCMState *s)
static void imx_ccm_reset(DeviceState *dev)
{
- IMXCCMState *s = container_of(dev, IMXCCMState, busdev.qdev);
+ IMXCCMState *s = IMX_CCM(dev);
s->ccmr = 0x074b0b7b;
s->pdr0 = 0xff870b48;
@@ -279,7 +283,7 @@ static const struct MemoryRegionOps imx_ccm_ops = {
static int imx_ccm_init(SysBusDevice *dev)
{
- IMXCCMState *s = FROM_SYSBUS(typeof(*s), dev);
+ IMXCCMState *s = IMX_CCM(dev);
memory_region_init_io(&s->iomem, OBJECT(dev), &imx_ccm_ops, s,
"imx_ccm", 0x1000);
@@ -308,7 +312,7 @@ static void imx_ccm_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo imx_ccm_info = {
- .name = "imx_ccm",
+ .name = TYPE_IMX_CCM,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(IMXCCMState),
.class_init = imx_ccm_class_init,