Browse Source

lib: lmb: rename lmb_get_unreserved_size to lmb_get_free_size

As a follow-up, change the name of the newly introduced function
'lmb_get_unreserved_size' to 'lmb_get_free_size', which is more
appropriate.

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fix test/lib/lmb.c]
Signed-off-by: Tom Rini <trini@konsulko.com>
Simon Goldschmidt 5 years ago
parent
commit
65304aade8
4 changed files with 14 additions and 14 deletions
  1. 1 1
      include/lmb.h
  2. 1 1
      lib/lmb.c
  3. 1 1
      net/tftp.c
  4. 11 11
      test/lib/lmb.c

+ 1 - 1
include/lmb.h

@@ -40,7 +40,7 @@ extern phys_addr_t __lmb_alloc_base(struct lmb *lmb, phys_size_t size, ulong ali
 			      phys_addr_t max_addr);
 extern phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base,
 				  phys_size_t size);
-extern phys_size_t lmb_get_unreserved_size(struct lmb *lmb, phys_addr_t addr);
+extern phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr);
 extern int lmb_is_reserved(struct lmb *lmb, phys_addr_t addr);
 extern long lmb_free(struct lmb *lmb, phys_addr_t base, phys_size_t size);
 

+ 1 - 1
lib/lmb.c

@@ -353,7 +353,7 @@ phys_addr_t lmb_alloc_addr(struct lmb *lmb, phys_addr_t base, phys_size_t size)
 }
 
 /* Return number of bytes from a given address that are free */
-phys_size_t lmb_get_unreserved_size(struct lmb *lmb, phys_addr_t addr)
+phys_size_t lmb_get_free_size(struct lmb *lmb, phys_addr_t addr)
 {
 	int i;
 	long j;

+ 1 - 1
net/tftp.c

@@ -609,7 +609,7 @@ static int tftp_init_load_addr(void)
 	lmb_init_and_reserve(&lmb, gd->bd->bi_dram[0].start,
 			     gd->bd->bi_dram[0].size, (void *)gd->fdt_blob);
 
-	max_size = lmb_get_unreserved_size(&lmb, load_addr);
+	max_size = lmb_get_free_size(&lmb, load_addr);
 	if (!max_size)
 		return -1;
 

+ 11 - 11
test/lib/lmb.c

@@ -560,31 +560,31 @@ static int test_get_unreserved_size(struct unit_test_state *uts,
 		   alloc_addr_b, 0x10000, alloc_addr_c, 0x10000);
 
 	/* check addresses in between blocks */
-	s = lmb_get_unreserved_size(&lmb, ram);
+	s = lmb_get_free_size(&lmb, ram);
 	ut_asserteq(s, alloc_addr_a - ram);
-	s = lmb_get_unreserved_size(&lmb, ram + 0x10000);
+	s = lmb_get_free_size(&lmb, ram + 0x10000);
 	ut_asserteq(s, alloc_addr_a - ram - 0x10000);
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_a - 4);
+	s = lmb_get_free_size(&lmb, alloc_addr_a - 4);
 	ut_asserteq(s, 4);
 
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_a + 0x10000);
+	s = lmb_get_free_size(&lmb, alloc_addr_a + 0x10000);
 	ut_asserteq(s, alloc_addr_b - alloc_addr_a - 0x10000);
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_a + 0x20000);
+	s = lmb_get_free_size(&lmb, alloc_addr_a + 0x20000);
 	ut_asserteq(s, alloc_addr_b - alloc_addr_a - 0x20000);
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_b - 4);
+	s = lmb_get_free_size(&lmb, alloc_addr_b - 4);
 	ut_asserteq(s, 4);
 
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_c + 0x10000);
+	s = lmb_get_free_size(&lmb, alloc_addr_c + 0x10000);
 	ut_asserteq(s, ram_end - alloc_addr_c - 0x10000);
-	s = lmb_get_unreserved_size(&lmb, alloc_addr_c + 0x20000);
+	s = lmb_get_free_size(&lmb, alloc_addr_c + 0x20000);
 	ut_asserteq(s, ram_end - alloc_addr_c - 0x20000);
-	s = lmb_get_unreserved_size(&lmb, ram_end - 4);
+	s = lmb_get_free_size(&lmb, ram_end - 4);
 	ut_asserteq(s, 4);
 
 	return 0;
 }
 
-static int lib_test_lmb_get_unreserved_size(struct unit_test_state *uts)
+static int lib_test_lmb_get_free_size(struct unit_test_state *uts)
 {
 	int ret;
 
@@ -597,5 +597,5 @@ static int lib_test_lmb_get_unreserved_size(struct unit_test_state *uts)
 	return test_get_unreserved_size(uts, 0xE0000000);
 }
 
-DM_TEST(lib_test_lmb_get_unreserved_size,
+DM_TEST(lib_test_lmb_get_free_size,
 	DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);