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 1157EC001B0 for ; Sun, 13 Aug 2023 14:29:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 067E086981; Sun, 13 Aug 2023 16:27:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="e1FLCqvc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 382FA86967; Sun, 13 Aug 2023 16:27:37 +0200 (CEST) Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (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 300A88638E for ; Sun, 13 Aug 2023 16:27:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-7911dfc9824so140484939f.2 for ; Sun, 13 Aug 2023 07:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691936854; x=1692541654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hu7uTVZuiVrHSdE4u+CRMhvOiTk5IncY2bSeKClcrPI=; b=e1FLCqvc9AW8yWNUGgi7xK89nouGmwtRzwDx80NS5Knn2kY7iOvw1szJcxiwBZnUTu bPM5rThTbLaJaH6C9kq3zk+/2U0jCt20hYColgnWqDdXqnTb+k198mPbzH9TyJV29Yyy 7Q6xM0w22jTDt4ORfsA/JkLNOYi5+bDvNijFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691936854; x=1692541654; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hu7uTVZuiVrHSdE4u+CRMhvOiTk5IncY2bSeKClcrPI=; b=ISnywbx8GfsNwyTvT7xLDrgAc6S0bEWn2oZJhjq4lCA/xkFvjWnU6GG0ik0J/oKdoJ QMO4X7pfVOajOsC5EaBHPXIOfovDV9GPldwNHNGISXDo4wfVl+Z7XmVJOHP5e8bwO42d IK1cqf6lalwqMTyKAhTzVzbC9KrDsklOGrYJ22CZ+Y6kc+oRO5TeIfvDw6YkJwVllL/T KyeJ7xigGIQ5V+RObUWLoKCbGGMWAUQYxK9bjxDWbqoDGeJ8W9ijTJic3vvfq9kwwuXg 4rWNKW/lotENRdlljYOG4tIDd9QN5aK2RiCl04QsKsl+VCUgKC2FMBzKP9sFNr9Lqvtb Bf0Q== X-Gm-Message-State: AOJu0Yy3EkOBwssSnpfnx+1dbB9YHC+aTFDmbrUX9Tlnothtk9u3phMZ 8ODgu0SXEw/FaXUoQ1jD53u9CtEYTe6q4V71IFk= X-Google-Smtp-Source: AGHT+IGPojwCGUon7lcvNhJq3qRZS2LRWJHTbltsemv8CMe0hW2pv/ByW56EJAmmRX0tGG/NInUY9w== X-Received: by 2002:a6b:5f0e:0:b0:791:276c:727f with SMTP id t14-20020a6b5f0e000000b00791276c727fmr10087023iob.14.1691936853726; Sun, 13 Aug 2023 07:27:33 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id w7-20020a02cf87000000b00430cf006d9bsm2280952jar.30.2023.08.13.07.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 07:27:33 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Heinrich Schuchardt , Joshua Watt Subject: [PATCH 10/24] part: Add an accessor for struct disk_partition sys_ind Date: Sun, 13 Aug 2023 08:26:38 -0600 Message-ID: <20230813142708.361456-11-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230813142708.361456-1-sjg@chromium.org> References: <20230813142708.361456-1-sjg@chromium.org> MIME-Version: 1.0 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.8 at phobos.denx.de X-Virus-Status: Clean This field is only present when a CONFIG is set. To avoid annoying #ifdefs in the source code, add an accessor. Update the only usage. Note that the accessor is optional. It can be omitted if it is known that the option is enabled. Signed-off-by: Simon Glass --- boot/bootdev-uclass.c | 7 +++---- include/part.h | 12 ++++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index 3f2c8d7153a4..00dc28e623a2 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -184,12 +184,11 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk, if (ret) return log_msg_ret("fs", ret); - /* Use an #ifdef due to info.sys_ind */ -#ifdef CONFIG_DOS_PARTITION log_debug("%s: Found partition %x type %x fstype %d\n", - blk->name, bflow->part, info.sys_ind, + blk->name, bflow->part, + IS_ENABLED(CONFIG_DOS_PARTITION) ? + disk_partition_sys_ind(&info) : 0, ret ? -1 : fs_get_type()); -#endif bflow->blk = blk; bflow->state = BOOTFLOWST_FS; } diff --git a/include/part.h b/include/part.h index aa96516ba353..c3de317fcce8 100644 --- a/include/part.h +++ b/include/part.h @@ -135,6 +135,18 @@ static inline void disk_partition_clr_type_guid(struct disk_partition *info) #endif } +/* Accessors for struct disk_partition field ->sys_ind */ +extern int __invalid_use_of_disk_partition_sys_ind; + +static inline uint disk_partition_sys_ind(const struct disk_partition *info) +{ +#ifdef CONFIG_DOS_PARTITION + return info->sys_ind; +#else + return __invalid_use_of_disk_partition_sys_ind; +#endif +} + struct disk_part { int partnum; struct disk_partition gpt_part_info; -- 2.41.0.640.ga95def55d0-goog