On Sun 2016-06-26 00:18:52, Chen Yu wrote: > Sometime we need to do some operations before resuming from > hibernation, so introduce a flag to indicate this stage. > > Signed-off-by: Chen Yu <yu.c.c...@intel.com> > --- > include/linux/suspend.h | 7 +++++++ > kernel/power/hibernate.c | 3 +++ > 2 files changed, 10 insertions(+) > > diff --git a/include/linux/suspend.h b/include/linux/suspend.h > index 8b6ec7e..422e87a 100644 > --- a/include/linux/suspend.h > +++ b/include/linux/suspend.h > @@ -384,6 +384,12 @@ extern bool system_entering_hibernation(void); > extern bool hibernation_available(void); > asmlinkage int swsusp_save(void); > extern struct pbe *restore_pblist; > +extern bool in_resume_hibernate;
in_resume_hibernation? But it is pretty sad if we need another such state function... Pavel > +static inline bool hibernation_in_resume(void) > +{ > + return in_resume_hibernate; > +} > #else /* CONFIG_HIBERNATION */ > static inline void register_nosave_region(unsigned long b, unsigned long e) > {} > static inline void register_nosave_region_late(unsigned long b, unsigned > long e) {} > @@ -395,6 +401,7 @@ static inline void hibernation_set_ops(const struct > platform_hibernation_ops *op > static inline int hibernate(void) { return -ENOSYS; } > static inline bool system_entering_hibernation(void) { return false; } > static inline bool hibernation_available(void) { return false; } > +static inline bool hibernation_in_resume(void) { return false; } > #endif /* CONFIG_HIBERNATION */ > > /* Hibernation and suspend events */ > diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c > index fca9254..41be909 100644 > --- a/kernel/power/hibernate.c > +++ b/kernel/power/hibernate.c > @@ -43,6 +43,7 @@ static char resume_file[256] = CONFIG_PM_STD_PARTITION; > dev_t swsusp_resume_device; > sector_t swsusp_resume_block; > __visible int in_suspend __nosavedata; > +bool in_resume_hibernate; > > enum { > HIBERNATION_INVALID, > @@ -433,6 +434,7 @@ static int resume_target_kernel(bool platform_mode) > if (error) > goto Cleanup; > > + in_resume_hibernate = true; > error = disable_nonboot_cpus(); > if (error) > goto Enable_cpus; > @@ -474,6 +476,7 @@ static int resume_target_kernel(bool platform_mode) > local_irq_enable(); > > Enable_cpus: > + in_resume_hibernate = false; > enable_nonboot_cpus(); > > Cleanup: -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html