From patchwork Wed Jan 20 16:46:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1429331 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=K4w9Ni9v; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DLWgX4Q44z9sT6 for ; Thu, 21 Jan 2021 03:48:40 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2A9F829F2; Wed, 20 Jan 2021 17:47:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="K4w9Ni9v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2136882878; Wed, 20 Jan 2021 17:47:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 6262B827FA for ; Wed, 20 Jan 2021 17:47:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oi1-x231.google.com with SMTP id p5so25682079oif.7 for ; Wed, 20 Jan 2021 08:47:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JGhsMipYccvX55LZ6jUzExh5ngr6ajD7egiS+BfqcAI=; b=K4w9Ni9vQxyFirDdsNke19jZFE/86khewv2TgzlsUZjLtMF49sybwQfswYGbq3NLZq zm82AwI3qofVBg3wdpWHXfyFepo1yCGQiw79DmG8y67OE4pXps2MpgD/qIz08EOJXWwL Taw5PagVoLSPA6iVWWp3bTcrHa1iRquFHIxJ/VqSQ1FwMbyKqvaLHp8Z/vVsYdeDhN3B 3OpzgAv+vCJSBkROKhVcWBquCkDAycoEPUPZHNpjb+/OvlXv4kASHw0mC8Tz6UOHD5UH 6G4MCNnDAtX58szLIER6WDOxeMm9HDVxkaR/8EhgF4pzbZtXwEESmpXoEX366TuygXtF ChCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JGhsMipYccvX55LZ6jUzExh5ngr6ajD7egiS+BfqcAI=; b=dliKrfChSMomY7H/L6Y7b6BLIg3uNfdVakC1jL+MQqb1WJ6L9ar9V8l40WBhc/K42q 5H3M+IU4OvmTIS4mfSDe3iZxVn+jrCgMm7K64IBpflJL0cxG5Gn4DeJW+FelbCX3Gh6O XQdxlAKJHAVOnRudirBinFSzAhOpU8C0oibQ1su0Ks+D3ropVJsUUFK5bbjTWCNpA5jx qSoSDeq6TV4d28ICwsEzuRhZP6+m1xsNEGT4NYq/Hf4R41skvx4B0kCr94n8gNuT1NSN L+pCu/nDv8kBFnnL2btrWIa2QBS7bvS8pcPg5fcPQY8EsNIAOxaXfx/cr0CgQoJTxpsR bHDw== X-Gm-Message-State: AOAM531Hh7eyJnROEw04/xK1yqeNcPlypt9TSLjuqXjmTxaiwAkQQ0Gp XMxE3ZvpbKY7lPdioTJaKDTwfmS1I8E= X-Google-Smtp-Source: ABdhPJxhcXN6qyZyuM6Qo7WK4P3CTVjSpZhI6/1jWh84B8RXU5OW1d/0z2HMT6Oer6P5Bd4crtLkzw== X-Received: by 2002:aca:d98a:: with SMTP id q132mr3451998oig.33.1611161224056; Wed, 20 Jan 2021 08:47:04 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id i9sm462972oii.34.2021.01.20.08.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 08:47:03 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de, sjg@chromium.org Subject: [PATCH v4 6/8] image: Do not #if guard board_fit_image_post_process() prototype Date: Wed, 20 Jan 2021 10:46:54 -0600 Message-Id: <20210120164656.1396639-7-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210120164656.1396639-1-mr.nuke.me@gmail.com> References: <20210120164656.1396639-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean There's no point in guarding function prototypes with #ifdefs. If a function is not defined, the linker will notice. Having the prototype does not affect code size. What the #if guard takes away is the ability to use IS_ENABLED: if (CONFIG_IS ENABLED(FIT_IMAGE_POST_PROCESS)) board_fit_image_post_process(...) When the prototype is guarded, the above form cannot be used. This leads to the proliferation of #ifdefs, and unreadable code. The opportunity cost of the #if guard outweighs any benefits. Remove it. Since the original version of this patch, an empty definition was added by commit f14e6eec6c7f ("image: cleanup pre-processor usage"). The empty definition can cause silent failures, when an implementation of board_fit_image_post_process() is expected because the linker will not catch the missing function. Thus this patch removes this empty inline declaration. Fixes: f14e6eec6c7f ("image: cleanup pre-processor usage") Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- include/image.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/include/image.h b/include/image.h index 856bc3e1b2..5cd143856a 100644 --- a/include/image.h +++ b/include/image.h @@ -1537,8 +1537,6 @@ bool android_image_print_dtb_contents(ulong hdr_addr); */ int board_fit_config_name_match(const char *name); -#if defined(CONFIG_SPL_FIT_IMAGE_POST_PROCESS) || \ - defined(CONFIG_FIT_IMAGE_POST_PROCESS) /** * board_fit_image_post_process() - Do any post-process on FIT binary data * @@ -1553,11 +1551,6 @@ int board_fit_config_name_match(const char *name); * @return no return value (failure should be handled internally) */ void board_fit_image_post_process(void **p_image, size_t *p_size); -#else -static inline void board_fit_image_post_process(void **p_image, size_t *p_size) -{ -} -#endif /* CONFIG_SPL_FIT_IMAGE_POST_PROCESS */ #define FDT_ERROR ((ulong)(-1))