From patchwork Wed Jan 18 05:50:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 716501 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3v3GLs0gGFz9t0C for ; Wed, 18 Jan 2017 16:51:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="TtwnEP7X"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D7056B3918; Wed, 18 Jan 2017 06:51:38 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4kA_oqNHqW-Q; Wed, 18 Jan 2017 06:51:38 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA242B391D; Wed, 18 Jan 2017 06:51:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C625B38FC for ; Wed, 18 Jan 2017 06:51:22 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ud-kMgxzeqbv for ; Wed, 18 Jan 2017 06:51:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ot0-f175.google.com (mail-ot0-f175.google.com [74.125.82.175]) by theia.denx.de (Postfix) with ESMTPS id 153DAB38EC for ; Wed, 18 Jan 2017 06:51:19 +0100 (CET) Received: by mail-ot0-f175.google.com with SMTP id 104so2209438otd.3 for ; Tue, 17 Jan 2017 21:51:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NeCcV6+ZwBCvG3btuP1pN0tt0z5V0DWaLRtG/Z8HkBg=; b=TtwnEP7XhogtKhs00Ah+kaKjeCQruzoKDFkUZQadR8O06vEnFs+XfmTjRGU9lkNE7u P7MNd9OfJ1UYb45I9SCCQgLivhbDhuGZos4CxFj9xdT5jITBgQ4/Ttsv1VGfwy+lAmru JVDXcDfKUyallgAiKXjOvq9KtGwuFEwt7DAJjidXCxukzbEGP7K/lbB/2MoJHTE13U57 /i/vpEkuaMn9TGn3T8DV62YYiLpZoVSpZOmkDdsrizlsG9JGiEbJfbKa4kIAGiBu7U6+ m2cvzrKTChKc6VpXprS8RhjAHDbOoD+QjfjHCP4E3uyVKTszns6DHYtWWWxpypA5C7le 1BXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NeCcV6+ZwBCvG3btuP1pN0tt0z5V0DWaLRtG/Z8HkBg=; b=lBfatVzp/mEoVpvekowp845LX7wOOwOBu0oIxaSghIImvMpW3V5iThDZfrSV2T7iVo +0LqrHmDnqBnnZNOMCXSk0QidR1xrnVlevtETikLE0+L5ioIdeEMBVkTCveixTnMiTZV IGEkooNlUgc07gSe5pgX0Fk3Er6uOsAqR2haWEXW3R3rti6r30teB0XrflPXpx6p6nhk 9apqSZt42Nh+Tjnw/Kb/YYlq58LQ2M3ywsKGEFQWB92TbxzZCWmGNZTBQ7G6f2nzm9ld VFSKU2MVpAYVY5+biNcjNz6CMcPI+19jFOiEl/HdtuQufb20LvZCCWkkpAiQg/2xCe3t Vlzg== X-Gm-Message-State: AIkVDXInCLYjYwVFg0+Qx58Gvkl3J9mg6xP5hIkOFPgUq1bbrJiRWPdOQswM/AQPl/pLfsDf X-Received: by 10.157.5.6 with SMTP id 6mr782403otw.209.1484718677984; Tue, 17 Jan 2017 21:51:17 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:10f2:12:e499:24d0:84a3:6151]) by smtp.gmail.com with ESMTPSA id u191sm14039546oiu.7.2017.01.17.21.51.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Jan 2017 21:51:17 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id DC33B40487; Tue, 17 Jan 2017 22:51:16 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Tue, 17 Jan 2017 22:50:32 -0700 Message-Id: <20170118055058.6358-4-sjg@chromium.org> X-Mailer: git-send-email 2.11.0.483.g087da7b7c-goog In-Reply-To: <20170118055058.6358-1-sjg@chromium.org> References: <20170118055058.6358-1-sjg@chromium.org> Cc: Tom Rini , Stephen Warren Subject: [U-Boot] [PATCH 03/22] Update WARN_ON() to return a value X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In linux v4.9 this returns a value. This saves checking the warning condition twice in some code. Update the U-Boot version to do this also. Signed-off-by: Simon Glass --- include/linux/compat.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/compat.h b/include/linux/compat.h index a43e4d66983..03f9bef0dae 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -106,8 +106,12 @@ static inline void kmem_cache_destroy(struct kmem_cache *cachep) #define BUG_ON(condition) do { if (condition) BUG(); } while(0) #endif /* BUG */ -#define WARN_ON(x) if (x) {printf("WARNING in %s line %d\n" \ - , __FILE__, __LINE__); } +#define WARN_ON(condition) ({ \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) \ + printf("WARNING in %s line %d\n", __FILE__, __LINE__);; \ + unlikely(__ret_warn_on); \ +}) #define PAGE_SIZE 4096