Skip to contentSkip to conversation

Remove more unused functions

PATCH Superseded Thomas Huth 4 participants 14 messages Mar 9, 2015 – Mar 18, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Remove more unused functions

Here are some more patches to remove completely unused functions from QEMU. Please review carefully, some of the functions might still get usefull in the future again, so if you discover one, please let me know, then I'll remove it from the patch series again.

Thomas Huth (8):
migration: Remove unused functions
vmxnet: Remove unused function vmxnet_rx_pkt_get_num_frags()
pci: Remove unused functions
monitor: Remove unused functions
ioport: Remove unused functions
usb: Remove unused functions
util: Remove unused functions
Remove various unused functions

 backends/tpm.c                   |   11 ------
 hmp.h                            |    1 -
 hw/char/serial.c                 |    7 ----
 hw/net/vmxnet_rx_pkt.c           |    7 ----
 hw/net/vmxnet_rx_pkt.h           |    9 -----
 hw/pci-bridge/i82801b11.c        |   21 ------------
 hw/pci/pcie.c                    |   25 --------------
 hw/usb/core.c                    |   41 -----------------------
 include/exec/ioport.h            |    2 -
 include/hw/char/serial.h         |    1 -
 include/hw/i386/ich9.h           |    1 -
 include/hw/pci/pcie.h            |    3 --
 include/hw/usb.h                 |    5 ---
 include/migration/migration.h    |    1 -
 include/migration/qemu-file.h    |    2 -
 include/monitor/monitor.h        |    1 -
 include/qemu-common.h            |    4 --
 include/qemu/compatfd.h          |    1 -
 include/sysemu/iothread.h        |    1 -
 include/sysemu/tpm_backend_int.h |    2 -
 ioport.c                         |   24 --------------
 iothread.c                       |   12 -------
 migration/migration.c            |    9 -----
 migration/qemu-file-buf.c        |   53 ------------------------------
 monitor.c                        |   13 -------
 util/compatfd.c                  |   19 -----------
 util/osdep.c                     |   66 --------------------------------------
 27 files changed, 0 insertions(+), 342 deletions(-)
#1 lore raw

PATCH 1/8 migration: Remove unused functions

migrate_rdma_pin_all(), qsb_clone() and qsb_set_length() are completely unused and thus can be deleted.

Cc Juan Quintela <[email protected]>
Cc Amit Shah <[email protected]>
---
 include/migration/migration.h |    1 -
 include/migration/qemu-file.h |    2 -
 migration/migration.c         |    9 -------
 migration/qemu-file-buf.c     |   53 -----------------------------------------
 4 files changed, 0 insertions(+), 65 deletions(-)
include/migration/migration.h +0 -1
index 703b7d7..0a1cea0 100644
@@ -139,7 +139,6 @@ void migrate_add_blocker(Error *reason);
  */
 void migrate_del_blocker(Error *reason);
 
-bool migrate_rdma_pin_all(void);
 bool migrate_zero_blocks(void);
 
 bool migrate_auto_converge(void);
include/migration/qemu-file.h +0 -2
index a923cec..45d7f71 100644
@@ -133,9 +133,7 @@ bool qemu_file_mode_is_not_valid(const char *mode);
 bool qemu_file_is_writable(QEMUFile *f);
 
 QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len);
-QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *);
 void qsb_free(QEMUSizedBuffer *);
-size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t length);
 size_t qsb_get_length(const QEMUSizedBuffer *qsb);
 ssize_t qsb_get_buffer(const QEMUSizedBuffer *, off_t start, size_t count,
                        uint8_t *buf);
migration/migration.c +0 -9
index b3adbc6..6f1a490 100644
@@ -540,15 +540,6 @@ void qmp_migrate_set_downtime(double value, Error **errp)
     max_downtime = (uint64_t)value;
 }
 
-bool migrate_rdma_pin_all(void)
-{
-    MigrationState *s;
-
-    s = migrate_get_current();
-
-    return s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL];
-}
-
 bool migrate_auto_converge(void)
 {
     MigrationState *s;
migration/qemu-file-buf.c +0 -53

65 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/8 vmxnet: Remove unused function vmxnet_rx_pkt_get_num_frags()

In reply to Thomas Huth

The function is not used anymore and thus can be deleted.

Cc Dmitry Fleytman <[email protected]>
---
 hw/net/vmxnet_rx_pkt.c |    7 -------
 hw/net/vmxnet_rx_pkt.h |    9 ---------
 2 files changed, 0 insertions(+), 16 deletions(-)
hw/net/vmxnet_rx_pkt.c +0 -7
index a40e346..acbca6a 100644
@@ -172,13 +172,6 @@ bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt)
     return pkt->has_virt_hdr;
 }
 
-uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt)
-{
-    assert(pkt);
-
-    return pkt->vec_len;
-}
-
 uint16_t vmxnet_rx_pkt_get_vlan_tag(struct VmxnetRxPkt *pkt)
 {
     assert(pkt);
hw/net/vmxnet_rx_pkt.h +0 -9
index 6b2c60e..5f8352a 100644
@@ -114,15 +114,6 @@ bool vmxnet_rx_pkt_is_vlan_stripped(struct VmxnetRxPkt *pkt);
 bool vmxnet_rx_pkt_has_virt_hdr(struct VmxnetRxPkt *pkt);
 
 /**
- * returns number of frags attached to the packet
- *
- * @pkt:            packet
- * @ret:            number of frags
- *
- */
-uint16_t vmxnet_rx_pkt_get_num_frags(struct VmxnetRxPkt *pkt);
-
-/**
  * attach data to rx packet
  *
  * @pkt:            packet
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/8 pci: Remove unused functions

In reply to Thomas Huth

The functions pcie_ari_init(), pcie_cap_is_arifwd_enabled() and ich9_d2pbr_init() are completely unused and thus can be deleted.

Cc Michael S. Tsirkin <[email protected]>
Cc Anthony Liguori <[email protected]>
---
 hw/pci-bridge/i82801b11.c |   21 ---------------------
 hw/pci/pcie.c             |   25 -------------------------
 include/hw/i386/ich9.h    |    1 -
 include/hw/pci/pcie.h     |    3 ---
 4 files changed, 0 insertions(+), 50 deletions(-)
hw/pci-bridge/i82801b11.c +0 -21
index 14cd7fd..7e79bc0 100644
@@ -101,27 +101,6 @@ static const TypeInfo i82801b11_bridge_info = {
     .class_init    = i82801b11_bridge_class_init,
 };
 
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus)
-{
-    PCIDevice *d;
-    PCIBridge *br;
-    char buf[16];
-    DeviceState *qdev;
-
-    d = pci_create_multifunction(bus, devfn, true, "i82801b11-bridge");
-    if (!d) {
-        return NULL;
-    }
-    br = PCI_BRIDGE(d);
-    qdev = DEVICE(d);
-
-    snprintf(buf, sizeof(buf), "pci.%d", sec_bus);
-    pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn);
-    qdev_init_nofail(qdev);
-
-    return pci_bridge_get_sec_bus(br);
-}
-
 static void d2pbr_register(void)
 {
     type_register_static(&i82801b11_bridge_info);
hw/pci/pcie.c +0 -25
index 1abbbb1..9b9f63d 100644
@@ -515,19 +515,6 @@ void pcie_cap_arifwd_reset(PCIDevice *dev)
     pci_long_test_and_clear_mask(devctl2, PCI_EXP_DEVCTL2_ARI);
 }
 
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev)
-{
-    if (!pci_is_express(dev)) {
-        return false;
-    }
-    if (!dev->exp.exp_cap) {
-        return false;
-    }
-
-    return pci_get_long(dev->config + dev->exp.exp_cap + PCI_EXP_DEVCTL2) &
-        PCI_EXP_DEVCTL2_ARI;
-}
-
 /**************************************************************************
  * pci express extended capability list management functions
  * uint16_t ext_cap_id (16 bit)
@@ -621,15 +608,3 @@ void pcie_add_capability(PCIDevice *dev,
     /* Check capability by default */
     memset(dev->cmask + offset, 0xFF, size);
 }
-
-/**************************************************************************
- * pci express extended capability helper functions
- */
-
-/* ARI */
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn)
-{
-    pcie_add_capability(dev, PCI_EXT_CAP_ID_ARI, PCI_ARI_VER,
-                        offset, PCI_ARI_SIZEOF);
-    pci_set_long(dev->config + offset + PCI_ARI_CAP, (nextfn & 0xff) << 8);
-}
include/hw/i386/ich9.h +0 -1
index 59ea25b..5cede9b 100644
@@ -19,7 +19,6 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
 int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
 PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
 void ich9_lpc_pm_init(PCIDevice *pci_lpc);
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus);
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 #define ICH9_CC_SIZE                            (16 * 1024)     /* 16KB */
include/hw/pci/pcie.h +0 -3
index b48a7a2..ae0969a 100644
@@ -106,7 +106,6 @@ void pcie_cap_flr_write_config(PCIDevice *dev,
 /* ARI forwarding capability and control */
 void pcie_cap_arifwd_init(PCIDevice *dev);
 void pcie_cap_arifwd_reset(PCIDevice *dev);
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev);
 
 /* PCI express extended capability helper functions */
 uint16_t pcie_find_capability(PCIDevice *dev, uint16_t cap_id);
@@ -114,8 +113,6 @@ void pcie_add_capability(PCIDevice *dev,
                          uint16_t cap_id, uint8_t cap_ver,
                          uint16_t offset, uint16_t size);
 
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn);
-
 extern const VMStateDescription vmstate_pcie_device;
 
 #define VMSTATE_PCIE_DEVICE(_field, _state) {                        \
