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>
This commit is contained in:
Andreas Färber 2013-07-26 21:50:54 +02:00
parent 5ff94a61c4
commit bcb34c7a61

View File

@ -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,