Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1B88C433F5 for ; Fri, 11 Feb 2022 17:06:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D54083B75; Fri, 11 Feb 2022 18:06:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="FbsOU8Ob"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAB1583B67; Fri, 11 Feb 2022 18:06:08 +0100 (CET) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 25ABB83B5F for ; Fri, 11 Feb 2022 18:06:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x833.google.com with SMTP id o3so9574743qtm.12 for ; Fri, 11 Feb 2022 09:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ks1HfTGejDhqMzFxpkNMSv5X/MknopTd+W9a+e64FMg=; b=FbsOU8ObiLafQHa9Cn+kI5tte5TtqxdqVlf/5XmbJE9mVSfebrZAAmKxYnlltDgRhA vJtfWk7qn7KPrDqK6XQz5F6xyHTb+njuKTMatT/an+rKGSNRdcmtgrivMYz4n3psuJHM xr9BGWLZI18q+UIx89v6MDhY4D5PI4hvkH0ZE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ks1HfTGejDhqMzFxpkNMSv5X/MknopTd+W9a+e64FMg=; b=hmYjfNFLHKcW+hziXPiT2FlBB53t8n9hj9jcU8p4xebj/yHGSSALS+K189krG+FQDY IAQ0dlQ9u0ZyO0plCmnCQpMEmf8oZ547mOqaHQYscV9ANLzrQ6hhoUxCD6R0x3xaIpdm WyEdwFmhqUGBVfqoX2qcXFBW7biQTRJn9sAXO1lHQYO/rWXKqzuZYO6iJbBYdYwR9H9z hT208lNmI4kNdXAFElWS+wvtt3E5F/TWWeqVeoEaqJ5HG7iMolh7GQSMWiKUEjTJfxvm 9eF/waAiy/1CN/Q9gf7XB4YQ0hZLLrWiz0XKttHgiatAw1rRpTurcQtpU8hRbqD0xx2X SkRg== X-Gm-Message-State: AOAM532RNMyB+kTPpic8n9zQ3AqEeocezaE1ypuYOC+vRROG7lQAOVUK PfBndhqzJ265Dc7YOU1S+QEPCONLrUJC7pTH X-Google-Smtp-Source: ABdhPJxg7y0yj9vBUV2+jIx+Zw8mddOp7+dwyY/5rzc+49Hx2MUvbCyhyuAhZFeEMgU7kUBucyaCcA== X-Received: by 2002:ac8:5d91:: with SMTP id d17mr1814162qtx.341.1644599164015; Fri, 11 Feb 2022 09:06:04 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-2ef0-5dff-fedb-a8ba.res6.spectrum.com. [2603:6081:7b01:cbda:2ef0:5dff:fedb:a8ba]) by smtp.gmail.com with ESMTPSA id f20sm13160136qtf.39.2022.02.11.09.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 09:06:03 -0800 (PST) Date: Fri, 11 Feb 2022 12:06:01 -0500 From: Tom Rini To: =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: u-boot@lists.denx.de, =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= Subject: Re: [PATCH V3 2/2] fw_env: simplify logic & code paths in the fw_env_open() Message-ID: <20220211170601.GK2697206@bill-the-cat> References: <20220112114706.12269-1-zajec5@gmail.com> <20220112114706.12269-3-zajec5@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Sh9dYexoRflRb0jn" Content-Disposition: inline In-Reply-To: <20220112114706.12269-3-zajec5@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean --Sh9dYexoRflRb0jn Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 12, 2022 at 12:47:06PM +0100, Rafa=C5=82 Mi=C5=82ecki wrote: > From: Rafa=C5=82 Mi=C5=82ecki >=20 > Environment variables can be stored in two formats: > 1. Single entry with header containing CRC32 > 2. Two entries with extra flags field in each entry header >=20 > For that reason fw_env_open() has two main code paths and there are > pointers for CRC32/flags/data. >=20 > Previous implementation was a bit hard to follow: > 1. It was checking for used format twice (in reversed order each time) > 2. It was setting "environment" global struct fields to some temporary > values that required extra comments explaining it >=20 > This change simplifies that code: > 1. It introduces two clear code paths > 2. It sets "environment" global struct fields values only once it really > knows them >=20 > To be fair there are *two* crc32() calls now and an extra pointer > variable but that should be cheap enough and worth it. >=20 > Signed-off-by: Rafa=C5=82 Mi=C5=82ecki Applied to u-boot/master, thanks! --=20 Tom --Sh9dYexoRflRb0jn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmIGl3kACgkQFHw5/5Y0 tywrcAwAiYU91tVlHobJlhRNJ7Tdt49At7PxPUgzl8mJyJ+wUgLlbPWCUcQgLX0B /lr5UA8/ctjJwOHRGS2rvrgGiIS3vyWtawnZvJZAB4Olrcx7gA9dN4ApMOv7bT1n Q2W3Lh2I6l66TPFYxq4RXMT9Ix2p/i4fk93//uDmU0UAtJNZjb0p4aYrAu9NQdZU I0dS6NeicuQohFrp0LqBVRe+ZUTUSixn5SIezRl2iw2q8W1w8aYC9dHh7524AzJh avRwpwxX1kRqjfldS87hapBROmAqInjviRbPeMYzziBtHyauI8UBIyler8TiBkt5 /H7npVsGrPgKFf/2/ahMzGhxqFwoyOPVldMo51g/YEyH0UJnWZ+knlJQF62yjoE9 GF55OYIjjh85d/KT5ivJRTGUZPw6L8bq2yHjmyFiMyRPPQb8d3zGLmo6JuxBZUDZ DzpEhIXKiYaGFl7e4LMXrsiqCMQo3GsZ9uLkSwy8TajVtsaAcF2BUWFXdiSOd6Ro H/5K0sud =7eZz -----END PGP SIGNATURE----- --Sh9dYexoRflRb0jn--