Skip to content

Commit 33569ef

Browse files
Amadeusz Sławińskirafaeljw
authored andcommitted
PM: hibernate: Remove register_nosave_region_late()
It is an unused wrapper forcing kmalloc allocation for registering nosave regions. Also, rename __register_nosave_region() to register_nosave_region() now that there is no need for disambiguation. Signed-off-by: Amadeusz Sławiński <[email protected]> Reviewed-by: Cezary Rojewski <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c9d967b commit 33569ef

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

include/linux/suspend.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -430,15 +430,7 @@ struct platform_hibernation_ops {
430430

431431
#ifdef CONFIG_HIBERNATION
432432
/* kernel/power/snapshot.c */
433-
extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
434-
static inline void __init register_nosave_region(unsigned long b, unsigned long e)
435-
{
436-
__register_nosave_region(b, e, 0);
437-
}
438-
static inline void __init register_nosave_region_late(unsigned long b, unsigned long e)
439-
{
440-
__register_nosave_region(b, e, 1);
441-
}
433+
extern void register_nosave_region(unsigned long b, unsigned long e);
442434
extern int swsusp_page_is_forbidden(struct page *);
443435
extern void swsusp_set_page_free(struct page *);
444436
extern void swsusp_unset_page_free(struct page *);
@@ -458,7 +450,6 @@ int pfn_is_nosave(unsigned long pfn);
458450
int hibernate_quiet_exec(int (*func)(void *data), void *data);
459451
#else /* CONFIG_HIBERNATION */
460452
static inline void register_nosave_region(unsigned long b, unsigned long e) {}
461-
static inline void register_nosave_region_late(unsigned long b, unsigned long e) {}
462453
static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
463454
static inline void swsusp_set_page_free(struct page *p) {}
464455
static inline void swsusp_unset_page_free(struct page *p) {}

kernel/power/snapshot.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm)
978978
* Register a range of page frames the contents of which should not be saved
979979
* during hibernation (to be used in the early initialization code).
980980
*/
981-
void __init __register_nosave_region(unsigned long start_pfn,
982-
unsigned long end_pfn, int use_kmalloc)
981+
void __init register_nosave_region(unsigned long start_pfn, unsigned long end_pfn)
983982
{
984983
struct nosave_region *region;
985984

@@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long start_pfn,
995994
goto Report;
996995
}
997996
}
998-
if (use_kmalloc) {
999-
/* During init, this shouldn't fail */
1000-
region = kmalloc(sizeof(struct nosave_region), GFP_KERNEL);
1001-
BUG_ON(!region);
1002-
} else {
1003-
/* This allocation cannot fail */
1004-
region = memblock_alloc(sizeof(struct nosave_region),
1005-
SMP_CACHE_BYTES);
1006-
if (!region)
1007-
panic("%s: Failed to allocate %zu bytes\n", __func__,
1008-
sizeof(struct nosave_region));
1009-
}
997+
/* This allocation cannot fail */
998+
region = memblock_alloc(sizeof(struct nosave_region),
999+
SMP_CACHE_BYTES);
1000+
if (!region)
1001+
panic("%s: Failed to allocate %zu bytes\n", __func__,
1002+
sizeof(struct nosave_region));
10101003
region->start_pfn = start_pfn;
10111004
region->end_pfn = end_pfn;
10121005
list_add_tail(&region->list, &nosave_regions);

0 commit comments

Comments
 (0)