From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUHww-0007Ie-Kq for qemu-devel@nongnu.org; Wed, 08 Jun 2011 08:33:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUHwm-0001sC-8b for qemu-devel@nongnu.org; Wed, 08 Jun 2011 08:33:30 -0400 Received: from thoth.sbs.de ([192.35.17.2]:15217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUHwl-0001rm-DR for qemu-devel@nongnu.org; Wed, 08 Jun 2011 08:33:19 -0400 Message-ID: <4DEF6C0D.5020605@siemens.com> Date: Wed, 08 Jun 2011 14:33:17 +0200 From: Jan Kiszka MIME-Version: 1.0 References: <0074e8926b2a8c93a8ef6aab9071d3e7e882a6c3.1307528800.git.jan.kiszka@siemens.com> <4DEF6AF6.6000805@redhat.com> In-Reply-To: <4DEF6AF6.6000805@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/7] msi: Guard msi/msix_write_config with msi_present List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel , "Michael S. Tsirkin" On 2011-06-08 14:28, Gerd Hoffmann wrote: >> @@ -1173,12 +1173,8 @@ static int intel_hda_exit(PCIDevice *pci) >> static void intel_hda_write_config(PCIDevice *pci, uint32_t addr, >> uint32_t val, int len) >> { >> - IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci); >> - >> pci_default_write_config(pci, addr, val, len); >> - if (d->msi) { >> - msi_write_config(pci, addr, val, len); >> - } >> + msi_write_config(pci, addr, val, len); >> } > > Nothing device specific left in there now. If msi_write_config() checks > itself whenever msi is enabled or not we could call it from > pci_default_write_config(), then zap this function altogether, no? Well, we could put those helpers (msi_write_config, msi_reset, maybe more) into generic PCI code. Then device will only have to overload the handlers if they do something in addition. Haven't checked the details yet, though. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux