From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azieZ-00016j-9O for qemu-devel@nongnu.org; Mon, 09 May 2016 06:43:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azieX-0004wS-C0 for qemu-devel@nongnu.org; Mon, 09 May 2016 06:43:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azieX-0004wM-63 for qemu-devel@nongnu.org; Mon, 09 May 2016 06:43:05 -0400 References: <1459237645-17227-1-git-send-email-zxq_yx_007@163.com> <1459237645-17227-4-git-send-email-zxq_yx_007@163.com> From: Paolo Bonzini Message-ID: <573069B4.8040005@redhat.com> Date: Mon, 9 May 2016 12:43:00 +0200 MIME-Version: 1.0 In-Reply-To: <1459237645-17227-4-git-send-email-zxq_yx_007@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/6] hw/char: QOM'ify lm32_juart.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xiaoqiang zhao , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, michael@walle.cc, agraf@suse.de, edgar.iglesias@gmail.com On 29/03/2016 09:47, xiaoqiang zhao wrote: > > /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */ > s->chr = qemu_char_get_next_serial(); > if (s->chr) { > qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s); > } This is wrong, for the usual reason that instance_init cannot touch globals. The right thing to do here would be to add a chardev property to the device as in the FIXME; at this point, it is obvious that the rest must be in a init or realize callback, because the properties are not available in init. Same for patch 4. Paolo