diff mbox

[1/2] hw/char: remove console_exit function in sclp

Message ID 1492626091-30531-1-git-send-email-tgnyang@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zihan Yang April 19, 2017, 6:21 p.m. UTC
Currently, the console_exit function in sclpconsole-lm.c and
    sclpconsole.c does nothing, just remove them. Since there is
    a NULL check on the DeviceClass exit callback as suggested by
    Frederic Konrad, it should be safe to simply remove them.

Signed-off-by: Zihan Yang <tgnyang@gmail.com>
---
 hw/char/sclpconsole-lm.c          | 6 ------
 hw/char/sclpconsole.c             | 6 ------
 include/hw/s390x/event-facility.h | 2 +-
 3 files changed, 1 insertion(+), 13 deletions(-)

Comments

Cornelia Huck April 24, 2017, 8:59 a.m. UTC | #1
On Thu, 20 Apr 2017 02:21:29 +0800
Zihan Yang <tgnyang@gmail.com> wrote:

>     Currently, the console_exit function in sclpconsole-lm.c and
>     sclpconsole.c does nothing, just remove them. Since there is
>     a NULL check on the DeviceClass exit callback as suggested by
>     Frederic Konrad, it should be safe to simply remove them.

Something strange happened to the commit message (leading whitespace).

You should also mention that you convert the callback to void.

> 
> Signed-off-by: Zihan Yang <tgnyang@gmail.com>
> ---
>  hw/char/sclpconsole-lm.c          | 6 ------
>  hw/char/sclpconsole.c             | 6 ------
>  include/hw/s390x/event-facility.h | 2 +-
>  3 files changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
> index 07d6ebd..86ddda6 100644
> --- a/hw/char/sclpconsole-lm.c
> +++ b/hw/char/sclpconsole-lm.c
> @@ -318,11 +318,6 @@ static int console_init(SCLPEvent *event)
>      return 0;
>  }
> 
> -static int console_exit(SCLPEvent *event)
> -{
> -    return 0;
> -}
> -
>  static void console_reset(DeviceState *dev)
>  {
>     SCLPEvent *event = SCLP_EVENT(dev);
> @@ -349,7 +344,6 @@ static void console_class_init(ObjectClass *klass, void *data)
>      dc->reset = console_reset;
>      dc->vmsd = &vmstate_sclplmconsole;
>      ec->init = console_init;
> -    ec->exit = console_exit;
>      ec->get_send_mask = send_mask;
>      ec->get_receive_mask = receive_mask;
>      ec->can_handle_event = can_handle_event;
> diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
> index b78f240..e916cac 100644
> --- a/hw/char/sclpconsole.c
> +++ b/hw/char/sclpconsole.c
> @@ -246,11 +246,6 @@ static void console_reset(DeviceState *dev)
>     scon->notify = false;
>  }
> 
> -static int console_exit(SCLPEvent *event)
> -{
> -    return 0;
> -}
> -
>  static Property console_properties[] = {
>      DEFINE_PROP_CHR("chardev", SCLPConsole, chr),
>      DEFINE_PROP_END_OF_LIST(),
> @@ -265,7 +260,6 @@ static void console_class_init(ObjectClass *klass, void *data)
>      dc->reset = console_reset;
>      dc->vmsd = &vmstate_sclpconsole;
>      ec->init = console_init;
> -    ec->exit = console_exit;
>      ec->get_send_mask = send_mask;
>      ec->get_receive_mask = receive_mask;
>      ec->can_handle_event = can_handle_event;
> diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
> index def1bb0..1a32f3a 100644
> --- a/include/hw/s390x/event-facility.h
> +++ b/include/hw/s390x/event-facility.h
> @@ -162,7 +162,7 @@ typedef struct SCLPEvent {
>  typedef struct SCLPEventClass {
>      DeviceClass parent_class;
>      int (*init)(SCLPEvent *event);
> -    int (*exit)(SCLPEvent *event);
> +    void (*exit)(SCLPEvent *event);
> 
>      /* get SCLP's send mask */
>      unsigned int (*get_send_mask)(void);

You missed one:

/home/cohuck/git/qemu/hw/s390x/event-facility.c: In function ‘event_unrealize’:
/home/cohuck/git/qemu/hw/s390x/event-facility.c:416:18: error: void value not ignored as it ought to be
diff mbox

Patch

diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c
index 07d6ebd..86ddda6 100644
--- a/hw/char/sclpconsole-lm.c
+++ b/hw/char/sclpconsole-lm.c
@@ -318,11 +318,6 @@  static int console_init(SCLPEvent *event)
     return 0;
 }
 
-static int console_exit(SCLPEvent *event)
-{
-    return 0;
-}
-
 static void console_reset(DeviceState *dev)
 {
    SCLPEvent *event = SCLP_EVENT(dev);
@@ -349,7 +344,6 @@  static void console_class_init(ObjectClass *klass, void *data)
     dc->reset = console_reset;
     dc->vmsd = &vmstate_sclplmconsole;
     ec->init = console_init;
-    ec->exit = console_exit;
     ec->get_send_mask = send_mask;
     ec->get_receive_mask = receive_mask;
     ec->can_handle_event = can_handle_event;
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index b78f240..e916cac 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -246,11 +246,6 @@  static void console_reset(DeviceState *dev)
    scon->notify = false;
 }
 
-static int console_exit(SCLPEvent *event)
-{
-    return 0;
-}
-
 static Property console_properties[] = {
     DEFINE_PROP_CHR("chardev", SCLPConsole, chr),
     DEFINE_PROP_END_OF_LIST(),
@@ -265,7 +260,6 @@  static void console_class_init(ObjectClass *klass, void *data)
     dc->reset = console_reset;
     dc->vmsd = &vmstate_sclpconsole;
     ec->init = console_init;
-    ec->exit = console_exit;
     ec->get_send_mask = send_mask;
     ec->get_receive_mask = receive_mask;
     ec->can_handle_event = can_handle_event;
diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
index def1bb0..1a32f3a 100644
--- a/include/hw/s390x/event-facility.h
+++ b/include/hw/s390x/event-facility.h
@@ -162,7 +162,7 @@  typedef struct SCLPEvent {
 typedef struct SCLPEventClass {
     DeviceClass parent_class;
     int (*init)(SCLPEvent *event);
-    int (*exit)(SCLPEvent *event);
+    void (*exit)(SCLPEvent *event);
 
     /* get SCLP's send mask */
     unsigned int (*get_send_mask)(void);