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 B5565C43334 for ; Mon, 13 Jun 2022 21:25:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 505AA8442C; Mon, 13 Jun 2022 23:25:27 +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=1655155527; bh=9kref3ol8AsqW2Q5Xud6xurNsa5LypQQqDs0XhB6Fl8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SnesPykhaf/gFxBwaBfOQ8DE/u30rBGNXpDoM8VNj5WAIifhvISmsVzb5TmQwHoyy wRBsKsg9GO1+lFszFeQ8t0X0zBxdHaec50Jg9DjtdxSRO8tiJ93B6g82AVpJQFX4fL 2b3RDqA/mgL6Q7AzSZC6dsKItt+i7R8wxomhIybWHaQG9m4qoH7Jk7lJz1zxwyrWtH 2YzQVTm64ia42meKpejBPQvXMOxE/8AkKCUBBLHJ7/MOQSGPacsx7jIVuDj/Y4Ryv7 gsV+WwiyO7tvJD5d2f5IoIf5N4jZ2ybAY/jpt9bkk9/5XOQNQWNSSkJ9aL74f8KIVH YlchKK646ruTw== 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 1C19D842F1; Mon, 13 Jun 2022 23:25:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1655155526; bh=9kref3ol8AsqW2Q5Xud6xurNsa5LypQQqDs0XhB6Fl8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jxqZceT5ZUf948RUgQ5+QCNXRZsWSYon41iYsCiyIXAy9jH0x9VyBFmVxzaj/+Tnk D1eNnLZ/3OqPC5Al4tDR8BK4PgI5mPIjACZgYsOtqpLQ8UZHSdjh+pRxXrotHPQ+NB 06XlsSVEn7U57y4eYITpT3V8pjjhyfXCFjOvLCzZxKFSZWxLmIHn+t5cZ93Uc+AkZn 31hjgfDOyATuuqBPeqj+4aRFBJBKABhy6PD5yVZ7YoklJTSybadQhGOTXYdr3a6yOr XGP95FhwigKaOuA3ehdwi+bdFlyC17FHZ5aeoD/5SO8U/spLdkoRfjQKjSz3ckD9c/ D3rBaDGVrt1/A== Message-ID: <3d10c59f-e4c1-e68a-3ba1-ca5e99c64212@denx.de> Date: Mon, 13 Jun 2022 23:25:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.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> <6aeb4ca7-2cbb-9fb1-2ed1-e4d96ba1226c@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 6/8/22 16:39, Jan Kiszka wrote: [...] >> 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 ? > > Your code is not generic enough as it ignores the config-selected > storage device. It would only happen to cover all our boards, but we are > not the world. That's why I had to add some ifdeffery. That storage device part is trivial to fix, right. > I could try write an alternative arch_env_get_location that does the > required logic with a single ifdef. The prize might be some code > duplication, though. Can you use CONFIG_IS_ENABLED()/IS_ENABLED() in arch_env_get_location() to avoid the #if ... and outright return ENVL_NOWHERE or whatever to avoid adding ifdefs to env_locations[] array ? That should likely be possible. [...]