From: Gregory Haskins <ghaskins@novell.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
davidel@xmailserver.org, mtosatti@redhat.com,
paulmck@linux.vnet.ibm.com, markmc@redhat.com
Subject: Re: [KVM PATCH v7 1/2] KVM: make io_bus interface more robust
Date: Thu, 18 Jun 2009 07:46:15 -0400 [thread overview]
Message-ID: <4A3A2907.1070409@novell.com> (raw)
In-Reply-To: <4A3A2685.4060500@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 785 bytes --]
Avi Kivity wrote:
> On 06/16/2009 04:42 PM, Gregory Haskins wrote:
>> +
>> +/* assumes kvm->lock held */
>> +void kvm_io_bus_unregister_dev(struct kvm_io_bus *bus,
>> + struct kvm_io_device *dev)
>> +{
>> + int i;
>> +
>> + for (i = 0; i< bus->dev_count; i++) {
>> +
>> + if (bus->devs[i] == dev) {
>> + int j;
>> +
>> + /* backfill the hole */
>> + for (j = i; j< bus->dev_count-1; j++)
>> + bus->devs[j] = bus->devs[j+1];
>> +
>> + bus->dev_count--;
>> +
>> + break;
>>
>
> Could be simplified to
>
> if (bus->devs[i] == dev) {
> bus->devs[i] = bus->devs[--bus->dev_count];
> return;
> }
>
Clever!
Will do.
-Greg
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 266 bytes --]
next prev parent reply other threads:[~2009-06-18 11:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 13:42 [KVM PATCH v7 0/2] iosignalfd Gregory Haskins
2009-06-16 13:42 ` [KVM PATCH v7 1/2] KVM: make io_bus interface more robust Gregory Haskins
2009-06-18 11:35 ` Avi Kivity
2009-06-18 11:46 ` Gregory Haskins [this message]
2009-06-16 13:42 ` [KVM PATCH v7 2/2] KVM: add iosignalfd support Gregory Haskins
2009-06-18 11:45 ` Avi Kivity
2009-06-18 12:09 ` Gregory Haskins
2009-06-18 12:21 ` Avi Kivity
2009-06-18 14:09 ` Gregory Haskins
2009-06-21 13:55 ` Avi Kivity
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=4A3A2907.1070409@novell.com \
--to=ghaskins@novell.com \
--cc=avi@redhat.com \
--cc=davidel@xmailserver.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markmc@redhat.com \
--cc=mtosatti@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
/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