Signature · 1 line
1.7.1
#4 lore raw

Re: [Qemu-devel] [PATCH 3/8] pci: Remove unused functions

Quoted 7 lines · Thomas Huth

The functions pcie_ari_init(), pcie_cap_is_arifwd_enabled() and ich9_d2pbr_init() are completely unused and thus can be deleted.

Cc Michael S. Tsirkin <[email protected]>
Cc Anthony Liguori <[email protected]>

I'd rather split ich9 out.
We might want to revert ari patch at some point
if/when we want to support ARI.

Quoted 114 lines
---
 hw/pci-bridge/i82801b11.c |   21 ---------------------
 hw/pci/pcie.c             |   25 -------------------------
 include/hw/i386/ich9.h    |    1 -
 include/hw/pci/pcie.h     |    3 ---
 4 files changed, 0 insertions(+), 50 deletions(-)
hw/pci-bridge/i82801b11.c +0 -21
index 14cd7fd..7e79bc0 100644
@@ -101,27 +101,6 @@ static const TypeInfo i82801b11_bridge_info = {
     .class_init    = i82801b11_bridge_class_init,
 };
 
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus)
-{
-    PCIDevice *d;
-    PCIBridge *br;
-    char buf[16];
-    DeviceState *qdev;
-
-    d = pci_create_multifunction(bus, devfn, true, "i82801b11-bridge");
-    if (!d) {
-        return NULL;
-    }
-    br = PCI_BRIDGE(d);
-    qdev = DEVICE(d);
-
-    snprintf(buf, sizeof(buf), "pci.%d", sec_bus);
-    pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn);
-    qdev_init_nofail(qdev);
-
-    return pci_bridge_get_sec_bus(br);
-}
-
 static void d2pbr_register(void)
 {
     type_register_static(&i82801b11_bridge_info);
hw/pci/pcie.c +0 -25
index 1abbbb1..9b9f63d 100644
@@ -515,19 +515,6 @@ void pcie_cap_arifwd_reset(PCIDevice *dev)
     pci_long_test_and_clear_mask(devctl2, PCI_EXP_DEVCTL2_ARI);
 }
 
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev)
-{
-    if (!pci_is_express(dev)) {
-        return false;
-    }
-    if (!dev->exp.exp_cap) {
-        return false;
-    }
-
-    return pci_get_long(dev->config + dev->exp.exp_cap + PCI_EXP_DEVCTL2) &
-        PCI_EXP_DEVCTL2_ARI;
-}
-
 /**************************************************************************
  * pci express extended capability list management functions
  * uint16_t ext_cap_id (16 bit)
@@ -621,15 +608,3 @@ void pcie_add_capability(PCIDevice *dev,
     /* Check capability by default */
     memset(dev->cmask + offset, 0xFF, size);
 }
-
-/**************************************************************************
- * pci express extended capability helper functions
- */
-
-/* ARI */
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn)
-{
-    pcie_add_capability(dev, PCI_EXT_CAP_ID_ARI, PCI_ARI_VER,
-                        offset, PCI_ARI_SIZEOF);
-    pci_set_long(dev->config + offset + PCI_ARI_CAP, (nextfn & 0xff) << 8);
-}
include/hw/i386/ich9.h +0 -1
index 59ea25b..5cede9b 100644
@@ -19,7 +19,6 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
 int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
 PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
 void ich9_lpc_pm_init(PCIDevice *pci_lpc);
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus);
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 #define ICH9_CC_SIZE                            (16 * 1024)     /* 16KB */
include/hw/pci/pcie.h +0 -3
index b48a7a2..ae0969a 100644
@@ -106,7 +106,6 @@ void pcie_cap_flr_write_config(PCIDevice *dev,
 /* ARI forwarding capability and control */
 void pcie_cap_arifwd_init(PCIDevice *dev);
 void pcie_cap_arifwd_reset(PCIDevice *dev);
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev);
 
 /* PCI express extended capability helper functions */
 uint16_t pcie_find_capability(PCIDevice *dev, uint16_t cap_id);
@@ -114,8 +113,6 @@ void pcie_add_capability(PCIDevice *dev,
                          uint16_t cap_id, uint8_t cap_ver,
                          uint16_t offset, uint16_t size);
 
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn);
-
 extern const VMStateDescription vmstate_pcie_device;
 
 #define VMSTATE_PCIE_DEVICE(_field, _state) {                        \
Signature · 1 line
1.7.1
#5 lore raw

Re: [Qemu-devel] [PATCH 3/8] pci: Remove unused functions

In reply to Thomas Huth
Quoted 7 lines · Thomas Huth

The functions pcie_ari_init(), pcie_cap_is_arifwd_enabled() and ich9_d2pbr_init() are completely unused and thus can be deleted.

Cc Michael S. Tsirkin <[email protected]>
Cc Anthony Liguori <[email protected]>

