From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMEr3-0002mM-MX for qemu-devel@nongnu.org; Wed, 18 Sep 2013 06:19:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMEqr-0008WD-Uq for qemu-devel@nongnu.org; Wed, 18 Sep 2013 06:19:29 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:57236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMEqr-0008W1-Lp for qemu-devel@nongnu.org; Wed, 18 Sep 2013 06:19:17 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 18 Sep 2013 11:19:17 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 86E2717D8058 for ; Wed, 18 Sep 2013 11:19:24 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r8IAJ1L164225456 for ; Wed, 18 Sep 2013 10:19:01 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r8IAJC8x024001 for ; Wed, 18 Sep 2013 04:19:13 -0600 From: Christian Borntraeger Date: Wed, 18 Sep 2013 12:19:30 +0200 Message-Id: <1379499572-49737-10-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1379499572-49737-1-git-send-email-borntraeger@de.ibm.com> References: <1379499572-49737-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH 09/11] s390/eventfacility: allow childs to handle more than 1 event type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Christian Borntraeger , Jens Freimann , Heinz Graalfs , qemu-devel Currently all handlers (quiesce, console) only handle one event type. Some drivers will handle multiple (compatible) event types. Rework the code accordingly. Signed-off-by: Christian Borntraeger --- hw/char/sclpconsole.c | 6 +++--- hw/s390x/event-facility.c | 2 +- hw/s390x/sclpquiesce.c | 6 +++--- include/hw/s390x/event-facility.h | 5 ++--- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 9469979..69ac5b3 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -79,9 +79,9 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) /* functions to be called by event facility */ -static int event_type(void) +static bool can_handle_event(uint8_t type) { - return SCLP_EVENT_ASCII_CONSOLE_DATA; + return type == SCLP_EVENT_ASCII_CONSOLE_DATA; } static unsigned int send_mask(void) @@ -271,7 +271,7 @@ static void console_class_init(ObjectClass *klass, void *data) ec->exit = console_exit; ec->get_send_mask = send_mask; ec->get_receive_mask = receive_mask; - ec->event_type = event_type; + ec->can_handle_event = can_handle_event; ec->read_event_data = read_event_data; ec->write_event_data = write_event_data; } diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 4347a48..b1afa7e 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -120,7 +120,7 @@ static uint16_t handle_write_event_buf(SCLPEventFacility *ef, ec = SCLP_EVENT_GET_CLASS(event); if (ec->write_event_data && - ec->event_type() == event_buf->type) { + ec->can_handle_event(event_buf->type)) { rc = ec->write_event_data(event, event_buf); break; } diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c index 1a528c0..4c67bac 100644 --- a/hw/s390x/sclpquiesce.c +++ b/hw/s390x/sclpquiesce.c @@ -22,9 +22,9 @@ typedef struct SignalQuiesce { uint8_t unit; } QEMU_PACKED SignalQuiesce; -static int event_type(void) +static bool can_handle_event(uint8_t type) { - return SCLP_EVENT_SIGNAL_QUIESCE; + return type == SCLP_EVENT_SIGNAL_QUIESCE; } static unsigned int send_mask(void) @@ -120,7 +120,7 @@ static void quiesce_class_init(ObjectClass *klass, void *data) k->get_send_mask = send_mask; k->get_receive_mask = receive_mask; - k->event_type = event_type; + k->can_handle_event = can_handle_event; k->read_event_data = read_event_data; k->write_event_data = NULL; } diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h index ff0f625..c0f5d19 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -87,9 +87,8 @@ typedef struct SCLPEventClass { int (*write_event_data)(SCLPEvent *event, EventBufferHeader *evt_buf_hdr); - /* returns the supported event type */ - int (*event_type)(void); - + /* can we handle this event type? */ + bool (*can_handle_event)(uint8_t type); } SCLPEventClass; #endif -- 1.8.3.1