From patchwork Mon Jul 9 16:11:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10515167 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 757C46032C for ; Mon, 9 Jul 2018 16:11:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62D8A289CB for ; Mon, 9 Jul 2018 16:11:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5452E28790; Mon, 9 Jul 2018 16:11:45 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0192228790 for ; Mon, 9 Jul 2018 16:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754459AbeGIQLo (ORCPT ); Mon, 9 Jul 2018 12:11:44 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:33320 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754518AbeGIQLn (ORCPT ); Mon, 9 Jul 2018 12:11:43 -0400 Received: by mail-ed1-f67.google.com with SMTP id x5-v6so10688475edr.0 for ; Mon, 09 Jul 2018 09:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3X9JFFs1YGW+QQRwFTsTnOJ4GgEVhsAf6HK9Pv7S2S8=; b=RhAWH6EinrTh5qYhnpcglt/c6pCXSskeZMHEWL4Wg5REOO3jfx9XV8HnU3iGZDnw9l NOxfHnqdYNvriVQvXks7piM4WlpQYy85YMReBtKWHVKeROQs+8BhhKTJlyrByiBipi0W C/E8yye12PwPaZQnQ/QTX0a3vIS8anp1eyR8U= 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=3X9JFFs1YGW+QQRwFTsTnOJ4GgEVhsAf6HK9Pv7S2S8=; b=bclFmYl5nptitI6LS3W1fvbbMZaCpHrmWx16F+KdC4xLgtXstrHpAYSNgj9QFvbewY ZkfpvawDqk2TPFyTLQ/PkBsc67mhPsDuYcru2/hjk2nGVOJjbfGFULZlN3pPbwtd1vtq Yvxu+FFFuy00JEXwlbl3JbXYKGLZvf5h4IgnfIrDslOagR8JGBUyCod7kzC2nbO3bfAR kpqOMQk3ZOOD3ycCPNkBXn3FecLSdBRzhNQ61rL+LMgZ15WffdBiM6/nWMxrAEIdnk1r CNG1LTYYKjW2JYWp4tuLQWbnU9BDh/9Oi15/C3djecrFEXTGBfd8H7rD51+j46WKmMb/ 4BxQ== X-Gm-Message-State: APt69E0H4i3jphxHeYZKSHYUSUdP37lpegUQc2Jk2chOPsF9LBfcA/na yBdiUaS+t0ey35020hEdtSgNvg== X-Google-Smtp-Source: AAOMgpeH0zEbBBcRCKg9sZb1QKJgO+OyVWrc4SRAzGoDstDanHiy8psAxktZIDbw9kUUHMowho/0GQ== X-Received: by 2002:a50:89aa:: with SMTP id g39-v6mr22006389edg.25.1531152702120; Mon, 09 Jul 2018 09:11:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5628:0:496f:7dc5:66d7:a057]) by smtp.gmail.com with ESMTPSA id i89-v6sm7191441edi.10.2018.07.09.09.11.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jul 2018 09:11:41 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , Daniel Vetter , Daniel Vetter , "Rafael J. Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org, Eric Engestrom Subject: [PATCH] cpufreq: use for_each_if Date: Mon, 9 Jul 2018 18:11:29 +0200 Message-Id: <20180709161129.28425-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180709083650.23549-4-daniel.vetter@ffwll.ch> References: <20180709083650.23549-4-daniel.vetter@ffwll.ch> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoids the inverted condition compared to the open coded version. Signed-off-by: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: linux-pm@vger.kernel.org Cc: Eric Engestrom Acked-by: Rafael J. Wysocki --- v2: Fix the logic fumble in the 2nd hunk, spotted by Eric. --- include/linux/cpufreq.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 882a9b9e34bc..3a774f523d00 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -649,9 +649,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct device *dev, #define cpufreq_for_each_valid_entry(pos, table) \ for (pos = table; pos->frequency != CPUFREQ_TABLE_END; pos++) \ - if (pos->frequency == CPUFREQ_ENTRY_INVALID) \ - continue; \ - else + for_each_if (pos->frequency != CPUFREQ_ENTRY_INVALID) /* * cpufreq_for_each_valid_entry_idx - iterate with index over a cpufreq @@ -663,9 +661,7 @@ static inline void dev_pm_opp_free_cpufreq_table(struct device *dev, #define cpufreq_for_each_valid_entry_idx(pos, table, idx) \ cpufreq_for_each_entry_idx(pos, table, idx) \ - if (pos->frequency == CPUFREQ_ENTRY_INVALID) \ - continue; \ - else + for_each_if (pos->frequency != CPUFREQ_ENTRY_INVALID) int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,