From patchwork Mon Jul 9 08:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10513891 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCAF7600CA for ; Mon, 9 Jul 2018 08:37:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 883B328707 for ; Mon, 9 Jul 2018 08:37:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C617286F8; Mon, 9 Jul 2018 08:37:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 32C25286F8 for ; Mon, 9 Jul 2018 08:37:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09C0B6E3DE; Mon, 9 Jul 2018 08:37:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE5586E3E1 for ; Mon, 9 Jul 2018 08:37:03 +0000 (UTC) Received: by mail-ed1-x541.google.com with SMTP id a5-v6so13264695edt.5 for ; Mon, 09 Jul 2018 01:37:03 -0700 (PDT) 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; bh=7WccuFXkkMDrR/QjpKmJWMzoePgpqLAnBtoCNqeveoE=; b=UP3/9Q70mu835XhCjZamvAOEL2LNy1wUSjClJ0F4rE0Q/mHFqVrcWSjdfxlg4LF58E ZwL732508CvJNCUQBmXZXZ6H2RZStLxdTycyCeaQpr1SqPfPzzm656km50iO/Xa0HdV/ H+GAatDaKNrn4eKb2NBI75Iewzwm+LJAAeC+R2ndUa0+gnhkGdCD3+r3qJrcYUhYzodg Ky3lZtCN6/kihTeVlnqD9pcUK35uxNykGzfoaTrZ5U4sbrh5Pcymm4tVHBIZoOP83RtG /Un4VahIjOj+1/ZKb26/nLflH9t3uGEW/WarERwVJWgXNicOWTM5S7AHD8JSCJQZMukQ jz3w== X-Gm-Message-State: APt69E2cdvAUrmVjDu8rhCLptCrVNaIzWMPQvSWa0lOZD5L7iZKYbwjO jeINqsUECXb0Ryv4OYI1HRBlPg== X-Google-Smtp-Source: AAOMgpe7w4I7bWD2HolPeXTnUCCRKxjnku+0YERJUQd3WhbmbwZMnfzq58+SsRfrCTMErmUY0PXGCw== X-Received: by 2002:a50:e718:: with SMTP id a24-v6mr1676706edn.278.1531125422554; Mon, 09 Jul 2018 01:37:02 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5628:0:496f:7dc5:66d7:a057]) by smtp.gmail.com with ESMTPSA id 8-v6sm340067edv.77.2018.07.09.01.37.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 01:37:01 -0700 (PDT) From: Daniel Vetter To: LKML Date: Mon, 9 Jul 2018 10:36:43 +0200 Message-Id: <20180709083650.23549-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180709083650.23549-1-daniel.vetter@ffwll.ch> References: <20180709083650.23549-1-daniel.vetter@ffwll.ch> Subject: [Intel-gfx] [PATCH 05/12] dmar: Use for_each_If X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Joerg Roedel , DRI Development , Daniel Vetter MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Avoids the inverted conditions compared to the open coded version. Signed-off-by: Daniel Vetter Cc: Joerg Roedel --- include/linux/dmar.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/dmar.h b/include/linux/dmar.h index e2433bc50210..99397504e75e 100644 --- a/include/linux/dmar.h +++ b/include/linux/dmar.h @@ -85,15 +85,15 @@ extern struct list_head dmar_drhd_units; #define for_each_active_drhd_unit(drhd) \ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ - if (drhd->ignored) {} else + for_each_if (!drhd->ignored) #define for_each_active_iommu(i, drhd) \ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ - if (i=drhd->iommu, drhd->ignored) {} else + for_each_if ((i=drhd->iommu, !drhd->ignored)) #define for_each_iommu(i, drhd) \ list_for_each_entry_rcu(drhd, &dmar_drhd_units, list) \ - if (i=drhd->iommu, 0) {} else + for_each_if ((i=drhd->iommu, true)) static inline bool dmar_rcu_check(void) { @@ -108,7 +108,8 @@ static inline bool dmar_rcu_check(void) NULL, (p) < (c)); (p)++) #define for_each_active_dev_scope(a, c, p, d) \ - for_each_dev_scope((a), (c), (p), (d)) if (!(d)) { continue; } else + for_each_dev_scope((a), (c), (p), (d)) \ + for_each_if (d) extern int dmar_table_init(void); extern int dmar_dev_scope_init(void);