diff mbox

[qom-next,v1,4/6] misc: max111x: QOM casting sweep

Message ID 517f7913f652bc726efde018dd329b3319cce702.1392164348.git.peter.crosthwaite@xilinx.com
State New
Headers show

Commit Message

Peter Crosthwaite Feb. 12, 2014, 12:29 a.m. UTC
Define and use QOM cast macro. Removes some usages of legacy casting
systems.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---

 hw/misc/max111x.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c
index 9e50e7e..8c78979 100644
--- a/hw/misc/max111x.c
+++ b/hw/misc/max111x.c
@@ -24,6 +24,9 @@  typedef struct {
 
 #define TYPE_MAX_111X "max111x"
 
+#define MAX_111X(obj) \
+    OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X)
+
 #define TYPE_MAX_1110 "max1110"
 #define TYPE_MAX_1111 "max1111"
 
@@ -97,7 +100,7 @@  static void max111x_write(MAX111xState *s, uint32_t value)
 
 static uint32_t max111x_transfer(SSISlave *dev, uint32_t value)
 {
-    MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, dev);
+    MAX111xState *s = MAX_111X(dev);
     max111x_write(s, value);
     return max111x_read(s);
 }
@@ -122,7 +125,7 @@  static const VMStateDescription vmstate_max111x = {
 
 static int max111x_init(SSISlave *dev, int inputs)
 {
-    MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, dev);
+    MAX111xState *s = MAX_111X(dev);
 
     qdev_init_gpio_out(DEVICE(dev), &s->interrupt, 1);
 
@@ -154,7 +157,7 @@  static int max1111_init(SSISlave *dev)
 
 void max111x_set_input(DeviceState *dev, int line, uint8_t value)
 {
-    MAX111xState *s = FROM_SSI_SLAVE(MAX111xState, SSI_SLAVE_FROM_QDEV(dev));
+    MAX111xState *s = MAX_111X(dev);
     assert(line >= 0 && line < s->inputs);
     s->input[line] = value;
 }