exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
cover exec: Kill CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs
Followed Peter's suggestions:
* delete the unused MmeoryRegionMmio
* move these typedefs into include/hw/usb.h and rename them to MUSBReadFunc and MUSBWriteFunc, since that's all they're used for now
https://www.mail-archive.com/[email protected]/msg708165.html
Philippe Mathieu-Daudé (3):
exec/memory: Remove unused MemoryRegionMmio type hw/usb: Move device-specific declarations to new 'musb.h' header exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/musb.h'
include/exec/cpu-common.h | 3 --- include/exec/memory.h | 6 ----- include/hw/usb.h | 30 ------------------------- include/hw/usb/musb.h | 47 +++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-musb.c | 5 +++-- hw/usb/tusb6010.c | 1 + 6 files changed, 51 insertions(+), 41 deletions(-) create mode 100644 include/hw/usb/musb.h
Signature · 1 line
2.21.3
PATCH 1/3 exec/memory: Remove unused MemoryRegionMmio type
Since commit 62a0db942dec ('memory: Remove old_mmio accessors') this structure is unused. Remove it.
--- include/exec/memory.h | 6 ------ 1 file changed, 6 deletions(-)
include/exec/memory.h +0 -6
@@ -50,12 +50,6 @@extern bool global_dirty_log;typedef struct MemoryRegionOps MemoryRegionOps ; -typedef struct MemoryRegionMmio MemoryRegionMmio ; - -struct MemoryRegionMmio { -CPUReadMemoryFunc *read[3 ]; -CPUWriteMemoryFunc *write[3 ]; -};typedef struct IOMMUTLBEntry IOMMUTLBEntry ;
Signature · 1 line
2.21.3
PATCH 2/3 hw/usb: Move device-specific declarations to new 'musb.h' header
In reply to Philippe Mathieu-DaudéMove the declarations for the MUSB-HDRC USB2.0 OTG compliant core into a separate header.
--- include/hw/usb.h | 30 ---------------------------- include/hw/usb/musb.h | 46 +++++++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-musb.c | 1 + hw/usb/tusb6010.c | 1 + 4 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 include/hw/usb/musb.h
include/hw/usb.h +0 -30
@@ -474,36 +474,6 @@ bool usb_host_dev_is_scsi_storage(USBDevice *usbdev);#define VM_USB_HUB_SIZE 8 -/* hw/usb/hdc-musb.c */ - -enum musb_irq_source_e { - musb_irq_suspend =0 , - musb_irq_resume, - musb_irq_rst_babble, - musb_irq_sof, - musb_irq_connect, - musb_irq_disconnect, - musb_irq_vbus_request, - musb_irq_vbus_error, - musb_irq_rx, - musb_irq_tx, - musb_set_vbus, - musb_set_session, -/* Add new interrupts here */ - musb_irq_max,/* total number of interrupts defined */ -}; - -typedef struct MUSBState MUSBState ; - -extern CPUReadMemoryFunc *const musb_read[]; -extern CPUWriteMemoryFunc *const musb_write[]; - -MUSBState *musb_init (DeviceState *parent_device,int gpio_base); -void musb_reset (MUSBState *s); -uint32_t musb_core_intr_get (MUSBState *s); -void musb_core_intr_clear (MUSBState *s,uint32_t mask); -void musb_set_size (MUSBState *s,int epnum,int size,int is_tx); -/* usb-bus.c */ #define TYPE_USB_BUS "usb-bus"
include/hw/usb/musb.h new file +46 -0
46 lines not on this page · raw message
hw/usb/hcd-musb.c +1 -0
@@ -23,6 +23,7 @@#include "qemu/osdep.h" #include "qemu/timer.h" #include "hw/usb.h" +#include "hw/usb/musb.h" #include "hw/irq.h" #include "hw/hw.h"
hw/usb/tusb6010.c +1 -0
@@ -23,6 +23,7 @@#include "qemu/module.h" #include "qemu/timer.h" #include "hw/usb.h" +#include "hw/usb/musb.h" #include "hw/arm/omap.h" #include "hw/hw.h" #include "hw/irq.h"
Signature · 1 line
2.21.3
PATCH 3/3 exec/cpu-common: Move MUSB specific typedefs to 'hw/usb/musb.h'
In reply to Philippe Mathieu-DaudéThe CPUReadMemoryFunc/CPUWriteMemoryFunc typedefs are legacy remnant from before the conversion to MemoryRegions. Since they are now only used in tusb6010.c and hcd-musb.c, move them to "hw/usb/musb.h" and rename them appropriately.
--- include/exec/cpu-common.h | 3 --- include/hw/usb/musb.h | 9 +++++---- hw/usb/hcd-musb.c | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-)
include/exec/cpu-common.h +0 -3
@@ -43,9 +43,6 @@ extern ram_addr_t ram_size;/* memory API */ -typedef void CPUWriteMemoryFunc (void *opaque,hwaddr addr,uint32_t value); -typedef uint32_t CPUReadMemoryFunc (void *opaque,hwaddr addr); -void qemu_ram_remap (ram_addr_t addr,ram_addr_t length);/* This should not be used by devices. */ ram_addr_t qemu_ram_addr_from_host (void *ptr);
include/hw/usb/musb.h +5 -4
@@ -13,8 +13,6 @@#ifndef HW_USB_MUSB_H #define HW_USB_MUSB_H -#include "exec/cpu-common.h" -enum musb_irq_source_e { musb_irq_suspend =0 , musb_irq_resume,
@@ -32,8 +30,11 @@ enum musb_irq_source_e { musb_irq_max /* total number of interrupts defined */ }; -extern CPUReadMemoryFunc *const musb_read[]; -extern CPUWriteMemoryFunc *const musb_write[]; +/* TODO convert hcd-musb to QOM/qdev and remove MUSBReadFunc/MUSBWriteFunc */ +typedef void MUSBWriteFunc (void *opaque,hwaddr addr,uint32_t value); +typedef uint32_t MUSBReadFunc (void *opaque,hwaddr addr); +extern MUSBReadFunc *const musb_read[]; +extern MUSBWriteFunc *const musb_write[];typedef struct MUSBState MUSBState ;
hw/usb/hcd-musb.c +2 -2
@@ -1540,13 +1540,13 @@ static void musb_writew(void *opaque, hwaddr addr, uint32_t value) }; } -CPUReadMemoryFunc *const musb_read[] = { +MUSBReadFunc *const musb_read[] = { musb_readb, musb_readh, musb_readw, }; -CPUWriteMemoryFunc *const musb_write[] = { +MUSBWriteFunc *const musb_write[] = { musb_writeb, musb_writeh, musb_writew,
Signature · 1 line
2.21.3
Quoted 8 lines · Philippe Mathieu-Daudé
Followed Peter's suggestions:
* delete the unused MmeoryRegionMmio
* move these typedefs intoinclude/hw/usb.hand rename them to MUSBReadFunc and MUSBWriteFunc, since that's all they're used for now
Quoted 6 lines
include/exec/cpu-common.h | 3 --- include/exec/memory.h | 6 ----- include/hw/usb.h | 30 ------------------------- include/hw/usb/musb.h | 47 +++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-musb.c | 5 +++-- hw/usb/tusb6010.c | 1 +
I think we usually would give the .h file a name matching the .c file, so include/hw/usb/hcd-musb.h ?
Either way, whole series:
thanks
-- PMM
Quoted 16 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
Followed Peter's suggestions:
* delete the unused MmeoryRegionMmio
* move these typedefs intoinclude/hw/usb.hand rename them to MUSBReadFunc and MUSBWriteFunc, since that's all they're used for nowQuoted 6 lines
include/exec/cpu-common.h | 3 --- include/exec/memory.h | 6 ----- include/hw/usb.h | 30 ------------------------- include/hw/usb/musb.h | 47 +++++++++++++++++++++++++++++++++++++++ hw/usb/hcd-musb.c | 5 +++-- hw/usb/tusb6010.c | 1 +
Quoted 2 lines
I think we usually would give the .h file a name matching the .c file, so
include/hw/usb/hcd-musb.h?
Indeed, I'll update.
Quoted 3 lines
Either way, whole series:
Reviewed-by Peter Maydell <[email protected]>
Thanks!
Quoted 4 lines
thanks
-- PMM