Thankfully, usbDeviceListCount() is O(1); if it were O(n) then you would
have a quadratic loop.  Still, it is slightly faster to factor the
function call out of the for loop.  On the other hand, right now we
aren't using gcc's attribute((pure/const)) because the warnings in gcc
4.6 were buggy; if we were to use that, then usbDeviceListCount() would
already be marked and there would be nothing to factor out.  So, this is
fine as is, and we can save the optimization for a future day when we
rely on gcc 4.7 to help us mark the attributes where needed. 

Unfortunately, this failed to compile on its own:
qemu/qemu_hotplug.c: In function 'qemuDomainAttachHostDevice':
qemu/qemu_hotplug.c:1137:9: error: passing argument 3 of
'qemuPrepareHostdevUSBDevices' from incompatible pointer type [-Werror]
qemu/qemu_hostdev.h:39:5: note: expected 'struct usbDeviceList *' but
argument is of type 'struct virDomainHostdevDef **'
qemu/qemu_hotplug.c:1137:9: error: too many arguments to function
'qemuPrepareHostdevUSBDevices'
qemu/qemu_hostdev.h:39:5: note: declared here
But since applying patch 3/3 fixes the failure:
ACK if you squash 2/3 and 3/3 into a single patch, so that the total
series is only 2 patches instead of 3.