Pls split this out to two patches. ARI might be useful in the future. ich9_d2pbr_init can go I think.

Quoted 115 lines
---
 hw/pci-bridge/i82801b11.c |   21 ---------------------
 hw/pci/pcie.c             |   25 -------------------------
 include/hw/i386/ich9.h    |    1 -
 include/hw/pci/pcie.h     |    3 ---
 4 files changed, 0 insertions(+), 50 deletions(-)
hw/pci-bridge/i82801b11.c +0 -21
index 14cd7fd..7e79bc0 100644
@@ -101,27 +101,6 @@ static const TypeInfo i82801b11_bridge_info = {
     .class_init    = i82801b11_bridge_class_init,
 };
 
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus)
-{
-    PCIDevice *d;
-    PCIBridge *br;
-    char buf[16];
-    DeviceState *qdev;
-
-    d = pci_create_multifunction(bus, devfn, true, "i82801b11-bridge");
-    if (!d) {
-        return NULL;
-    }
-    br = PCI_BRIDGE(d);
-    qdev = DEVICE(d);
-
-    snprintf(buf, sizeof(buf), "pci.%d", sec_bus);
-    pci_bridge_map_irq(br, buf, pci_swizzle_map_irq_fn);
-    qdev_init_nofail(qdev);
-
-    return pci_bridge_get_sec_bus(br);
-}
-
 static void d2pbr_register(void)
 {
     type_register_static(&i82801b11_bridge_info);
hw/pci/pcie.c +0 -25
index 1abbbb1..9b9f63d 100644
@@ -515,19 +515,6 @@ void pcie_cap_arifwd_reset(PCIDevice *dev)
     pci_long_test_and_clear_mask(devctl2, PCI_EXP_DEVCTL2_ARI);
 }
 
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev)
-{
-    if (!pci_is_express(dev)) {
-        return false;
-    }
-    if (!dev->exp.exp_cap) {
-        return false;
-    }
-
-    return pci_get_long(dev->config + dev->exp.exp_cap + PCI_EXP_DEVCTL2) &
-        PCI_EXP_DEVCTL2_ARI;
-}
-
 /**************************************************************************
  * pci express extended capability list management functions
  * uint16_t ext_cap_id (16 bit)
@@ -621,15 +608,3 @@ void pcie_add_capability(PCIDevice *dev,
     /* Check capability by default */
     memset(dev->cmask + offset, 0xFF, size);
 }
-
-/**************************************************************************
- * pci express extended capability helper functions
- */
-
-/* ARI */
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn)
-{
-    pcie_add_capability(dev, PCI_EXT_CAP_ID_ARI, PCI_ARI_VER,
-                        offset, PCI_ARI_SIZEOF);
-    pci_set_long(dev->config + offset + PCI_ARI_CAP, (nextfn & 0xff) << 8);
-}
include/hw/i386/ich9.h +0 -1
index 59ea25b..5cede9b 100644
@@ -19,7 +19,6 @@ void ich9_lpc_set_irq(void *opaque, int irq_num, int level);
 int ich9_lpc_map_irq(PCIDevice *pci_dev, int intx);
 PCIINTxRoute ich9_route_intx_pin_to_irq(void *opaque, int pirq_pin);
 void ich9_lpc_pm_init(PCIDevice *pci_lpc);
-PCIBus *ich9_d2pbr_init(PCIBus *bus, int devfn, int sec_bus);
 I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base);
 
 #define ICH9_CC_SIZE                            (16 * 1024)     /* 16KB */
include/hw/pci/pcie.h +0 -3
index b48a7a2..ae0969a 100644
@@ -106,7 +106,6 @@ void pcie_cap_flr_write_config(PCIDevice *dev,
 /* ARI forwarding capability and control */
 void pcie_cap_arifwd_init(PCIDevice *dev);
 void pcie_cap_arifwd_reset(PCIDevice *dev);
-bool pcie_cap_is_arifwd_enabled(const PCIDevice *dev);
 
 /* PCI express extended capability helper functions */
 uint16_t pcie_find_capability(PCIDevice *dev, uint16_t cap_id);
@@ -114,8 +113,6 @@ void pcie_add_capability(PCIDevice *dev,
                          uint16_t cap_id, uint8_t cap_ver,
                          uint16_t offset, uint16_t size);
 
-void pcie_ari_init(PCIDevice *dev, uint16_t offset, uint16_t nextfn);
-
 extern const VMStateDescription vmstate_pcie_device;
 
 #define VMSTATE_PCIE_DEVICE(_field, _state) {                        \
Signature · 1 line
1.7.1
#6 lore raw

PATCH 4/8 monitor: Remove unused functions

In reply to Thomas Huth

The functions ringbuf_read_completion() and monitor_get_rs() are not used anywhere anymore, so let's remove them.

Cc Luiz Capitulino <[email protected]>
---
 hmp.h                     |    1 -
 include/monitor/monitor.h |    1 -
 monitor.c                 |   13 -------------
 3 files changed, 0 insertions(+), 15 deletions(-)
hmp.h +0 -1
index 81177b2..0c96e9a 100644
@@ -106,7 +106,6 @@ void set_link_completion(ReadLineState *rs, int nb_args, const char *str);
 void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str);
 void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str);
 void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str);
