From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiZiS-00077W-8x for qemu-devel@nongnu.org; Tue, 22 Mar 2016 23:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiZiO-0006P0-8R for qemu-devel@nongnu.org; Tue, 22 Mar 2016 23:44:16 -0400 Received: from mga11.intel.com ([192.55.52.93]:49693) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiZiO-0006Os-2H for qemu-devel@nongnu.org; Tue, 22 Mar 2016 23:44:12 -0400 References: <1458203581-59143-1-git-send-email-guangrong.xiao@linux.intel.com> <1458203581-59143-11-git-send-email-guangrong.xiao@linux.intel.com> <20160317103538.GC14062@stefanha-x1.localdomain> From: Xiao Guangrong Message-ID: <56F210DB.8060503@linux.intel.com> Date: Wed, 23 Mar 2016 11:43:23 +0800 MIME-Version: 1.0 In-Reply-To: <20160317103538.GC14062@stefanha-x1.localdomain> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 10/15] nvdimm acpi: abstract the operations for root device and nvdimm devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: ehabkost@redhat.com, kvm@vger.kernel.org, mst@redhat.com, gleb@kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, imammedo@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, rth@twiddle.net On 03/17/2016 06:35 PM, Stefan Hajnoczi wrote: > On Thu, Mar 17, 2016 at 04:32:56PM +0800, Xiao Guangrong wrote: >> +static void >> +nvdimm_dsm_function0(uint32_t supported_func, hwaddr dsm_mem_addr) >> +{ >> + NvdimmDsmFunc0Out func0 = { >> + .len = cpu_to_le32(sizeof(func0)), >> + .supported_func = cpu_to_le32(supported_func), >> + }; >> + cpu_physical_memory_write(dsm_mem_addr, &func0, sizeof(func0)); >> +} >> + >> +static void >> +nvdimm_dsm_no_payload(uint32_t func_ret_status, hwaddr dsm_mem_addr) >> +{ >> + NvdimmDsmFuncNoPayloadOut out = { >> + .len = cpu_to_le32(sizeof(out)), >> + .func_ret_status = cpu_to_le32(func_ret_status), >> + }; >> + cpu_physical_memory_write(dsm_mem_addr, &out, sizeof(out)); >> +} >> + >> +static void nvdimm_dsm_root(NvdimmDsmIn *in, hwaddr dsm_mem_addr) >> +{ >> + /* >> + * function 0 is called to inquire which functions are supported by >> + * OSPM >> + */ >> + if (!in->function) { >> + return nvdimm_dsm_function0(0 /* No function supported other >> + than function 0 */, dsm_mem_addr); > > The return type is void so "return foo()" looks strange. I went back > and double-checked function prototypes because I was surprised by this > line of code. Please use the conventional "foo(); return;" for void > return instead. > I am so lazy to omit this single line. :) Okay, will follow this style in the next version.