Skip to content

Commit

Permalink
ipoctal232: QOM parent field cleanup
Browse files Browse the repository at this point in the history
Clean up accesses to IPOctalState::dev field and rename it.

Acked-by: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Feb 14, 2014
1 parent 227d327 commit 08c9cac
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions hw/char/ipoctal232.c
Expand Up @@ -108,7 +108,8 @@ struct SCC2698Block {
};

struct IPOctalState {
IPackDevice dev;
IPackDevice parent_obj;

SCC2698Channel ch[N_CHANNELS];
SCC2698Block blk[N_BLOCKS];
uint8_t irq_vector;
Expand Down Expand Up @@ -154,7 +155,7 @@ static const VMStateDescription vmstate_ipoctal = {
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField[]) {
VMSTATE_IPACK_DEVICE(dev, IPOctalState),
VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
vmstate_scc2698_channel, SCC2698Channel),
VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS, 1,
Expand All @@ -172,16 +173,17 @@ static const uint8_t id_prom_data[] = {

static void update_irq(IPOctalState *dev, unsigned block)
{
IPackDevice *idev = IPACK_DEVICE(dev);
/* Blocks A and B interrupt on INT0#, C and D on INT1#.
Thus, to get the status we have to check two blocks. */
SCC2698Block *blk0 = &dev->blk[block];
SCC2698Block *blk1 = &dev->blk[block^1];
unsigned intno = block / 2;

if ((blk0->isr & blk0->imr) || (blk1->isr & blk1->imr)) {
qemu_irq_raise(dev->dev.irq[intno]);
qemu_irq_raise(idev->irq[intno]);
} else {
qemu_irq_lower(dev->dev.irq[intno]);
qemu_irq_lower(idev->irq[intno]);
}
}

Expand Down

0 comments on commit 08c9cac

Please sign in to comment.