-void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str);
 void watchdog_action_completion(ReadLineState *rs, int nb_args,
                                 const char *str);
 void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
include/monitor/monitor.h +0 -1
index 1c06bed..df67d56 100644
@@ -47,7 +47,6 @@ typedef void (MonitorCompletion)(void *opaque, QObject *ret_data);
 
 void monitor_set_error(Monitor *mon, QError *qerror);
 void monitor_read_command(Monitor *mon, int show_prompt);
-ReadLineState *monitor_get_rs(Monitor *mon);
 int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
                           void *opaque);
 
monitor.c +0 -13
index c86a89e..18d7f23 100644
@@ -4385,14 +4385,6 @@ static void ringbuf_completion(ReadLineState *rs, const char *str)
     qapi_free_ChardevInfoList(start);
 }
 
-void ringbuf_read_completion(ReadLineState *rs, int nb_args, const char *str)
-{
-    if (nb_args != 2) {
-        return;
-    }
-    ringbuf_completion(rs, str);
-}
-
 void ringbuf_write_completion(ReadLineState *rs, int nb_args, const char *str)
 {
     if (nb_args != 2) {
@@ -5370,11 +5362,6 @@ static void bdrv_password_cb(void *opaque, const char *password,
     monitor_read_command(mon, 1);
 }
 
-ReadLineState *monitor_get_rs(Monitor *mon)
-{
-    return mon->rs;
-}
-
 int monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,
                                 BlockCompletionFunc *completion_cb,
                                 void *opaque)
Signature · 1 line
1.7.1
#7 lore raw

PATCH 5/8 ioport: Remove unused functions

In reply to Thomas Huth

The functions portio_list_destroy() and portio_list_del() are not used anywhere, so let's remove them.

---
 include/exec/ioport.h |    2 --
 ioport.c              |   24 ------------------------
 2 files changed, 0 insertions(+), 26 deletions(-)
include/exec/ioport.h +0 -2
index 3bd6722..218c835 100644
@@ -71,10 +71,8 @@ void portio_list_init(PortioList *piolist, Object *owner,
                       const struct MemoryRegionPortio *callbacks,
                       void *opaque, const char *name);
 void portio_list_set_flush_coalesced(PortioList *piolist);
-void portio_list_destroy(PortioList *piolist);
 void portio_list_add(PortioList *piolist,
                      struct MemoryRegion *address_space,
                      uint32_t addr);
-void portio_list_del(PortioList *piolist);
 
 #endif /* IOPORT_H */
ioport.c +0 -24
index 783a3ae..712b9e2 100644
@@ -147,19 +147,6 @@ void portio_list_set_flush_coalesced(PortioList *piolist)
     piolist->flush_coalesced_mmio = true;
 }
 
-void portio_list_destroy(PortioList *piolist)
-{
-    MemoryRegionPortioList *mrpio;
-    unsigned i;
-
-    for (i = 0; i < piolist->nr; ++i) {
-        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
-        object_unparent(OBJECT(&mrpio->mr));
-        g_free(mrpio);
-    }
-    g_free(piolist->regions);
-}
-
 static const MemoryRegionPortio *find_portio(MemoryRegionPortioList *mrpio,
                                              uint64_t offset, unsigned size,
                                              bool write)
@@ -290,14 +277,3 @@ void portio_list_add(PortioList *piolist,
     /* There will always be an open sub-list.  */
     portio_list_add_1(piolist, pio_start, count, start, off_low, off_high);
 }
-
-void portio_list_del(PortioList *piolist)
-{
-    MemoryRegionPortioList *mrpio;
-    unsigned i;
-
-    for (i = 0; i < piolist->nr; ++i) {
-        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
-        memory_region_del_subregion(piolist->address_space, &mrpio->mr);
-    }
-}
Signature · 1 line
1.7.1
#8 lore raw

Re: [Qemu-devel] [PATCH 5/8] ioport: Remove unused functions

Quoted 5 lines · Thomas Huth

The functions portio_list_destroy() and portio_list_del() are not used anywhere, so let's remove them.

I think it's better to provide a complete API, mimicking memory_region_* as much as possible, so I'd rather keep these.

Paolo

Quoted 60 lines
---
 include/exec/ioport.h |    2 --
 ioport.c              |   24 ------------------------
 2 files changed, 0 insertions(+), 26 deletions(-)
