All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 4/5] usb-ccid: inline ccid_card_initfn() in ccid_card_realize()
Date: Fri, 26 Jan 2018 09:05:14 +0100	[thread overview]
Message-ID: <20180126080515.26108-5-kraxel@redhat.com> (raw)
In-Reply-To: <20180126080515.26108-1-kraxel@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20180125171432.13554-3-f4bug@amsat.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-smartcard-reader.c | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 0092493f4e..85f5f2247b 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -510,20 +510,6 @@ static void ccid_card_exitfn(CCIDCardState *card)
 
 }
 
-static void ccid_card_initfn(CCIDCardState *card, Error **errp)
-{
-    CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
-    Error *local_err = NULL;
-
-    if (cc->realize) {
-        cc->realize(card, &local_err);
-        if (local_err != NULL) {
-            error_propagate(errp, local_err);
-            return;
-        }
-    }
-}
-
 static bool ccid_has_pending_answers(USBCCIDState *s)
 {
     return s->pending_answers_num > 0;
@@ -1302,6 +1288,7 @@ static int ccid_card_exit(DeviceState *qdev)
 static void ccid_card_realize(DeviceState *qdev, Error **errp)
 {
     CCIDCardState *card = CCID_CARD(qdev);
+    CCIDCardClass *cc = CCID_CARD_GET_CLASS(card);
     USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
     USBCCIDState *s = USB_CCID_DEV(dev);
     Error *local_err = NULL;
@@ -1315,10 +1302,12 @@ static void ccid_card_realize(DeviceState *qdev, Error **errp)
         error_setg(errp, "usb-ccid card already full, not adding");
         return;
     }
-    ccid_card_initfn(card, &local_err);
-    if (local_err != NULL) {
-        error_propagate(errp, local_err);
-        return;
+    if (cc->realize) {
+        cc->realize(card, &local_err);
+        if (local_err != NULL) {
+            error_propagate(errp, local_err);
+            return;
+        }
     }
     s->card = card;
 }
-- 
2.9.3

  parent reply	other threads:[~2018-01-26  8:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-26  8:05 [Qemu-devel] [PULL 0/5] Usb 20180126 v3 patches Gerd Hoffmann
2018-01-26  8:05 ` [Qemu-devel] [PULL 1/5] usb: Remove legacy -usbdevice options (host, serial, disk and net) Gerd Hoffmann
2018-01-26  8:05 ` [Qemu-devel] [PULL 2/5] usb-storage: Fix share-rw option parsing Gerd Hoffmann
2018-01-26  8:05 ` [Qemu-devel] [PULL 3/5] hw/usb/ccid: Make ccid_card_init() take an error parameter Gerd Hoffmann
2018-01-26  8:05 ` Gerd Hoffmann [this message]
2018-01-26  8:05 ` [Qemu-devel] [PULL 5/5] usb-ccid: convert CCIDCardClass::exitfn() -> unrealize() Gerd Hoffmann
2018-01-26 14:21 ` [Qemu-devel] [PULL 0/5] Usb 20180126 v3 patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180126080515.26108-5-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.