From patchwork Mon Oct 28 16:32:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 11215969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF46C1668 for ; Mon, 28 Oct 2019 16:34:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B569A20717 for ; Mon, 28 Oct 2019 16:34:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FfCZQA+z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B569A20717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mjFmOhZqkap1Bhcv+r+LbNalxmrEe6lh2krRYfEnYM8=; b=FfCZQA+z9g6YB1 6yBwar+OmZeXNweELsItK9vvlLSGfFjhL6efejNt6Uyr9nGb3YqaRE1o6XHl9ItyEJ4Wwdhu+le/f 6jnfj2L+kgd874ZUtaaOwkS/fDQ0aWUApSjhirMYxMVN9B0ZK0H0OzBtSNHKIJws8ug/hvHPCOBYc 3OXCutk3hKND6ctE35aenoVqmn88N3KmThhWX0yApx2STxgmqs8chtX3TRIJCFlo8mJiqt44JqaBp Z4IEsbjlV6JUfvV4GekkI9MWDDEoDNADnH67+u3TbPfV9pv1WVuXn5o5EuJSkmnlFc0x0pDSMPoV9 FXOuxeXwb54btINre61A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iP7xz-0007c9-5K; Mon, 28 Oct 2019 16:34:03 +0000 Received: from mail-oi1-f196.google.com ([209.85.167.196]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iP7wz-0006f4-T8; Mon, 28 Oct 2019 16:33:03 +0000 Received: by mail-oi1-f196.google.com with SMTP id n16so4145397oig.2; Mon, 28 Oct 2019 09:33:01 -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:mime-version:content-transfer-encoding; bh=Ly9SwwfQU77PS/De9nePQz9/hgu0i/2+0AP8IGmXD3o=; b=KSjVq6CXfFlB8cETJsVtEEsIvZXdEJwQSXSMy77lWs4AO1LebR9LaCaNn1Xvx5+Ub+ oVGvgenEBJfvI9yq3Dejyr+XO2uoddRbtPEfLHoB2/3yzxTdxB0RhO3F2Bo2fBf+vz9E PQ/FRnKg7mESQogoyfA7OjAtX3ilBGatdfO8krePsAT3SmmyflKg3AgMZ+INwlnQ6Onf fUyOtNT0ncPikcQ/6uruwAa9NOSNxyg9x39EPdL9HKNGv4hHhLsTffIY1hMLhlPl4ZUE 8WByOez2Lt8WGHF8iDdJVKrfoAxzbNT7y6MvsJIFfdUkhR5qDD5dS4GMX5Z1aN+EG4Vq UkFw== X-Gm-Message-State: APjAAAUCCtiLEY887x7+7RUl4vvyZ1dzLXBt4byIzsti72XqMEXxO7Om K/egZI0bQvbh/vc3JEaSxQ== X-Google-Smtp-Source: APXvYqz7AvFVl42WcaIBsnF/FBWNvONUeq6ow/pzPzHbo/QsqT4JbiucFb+B7zhfVTYFjNW6To0vKg== X-Received: by 2002:aca:1e0c:: with SMTP id m12mr168280oic.18.1572280381198; Mon, 28 Oct 2019 09:33:01 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id e186sm354991oia.47.2019.10.28.09.32.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 09:33:00 -0700 (PDT) From: Rob Herring To: Andrew Murray , Bjorn Helgaas , Lorenzo Pieralisi Subject: [PATCH v3 01/25] resource: Add a resource_list_first_type helper Date: Mon, 28 Oct 2019 11:32:32 -0500 Message-Id: <20191028163256.8004-2-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191028163256.8004-1-robh@kernel.org> References: <20191028163256.8004-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191028_093301_937796_BF60994D X-CRM114-Status: GOOD ( 11.32 ) X-Spam-Score: 0.5 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.196 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.196 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , Karthikeyan Mitran , linux-pci@vger.kernel.org, Shawn Lin , Thomas Petazzoni , Toan Le , Will Deacon , Ryder Lee , Michal Simek , Christoph Hellwig , linux-rockchip@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Linus Walleij , Ray Jui , Hou Zhiqiang , Simon Horman , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org, Scott Branden , Jingoo Han , rfi@lists.rocketboards.org, linux-renesas-soc@vger.kernel.org, Tom Joseph , Srinath Mannam , Gustavo Pimentel , Ley Foon Tan Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org A common pattern is looping over a resource_list just to get a matching entry with a specific type. Add resource_list_first_type() helper which implements this. Signed-off-by: Rob Herring --- v3: - Rename resource_list_get_entry_of_type to resource_list_first_type include/linux/resource_ext.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.20.1 diff --git a/include/linux/resource_ext.h b/include/linux/resource_ext.h index 06da59b23b79..ff0339df56af 100644 --- a/include/linux/resource_ext.h +++ b/include/linux/resource_ext.h @@ -66,4 +66,16 @@ resource_list_destroy_entry(struct resource_entry *entry) #define resource_list_for_each_entry_safe(entry, tmp, list) \ list_for_each_entry_safe((entry), (tmp), (list), node) +static inline struct resource_entry * +resource_list_first_type(struct list_head *list, unsigned long type) +{ + struct resource_entry *entry; + + resource_list_for_each_entry(entry, list) { + if (resource_type(entry->res) == type) + return entry; + } + return NULL; +} + #endif /* _LINUX_RESOURCE_EXT_H */