include/exec/ioport.h +0 -2
index 3bd6722..218c835 100644
@@ -71,10 +71,8 @@ void portio_list_init(PortioList *piolist, Object *owner,
                       const struct MemoryRegionPortio *callbacks,
                       void *opaque, const char *name);
 void portio_list_set_flush_coalesced(PortioList *piolist);
-void portio_list_destroy(PortioList *piolist);
 void portio_list_add(PortioList *piolist,
                      struct MemoryRegion *address_space,
                      uint32_t addr);
-void portio_list_del(PortioList *piolist);
 
 #endif /* IOPORT_H */
ioport.c +0 -24
index 783a3ae..712b9e2 100644
@@ -147,19 +147,6 @@ void portio_list_set_flush_coalesced(PortioList *piolist)
     piolist->flush_coalesced_mmio = true;
 }
 
-void portio_list_destroy(PortioList *piolist)
-{
-    MemoryRegionPortioList *mrpio;
-    unsigned i;
-
-    for (i = 0; i < piolist->nr; ++i) {
-        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
-        object_unparent(OBJECT(&mrpio->mr));
-        g_free(mrpio);
-    }
-    g_free(piolist->regions);
-}
-
 static const MemoryRegionPortio *find_portio(MemoryRegionPortioList *mrpio,
                                              uint64_t offset, unsigned size,
                                              bool write)
@@ -290,14 +277,3 @@ void portio_list_add(PortioList *piolist,
     /* There will always be an open sub-list.  */
     portio_list_add_1(piolist, pio_start, count, start, off_low, off_high);
 }
-
-void portio_list_del(PortioList *piolist)
-{
-    MemoryRegionPortioList *mrpio;
-    unsigned i;
-
-    for (i = 0; i < piolist->nr; ++i) {
-        mrpio = container_of(piolist->regions[i], MemoryRegionPortioList, mr);
-        memory_region_del_subregion(piolist->address_space, &mrpio->mr);
-    }
-}
#9 lore raw

Re: [Qemu-devel] [PATCH 5/8] ioport: Remove unused functions

Quoted 10 lines · On Mon, 09 Mar 2015 20:23:24 +0100 Paolo Bonzini <[email protected]> wrote:
Quoted 5 lines · Thomas Huth

The functions portio_list_destroy() and portio_list_del() are not used anywhere, so let's remove them.

I think it's better to provide a complete API, mimicking memory_region_* as much as possible, so I'd rather keep these.

Ok, then let's keep then and drop this patch.

Thomas

#10 lore raw

PATCH 6/8 usb: Remove unused functions

In reply to Thomas Huth

Delete set_usb_string(), usb_ep_get_ifnum(), usb_ep_get_max_packet_size() usb_ep_get_max_streams() and usb_ep_set_pipeline() since they are not used anymore.

---
 hw/usb/core.c    |   41 -----------------------------------------
 include/hw/usb.h |    5 -----
 2 files changed, 0 insertions(+), 46 deletions(-)
hw/usb/core.c +0 -41
index cf34755..d0025db 100644
@@ -331,23 +331,6 @@ void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p)
     usb_packet_complete(s, p);
 }
 
-/* XXX: fix overflow */
-int set_usb_string(uint8_t *buf, const char *str)
-{
-    int len, i;
-    uint8_t *q;
-
-    q = buf;
-    len = strlen(str);
-    *q++ = 2 * len + 2;
-    *q++ = 3;
-    for(i = 0; i < len; i++) {
-        *q++ = str[i];
-        *q++ = 0;
-    }
-    return q - buf;
-}
-
 USBDevice *usb_find_device(USBPort *port, uint8_t addr)
 {
     USBDevice *dev = port->dev;
@@ -749,12 +732,6 @@ void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type)
     uep->type = type;
 }
 
-uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->ifnum;
-}
-
 void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
@@ -782,12 +759,6 @@ void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep,
     uep->max_packet_size = size * microframes;
 }
 
-int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->max_packet_size;
-}
-
 void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
@@ -801,18 +772,6 @@ void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw)
     }
 }
 
-int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->max_streams;
-}
-
-void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    uep->pipeline = enabled;
-}
-
 void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
include/hw/usb.h +0 -5
index e6dfb87..bdd570a 100644
@@ -445,15 +445,11 @@ void usb_ep_reset(USBDevice *dev);
 void usb_ep_dump(USBDevice *dev);
 struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep);
 uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep);
-uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep);
 void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type);
 void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum);
 void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep,
                                 uint16_t raw);
-int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep);
 void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw);
-int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep);
-void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled);
 void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted);
 USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
                                     uint64_t id);
@@ -469,7 +465,6 @@ void usb_port_reset(USBPort *port);
 void usb_device_reset(USBDevice *dev);
 void usb_wakeup(USBEndpoint *ep, unsigned int stream);
 void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p);
-int set_usb_string(uint8_t *buf, const char *str);
 
 /* usb-linux.c */
 USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
Signature · 1 line
1.7.1
Reviewed-by on v1 6/8
#11 lore raw

