qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/7] usb-ccid: convert CCIDCardClass::init ->


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 3/7] usb-ccid: convert CCIDCardClass::init -> realize
Date: Wed, 31 Jan 2018 14:43:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Philippe Mathieu-Daudé <address@hidden> writes:

> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  hw/usb/ccid.h                 |  9 +++++--
>  hw/usb/ccid-card-emulated.c   | 45 ++++++++++++++++++----------------
>  hw/usb/ccid-card-passthru.c   | 10 ++++----
>  hw/usb/dev-smartcard-reader.c | 57 
> +++++++++++++++----------------------------
>  4 files changed, 56 insertions(+), 65 deletions(-)
>
[...]
> diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
> index e646eb243b..a2b608a953 100644
> --- a/hw/usb/ccid-card-emulated.c
> +++ b/hw/usb/ccid-card-emulated.c
> @@ -27,6 +27,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qapi/error.h"
>  #include <eventt.h>
>  #include <vevent.h>
>  #include <vreader.h>
> @@ -480,7 +481,7 @@ static uint32_t parse_enumeration(char *str,
>      return ret;
>  }
>  
> -static int emulated_initfn(CCIDCardState *base)
> +static void emulated_realize(CCIDCardState *base, Error **errp)
>  {
>      EmulatedState *card = EMULATED_CCID_CARD(base);
>      VCardEmulError ret;
> @@ -495,7 +496,8 @@ static int emulated_initfn(CCIDCardState *base)
>      card->reader = NULL;
>      card->quit_apdu_thread = 0;
>      if (init_event_notifier(card) < 0) {
> -        return -1;
> +        error_setg(errp, TYPE_EMULATED_CCID ": event notifier creation 
> failed");
> +        return;
>      }
>  
>      card->backend = 0;
> @@ -505,11 +507,12 @@ static int emulated_initfn(CCIDCardState *base)
>      }
>  
>      if (card->backend == 0) {
> -        printf("backend must be one of:\n");
> +        error_setg(errp, TYPE_EMULATED_CCID ": no backend specified.");

No period at end of error_setg() messages, please.  More of the same below.

> +        error_append_hint(errp, "backend must be one of:\n");
>          for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) {
> -            printf("%s\n", ptable->name);
> +            error_append_hint(errp, "%s\n", ptable->name);
>          }
> -        return -1;
> +        return;
>      }
>  
>      /* TODO: a passthru backened that works on local machine. third card 
> type?*/
[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]