From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 037D1211B739C for ; Tue, 15 Jan 2019 01:53:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7055C5D676; Tue, 15 Jan 2019 09:53:55 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-50.rdu2.redhat.com [10.10.120.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3D45600C8; Tue, 15 Jan 2019 09:53:53 +0000 (UTC) To: "Zeng, Star" , "Wang, Jian J" , "edk2-devel@lists.01.org" Cc: "Wu, Hao A" , "Ni, Ray" , "Gao, Liming" , "Kinney, Michael D" References: <1547479196-40248-1-git-send-email-star.zeng@intel.com> <1547479196-40248-9-git-send-email-star.zeng@intel.com> <977b3984-18ef-3481-67e9-1f6725d67a79@intel.com> From: Laszlo Ersek Message-ID: Date: Tue, 15 Jan 2019 10:53:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <977b3984-18ef-3481-67e9-1f6725d67a79@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 15 Jan 2019 09:53:55 +0000 (UTC) Subject: Re: [PATCH V2 08/15] MdeModulePkg Variable: Add emulated variable NV mode support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 09:53:56 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 01/15/19 07:16, Zeng, Star wrote: > On 2019/1/15 14:01, Wang, Jian J wrote: >> Hi Star, >> >> Just two minor comments below. >> >>> -----Original Message----- >>> From: Zeng, Star >>> Sent: Monday, January 14, 2019 11:20 PM >>> To: edk2-devel@lists.01.org >>> Cc: Zeng, Star ; Wang, Jian J >>> ; >>> Wu, Hao A ; Kinney, Michael D >>> ; Gao, Liming ; Ni, >>> Ray >>> ; Laszlo Ersek ; Ard Biesheuvel >>> >>> Subject: [PATCH V2 08/15] MdeModulePkg Variable: Add emulated >>> variable NV >>> mode support >>> @@ -3894,9 +4024,19 @@ InitNonVolatileVariableStore ( >>>     UINTN                                 VariableSize; >>>     EFI_STATUS                            Status; >>> >>> -  Status = InitRealNonVolatileVariableStore (&VariableStoreBase); >>> -  if (EFI_ERROR (Status)) { >>> -    return Status; >>> +  if (!PcdGetBool (PcdEmuVariableNvModeEnable)) { >>> +    Status = InitRealNonVolatileVariableStore (&VariableStoreBase); >>> +    if (EFI_ERROR (Status)) { >>> +      return Status; >>> +    } >>> +    mVariableModuleGlobal->VariableGlobal.EmuNvMode = FALSE; >>> +  } else { >>> +    Status = InitEmuNonVolatileVariableStore (&VariableStoreBase); >>> +    if (EFI_ERROR (Status)) { >>> +      return Status; >>> +    } >>> +    mVariableModuleGlobal->VariableGlobal.EmuNvMode = TRUE; >>> +    DEBUG ((DEBUG_INFO, "Variable driver will work at emulated >>> non-volatile >>> variable mode!\n")); >>>     } >>> >> >> The logic is not wrong, just the if/else style might cause confusion at >> the first glance. Swapping the if/else might let the code more clear. >> >> if (PcdGetBool (PcdEmuVariableNvModeEnable)) { >>     ...initialize emulated variable store... >> } else { >>     ...initialize the real nv variable store... >> } > > I am neutral about it. I can update it if no other comment. I agree with Jian: the change that he suggests does not complicate the patch, and the end result is slightly more readable. Thanks Laszlo