From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLmzU-00006G-MN for qemu-devel@nongnu.org; Sun, 15 May 2011 21:53:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLmzT-00025Z-IN for qemu-devel@nongnu.org; Sun, 15 May 2011 21:53:00 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:38417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLmzT-00025U-9N for qemu-devel@nongnu.org; Sun, 15 May 2011 21:52:59 -0400 Received: by pwi6 with SMTP id 6so2414938pwi.4 for ; Sun, 15 May 2011 18:52:57 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1303722395-10791-2-git-send-email-dbaryshkov@gmail.com> References: <1303722395-10791-1-git-send-email-dbaryshkov@gmail.com> <1303722395-10791-2-git-send-email-dbaryshkov@gmail.com> Date: Mon, 16 May 2011 03:52:57 +0200 Message-ID: From: andrzej zaborowski Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RESEND][PATCH 2/9] PCMCIA: start qdev'ication List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dmitry Eremin-Solenikov Cc: qemu-devel@nongnu.org Hi Dmitry, On 25 April 2011 11:06, Dmitry Eremin-Solenikov wrot= e: > Convert PCMCIA bus handling code to use QBus internally. > MicroDrive code is still unaffected. > > Signed-off-by: Dmitry Eremin-Solenikov > --- > =C2=A0Makefile.objs =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A03 ++ > =C2=A0hw/pcmcia.c =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0102 ++++++++++++++++= ++++++++++++++++++++++++++++++++++++ > =C2=A0hw/pcmcia.h =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=A0 15 +++++++- > =C2=A0hw/pxa2xx_pcmcia.c | =C2=A0 =C2=A02 +- > =C2=A0vl.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 43 -= --------------------- > =C2=A05 files changed, 120 insertions(+), 45 deletions(-) > =C2=A0create mode 100644 hw/pcmcia.c > > diff --git a/Makefile.objs b/Makefile.objs > index 44ce368..153a148 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -289,6 +289,9 @@ hw-obj-$(CONFIG_REALLY_VIRTFS) +=3D virtio-9p-debug.o > =C2=A0hw-obj-$(CONFIG_VIRTFS) +=3D virtio-9p-local.o virtio-9p-xattr.o > =C2=A0hw-obj-$(CONFIG_VIRTFS) +=3D virtio-9p-xattr-user.o virtio-9p-posix= -acl.o > > +# PCMCIA > +hw-obj-y +=3D pcmcia.o > + > =C2=A0###################################################################= ### > =C2=A0# libdis > =C2=A0# NOTE: the disassembler code is only needed for debugging > diff --git a/hw/pcmcia.c b/hw/pcmcia.c > new file mode 100644 > index 0000000..17a49b6 > --- /dev/null > +++ b/hw/pcmcia.c > @@ -0,0 +1,102 @@ > +/* > + * QEMU System Emulator > + * PCMCIA subsystem > + * > + * Copyright (c) 2003-2008 Fabrice Bellard > + * Copyright (c) 2011 Dmitry Eremin-Solenikov > + * > + * Permission is hereby granted, free of charge, to any person obtaining= a copy > + * of this software and associated documentation files (the "Software"),= to deal > + * in the Software without restriction, including without limitation the= rights > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or = sell > + * copies of the Software, and to permit persons to whom the Software is > + * furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be includ= ed in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRE= SS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHA= LL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR = OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISI= NG FROM, > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALING= S IN > + * THE SOFTWARE. > + */ > +#include "hw.h" > +#include "pcmcia.h" > +#include "monitor.h" > + > +/***********************************************************/ > +/* PCMCIA/Cardbus */ > + > +static struct pcmcia_socket_entry_s { > + =C2=A0 =C2=A0PCMCIASocket *socket; > + =C2=A0 =C2=A0struct pcmcia_socket_entry_s *next; > +} *pcmcia_sockets =3D 0; > + > +static BusInfo pcmcia_bus_info =3D { > + =C2=A0 =C2=A0.name =C2=A0 =C2=A0 =C2=A0 =3D "PCMCIA", > + =C2=A0 =C2=A0.size =C2=A0 =C2=A0 =C2=A0 =3D sizeof(PCMCIASocket), > +}; > + > +void pcmcia_socket_register(PCMCIASocket *socket, DeviceState *parent) > +{ > + =C2=A0 =C2=A0struct pcmcia_socket_entry_s *entry; > + > + =C2=A0 =C2=A0qbus_create_inplace(&socket->qbus, &pcmcia_bus_info, > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pa= rent, "pcmcia"); > + > + =C2=A0 =C2=A0entry =3D qemu_malloc(sizeof(struct pcmcia_socket_entry_s)= ); > + =C2=A0 =C2=A0entry->socket =3D socket; > + =C2=A0 =C2=A0entry->next =3D pcmcia_sockets; > + =C2=A0 =C2=A0pcmcia_sockets =3D entry; > +} > + > +void pcmcia_socket_unregister(PCMCIASocket *socket) > +{ > + =C2=A0 =C2=A0struct pcmcia_socket_entry_s *entry, **ptr; > + > + =C2=A0 =C2=A0ptr =3D &pcmcia_sockets; > + =C2=A0 =C2=A0for (entry =3D *ptr; entry; ptr =3D &entry->next, entry = =3D *ptr) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (entry->socket =3D=3D socket) { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*ptr =3D entry->next; > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0qemu_free(entry); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0} I think you need a "break" here, or something else. Otherwise you'll be accessing entry->next incorrectly. (I notice that this error is present in the current code too) It would also be great if someone with understanding of qbus could ack the rest of this patch. Out of curiosity, In the patch 1/9 can you include pxa.h instead of moving the declaration out of pxa.h? I also want to remind you that (iirc) the tosa code was merged in a rather incomplete state, like the collie, kind of on the condition that it would be worked on for stuff like audio/video soon after ;) Cheers