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 D1E45C352A1 for ; Wed, 30 Nov 2022 10:44:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A36A885352; Wed, 30 Nov 2022 11:44:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="RihLrdTc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 55B6885205; Wed, 30 Nov 2022 11:44:16 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6E3C485355 for ; Wed, 30 Nov 2022 11:44:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=8333d7dc6e=patrick.delaunay@foss.st.com Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AU8OYth017210; Wed, 30 Nov 2022 11:44:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=Sn8W6QfHs2LE2KWTmMOn2CPNue+Z/1mrr3n4Rnxi3Rc=; b=RihLrdTcG2ZbEt0e+ZxH7yX4lYF1A2OqEQM7MRXTjofB6OTTuLw/8it7dpYS5Y/Ut1n6 mGd8EAaCIqtMgV3zX/F0iRm2uKUmntO9yOFB/8RpYAnTSYauzI4GGfftt1UPiBPcCBcy lKmykUjcRDiuRZxm48309VP3RbWarJFqvHUS7yzrcRi8dNNUiwMLSoB9hpom4epElo9Q T/NIQ6qq52eMX1pw+LG8UzyOyaEXGCt1/j2XODbSUgeS+npBe0ESukvCm5ypD4Pd+24p EN3+5eKuD1X6nqTL7mNThxfh8RLZkVr28AXa70hYF4kcPnAZpVDUwvXz328ugPhfD5Ir Ew== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3m5krgnm0t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Nov 2022 11:44:12 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 175EE10002A; Wed, 30 Nov 2022 11:44:08 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1201321BF48; Wed, 30 Nov 2022 11:44:08 +0100 (CET) Received: from [10.48.0.157] (10.48.0.157) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Wed, 30 Nov 2022 11:44:07 +0100 Message-ID: <6ed01e2a-792a-655d-ea69-02c9ae87e48e@foss.st.com> Date: Wed, 30 Nov 2022 11:44:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH] dfu: Call backend specific dfu_fill_*() only if enabled Content-Language: en-US To: Marek Vasut , CC: Lukasz Majewski , Patrice Chotard References: <20221128193917.236188-1-marex@denx.de> From: Patrick DELAUNAY In-Reply-To: <20221128193917.236188-1-marex@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.0.157] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-30_04,2022-11-30_01,2022-06-22_01 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Marek, On 11/28/22 20:39, Marek Vasut wrote: > The dfu_fill_*() functions are available only if the matching backend is > enabled. Add missing CONFIG_IS_ENABLED() guard for each backend to prevent > build errors, in case such a backend is enabled in U-Boot and not in SPL > or vice versa. > > Signed-off-by: Marek Vasut > --- > Cc: Lukasz Majewski > Cc: Patrice Chotard > Cc: Patrick Delaunay > --- > drivers/dfu/dfu.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c > index 516dda61796..f9679d5ee52 100644 > --- a/drivers/dfu/dfu.c > +++ b/drivers/dfu/dfu.c > @@ -529,22 +529,22 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, > dfu->free_entity = NULL; > > /* Specific for mmc device */ > - if (strcmp(interface, "mmc") == 0) { > + if (CONFIG_IS_ENABLED(DFU_MMC) && !strcmp(interface, "mmc")) { > if (dfu_fill_entity_mmc(dfu, devstr, argv, argc)) > return -1; > - } else if (strcmp(interface, "mtd") == 0) { > + } else if (CONFIG_IS_ENABLED(DFU_MTD) && !strcmp(interface, "mtd")) { > if (dfu_fill_entity_mtd(dfu, devstr, argv, argc)) > return -1; > - } else if (strcmp(interface, "nand") == 0) { > + } else if (CONFIG_IS_ENABLED(DFU_NAND) && !strcmp(interface, "nand")) { > if (dfu_fill_entity_nand(dfu, devstr, argv, argc)) > return -1; > - } else if (strcmp(interface, "ram") == 0) { > + } else if (CONFIG_IS_ENABLED(DFU_RAM) && !strcmp(interface, "ram")) { > if (dfu_fill_entity_ram(dfu, devstr, argv, argc)) > return -1; > - } else if (strcmp(interface, "sf") == 0) { > + } else if (CONFIG_IS_ENABLED(DFU_SF) && !strcmp(interface, "sf")) { > if (dfu_fill_entity_sf(dfu, devstr, argv, argc)) > return -1; > - } else if (strcmp(interface, "virt") == 0) { > + } else if (CONFIG_IS_ENABLED(DFU_VIRT) && !strcmp(interface, "virt")) { > if (dfu_fill_entity_virt(dfu, devstr, argv, argc)) > return -1; > } else { All these DFU backend functions are stubbed in API = include/dfu.h for example: #if CONFIG_IS_ENABLED(DFU_MMC) extern int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr,                    char **argv, int argc); #else static inline int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr,                       char **argv, int argc) {     puts("MMC support not available!\n");     return -1; } #endif I think the only issue here is the test for CONFIG_DFU_VIRT => my patch which add this backend is not SPL friendly -  #ifdef CONFIG_DFU_VIRT + #if CONFIG_IS_ENABLED(DFU_VIRT) it is a fixes for commit ec44cace4b8d2 ("dfu: add DFU virtual backend") I just pushed this correction... "dfu: Make DFU virtual backend SPL friendly" http://patchwork.ozlabs.org/project/uboot/patch/20221130114146.1.I1944fc560e894329a83e9cf8f50cab3610f4f334@changeid/ Regards Patrick