Files
rockchip-kernel/include/linux/wakelock.h
Tao Huang 70f1413e90 Merge remote branch 'android-4.19' of https://android.googlesource.com/kernel/common
* android-4.19: (2854 commits)
  ANDROID: move up spin_unlock_bh() ahead of remove_proc_entry()
  BACKPORT: arm64: tags: Preserve tags for addresses translated via TTBR1
  UPSTREAM: arm64: memory: Implement __tag_set() as common function
  UPSTREAM: arm64/mm: fix variable 'tag' set but not used
  UPSTREAM: arm64: avoid clang warning about self-assignment
  ANDROID: sdcardfs: evict dentries on fscrypt key removal
  ANDROID: fscrypt: add key removal notifier chain
  ANDROID: refactor build.config files to remove duplication
  ANDROID: Move from clang r353983c to r365631c
  ANDROID: gki_defconfig: remove PWRSEQ_EMMC and PWRSEQ_SIMPLE
  ANDROID: unconditionally compile sig_ok in struct module
  Linux 4.19.80
  perf/hw_breakpoint: Fix arch_hw_breakpoint use-before-initialization
  PCI: vmd: Fix config addressing when using bus offsets
  x86/asm: Fix MWAITX C-state hint value
  hwmon: Fix HWMON_P_MIN_ALARM mask
  tracing: Get trace_array reference for available_tracers files
  ftrace: Get a reference counter for the trace_array on filter files
  tracing/hwlat: Don't ignore outer-loop duration when calculating max_latency
  tracing/hwlat: Report total time spent in all NMIs during the sample
  ...

Conflicts:
	drivers/clk/rockchip/clk-mmc-phase.c
	drivers/gpu/drm/rockchip/rockchip_drm_vop.c
	drivers/regulator/core.c
	drivers/tty/serial/8250/8250_port.c
	drivers/usb/dwc3/core.h
	drivers/usb/dwc3/gadget.c
	drivers/usb/dwc3/gadget.h

Change-Id: I65599d770d6613caba14251b890fcfd1cfa0f100
2019-10-28 20:26:28 +08:00

77 lines
1.7 KiB
C

/* include/linux/wakelock.h
*
* Copyright (C) 2007-2012 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef _LINUX_WAKELOCK_H
#define _LINUX_WAKELOCK_H
#include <linux/ktime.h>
#include <linux/device.h>
/* A wake_lock prevents the system from entering suspend or other low power
* states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock
* prevents a full system suspend.
*/
enum {
WAKE_LOCK_SUSPEND, /* Prevent suspend */
WAKE_LOCK_TYPE_COUNT
};
struct wake_lock {
struct wakeup_source ws;
};
static inline void wake_lock_init(struct wake_lock *lock, int type,
const char *name)
{
struct wakeup_source *ws = &lock->ws;
if (ws) {
memset(ws, 0, sizeof(*ws));
ws->name = name;
}
wakeup_source_add(ws);
}
static inline void wake_lock_destroy(struct wake_lock *lock)
{
struct wakeup_source *ws = &lock->ws;
wakeup_source_remove(ws);
__pm_relax(ws);
}
static inline void wake_lock(struct wake_lock *lock)
{
__pm_stay_awake(&lock->ws);
}
static inline void wake_lock_timeout(struct wake_lock *lock, long timeout)
{
__pm_wakeup_event(&lock->ws, jiffies_to_msecs(timeout));
}
static inline void wake_unlock(struct wake_lock *lock)
{
__pm_relax(&lock->ws);
}
static inline int wake_lock_active(struct wake_lock *lock)
{
return lock->ws.active;
}
#endif