Skip to content

Commit 4e0d8f7

Browse files
toshikanidjbw
authored andcommitted
resource: Change __request_region to inherit from immediate parent
__request_region() sets 'flags' of a new resource from @parent as it inherits the parent's attribute. When a target resource has a conflict, this function inserts the new resource entry under the conflicted entry by updating @parent. In this case, the new resource entry needs to inherit attribute from the updated parent. This conflict is a typical case since __request_region() is used to allocate a new resource from a specific resource range. For instance, request_mem_region() calls __request_region() with @parent set to &iomem_resource, which is the root entry of the whole iomem range. When this request results in inserting a new entry "DEV-A" under "BUS-1", "DEV-A" needs to inherit from the immediate parent "BUS-1" as it holds specific attribute for the range. root (&iomem_resource) : + "BUS-1" + "DEV-A" Change __request_region() to set 'flags' and 'desc' of a new entry from the immediate parent. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Borislav Petkov <bp@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 45f6880 commit 4e0d8f7

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎kernel/resource.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,15 +1085,16 @@ struct resource * __request_region(struct resource *parent,
10851085
res->name = name;
10861086
res->start = start;
10871087
res->end = start + n - 1;
1088-
res->flags = resource_type(parent) | resource_ext_type(parent);
1089-
res->flags |= IORESOURCE_BUSY | flags;
1090-
res->desc = IORES_DESC_NONE;
10911088

10921089
write_lock(&resource_lock);
10931090

10941091
for (;;) {
10951092
struct resource *conflict;
10961093

1094+
res->flags = resource_type(parent) | resource_ext_type(parent);
1095+
res->flags |= IORESOURCE_BUSY | flags;
1096+
res->desc = parent->desc;
1097+
10971098
conflict = __request_resource(parent, res);
10981099
if (!conflict)
10991100
break;

0 commit comments

Comments
 (0)