From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiuYU-0002Q8-NU for qemu-devel@nongnu.org; Wed, 23 Mar 2016 21:59:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiuYU-00047E-1r for qemu-devel@nongnu.org; Wed, 23 Mar 2016 21:59:22 -0400 Date: Thu, 24 Mar 2016 09:59:10 +0800 From: Peter Xu Message-ID: <20160324015910.GX28183@pxdev.xzpeter.org> References: <1458711153-15988-1-git-send-email-peterx@redhat.com> <1458711153-15988-4-git-send-email-peterx@redhat.com> <56F28BEC.2070008@gmail.com> <20160323145652.GW28183@pxdev.xzpeter.org> <56F2B044.4030202@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56F2B044.4030202@gmail.com> Subject: Re: [Qemu-devel] [PATCH v6 3/4] kvm: add kvm_support_device() helper function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: wei@redhat.com, peter.maydell@linaro.org, drjones@redhat.com, libvir-list@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-arm@nongnu.org, abologna@redhat.com On Wed, Mar 23, 2016 at 06:03:32PM +0300, Sergey Fedorov wrote: > Yes, but kvm_create_device() returns a file descriptor whereas this > function is predicative. Personally, I like the convention described in > chapter 16 of Linux kernel coding style [1]: > > If the name of a function is an action or an imperative command, > the function should return an error-code integer. If the name > is a predicate, the function should return a "succeeded" boolean. The above is talking about return values. Maybe you were trying to reference this one as example about add_work() and pci_dev_present(): For example, "add work" is a command, and the add_work() function returns 0 for success or -EBUSY for failure. In the same way, "PCI device present" is a predicate, and the pci_dev_present() function returns 1 if it succeeds in finding a matching device or 0 if it doesn't. Seems make sense. Will take your advice. Thanks. -- peterx