xref: /freebsd/sys/compat/linuxkpi/common/include/linux/pm.h (revision 4abbf816bf06aa70200c5d1d976dd61c2752bdaf)
1*4abbf816SBjoern A. Zeeb /*-
2*4abbf816SBjoern A. Zeeb  * SPDX-License-Identifier: BSD-2-Clause
3*4abbf816SBjoern A. Zeeb  *
4*4abbf816SBjoern A. Zeeb  * Copyright (c) 2020 The FreeBSD Foundation
5*4abbf816SBjoern A. Zeeb  *
6*4abbf816SBjoern A. Zeeb  * This software was developed by Björn Zeeb under sponsorship from
7*4abbf816SBjoern A. Zeeb  * the FreeBSD Foundation.
8*4abbf816SBjoern A. Zeeb  *
9*4abbf816SBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
10*4abbf816SBjoern A. Zeeb  * modification, are permitted provided that the following conditions
11*4abbf816SBjoern A. Zeeb  * are met:
12*4abbf816SBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
13*4abbf816SBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
14*4abbf816SBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
15*4abbf816SBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
16*4abbf816SBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
17*4abbf816SBjoern A. Zeeb  *
18*4abbf816SBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19*4abbf816SBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20*4abbf816SBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21*4abbf816SBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22*4abbf816SBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23*4abbf816SBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24*4abbf816SBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*4abbf816SBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26*4abbf816SBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27*4abbf816SBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28*4abbf816SBjoern A. Zeeb  * SUCH DAMAGE.
29*4abbf816SBjoern A. Zeeb  *
30*4abbf816SBjoern A. Zeeb  * $FreeBSD$
31*4abbf816SBjoern A. Zeeb  */
32*4abbf816SBjoern A. Zeeb 
33*4abbf816SBjoern A. Zeeb #ifndef	_LINUXKPI_LINUX_PM_H
34*4abbf816SBjoern A. Zeeb #define	_LINUXKPI_LINUX_PM_H
35*4abbf816SBjoern A. Zeeb 
36*4abbf816SBjoern A. Zeeb #ifdef CONFIG_PM_SLEEP
37*4abbf816SBjoern A. Zeeb #define	SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc)	\
38*4abbf816SBjoern A. Zeeb const struct dev_pm_ops _name = {				\
39*4abbf816SBjoern A. Zeeb         .suspend	= _suspendfunc,				\
40*4abbf816SBjoern A. Zeeb         .resume		= _resumefunc,				\
41*4abbf816SBjoern A. Zeeb         .freeze		= _suspendfunc,				\
42*4abbf816SBjoern A. Zeeb         .thaw		= _resumefunc,				\
43*4abbf816SBjoern A. Zeeb         .poweroff	= _suspendfunc,				\
44*4abbf816SBjoern A. Zeeb         .restore	= _resumefunc,				\
45*4abbf816SBjoern A. Zeeb }
46*4abbf816SBjoern A. Zeeb #else
47*4abbf816SBjoern A. Zeeb #define	SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc)	\
48*4abbf816SBjoern A. Zeeb const struct dev_pm_ops _name = {				\
49*4abbf816SBjoern A. Zeeb }
50*4abbf816SBjoern A. Zeeb #endif
51*4abbf816SBjoern A. Zeeb 
52*4abbf816SBjoern A. Zeeb #endif	/* _LINUXKPI_LINUX_PM_H */
53