From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NRp3x-0006AM-4y for qemu-devel@nongnu.org; Mon, 04 Jan 2010 10:41:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NRp3s-00063t-JH for qemu-devel@nongnu.org; Mon, 04 Jan 2010 10:41:44 -0500 Received: from [199.232.76.173] (port=43249 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NRp3s-00063P-Ct for qemu-devel@nongnu.org; Mon, 04 Jan 2010 10:41:40 -0500 Received: from mx20.gnu.org ([199.232.41.8]:47392) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NRp3q-0001I1-Qj for qemu-devel@nongnu.org; Mon, 04 Jan 2010 10:41:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NRp3l-00079R-N4 for qemu-devel@nongnu.org; Mon, 04 Jan 2010 10:41:33 -0500 Date: Mon, 4 Jan 2010 17:38:39 +0200 From: "Michael S. Tsirkin" Message-ID: <20100104153839.GB13813@redhat.com> References: <20091224124358.GB31553@redhat.com> <4B41F9AC.9010104@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B41F9AC.9010104@redhat.com> Subject: [Qemu-devel] Re: [PATCHv4 1/2] qdev: add bit property type List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org On Mon, Jan 04, 2010 at 03:22:36PM +0100, Gerd Hoffmann wrote: > On 12/24/09 13:43, Michael S. Tsirkin wrote: >> This adds "bit" property type, which is a boolean stored in a 32 bit >> integer field, with legal values on and off. Will be used by virtio for >> feature bits. > >> +static void *qdev_bit_prop_ptr(DeviceState *dev, Property *prop) >> +{ >> + void *ptr = dev; >> + assert(prop->info->type == PROP_TYPE_BIT); >> + ptr += prop->offset / 32; >> + return ptr; >> +} > > I don't like that idea. IMHO prop->offset should be specified in bytes > no matter what the property is. Better add a new prop->bitnr field to > specify which bit of the 32bit word should be toggled. Then you don't > need this function in the first place. > > cheers, > Gerd OK, I reworked the patches in this way.