From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:56418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQ8mi-0005Aw-OG for qemu-devel@nongnu.org; Mon, 14 Nov 2011 21:30:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RQ8mh-00014q-Bn for qemu-devel@nongnu.org; Mon, 14 Nov 2011 21:30:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16470) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQ8mh-00013v-0b for qemu-devel@nongnu.org; Mon, 14 Nov 2011 21:30:03 -0500 Message-ID: <1321324188.17169.129.camel@bling.home> From: Alex Williamson Date: Mon, 14 Nov 2011 19:29:48 -0700 In-Reply-To: <1321304079.17169.74.camel@bling.home> References: <20111103195452.21259.93021.stgit@bling.home> <4EBDBA50.3070801@freescale.com> <1321304079.17169.74.camel@bling.home> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Subject: Re: [Qemu-devel] [RFC PATCH] vfio: VFIO Driver core framework List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Scott Wood Cc: aafabbri@cisco.com, aik@au1.ibm.com, kvm@vger.kernel.org, pmac@au1.ibm.com, qemu-devel@nongnu.org, joerg.roedel@amd.com, konrad.wilk@oracle.com, agraf@suse.de, dwg@au1.ibm.com, chrisw@sous-sol.org, B08248@freescale.com, iommu@lists.linux-foundation.org, avi@redhat.com, linux-pci@vger.kernel.org, B07421@freescale.com, benve@cisco.com On Mon, 2011-11-14 at 13:54 -0700, Alex Williamson wrote: > On Fri, 2011-11-11 at 18:14 -0600, Scott Wood wrote: > > On 11/03/2011 03:12 PM, Alex Williamson wrote: > > > + int (*get)(void *); > > > + void (*put)(void *); > > > + ssize_t (*read)(void *, char __user *, > > > + size_t, loff_t *); > > > + ssize_t (*write)(void *, const char __user *, > > > + size_t, loff_t *); > > > + long (*ioctl)(void *, unsigned int, unsigned long); > > > + int (*mmap)(void *, struct vm_area_struct *); > > > +}; > > > > When defining an API, please do not omit parameter names. > > ok > > > Should specify what the driver is supposed to do with get/put -- I guess > > not try to unbind when the count is nonzero? Races could still lead the > > unbinder to be blocked, but I guess it lets the driver know when it's > > likely to succeed. > > Right, for the pci bus driver, it's mainly for reference counting, > including the module_get to prevent vfio-pci from being unloaded. On > the first get for a device, we also do a pci_enable() and pci_disable() > on last put. I'll try to clarify in the docs. Looking at these again, I should just rename them to open/release. That matches the points when they're called. I suspect I started with just reference counting and it grew to more of a full blown open/release. Thanks, Alex