X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Ffreezer.h;h=08934995c7ab5463e5f4064f4e2fff5ccfb4af94;hb=2c57ee6f924c95e4dce61ed4776fb3f62e1b9f92;hp=c8e02de737f6b07a3443d53362aee0d3bc507087;hpb=fdb64f93b38a3470fa4db8cd5720b8c731922d1a;p=linux-2.6-omap-h63xx.git diff --git a/include/linux/freezer.h b/include/linux/freezer.h index c8e02de737f..08934995c7a 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -4,8 +4,9 @@ #define FREEZER_H_INCLUDED #include +#include -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP /* * Check if a process has been frozen */ @@ -126,7 +127,37 @@ static inline void set_freezable(void) current->flags &= ~PF_NOFREEZE; } -#else +/* + * Freezer-friendly wrappers around wait_event_interruptible() and + * wait_event_interruptible_timeout(), originally defined in + */ + +#define wait_event_freezable(wq, condition) \ +({ \ + int __retval; \ + do { \ + __retval = wait_event_interruptible(wq, \ + (condition) || freezing(current)); \ + if (__retval && !freezing(current)) \ + break; \ + else if (!(condition)) \ + __retval = -ERESTARTSYS; \ + } while (try_to_freeze()); \ + __retval; \ +}) + + +#define wait_event_freezable_timeout(wq, condition, timeout) \ +({ \ + long __retval = timeout; \ + do { \ + __retval = wait_event_interruptible_timeout(wq, \ + (condition) || freezing(current), \ + __retval); \ + } while (try_to_freeze()); \ + __retval; \ +}) +#else /* !CONFIG_PM_SLEEP */ static inline int frozen(struct task_struct *p) { return 0; } static inline int freezing(struct task_struct *p) { return 0; } static inline void set_freeze_flag(struct task_struct *p) {} @@ -143,6 +174,13 @@ static inline void freezer_do_not_count(void) {} static inline void freezer_count(void) {} static inline int freezer_should_skip(struct task_struct *p) { return 0; } static inline void set_freezable(void) {} -#endif + +#define wait_event_freezable(wq, condition) \ + wait_event_interruptible(wq, condition) + +#define wait_event_freezable_timeout(wq, condition, timeout) \ + wait_event_interruptible_timeout(wq, condition, timeout) + +#endif /* !CONFIG_PM_SLEEP */ #endif /* FREEZER_H_INCLUDED */