From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MIfyj-0006jD-I9 for qemu-devel@nongnu.org; Mon, 22 Jun 2009 05:38:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MIfyf-0006gy-H8 for qemu-devel@nongnu.org; Mon, 22 Jun 2009 05:38:17 -0400 Received: from [199.232.76.173] (port=43732 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MIfyf-0006gl-Bv for qemu-devel@nongnu.org; Mon, 22 Jun 2009 05:38:13 -0400 Received: from mx2.redhat.com ([66.187.237.31]:32864) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MIfye-0008Iq-K0 for qemu-devel@nongnu.org; Mon, 22 Jun 2009 05:38:12 -0400 Message-ID: <4A3F50BA.2030103@redhat.com> Date: Mon, 22 Jun 2009 12:36:58 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 0/10] qdev patches. References: <1245243565-24807-1-git-send-email-kraxel@redhat.com> <4A3A51B9.90207@redhat.com> <4A3BB5F2.9050701@redhat.com> <200906191851.21563.paul@codesourcery.com> <4A3F4BB9.6060604@redhat.com> In-Reply-To: <4A3F4BB9.6060604@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Paul Brook , qemu-devel@nongnu.org On 06/22/2009 12:15 PM, Gerd Hoffmann wrote: > On 06/19/09 19:51, Paul Brook wrote: >> * qdev: update pci device registration >> >> I dislike passing an {array,length} pair. Especially when it requires >> every >> user to manually get the right length. > > qemu has a ARRAY_SIZE macro which can be used like this: > (from uhci patch): > > pci_qdev_register(uhci_info, ARRAY_SIZE(uhci_info)); > > to get the right length, so I don't see this as a problem. > > I can create pci_qdev_register_{single,array} macros to hide the > length parameter. I can also just drop the length argument and just > use multiple calls in the (few) places where multiple drivers are > registered at once. What do you prefer? There's a third alternative, zero terminating the array. If most calls register one qdev, I'd prefer pci_qdev_register() and pci_qdev_register_many(). -- error compiling committee.c: too many arguments to function