提交 e563c59b 编写于 作者: X xiaoqiang zhao 提交者: Cornelia Huck

hw/char: QOM'ify sclpconsole-lm.c

Drop the DO_UPCAST macro
Signed-off-by: Nxiaoqiang zhao <zxq_yx_007@163.com>
Message-Id: <1459237645-17227-6-git-send-email-zxq_yx_007@163.com>
Signed-off-by: NCornelia Huck <cornelia.huck@de.ibm.com>
上级 010d45d2
...@@ -44,6 +44,10 @@ typedef struct SCLPConsoleLM { ...@@ -44,6 +44,10 @@ typedef struct SCLPConsoleLM {
uint8_t buf[SIZE_CONSOLE_BUFFER]; uint8_t buf[SIZE_CONSOLE_BUFFER];
} SCLPConsoleLM; } SCLPConsoleLM;
#define TYPE_SCLPLM_CONSOLE "sclplmconsole"
#define SCLPLM_CONSOLE(obj) \
OBJECT_CHECK(SCLPConsoleLM, (obj), TYPE_SCLPLM_CONSOLE)
/* /*
* Character layer call-back functions * Character layer call-back functions
* *
...@@ -116,7 +120,7 @@ static int get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size, ...@@ -116,7 +120,7 @@ static int get_console_data(SCLPEvent *event, uint8_t *buf, size_t *size,
{ {
int len; int len;
SCLPConsoleLM *cons = DO_UPCAST(SCLPConsoleLM, event, event); SCLPConsoleLM *cons = SCLPLM_CONSOLE(event);
len = cons->length; len = cons->length;
/* data need to fit into provided SCLP buffer */ /* data need to fit into provided SCLP buffer */
...@@ -190,7 +194,7 @@ static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len) ...@@ -190,7 +194,7 @@ static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len)
int ret = 0; int ret = 0;
const uint8_t *buf_offset; const uint8_t *buf_offset;
SCLPConsoleLM *scon = DO_UPCAST(SCLPConsoleLM, event, event); SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
if (!scon->chr) { if (!scon->chr) {
/* If there's no backend, we can just say we consumed all data. */ /* If there's no backend, we can just say we consumed all data. */
...@@ -244,7 +248,7 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *ebh) ...@@ -244,7 +248,7 @@ static int write_event_data(SCLPEvent *event, EventBufferHeader *ebh)
int errors = 0; int errors = 0;
MDBO *mdbo; MDBO *mdbo;
SclpMsg *data = (SclpMsg *) ebh; SclpMsg *data = (SclpMsg *) ebh;
SCLPConsoleLM *scon = DO_UPCAST(SCLPConsoleLM, event, event); SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
len = be16_to_cpu(data->mdb.header.length); len = be16_to_cpu(data->mdb.header.length);
if (len < sizeof(data->mdb.header)) { if (len < sizeof(data->mdb.header)) {
...@@ -313,7 +317,7 @@ static int console_init(SCLPEvent *event) ...@@ -313,7 +317,7 @@ static int console_init(SCLPEvent *event)
{ {
static bool console_available; static bool console_available;
SCLPConsoleLM *scon = DO_UPCAST(SCLPConsoleLM, event, event); SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
if (console_available) { if (console_available) {
error_report("Multiple line-mode operator consoles are not supported"); error_report("Multiple line-mode operator consoles are not supported");
...@@ -336,7 +340,7 @@ static int console_exit(SCLPEvent *event) ...@@ -336,7 +340,7 @@ static int console_exit(SCLPEvent *event)
static void console_reset(DeviceState *dev) static void console_reset(DeviceState *dev)
{ {
SCLPEvent *event = SCLP_EVENT(dev); SCLPEvent *event = SCLP_EVENT(dev);
SCLPConsoleLM *scon = DO_UPCAST(SCLPConsoleLM, event, event); SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
event->event_pending = false; event->event_pending = false;
scon->length = 0; scon->length = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册