Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH] memblock: Document memblock_is_region_{memory,reserved}()

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


sboyd at codeaurora

May 24, 2012, 12:45 AM

Post #1 of 2 (31 views)
Permalink
[PATCH] memblock: Document memblock_is_region_{memory,reserved}()

At first glance one would think that memblock_is_region_memory()
and memblock_is_region_reserved() would be implemented in the
same way. Unfortunately they aren't and the former returns
whether the region specified is a subset of a memory bank while
the latter returns whether the region specified intersects with
reserved memory.

Document the two functions so that users aren't tempted to
make the implementation the same between them and to clarify the
purpose of the functions.

Cc: Tejun Heo <tj [at] kernel>
Signed-off-by: Stephen Boyd <sboyd [at] codeaurora>
---
mm/memblock.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..e35e39b 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -855,6 +855,16 @@ int __init_memblock memblock_is_memory(phys_addr_t addr)
return memblock_search(&memblock.memory, addr) != -1;
}

+/**
+ * memblock_is_region_memory - check if a region is a subset of memory
+ * @base: base of region to check
+ * @size: size of region to check
+ *
+ * Check if the region [.@base, @base+@size) is a subset of a memory block.
+ *
+ * RETURNS:
+ * 0 if false, non-zero if true
+ */
int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size)
{
int idx = memblock_search(&memblock.memory, base);
@@ -867,6 +877,16 @@ int __init_memblock memblock_is_region_memory(phys_addr_t base, phys_addr_t size
memblock.memory.regions[idx].size) >= end;
}

+/**
+ * memblock_is_region_reserved - check if a region intersects reserved memory
+ * @base: base of region to check
+ * @size: size of region to check
+ *
+ * Check if the region [@base, @base+@size) intersects a reserved memory block.
+ *
+ * RETURNS:
+ * 0 if false, non-zero if true
+ */
int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t size)
{
memblock_cap_size(base, &size);
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


sboyd at codeaurora

Jun 7, 2012, 10:23 AM

Post #2 of 2 (26 views)
Permalink
Re: [PATCH] memblock: Document memblock_is_region_{memory,reserved}() [In reply to]

On 05/24/12 00:45, Stephen Boyd wrote:
> At first glance one would think that memblock_is_region_memory()
> and memblock_is_region_reserved() would be implemented in the
> same way. Unfortunately they aren't and the former returns
> whether the region specified is a subset of a memory bank while
> the latter returns whether the region specified intersects with
> reserved memory.
>
> Document the two functions so that users aren't tempted to
> make the implementation the same between them and to clarify the
> purpose of the functions.
>
> Cc: Tejun Heo <tj [at] kernel>
> Signed-off-by: Stephen Boyd <sboyd [at] codeaurora>
> ---

Hi Ingo, can you pick up or review this patch (I realize it was sent
during the merge window)?

--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.