From: Alon Levy <alevy@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] usb: add public usb_device_by_id
Date: Tue, 19 Oct 2010 09:13:07 -0400 (EDT) [thread overview]
Message-ID: <304691519.861701287493987348.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <4CBD9892.2040301@redhat.com>
----- "Gerd Hoffmann" <kraxel@redhat.com> wrote:
> > +USBDevice *usb_device_by_id(const char* id)
> > +{
> > + USBBus *bus;
> > + DeviceState *qdev;
> > + USBDevice *dev;
> > +
> > + QTAILQ_FOREACH(bus,&busses, next) {
> > + qdev = qdev_find_recursive(&bus->qbus, id);
> > + if (qdev != NULL) {
> > + dev = DO_UPCAST(USBDevice, qdev, qdev);
> > + return dev;
> > + }
> > + }
>
> You don't need qdev_find_recursive here. Have a look at the
> usb_info()
> code to see how to loop over all usb devices. Then compare id with
> USBDevice->qdev.id.
>
> cheers,
> Gerd
There is no problem to loop over all usb devices. But first of all I don't want to loop on used, since then I miss any detached devices, so I actually do want the same behavior of qdev_find_recursive, and since it's already available, why rewrite it in a different compilation unit?
Alon
next prev parent reply other threads:[~2010-10-19 13:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-19 10:33 [Qemu-devel] [PATCH 0/3] add usb_detach and usb_attach (v2) Alon Levy
2010-10-19 10:33 ` [Qemu-devel] [PATCH 1/3] qdev: make qdev_find_recursive public Alon Levy
2010-10-19 10:33 ` [Qemu-devel] [PATCH 2/3] usb: add public usb_device_by_id Alon Levy
2010-10-19 13:09 ` Gerd Hoffmann
2010-10-19 13:13 ` Alon Levy [this message]
2010-10-19 13:30 ` Gerd Hoffmann
2010-10-19 10:33 ` [Qemu-devel] [PATCH 3/3] monitor: add usb_attach and usb_detach Alon Levy
2010-10-19 13:35 ` Gerd Hoffmann
2010-10-20 16:24 ` Luiz Capitulino
2010-10-21 10:00 ` Gerd Hoffmann
2010-10-21 10:58 ` Alon Levy
2010-10-21 19:18 ` Alon Levy
-- strict thread matches above, loose matches on Subject: below --
2010-10-21 6:36 [Qemu-devel] [PATCH 0/3] add usb_detach and usb_attach (v3) Alon Levy
2010-10-21 6:36 ` [Qemu-devel] [PATCH 2/3] usb: add public usb_device_by_id Alon Levy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=304691519.861701287493987348.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com \
--to=alevy@redhat.com \
--cc=kraxel@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).