From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT5xv-00068u-Mv for qemu-devel@nongnu.org; Mon, 07 Oct 2013 04:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT5xp-000208-Mn for qemu-devel@nongnu.org; Mon, 07 Oct 2013 04:14:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT5xp-0001zm-Er for qemu-devel@nongnu.org; Mon, 07 Oct 2013 04:14:49 -0400 Message-ID: <1381133695.1938.11.camel@localhost.localdomain> From: Marcel Apfelbaum Date: Mon, 07 Oct 2013 11:14:55 +0300 In-Reply-To: <20131007080423.GA1960@redhat.com> References: <1381131401-15155-1-git-send-email-marcel.a@redhat.com> <1381131401-15155-7-git-send-email-marcel.a@redhat.com> <20131007080347.GB647@redhat.com> <20131007080423.GA1960@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 6/8] hw: set interrupts using pci irq wrappers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: kwolf@redhat.com, peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, anthony@codemonkey.ws, sw@weilnetz.de, jasowang@redhat.com, qemu-devel@nongnu.org, dkoch@verizon.com, keith.busch@intel.com, alex.williamson@redhat.com, kraxel@redhat.com, stefanha@redhat.com, dmitry@daynix.com, pbonzini@redhat.com, afaerber@suse.de, ehabkost@redhat.com > > > static void uhci_reset(void *opaque) > > > @@ -1240,8 +1239,7 @@ static int usb_uhci_common_initfn(PCIDevice *dev) > > > /* TODO: reset value should be 0. */ > > > pci_conf[USB_SBRN] = USB_RELEASE_1; // release number > > > > > > - s->irq_pin = u->info.irq_pin; > > > - pci_config_set_interrupt_pin(pci_conf, s->irq_pin + 1); > > > + pci_config_set_interrupt_pin(pci_conf, u->info.irq_pin + 1); > > > > So everyone does this + 1/ - 1 logic. > > > > We get comments like: > > pci_config_set_interrupt_pin(pci_conf, 1); /* interrupt pin 0 */ > > which just shows the API is confusing. > > How about we change pci_config_set_interrupt_pin to do + 1 > > internally? > > Then add pci_config_get_interrupt_pin to do - 1. It seems a good idea. > > > > Add a comment that this does not support devices without interrupts, > > for that - use get_byte directly. > > > Note: this is not a problem with your patch, it can > be a cleanup on top. > I will make another patch(not part of this series) to be applied on top of this series. Thanks, Marcel