bcm27xx-gpu-fw: update to latest version
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0449-resource-Add-a-resource_list_first_type-helper.patch
1 From dacb1a46835914b8c3862db15726bcc0a68af8f5 Mon Sep 17 00:00:00 2001
2 From: Rob Herring <robh@kernel.org>
3 Date: Mon, 28 Oct 2019 11:32:32 -0500
4 Subject: [PATCH] resource: Add a resource_list_first_type helper
5
6 commit 494f8b10d832456a96be4ee7317425f6936cabc8 upstream.
7
8 A common pattern is looping over a resource_list just to get a matching
9 entry with a specific type. Add resource_list_first_type() helper which
10 implements this.
11
12 Signed-off-by: Rob Herring <robh@kernel.org>
13 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
14 ---
15 include/linux/resource_ext.h | 12 ++++++++++++
16 1 file changed, 12 insertions(+)
17
18 --- a/include/linux/resource_ext.h
19 +++ b/include/linux/resource_ext.h
20 @@ -66,4 +66,16 @@ resource_list_destroy_entry(struct resou
21 #define resource_list_for_each_entry_safe(entry, tmp, list) \
22 list_for_each_entry_safe((entry), (tmp), (list), node)
23
24 +static inline struct resource_entry *
25 +resource_list_first_type(struct list_head *list, unsigned long type)
26 +{
27 + struct resource_entry *entry;
28 +
29 + resource_list_for_each_entry(entry, list) {
30 + if (resource_type(entry->res) == type)
31 + return entry;
32 + }
33 + return NULL;
34 +}
35 +
36 #endif /* _LINUX_RESOURCE_EXT_H */