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:
parent
5ff94a61c4
commit
bcb34c7a61
@ -29,8 +29,12 @@ do { printf("imx_ccm: " fmt , ##args); } while (0)
|
|||||||
|
|
||||||
static int imx_ccm_post_load(void *opaque, int version_id);
|
static int imx_ccm_post_load(void *opaque, int version_id);
|
||||||
|
|
||||||
typedef struct {
|
#define TYPE_IMX_CCM "imx_ccm"
|
||||||
SysBusDevice busdev;
|
#define IMX_CCM(obj) OBJECT_CHECK(IMXCCMState, (obj), TYPE_IMX_CCM)
|
||||||
|
|
||||||
|
typedef struct IMXCCMState {
|
||||||
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
|
|
||||||
uint32_t ccmr;
|
uint32_t ccmr;
|
||||||
@ -108,7 +112,7 @@ static const VMStateDescription vmstate_imx_ccm = {
|
|||||||
|
|
||||||
uint32_t imx_clock_frequency(DeviceState *dev, IMXClk clock)
|
uint32_t imx_clock_frequency(DeviceState *dev, IMXClk clock)
|
||||||
{
|
{
|
||||||
IMXCCMState *s = container_of(dev, IMXCCMState, busdev.qdev);
|
IMXCCMState *s = IMX_CCM(dev);
|
||||||
|
|
||||||
switch (clock) {
|
switch (clock) {
|
||||||
case NOCLK:
|
case NOCLK:
|
||||||
@ -178,7 +182,7 @@ static void update_clocks(IMXCCMState *s)
|
|||||||
|
|
||||||
static void imx_ccm_reset(DeviceState *dev)
|
static void imx_ccm_reset(DeviceState *dev)
|
||||||
{
|
{
|
||||||
IMXCCMState *s = container_of(dev, IMXCCMState, busdev.qdev);
|
IMXCCMState *s = IMX_CCM(dev);
|
||||||
|
|
||||||
s->ccmr = 0x074b0b7b;
|
s->ccmr = 0x074b0b7b;
|
||||||
s->pdr0 = 0xff870b48;
|
s->pdr0 = 0xff870b48;
|
||||||
@ -279,7 +283,7 @@ static const struct MemoryRegionOps imx_ccm_ops = {
|
|||||||
|
|
||||||
static int imx_ccm_init(SysBusDevice *dev)
|
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,
|
memory_region_init_io(&s->iomem, OBJECT(dev), &imx_ccm_ops, s,
|
||||||
"imx_ccm", 0x1000);
|
"imx_ccm", 0x1000);
|
||||||
@ -308,7 +312,7 @@ static void imx_ccm_class_init(ObjectClass *klass, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo imx_ccm_info = {
|
static const TypeInfo imx_ccm_info = {
|
||||||
.name = "imx_ccm",
|
.name = TYPE_IMX_CCM,
|
||||||
.parent = TYPE_SYS_BUS_DEVICE,
|
.parent = TYPE_SYS_BUS_DEVICE,
|
||||||
.instance_size = sizeof(IMXCCMState),
|
.instance_size = sizeof(IMXCCMState),
|
||||||
.class_init = imx_ccm_class_init,
|
.class_init = imx_ccm_class_init,
|
||||||
|
Loading…
Reference in New Issue
Block a user