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 0DEF3C433EF for ; Mon, 6 Jun 2022 06:42:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F408684184; Mon, 6 Jun 2022 08:42:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1654497751; bh=RABzVculT3X4x7wikymXyFxUdCSgwIvF6aiqIK+sy1o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M1j4JzLTWMShCXMw7/rv/WREGQJfKn4KoWxGP8IMgfTeVTVYBc2NkjVoeyZHDDpSc 83QW00Seq8Of/nTVNiK/o9LFelSBfiYuN5pSx3o/VjHE+4rlvtXIk9Y9rNpqVlc8aH xjHIY5oxes2DnvNc1VwVEg1nW4NMMH4NhOeS6XUvSZJLvYNbZ/o+cxmnXgO6u1aWsQ /o2P9ZAt+1I9f2oYReIb+Q4PwOLei5qSPbjjfkSgn/PS2fvarILfTX78UpW+1glWWd xxuvAIxIsSRNKXAEzugoW2lawZ4zRn4s1DYrgh6lEJE6U6fiKu0dJILVTEEVwJgQQA g9vTZkPLpnKag== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 101FD84021; Mon, 6 Jun 2022 08:42:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1654497749; bh=RABzVculT3X4x7wikymXyFxUdCSgwIvF6aiqIK+sy1o=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DEPBtJ39yzyXGnKe4Ed5ofl4bggSc4p9GGO+006mrEf1sRpLYTJoMTJe6HYoZjjok 9ow72oyqFBSBhWfdM8FexxNrzGUKMbrSHM9OBVsT6r+fAGxQeoFoaCd7bFZi8Ynj1c n8K0K9VrvWUWPGJ53O9U6QaEu2xz3Ewym3F0MFIsTSoPGZ8NaqyeSReGbc/zuznQJA Wf1d80Hd/7oKlhkqXSHZBwc7hLOSEBLcRiMyg4L3oiD4F6zdxlPRSfTYdU4Uco4r8V Q6ihjYoRrP6dFPFShIaZ2ns1t2FIvhCyOevGIBJr8Wg+SeuQmefpeOVhW2w+GqkZS1 ieCbqd2uhHtwg== Message-ID: <6aeb4ca7-2cbb-9fb1-2ed1-e4d96ba1226c@denx.de> Date: Mon, 6 Jun 2022 08:42:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 01/12] env: Complete generic support for writable list Content-Language: en-US To: Jan Kiszka , U-Boot Mailing List Cc: Joe Hershberger References: <9ddb5292-89c6-b295-69a7-6cfbd9dc8eb0@denx.de> <5983abdd-d0c3-2381-15e4-d7302a92da3b@siemens.com> From: Marek Vasut In-Reply-To: <5983abdd-d0c3-2381-15e4-d7302a92da3b@siemens.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 5/29/22 17:37, Jan Kiszka wrote: > On 29.05.22 03:46, Marek Vasut wrote: >> On 5/28/22 15:02, Jan Kiszka wrote: >>> From: Jan Kiszka >>> >>> This completes what 890feecaab72 started by selecting ENV_APPEND and >>> ENV_IS_NOWHERE and by moving this driver to top if the list. This >> >> s@if the list@of the list@ >> >>> ensures that load operations pick up both the default env and the >>> permitted parts of the next-prio location. When writing though, we must >>> not use NOWHERE and rather need to forward directly to the first >>> external location. >> >> Isn't the env load order a board-specific setting ? >> > > There can always be special cases, but I don't see why it should be > _always_ board-specific. Because this is a special case, right ? >>> With this change, boards only need to define the list of writable >>> variables but no longer have to provide a custom env_get_location >>> implementation. >> >> This also brings in a lot of ifdeffery and extra complexity. If you >> implement this as a board-specific env_get_location() override, you can >> avoid that. Try: >> >> enum env_location env_get_location(enum env_operation op, int prio) >> { >>          if (op == ENVOP_SAVE) { >>                  if (prio == 0) >>                          return ENVL_SPI_FLASH; >>          } else { >>                  if (prio == 0) >>                          return ENVL_NOWHERE; >>                  if (prio == 1) >>                          return ENVL_SPI_FLASH; >>          } >> >>          return ENVL_UNKNOWN; >> } > > This is exactly what I would like to avoid, having to carry such a > generic function (minus that hard-coded the choice of storage - this can > be controlled via .config) in every board. Just for a quick statistics -- how many boards would make use of this generic function ? If you want to make this into a generic patch, can you somehow reduce the ever-growing ifdeffery, so that the patch won't add to it so much ? I suspect the code above can help with that, maybe it can be used to remove at least the env_locations[] reordering ifdeffery ?