Received: from [140.186.70.92] (port=57366 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHAgu-0000SV-46 for qemu-devel@nongnu.org; Wed, 26 May 2010 03:06:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHAgs-0005qn-0Z for qemu-devel@nongnu.org; Wed, 26 May 2010 03:06:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2357) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHAgr-0005qG-P8 for qemu-devel@nongnu.org; Wed, 26 May 2010 03:06:09 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 1/2] ioport: add function to check whenever a port is assigned or not References: <1274262857-31964-1-git-send-email-kraxel@redhat.com> <201005241332.51768.paul@codesourcery.com> <4BFB9B49.9080503@redhat.com> Date: Wed, 26 May 2010 09:05:58 +0200 In-Reply-To: <4BFB9B49.9080503@redhat.com> (Gerd Hoffmann's message of "Tue, 25 May 2010 11:41:29 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Gerd Hoffmann writes: > On 05/24/10 14:32, Paul Brook wrote: >>> +int is_ioport_assigned(pio_addr_t addr) >> >> Shouldn't we move this into register_ioport_{read,write}, and have that fail >> if the port has already been assigned? > > It already checks and fails with hw_error(). Problem with that is > that this kills qemu in case you try to pci hot-plug a vga card. So > I've added a way to check before-hand, so we can fail gracefully in > the few places where we need it (see second patch of the series). If we needed in more than a few places, then a solution like the one we adopted for qdev_init() could make sense: have register_ioport_FOO() return an error, convert all users that don't want to check it to register_ioport_FOO_nofail(), which hw_error()s out.