mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
resource: Add I/O resource descriptor
walk_iomem_res() and region_intersects() still need to use strcmp() for searching a resource entry by @name in the iomem table. This patch introduces I/O resource descriptor 'desc' in struct resource for the iomem search interfaces. Drivers can assign their unique descriptor to a range when they support the search interfaces. Otherwise, 'desc' is set to IORES_DESC_NONE (0). This avoids changing most of the drivers as they typically allocate resource entries statically, or by calling alloc_resource(), kzalloc(), or alloc_bootmem_low(), which set the field to zero by default. A later patch will address some drivers that use kmalloc() without zero'ing the field. Also change release_mem_region_adjustable() to set 'desc' when its resource entry gets separated. Other resource interfaces are also changed to initialize 'desc' explicitly although alloc_resource() sets it to 0. Signed-off-by: Toshi Kani <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Dan Williams <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jakub Sitnicki <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Luis R. Rodriguez <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Toshi Kani <[email protected]> Cc: [email protected] Cc: linux-mm <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
a3650d53ba
commit
43ee493bde
2 changed files with 23 additions and 0 deletions
|
|
@ -949,6 +949,7 @@ static void __init __reserve_region_with_split(struct resource *root,
|
|||
res->start = start;
|
||||
res->end = end;
|
||||
res->flags = IORESOURCE_BUSY;
|
||||
res->desc = IORES_DESC_NONE;
|
||||
|
||||
while (1) {
|
||||
|
||||
|
|
@ -983,6 +984,7 @@ static void __init __reserve_region_with_split(struct resource *root,
|
|||
next_res->start = conflict->end + 1;
|
||||
next_res->end = end;
|
||||
next_res->flags = IORESOURCE_BUSY;
|
||||
next_res->desc = IORES_DESC_NONE;
|
||||
}
|
||||
} else {
|
||||
res->start = conflict->end + 1;
|
||||
|
|
@ -1074,6 +1076,7 @@ struct resource * __request_region(struct resource *parent,
|
|||
res->end = start + n - 1;
|
||||
res->flags = resource_type(parent) | resource_ext_type(parent);
|
||||
res->flags |= IORESOURCE_BUSY | flags;
|
||||
res->desc = IORES_DESC_NONE;
|
||||
|
||||
write_lock(&resource_lock);
|
||||
|
||||
|
|
@ -1238,6 +1241,7 @@ int release_mem_region_adjustable(struct resource *parent,
|
|||
new_res->start = end + 1;
|
||||
new_res->end = res->end;
|
||||
new_res->flags = res->flags;
|
||||
new_res->desc = res->desc;
|
||||
new_res->parent = res->parent;
|
||||
new_res->sibling = res->sibling;
|
||||
new_res->child = NULL;
|
||||
|
|
@ -1413,6 +1417,7 @@ static int __init reserve_setup(char *str)
|
|||
res->start = io_start;
|
||||
res->end = io_start + io_num - 1;
|
||||
res->flags = IORESOURCE_BUSY;
|
||||
res->desc = IORES_DESC_NONE;
|
||||
res->child = NULL;
|
||||
if (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0)
|
||||
reserved = x+1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue