From patchwork Mon Mar 20 18:00:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Volkov X-Patchwork-Id: 741107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vn3fH6dr0z9s0m for ; Tue, 21 Mar 2017 05:01:11 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=inbox.ru header.i=@inbox.ru header.b="MsIwhSFa"; dkim-atps=neutral Received: from localhost ([::1]:34234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cq1cC-0000qU-4O for incoming@patchwork.ozlabs.org; Mon, 20 Mar 2017 14:01:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cq1bg-0000qC-Mf for qemu-devel@nongnu.org; Mon, 20 Mar 2017 14:00:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cq1bd-0008IY-Im for qemu-devel@nongnu.org; Mon, 20 Mar 2017 14:00:36 -0400 Received: from smtp59.i.mail.ru ([217.69.128.39]:49004) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cq1bd-0008Hf-3P for qemu-devel@nongnu.org; Mon, 20 Mar 2017 14:00:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=inbox.ru; s=mail; h=Message-Id:Date:Subject:Cc:To:From; bh=gabNQZ872jYZkZ1M+LtyHAw9nfIf7ExRxpJEczRLJMQ=; b=MsIwhSFah5Z9ZENo3gxq60xkmN3huMxnzRv8QMuVxqP/WkUT9NhKED2IsnFsCnsCmOUVtF/YKYHA3jF7vdS75P4Vw3upOH+dOLAohLoegLiCOnUbEwTACfWBpmveFtwAw+4caXKJnoQ+s8r9FJZF+q0hVV7kqRnD164IZ4zekZE=; Received: from [81.25.53.169] (port=53742 helo=lexabiton1.ultra.net.ru) by smtp59.i.mail.ru with esmtpa (envelope-from ) id 1cq1bX-0008Oy-SF; Mon, 20 Mar 2017 21:00:29 +0300 From: Anton Volkov To: qemu-devel@nongnu.org Date: Mon, 20 Mar 2017 21:00:24 +0300 Message-Id: <20170320180024.23432-1-arvolkov@inbox.ru> X-Mailer: git-send-email 2.10.1 (Apple Git-78) Authentication-Results: smtp59.i.mail.ru; auth=pass smtp.auth=arvolkov@inbox.ru smtp.mailfrom=arvolkov@inbox.ru X-7FA49CB5: 0D63561A33F958A54E65434B01345A2E516EBD5118E0F70BEC9220579E41F2EB9F18ECD7E95F35E938F506CA769165D3E648129B5B31C90EF6782D180EC434A80BF2EBBBDD9D6B0F7FFC5772FDE91EBA X-Mailru-Sender: E35DCF8F64B9C34B6778EFE9B4436A16A2B14DD1B25310A643EAAF4DE0DB1BFAF843993030728235AD78706863F42AC66EFAE8183A2EAE0D8939777A2BC6367982BADC8C81B40964807B52DDCCEC6344EAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: OK X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 217.69.128.39 Subject: [Qemu-devel] [PATCH] hw: dead code removal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: borntraeger@de.ibm.com, kraxel@redhat.com, agraf@suse.de Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Made functions *_exit in hw/ return void instead of int (they returned 0 all the time) and removed related return value checks Signed-off-by: Anton Volkov Acked-by: Cornelia Huck --- hw/audio/hda-codec.c | 3 +-- hw/audio/intel-hda.c | 3 +-- hw/audio/intel-hda.h | 2 +- hw/char/sclpconsole-lm.c | 4 ++-- hw/char/sclpconsole.c | 4 ++-- hw/core/qdev.c | 6 +----- hw/s390x/event-facility.c | 6 +----- hw/s390x/virtio-ccw.c | 7 +++---- hw/s390x/virtio-ccw.h | 2 +- hw/usb/dev-smartcard-reader.c | 3 +-- include/hw/qdev-core.h | 2 +- include/hw/s390x/event-facility.h | 2 +- 12 files changed, 16 insertions(+), 28 deletions(-) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 52d4640..5402cd1 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -520,7 +520,7 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc) return 0; } -static int hda_audio_exit(HDACodecDevice *hda) +static void hda_audio_exit(HDACodecDevice *hda) { HDAAudioState *a = HDA_AUDIO(hda); HDAAudioStream *st; @@ -539,7 +539,6 @@ static int hda_audio_exit(HDACodecDevice *hda) } } AUD_remove_card(&a->card); - return 0; } static int hda_audio_post_load(void *opaque, int version) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 537face..991c704 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -70,7 +70,7 @@ static void hda_codec_dev_realize(DeviceState *qdev, Error **errp) } } -static int hda_codec_dev_exit(DeviceState *qdev) +static void hda_codec_dev_exit(DeviceState *qdev) { HDACodecDevice *dev = HDA_CODEC_DEVICE(qdev); HDACodecDeviceClass *cdc = HDA_CODEC_DEVICE_GET_CLASS(dev); @@ -78,7 +78,6 @@ static int hda_codec_dev_exit(DeviceState *qdev) if (cdc->exit) { cdc->exit(dev); } - return 0; } HDACodecDevice *hda_codec_find(HDACodecBus *bus, uint32_t cad) diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h index d784bcf..53b78da 100644 --- a/hw/audio/intel-hda.h +++ b/hw/audio/intel-hda.h @@ -38,7 +38,7 @@ typedef struct HDACodecDeviceClass DeviceClass parent_class; int (*init)(HDACodecDevice *dev); - int (*exit)(HDACodecDevice *dev); + void (*exit)(HDACodecDevice *dev); void (*command)(HDACodecDevice *dev, uint32_t nid, uint32_t data); void (*stream)(HDACodecDevice *dev, uint32_t stnr, bool running, bool output); } HDACodecDeviceClass; diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 07d6ebd..fbe5b42 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -318,9 +318,9 @@ static int console_init(SCLPEvent *event) return 0; } -static int console_exit(SCLPEvent *event) +static void console_exit(SCLPEvent *event) { - return 0; + return; } static void console_reset(DeviceState *dev) diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index b78f240..644f7cd 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -246,9 +246,9 @@ static void console_reset(DeviceState *dev) scon->notify = false; } -static int console_exit(SCLPEvent *event) +static void console_exit(SCLPEvent *event) { - return 0; + return; } static Property console_properties[] = { diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 1e7fb33..5415843 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -238,11 +238,7 @@ static void device_unrealize(DeviceState *dev, Error **errp) DeviceClass *dc = DEVICE_GET_CLASS(dev); if (dc->exit) { - int rc = dc->exit(dev); - if (rc < 0) { - error_setg(errp, "Device exit failed."); - return; - } + dc->exit(dev); } } diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c index 34b2faf..f7c509c 100644 --- a/hw/s390x/event-facility.c +++ b/hw/s390x/event-facility.c @@ -413,11 +413,7 @@ static void event_unrealize(DeviceState *qdev, Error **errp) SCLPEvent *event = SCLP_EVENT(qdev); SCLPEventClass *child = SCLP_EVENT_GET_CLASS(event); if (child->exit) { - int rc = child->exit(event); - if (rc < 0) { - error_setg(errp, "SCLP event exit failed."); - return; - } + child->exit(event); } } diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 00b3bde..d1c4ff6 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -722,7 +722,7 @@ static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) } } -static int virtio_ccw_exit(VirtioCcwDevice *dev) +static void virtio_ccw_exit(VirtioCcwDevice *dev) { CcwDevice *ccw_dev = CCW_DEVICE(dev); SubchDev *sch = ccw_dev->sch; @@ -735,7 +735,6 @@ static int virtio_ccw_exit(VirtioCcwDevice *dev) release_indicator(&dev->routes.adapter, dev->indicators); dev->indicators = NULL; } - return 0; } static void virtio_ccw_net_realize(VirtioCcwDevice *ccw_dev, Error **errp) @@ -1616,12 +1615,12 @@ static void virtio_ccw_busdev_realize(DeviceState *dev, Error **errp) virtio_ccw_device_realize(_dev, errp); } -static int virtio_ccw_busdev_exit(DeviceState *dev) +static void virtio_ccw_busdev_exit(DeviceState *dev) { VirtioCcwDevice *_dev = (VirtioCcwDevice *)dev; VirtIOCCWDeviceClass *_info = VIRTIO_CCW_DEVICE_GET_CLASS(dev); - return _info->exit(_dev); + _info->exit(_dev); } static void virtio_ccw_busdev_unplug(HotplugHandler *hotplug_dev, diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h index 41d4010..ce8baa3 100644 --- a/hw/s390x/virtio-ccw.h +++ b/hw/s390x/virtio-ccw.h @@ -74,7 +74,7 @@ typedef struct VirtioCcwDevice VirtioCcwDevice; typedef struct VirtIOCCWDeviceClass { CCWDeviceClass parent_class; void (*realize)(VirtioCcwDevice *dev, Error **errp); - int (*exit)(VirtioCcwDevice *dev); + void (*exit)(VirtioCcwDevice *dev); } VirtIOCCWDeviceClass; /* Performance improves when virtqueue kick processing is decoupled from the diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 757b8b3..71e3667 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -1289,7 +1289,7 @@ void ccid_card_card_inserted(CCIDCardState *card) ccid_on_slot_change(s, true); } -static int ccid_card_exit(DeviceState *qdev) +static void ccid_card_exit(DeviceState *qdev) { CCIDCardState *card = CCID_CARD(qdev); USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent); @@ -1300,7 +1300,6 @@ static int ccid_card_exit(DeviceState *qdev) } ccid_card_exitfn(card); s->card = NULL; - return 0; } static int ccid_card_init(DeviceState *qdev) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index b44b476..0efd9e9 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -31,7 +31,7 @@ typedef enum DeviceCategory { } DeviceCategory; typedef int (*qdev_initfn)(DeviceState *dev); -typedef int (*qdev_event)(DeviceState *dev); +typedef void (*qdev_event)(DeviceState *dev); typedef void (*qdev_resetfn)(DeviceState *dev); typedef void (*DeviceRealize)(DeviceState *dev, Error **errp); typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp); 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);