Remove more unused functions
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(-)
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.
--- 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
@@ -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
@@ -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
@@ -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
PATCH 3/8 pci: Remove unused functions
In reply to Thomas HuthThe functions pcie_ari_init(), pcie_cap_is_arifwd_enabled() and ich9_d2pbr_init() are completely unused and thus can be deleted.
--- 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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH 2/8 vmxnet: Remove unused function vmxnet_rx_pkt_get_num_frags()
In reply to Thomas HuthThe function is not used anymore and thus can be deleted.
--- 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
@@ -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
@@ -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
PATCH 4/8 monitor: Remove unused functions
In reply to Thomas HuthThe functions ringbuf_read_completion() and monitor_get_rs() are not used anywhere anymore, so let's remove them.
--- hmp.h | 1 - include/monitor/monitor.h | 1 - monitor.c | 13 ------------- 3 files changed, 0 insertions(+), 15 deletions(-)
hmp.h +0 -1
@@ -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
@@ -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
@@ -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
PATCH 7/8 util: Remove unused functions
In reply to Thomas HuthDelete the unused functions qemu_signalfd_available(), qemu_send_full() and qemu_recv_full().
--- 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
@@ -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 _WIN32int qemu_pipe (int pipefd[2 ]);
include/qemu/compatfd.h +0 -1
@@ -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
@@ -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
PATCH 5/8 ioport: Remove unused functions
In reply to Thomas HuthThe 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
@@ -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
@@ -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
PATCH 6/8 usb: Remove unused functions
In reply to Thomas HuthDelete 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
@@ -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
@@ -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
PATCH 8/8 Remove various unused functions
In reply to Thomas HuthThe 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [Qemu-devel] [PATCH 5/8] ioport: Remove unused functions
In reply to Thomas HuthQuoted 5 lines · Thomas Huth
The functions
portio_list_destroy()andportio_list_del()are not used anywhere, so let's remove them.Signed-off-by Thomas Huth <[email protected]>Cc Paolo Bonzini <[email protected]>
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@@ -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@@ -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); - } -}
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()andportio_list_del()are not used anywhere, so let's remove them.Signed-off-by Thomas Huth <[email protected]>Cc Paolo Bonzini <[email protected]>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
Re: [Qemu-devel] [PATCH 6/8] usb: Remove unused functions
In reply to Thomas HuthQuoted 3 lines · Thomas Huth
Delete
set_usb_string(),usb_ep_get_ifnum(),usb_ep_get_max_packet_size()usb_ep_get_max_streams()andusb_ep_set_pipeline()since they are not used anymore.
Quoted 109 lines
Signed-off-by Thomas Huth <[email protected]>Cc Gerd Hoffmann <[email protected]>--- hw/usb/core.c | 41 ----------------------------------------- include/hw/usb.h | 5 ----- 2 files changed, 0 insertions(+), 46 deletions(-)hw/usb/core.c +0
-41@@ -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@@ -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);
Re: [Qemu-devel] [PATCH 3/8] pci: Remove unused functions
In reply to Thomas HuthQuoted 7 lines · Thomas Huth
The functions
pcie_ari_init(),pcie_cap_is_arifwd_enabled()andich9_d2pbr_init()are completely unused and thus can be deleted.Signed-off-by Thomas Huth <[email protected]>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@@ -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@@ -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@@ -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@@ -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
Re: [Qemu-devel] [PATCH 3/8] pci: Remove unused functions
In reply to Thomas HuthQuoted 7 lines · Thomas Huth
The functions
pcie_ari_init(),pcie_cap_is_arifwd_enabled()andich9_d2pbr_init()are completely unused and thus can be deleted.Signed-off-by Thomas Huth <[email protected]>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@@ -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@@ -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@@ -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@@ -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