On 5/16/11, andrzej zaborowski <balr...@gmail.com> wrote: > On 16 May 2011 06:54, Dmitry Eremin-Solenikov <dbarysh...@gmail.com> wrote: >> Hello, >> >> On 5/16/11, andrzej zaborowski <balr...@gmail.com> wrote: >>> On 25 April 2011 11:06, Dmitry Eremin-Solenikov <dbarysh...@gmail.com> >>> wrote: >>>> Switch dscm1xxxx microdrive driver to use qdev infrastructure. >>>> --- >>>> hw/ide/microdrive.c | 49 >>>> +++++++++++++++++++++++++++++++++++++++---------- >>>> hw/pcmcia.h | 2 +- >>>> hw/spitz.c | 5 ++++- >>>> hw/tosa.c | 5 ++++- >>>> 4 files changed, 48 insertions(+), 13 deletions(-) >>>> >>>> diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c >>>> index 9fbbf0e..7692603 100644 >>>> --- a/hw/ide/microdrive.c >>>> +++ b/hw/ide/microdrive.c >>>> @@ -38,8 +38,8 @@ >>>> >>>> /* DSCM-1XXXX Microdrive hard disk with CF+ II / PCMCIA interface. */ >>>> typedef struct { >>>> - IDEBus bus; >>>> PCMCIACardState card; >>>> + IDEBus bus; >>>> uint32_t attr_base; >>>> uint32_t io_base; >>>> >>>> @@ -529,22 +529,51 @@ static int dscm1xxxx_detach(void *opaque) >>>> return 0; >>>> } >>>> >>>> -PCMCIACardState *dscm1xxxx_init(DriveInfo *bdrv) >>>> +PCMCIACardState *dscm1xxxx_init(PCMCIASocket *socket, DriveInfo *bdrv) >>> >>> This looks like a regression that you have to pass the socket when >>> creating a PCMCIA card. I consider it an advantage of the current >>> code that pcmcia cards are hotswappable. Can we keep that with >>> qdevification? Otherwise is there a gain from the qdevification? >> >> Socket is required, as we have to know the QBus before creating the >> device on it. > > Let's skip the qbusification then. It seems that qbus is a wrong > choice for pcmcia and there are no new features or bugs fixed by the > conversion, it's code motion? I also don't see why the socket > structure should be needed at the creation time of a PCI device for > example, the BusInfo should be enough logically.
Major point for qbus'ification was ability to create PCMCIA devices from command line/via other management tools. This would also allow us e.g. to move microdrive driver to common ide parts, etc. For creation of a DeviceState via qdev_create you need BusState (which is a part of PCMCIASocket). Of course I can make one global QBus for all PCMCIA devices and make some artificial hacks to attach/detach cards to artificial sockets, but this seems like a hack. -- With best wishes Dmitry