Re: [Qemu-devel] [PATCH 6/8] usb: Remove unused functions

Quoted 3 lines · Thomas Huth

Delete set_usb_string(), usb_ep_get_ifnum(), usb_ep_get_max_packet_size() usb_ep_get_max_streams() and usb_ep_set_pipeline() since they are not used anymore.

Quoted 109 lines
---
 hw/usb/core.c    |   41 -----------------------------------------
 include/hw/usb.h |    5 -----
 2 files changed, 0 insertions(+), 46 deletions(-)
hw/usb/core.c +0 -41
index cf34755..d0025db 100644
@@ -331,23 +331,6 @@ void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p)
     usb_packet_complete(s, p);
 }
 
-/* XXX: fix overflow */
-int set_usb_string(uint8_t *buf, const char *str)
-{
-    int len, i;
-    uint8_t *q;
-
-    q = buf;
-    len = strlen(str);
-    *q++ = 2 * len + 2;
-    *q++ = 3;
-    for(i = 0; i < len; i++) {
-        *q++ = str[i];
-        *q++ = 0;
-    }
-    return q - buf;
-}
-
 USBDevice *usb_find_device(USBPort *port, uint8_t addr)
 {
     USBDevice *dev = port->dev;
@@ -749,12 +732,6 @@ void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type)
     uep->type = type;
 }
 
-uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->ifnum;
-}
-
 void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
@@ -782,12 +759,6 @@ void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep,
     uep->max_packet_size = size * microframes;
 }
 
-int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->max_packet_size;
-}
-
 void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
@@ -801,18 +772,6 @@ void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw)
     }
 }
 
-int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    return uep->max_streams;
-}
-
-void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled)
-{
-    struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
-    uep->pipeline = enabled;
-}
-
 void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted)
 {
     struct USBEndpoint *uep = usb_ep_get(dev, pid, ep);
include/hw/usb.h +0 -5
index e6dfb87..bdd570a 100644
@@ -445,15 +445,11 @@ void usb_ep_reset(USBDevice *dev);
 void usb_ep_dump(USBDevice *dev);
 struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep);
 uint8_t usb_ep_get_type(USBDevice *dev, int pid, int ep);
-uint8_t usb_ep_get_ifnum(USBDevice *dev, int pid, int ep);
 void usb_ep_set_type(USBDevice *dev, int pid, int ep, uint8_t type);
 void usb_ep_set_ifnum(USBDevice *dev, int pid, int ep, uint8_t ifnum);
 void usb_ep_set_max_packet_size(USBDevice *dev, int pid, int ep,
                                 uint16_t raw);
-int usb_ep_get_max_packet_size(USBDevice *dev, int pid, int ep);
 void usb_ep_set_max_streams(USBDevice *dev, int pid, int ep, uint8_t raw);
-int usb_ep_get_max_streams(USBDevice *dev, int pid, int ep);
-void usb_ep_set_pipeline(USBDevice *dev, int pid, int ep, bool enabled);
 void usb_ep_set_halted(USBDevice *dev, int pid, int ep, bool halted);
 USBPacket *usb_ep_find_packet_by_id(USBDevice *dev, int pid, int ep,
                                     uint64_t id);
@@ -469,7 +465,6 @@ void usb_port_reset(USBPort *port);
 void usb_device_reset(USBDevice *dev);
 void usb_wakeup(USBEndpoint *ep, unsigned int stream);
 void usb_generic_async_ctrl_complete(USBDevice *s, USBPacket *p);
-int set_usb_string(uint8_t *buf, const char *str);
 
 /* usb-linux.c */
 USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
#12 lore raw

PATCH 7/8 util: Remove unused functions

In reply to Thomas Huth

Delete the unused functions qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().

Cc Markus Armbruster <[email protected]>
---
 include/qemu-common.h   |    4 ---
 include/qemu/compatfd.h |    1 -
 util/compatfd.c         |   19 -------------
 util/osdep.c            |   66 -----------------------------------------------
 4 files changed, 0 insertions(+), 90 deletions(-)
include/qemu-common.h +0 -4
index 1b5cffb..6b373ff 100644
@@ -217,10 +217,6 @@ void *qemu_oom_check(void *ptr);
 
 ssize_t qemu_write_full(int fd, const void *buf, size_t count)
     QEMU_WARN_UNUSED_RESULT;
-ssize_t qemu_send_full(int fd, const void *buf, size_t count, int flags)
-    QEMU_WARN_UNUSED_RESULT;
-ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags)
-    QEMU_WARN_UNUSED_RESULT;
 
 #ifndef _WIN32
 int qemu_pipe(int pipefd[2]);
include/qemu/compatfd.h +0 -1
index 6b04877..fc37915 100644
@@ -39,6 +39,5 @@ struct qemu_signalfd_siginfo {
 };
 
 int qemu_signalfd(const sigset_t *mask);
