Skip to content

Indirection Cleanup

Juan Quintela qemu-devel 1 version NAK

Status from this message: NACK.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest22 patches 28 repliesNAK

Patches in v1

#Subject and filesSizeRepliesApplied
1/22eepro100: convert casts to DO_UPCAST()hw/eepro100.c+5 -52 replies
2/22eepro100: cast a void * makes no sensehw/eepro100.c+3 -320 replies
3/22eepro100: Remove unused indirection of PCIDevicehw/eepro100.c+23 -340 replies
4/22es1370: Remove unused indirection of PCIES1370State and ES1370Statehw/es1370.c+10 -210 replies
5/22ne2000: remove casts from void *hw/ne2000.c+2 -20 replies
6/22ne2000: pci_dev has this very value with the right typehw/ne2000.c+1 -10 replies
7/22ne2000: Remove unneeded double indirection of PCINE2000Statehw/ne2000.c+10 -172 replies
8/22ne2000: change pci_dev to is_pcihw/ne2000.c+6 -60 replies
9/22pci: remove casts from void *hw/pci.c+4 -40 replies
10/22rtl8139: Remove unneeded double indirection of PCIRTL8139Statehw/rtl8139.c+13 -250 replies
11/22rtl8139: remove pointless cast from void *hw/rtl8139.c+2 -20 replies
12/22lsi53c895a: remove pointless cast from void *hw/lsi53c895a.c+19 -190 replies
13/22lsi53c895a: use DO_UPCAST to cast from PCIDevicehw/lsi53c895a.c+5 -50 replies
14/22lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)hw/lsi53c895a.c+12 -120 replies
15/22lsi53c895a: LSIState is a PCIDevice is a DeviceHosthw/lsi53c895a.c+2 -11 reply
16/22usb-ohci: Remove unneeded double indirection of OHCIPCIStatehw/usb-ohci.c+14 -201 reply
17/22cirrus_vga: Remove unneeded double indirection of PCICirrusVGAStatehw/cirrus_vga.c+12 -180 replies
18/22cirrus_vga: remove pointless cast from void *hw/cirrus_vga.c+5 -50 replies
19/22cirrus_vga: change use of pci_dev for is_pcihw/cirrus_vga.c+6 -50 replies
20/22Introduce vga_common_reset() to be able to typcheck vga_reset()hw/cirrus_vga.c hw/vga.c hw/vga_int.h+9 -50 replies
21/22vga: Rename vga_state -> vgahw/vga.c+6 -60 replies
22/22Everything outside of vga.c should use VGACommonStatehw/cirrus_vga.c hw/vga.c hw/vga_int.h +1 more+14 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 00/22] Indirection Cleanup

This patch series clean up "half" converted qemu drivers that had changed from:

struct FOOState

to

typedef PCIFOOState {
    PCIDevice dev;
    FOOState foo;
} PCIFOOState;

It just moves PCIDevice to be the 1st field of FOOState.

Once there, other cleanups were done:
a - pci_dev pointer from FOOState to PCIFOOState is removed, jsut use s->dev
The field is leave only in the drivers that also emulate isa.
b- Once there, transformo
PCIFOOState *s = (PCIFOOState *)pci_dev
to
PCIFOOState *s = DO_UPCAST(PCIFOOState, dev, pci_dev)
where pci_dev is a PCI_DEVICE.
c- again, once there, remove all the casts from void * (they are not
needed since '89)
PCIFOOState *s = (PCIFOOState *)opaque;
to
PCIFOOState *s = opaque;
d- Start of vga.c cleanup. It is not trivial, as just now
VGAState == VGACommonState, functions need to be changed to use the right value.

ToDo:
- pcnet: It needs a different approach, because it can be both a PCIDevice or a SysBus device.
- vga: It have to separate the common part for the not common part, problems now is that VGAState is used for both the common state and the standard vga. To make things more interesting, different bits are "inherited" from vga in different devices:
- cirrus_vga
- vmware_vga
- blizzard (vga that is not pci)
- vga common state has a pci_dev pointer, that is only needed by std vga, as cirrus_vga stores it (with this patches) otherplace, blizzard is not pci .... you get the idea
- I guess some other driver is missing, but my fast grep didn't found it.

Later, Juan.

Juan Quintela (22):
eepro100: convert casts to DO_UPCAST()
eepro100: cast a void * makes no sense
eepro100: Remove unused indirection of PCIDevice
es1370: Remove unused indirection of PCIES1370State and ES1370State
ne2000: remove casts from void *
ne2000: pci_dev has this very value with the right type
ne2000: Remove unneeded double indirection of PCINE2000State
ne2000: change pci_dev to is_pci
pci: remove casts from void *
rtl8139: Remove unneeded double indirection of PCIRTL8139State
rtl8139: remove pointless cast from void *
lsi53c895a: remove pointless cast from void *
lsi53c895a: use DO_UPCAST to cast from PCIDevice
lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)
lsi53c895a: LSIState is a PCIDevice is a DeviceHost
usb-ohci: Remove unneeded double indirection of OHCIPCIState
cirrus_vga: Remove unneeded double indirection of PCICirrusVGAState
cirrus_vga: remove pointless cast from void *
cirrus_vga: change use of pci_dev for is_pci
Introduce vga_common_reset() to be able to typcheck vga_reset()
vga: Rename vga_state -> vga
Everything outside of vga.c should use VGACommonState

 hw/cirrus_vga.c |   59 ++++++++++++++++++++++---------------------------
 hw/eepro100.c   |   65 ++++++++++++++++++++++--------------------------------
 hw/es1370.c     |   31 ++++++++-----------------
 hw/lsi53c895a.c |   65 ++++++++++++++++++++++++++++---------------------------
 hw/ne2000.c     |   41 ++++++++++++++--------------------
 hw/pci.c        |    8 +++---
 hw/rtl8139.c    |   42 ++++++++++++----------------------
 hw/usb-ohci.c   |   34 +++++++++++-----------------
 hw/vga.c        |   26 +++++++++++++--------
 hw/vga_int.h    |   12 ++++------
 hw/vmware_vga.c |    4 +-
 11 files changed, 170 insertions(+), 217 deletions(-)