@@ -328,25 +328,23 @@ EXPORT_SYMBOL(release_resource);
328
328
* -1.
329
329
*
330
330
* This function walks the whole tree and not just first level children
331
- * unless @first_level_children_only is true.
331
+ * unless @first_lvl is true.
332
332
*/
333
333
static int find_next_iomem_res (resource_size_t start , resource_size_t end ,
334
334
unsigned long flags , unsigned long desc ,
335
- bool first_level_children_only ,
336
- struct resource * res )
335
+ bool first_lvl , struct resource * res )
337
336
{
338
337
struct resource * p ;
339
- bool sibling_only = false;
340
338
341
- BUG_ON (!res );
342
- BUG_ON ( start >= end ) ;
339
+ if (!res )
340
+ return - EINVAL ;
343
341
344
- if (first_level_children_only )
345
- sibling_only = true ;
342
+ if (start >= end )
343
+ return - EINVAL ;
346
344
347
345
read_lock (& resource_lock );
348
346
349
- for (p = iomem_resource .child ; p ; p = next_resource (p , sibling_only )) {
347
+ for (p = iomem_resource .child ; p ; p = next_resource (p , first_lvl )) {
350
348
if ((p -> flags & flags ) != flags )
351
349
continue ;
352
350
if ((desc != IORES_DESC_NONE ) && (desc != p -> desc ))
@@ -373,15 +371,14 @@ static int find_next_iomem_res(resource_size_t start, resource_size_t end,
373
371
374
372
static int __walk_iomem_res_desc (resource_size_t start , resource_size_t end ,
375
373
unsigned long flags , unsigned long desc ,
376
- bool first_level_children_only , void * arg ,
374
+ bool first_lvl , void * arg ,
377
375
int (* func )(struct resource * , void * ))
378
376
{
379
377
struct resource res ;
380
378
int ret = -1 ;
381
379
382
380
while (start < end &&
383
- !find_next_iomem_res (start , end , flags , desc ,
384
- first_level_children_only , & res )) {
381
+ !find_next_iomem_res (start , end , flags , desc , first_lvl , & res )) {
385
382
ret = (* func )(& res , arg );
386
383
if (ret )
387
384
break ;
@@ -392,7 +389,7 @@ static int __walk_iomem_res_desc(resource_size_t start, resource_size_t end,
392
389
return ret ;
393
390
}
394
391
395
- /*
392
+ /**
396
393
* Walks through iomem resources and calls func() with matching resource
397
394
* ranges. This walks through whole tree and not just first level children.
398
395
* All the memory ranges which overlap start,end and also match flags and
@@ -421,7 +418,7 @@ EXPORT_SYMBOL_GPL(walk_iomem_res_desc);
421
418
* ranges.
422
419
*/
423
420
int walk_system_ram_res (u64 start , u64 end , void * arg ,
424
- int (* func )(struct resource * , void * ))
421
+ int (* func )(struct resource * , void * ))
425
422
{
426
423
unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY ;
427
424
@@ -450,7 +447,7 @@ int walk_mem_res(u64 start, u64 end, void *arg,
450
447
* It is to be used only for System RAM.
451
448
*/
452
449
int walk_system_ram_range (unsigned long start_pfn , unsigned long nr_pages ,
453
- void * arg , int (* func )(unsigned long , unsigned long , void * ))
450
+ void * arg , int (* func )(unsigned long , unsigned long , void * ))
454
451
{
455
452
resource_size_t start , end ;
456
453
unsigned long flags ;
@@ -646,8 +643,8 @@ static int find_resource(struct resource *root, struct resource *new,
646
643
* @constraint: the size and alignment constraints to be met.
647
644
*/
648
645
static int reallocate_resource (struct resource * root , struct resource * old ,
649
- resource_size_t newsize ,
650
- struct resource_constraint * constraint )
646
+ resource_size_t newsize ,
647
+ struct resource_constraint * constraint )
651
648
{
652
649
int err = 0 ;
653
650
struct resource new = * old ;
@@ -960,7 +957,7 @@ static int __adjust_resource(struct resource *res, resource_size_t start,
960
957
* Existing children of the resource are assumed to be immutable.
961
958
*/
962
959
int adjust_resource (struct resource * res , resource_size_t start ,
963
- resource_size_t size )
960
+ resource_size_t size )
964
961
{
965
962
int result ;
966
963
@@ -971,9 +968,9 @@ int adjust_resource(struct resource *res, resource_size_t start,
971
968
}
972
969
EXPORT_SYMBOL (adjust_resource );
973
970
974
- static void __init __reserve_region_with_split ( struct resource * root ,
975
- resource_size_t start , resource_size_t end ,
976
- const char * name )
971
+ static void __init
972
+ __reserve_region_with_split ( struct resource * root , resource_size_t start ,
973
+ resource_size_t end , const char * name )
977
974
{
978
975
struct resource * parent = root ;
979
976
struct resource * conflict ;
@@ -1032,9 +1029,9 @@ static void __init __reserve_region_with_split(struct resource *root,
1032
1029
1033
1030
}
1034
1031
1035
- void __init reserve_region_with_split ( struct resource * root ,
1036
- resource_size_t start , resource_size_t end ,
1037
- const char * name )
1032
+ void __init
1033
+ reserve_region_with_split ( struct resource * root , resource_size_t start ,
1034
+ resource_size_t end , const char * name )
1038
1035
{
1039
1036
int abort = 0 ;
1040
1037
@@ -1160,7 +1157,7 @@ EXPORT_SYMBOL(__request_region);
1160
1157
* The described resource region must match a currently busy region.
1161
1158
*/
1162
1159
void __release_region (struct resource * parent , resource_size_t start ,
1163
- resource_size_t n )
1160
+ resource_size_t n )
1164
1161
{
1165
1162
struct resource * * p ;
1166
1163
resource_size_t end ;
@@ -1222,7 +1219,7 @@ EXPORT_SYMBOL(__release_region);
1222
1219
* simplicity. Enhance this logic when necessary.
1223
1220
*/
1224
1221
int release_mem_region_adjustable (struct resource * parent ,
1225
- resource_size_t start , resource_size_t size )
1222
+ resource_size_t start , resource_size_t size )
1226
1223
{
1227
1224
struct resource * * p ;
1228
1225
struct resource * res ;
@@ -1398,9 +1395,9 @@ static int devm_region_match(struct device *dev, void *res, void *match_data)
1398
1395
this -> start == match -> start && this -> n == match -> n ;
1399
1396
}
1400
1397
1401
- struct resource * __devm_request_region ( struct device * dev ,
1402
- struct resource * parent , resource_size_t start ,
1403
- resource_size_t n , const char * name )
1398
+ struct resource *
1399
+ __devm_request_region ( struct device * dev , struct resource * parent ,
1400
+ resource_size_t start , resource_size_t n , const char * name )
1404
1401
{
1405
1402
struct region_devres * dr = NULL ;
1406
1403
struct resource * res ;
0 commit comments