-bool qemu_signalfd_available(void);
 
 #endif
util/compatfd.c +0 -19
index 341ada6..e857150 100644
@@ -108,22 +108,3 @@ int qemu_signalfd(const sigset_t *mask)
 
     return qemu_signalfd_compat(mask);
 }
-
-bool qemu_signalfd_available(void)
-{
-#ifdef CONFIG_SIGNALFD
-    sigset_t mask;
-    int fd;
-    bool ok;
-    sigemptyset(&mask);
-    errno = 0;
-    fd = syscall(SYS_signalfd, -1, &mask, _NSIG / 8);
-    ok = (errno != ENOSYS);
-    if (fd >= 0) {
-        close(fd);
-    }
-    return ok;
-#else
-    return false;
-#endif
-}
util/osdep.c +0 -66

72 lines not on this page · raw message

Signature · 1 line
1.7.1
#13 lore raw

PATCH 8/8 Remove various unused functions

In reply to Thomas Huth

The functions tpm_backend_thread_tpm_reset(), serial_set_frequency() and iothread_find() are completely unused, let's remove them.

---
 backends/tpm.c                   |   11 -----------
 hw/char/serial.c                 |    7 -------
 include/hw/char/serial.h         |    1 -
 include/sysemu/iothread.h        |    1 -
 include/sysemu/tpm_backend_int.h |    2 --
 iothread.c                       |   12 ------------
 6 files changed, 0 insertions(+), 34 deletions(-)
backends/tpm.c +0 -11
index 01860c4..0566202 100644
@@ -165,17 +165,6 @@ void tpm_backend_thread_end(TPMBackendThread *tbt)
     }
 }
 
-void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt,
-                                  GFunc func, gpointer user_data)
-{
-    if (!tbt->pool) {
-        tpm_backend_thread_create(tbt, func, user_data);
-    } else {
-        g_thread_pool_push(tbt->pool, (gpointer)TPM_BACKEND_CMD_TPM_RESET,
-                           NULL);
-    }
-}
-
 static const TypeInfo tpm_backend_info = {
     .name = TYPE_TPM_BACKEND,
     .parent = TYPE_OBJECT,
hw/char/serial.c +0 -7
index 55011cf..231ec7d 100644
@@ -876,13 +876,6 @@ void serial_exit_core(SerialState *s)
     qemu_unregister_reset(serial_reset, s);
 }
 
-/* Change the main reference oscillator frequency. */
-void serial_set_frequency(SerialState *s, uint32_t frequency)
-{
-    s->baudbase = frequency;
-    serial_update_parameters(s);
-}
-
 const MemoryRegionOps serial_io_ops = {
     .read = serial_ioport_read,
     .write = serial_ioport_write,
include/hw/char/serial.h +0 -1
index 15beb6b..4be245f 100644
@@ -80,7 +80,6 @@ extern const MemoryRegionOps serial_io_ops;
 
 void serial_realize_core(SerialState *s, Error **errp);
 void serial_exit_core(SerialState *s);
-void serial_set_frequency(SerialState *s, uint32_t frequency);
 
 /* legacy pre qom */
 SerialState *serial_init(int base, qemu_irq irq, int baudbase,
include/sysemu/iothread.h +0 -1
index 7c01a61..2eefea1 100644
@@ -33,7 +33,6 @@ typedef struct {
 #define IOTHREAD(obj) \
    OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
 
-IOThread *iothread_find(const char *id);
 char *iothread_get_id(IOThread *iothread);
 AioContext *iothread_get_aio_context(IOThread *iothread);
 
include/sysemu/tpm_backend_int.h +0 -2
index 05d94d0..40f693a 100644
@@ -32,8 +32,6 @@ void tpm_backend_thread_deliver_request(TPMBackendThread *tbt);
 void tpm_backend_thread_create(TPMBackendThread *tbt,
                                GFunc func, gpointer user_data);
 void tpm_backend_thread_end(TPMBackendThread *tbt);
-void tpm_backend_thread_tpm_reset(TPMBackendThread *tbt,
-                                  GFunc func, gpointer user_data);
 
 typedef enum TPMBackendCmd {
     TPM_BACKEND_CMD_INIT = 1,
iothread.c +0 -12
index 342a23f..878a594 100644
@@ -121,18 +121,6 @@ static void iothread_register_types(void)
 
 type_init(iothread_register_types)
 
-IOThread *iothread_find(const char *id)
-{
-    Object *container = container_get(object_get_root(), IOTHREADS_PATH);
-    Object *child;
-
-    child = object_property_get_link(container, id, NULL);
-    if (!child) {
-        return NULL;
-    }
-    return (IOThread *)object_dynamic_cast(child, TYPE_IOTHREAD);
-}
-
 char *iothread_get_id(IOThread *iothread)
 {
     return object_get_canonical_path_component(OBJECT(iothread));
Signature · 1 line
1.7.1