From nobody Sat Dec 31 02:52:41 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NkRWG18kkz2lDTQ; Sat, 31 Dec 2022 02:52:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NkRWG0cCVz4MNh; Sat, 31 Dec 2022 02:52:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672455162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x+BxhSNZIyqVdkoVrMvqAGAk9t/hhhplGo3Wy45fOj0=; b=IKsusLkED/OyKbTInOHpkFd2mywfrxcV5mefwgPoLLYDLjwIUKO1UALvnf3CR2xBg1iyOu zX+oxioSJb8oNego9Rwjo4t0tzg2UfeLretgbBeRXcYZOzkU5jhbSdDEY8wwcD+wxvjkh4 3zPkqHh+ltCdGttg9y0kQ2Kh11iTAgYyKHYih5CNYhj75OeTVpGbipGIG7vlcknutlkgWS TshLVQQycQbTJL73XXSRcTuE4TBRSdjZvPtTV2bh7lngal73cizU6SrrPJondLZzGc3yaH ZuXZ70fjF51bVISpugv9BqbJVMwUK/c3U2utreWsnPZCi1e1gKwtZFHt4g+WFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1672455162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=x+BxhSNZIyqVdkoVrMvqAGAk9t/hhhplGo3Wy45fOj0=; b=HsMqRqlKmGqIlbTcrlNuziuKlO6K7U7uPdZm9OQMUwoln8MoCT3/s/+PXXyTrlDAFI36bt CvHDZGYFD3CHKnoXgLDxlExG7hCj6RKlVU32SJMX9tIxXthtISglmBgRf/cfE6WHh7wW1i l8KIHKAybOngN9Cr8AcjHxLWJH+I5lfO/ywAAqZX9AQgnV50W0bieCmbfiuCGKwutXLEEg 6KfgVMCrcq64JEJ80qK/VmALkTPVGNYjFSYqZSivdZ1De9U5kMQp2Fs2dq1uoxKQgIQaY3 Cf6nt4XZVp2Y/ZzILdoUrpLQjF8PXGVNGzsXXOfczZqPngWDXJBhqpvkcaMNiA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1672455162; a=rsa-sha256; cv=none; b=qTci9O6716c8fR/UAVQ0G5anTl20Z8mEp9/1gO6IY5kSKtmqR2jmaN6nqqFLsJNzOHMfM+ 1ETuzgwMiAEjQDeHpHX5bx07/HMeYBStg0bDdK5eYP5xCmu9LLzReD6LWX9ke6fog/oTK9 FfJ8FV57ombdHM4055JXbsI/SFXLmLYaDeBuha/LzOB+ejhOO8/XRsLNlC6UvN9o500COh neKm9LAlDjVlshUWGZa/fD+8JnYz+Ktknxlc5DD7JcstWFFdj5v56TlUfF6JHGyFVE+B3B NmL0sRF9iuYMfTRB/v58aobnVpJky0RcYzLvo0xqgtGRsyo8uyseyY/SY1nPuw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NkRWF6lS5zXqd; Sat, 31 Dec 2022 02:52:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2BV2qfv2049403; Sat, 31 Dec 2022 02:52:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BV2qfF1049402; Sat, 31 Dec 2022 02:52:41 GMT (envelope-from git) Date: Sat, 31 Dec 2022 02:52:41 GMT Message-Id: <202212310252.2BV2qfF1049402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4052b0e4b218 - main - LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4052b0e4b218f916b1f491a5ec9e41d38029215b Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4052b0e4b218f916b1f491a5ec9e41d38029215b commit 4052b0e4b218f916b1f491a5ec9e41d38029215b Author: Bjoern A. Zeeb AuthorDate: 2022-11-28 22:31:28 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-12-31 02:51:09 +0000 LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS(). For the moment this duplicates some parts (as can be seen in the earlier review I tried to simplify bits but given our implementation this was easier in the end). While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only). MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D37527 --- sys/compat/linuxkpi/common/include/linux/pm.h | 28 +++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h index d054a95f17a3..085b180642aa 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm.h +++ b/sys/compat/linuxkpi/common/include/linux/pm.h @@ -53,20 +53,36 @@ struct dev_pm_info { #define PM_EVENT_FREEZE 0x0001 #define PM_EVENT_SUSPEND 0x0002 +#define pm_sleep_ptr(_p) \ + IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL + #ifdef CONFIG_PM_SLEEP #define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ const struct dev_pm_ops _name = { \ - .suspend = _suspendfunc, \ - .resume = _resumefunc, \ - .freeze = _suspendfunc, \ - .thaw = _resumefunc, \ - .poweroff = _suspendfunc, \ - .restore = _resumefunc, \ + .suspend = _suspendfunc, \ + .resume = _resumefunc, \ + .freeze = _suspendfunc, \ + .thaw = _resumefunc, \ + .poweroff = _suspendfunc, \ + .restore = _resumefunc, \ +} + +#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ +const struct dev_pm_ops _name = { \ + .suspend = _suspendfunc, \ + .resume = _resumefunc, \ + .freeze = _suspendfunc, \ + .thaw = _resumefunc, \ + .poweroff = _suspendfunc, \ + .restore = _resumefunc, \ } #else #define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ const struct dev_pm_ops _name = { \ } +#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \ +const struct dev_pm_ops _name = { \ +} #endif #endif /* _LINUXKPI_LINUX_PM_H */