From nobody Sat Oct 10 18:29:02 2026 X-Original-To: dev-commits-src-main@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 4j2C1B4W2Yz6vdF6 for ; Sat, 10 Oct 2026 18:29:02 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j2C1B2vNnz4nBY for ; Sat, 10 Oct 2026 18:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791656942; 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=tCEtLYmGyrEkSpY48vEnr42oKwjIkAbkOnlSBCtKs1Y=; b=VBgd9FTB8EtSVKX9BAfnFHH0705u2d8/pu561XYc6mLHWP9NR/QaixhNpBTOmPf3mkdAG0 t4/rFnMpS+XkbAHi39tnrwkFpfiDo3EaMU8RtnalEHGc2m59btAa+Spon6yR5Q90sZfm13 if+4GeRA8W6Tplcw1Wd9VQxQ1lVyt1s/zJJKXuPugjRliyxURWCFyTSu3xI4OOYWYNoI4g wWEZEjq5xGK1LCyrfMO8fQoKV2xdz7uUrTLNoKRwBhAb+zmwUW73cItWjbrI4R1X9/KbHu Hm0Btwj3ObZcENG789ISI4QsiuD5nZaW+fEDCLB3bvZMcmIsCifWjlnPaqeCew== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791656942; b=W70KttAKl1yCPEm0i1qG/rWN9IrBe/6iac0Dfmd+G28iyoANEwHLe5Un4M71nHPg2m/g14 fVz+n2Tct9mtz82V5WVmE0OJXBAh8eheLLwio+sW4U0rBrPNiqHJhqtPxUudhdGr7PL30I HdTOeUdbKVxOCaBIPr2fy58TMVntjNF9Bv6t4J6T9ppU30lrEPh2oINWTxsnK4PSyKxqUz uhrm/aC5/DjBRjE+4V2MqIiPCsahlO1dIYjV4QIl2veDgG2Te8nrEVZ7QrHiMkDQtTrHrE 1khUWYnWLlWV3muKnU+iVR4+H8lwA21e+TiLq5DO2WkicM1aVpZkZCN0PgOOqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791656942; 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=tCEtLYmGyrEkSpY48vEnr42oKwjIkAbkOnlSBCtKs1Y=; b=R8YPqu7FJY7ggSKWIySmSVSUXS32tjesYSVOtE6LpDYZ3QxYnJwSR6d1uRS3qlgdd5wbfN N57V5XwQbZXY0c4leKtGw5TMWZ/MGfyTRuc37HLpAXHkj8jVPZBa5OHpJ88TAF1o5socOP Exr6ygo2LjProNDhPcEZEECJ1Wrl+L8UnwQ56gqIqafrVVbEzWEDoW5NXayJDHJbmdX1pf oKypUvLI5v4cPibo0baa3/G5E7yBiI+4B+dxLNZdqCs38pAKXyaf266eG4HY78moM0VBps khD0bvzk6oAsCGcU5Qfs+a7kjnXOAd8JZxqIykR62RfRND7PXepMHfcrvOVwBg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j2C1B0pk3z15cG for ; Sat, 10 Oct 2026 18:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 22d35 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 10 Oct 2026 18:29:02 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 863fe7ae5152 - main - LinuxKPI: re-implement pm_runtime.h List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: 863fe7ae5152926fab0380a78ba26b6ba4a2d65f Auto-Submitted: auto-generated Date: Sat, 10 Oct 2026 18:29:02 +0000 Message-Id: <6aca83ee.22d35.367468dc@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=863fe7ae5152926fab0380a78ba26b6ba4a2d65f commit 863fe7ae5152926fab0380a78ba26b6ba4a2d65f Author: Bjoern A. Zeeb AuthorDate: 2026-07-11 14:36:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-10-10 18:28:32 +0000 LinuxKPI: re-implement pm_runtime.h The original implementation was based on OpenBSD under public domain but just defined the functions to void. FreeBSD later extended the file with more inline functions or dealing with differences in Linux versions. This rework tries to group some functions, adds properly typed arguments and return values in some cases. It further adjusts return values based on the !CONFIG_PM expectations. Lastly pr_debug() calls are added so we could see if/how much these functions are used in new/other works rather than code just compiling but the functions entirely being ignored without the knowledge of the person porting code. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D58169 --- .../linuxkpi/common/include/linux/pm_runtime.h | 164 +++++++++++++++++---- 1 file changed, 134 insertions(+), 30 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h index 8c7d9f3a8e1c..c4fcfad2860d 100644 --- a/sys/compat/linuxkpi/common/include/linux/pm_runtime.h +++ b/sys/compat/linuxkpi/common/include/linux/pm_runtime.h @@ -1,60 +1,164 @@ -/* Public domain. */ +/* + * Copyright (c) 2026 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. + * + * SPDX-License-Identifier: BSD-2-Clause + */ #ifndef _LINUXKPI_LINUX_PM_RUNTIME_H_ #define _LINUXKPI_LINUX_PM_RUNTIME_H_ +#include /* pr_debug */ #include #include -#define pm_runtime_mark_last_busy(x) (void)(x) -#define pm_runtime_use_autosuspend(x) (void)(x) -#define pm_runtime_dont_use_autosuspend(x) (void)(x) -#define pm_runtime_put_autosuspend(x) (void)(x) -#define pm_runtime_set_autosuspend_delay(x, y) (void)(x); (void)(y) -#define pm_runtime_set_active(x) (void)(x) -#define pm_runtime_allow(x) (void)(x) -#define pm_runtime_put_noidle(x) (void)(x) -#define pm_runtime_forbid(x) (void)(x) -#define pm_runtime_get_noresume(x) (void)(x) -#define pm_runtime_put(x) (void)(x) -#define pm_runtime_enable(x) (void)(x) -#define pm_runtime_disable(x) (void)(x) -#define pm_runtime_autosuspend(x) (void)(x) -#define pm_runtime_resume(x) (void)(x) +/* + * Return values, where needed, are based on the !CONFIG_PM/!CONFIG_PM_SLEEP + * assumption given we currently do not support anything in here. + * We could #error in case CONFIG_PM or CONFIG_PM_SLEEP are set but that + * would likely be too intrusive for now. + * + * We could likely use dev_dbg() in here instead of pr_debug() if the former + * would be mapped to the latter with additional dev information. + */ + +static inline void +pm_runtime_enable(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_disable(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_allow(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_forbid(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + + +static inline void +pm_runtime_mark_last_busy(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_get_noresume(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_put_noidle(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline bool +pm_runtime_suspended(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); + return (false); +} static inline int -pm_runtime_get_sync(struct device *dev) +pm_runtime_autosuspend(struct device *dev) +{ + pm_runtime_mark_last_busy(dev); + pr_debug("%s TODO\n", __func__); + return (-ENOSYS); +} + +static inline void +pm_runtime_use_autosuspend(struct device *dev __unused) { - return 0; + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_dont_use_autosuspend(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + +static inline void +pm_runtime_set_autosuspend_delay(struct device *dev __unused, int delay __unused) +{ + pr_debug("%s TODO\n", __func__); } static inline int -pm_runtime_get_if_in_use(struct device *dev) +pm_runtime_put_autosuspend(struct device *dev) { - return 1; + pm_runtime_mark_last_busy(dev); + pr_debug("%s TODO\n", __func__); + return (-ENOSYS); } -#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION < 60900 static inline int -pm_runtime_get_if_active(struct device *dev, bool x) -#else +pm_runtime_set_active(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); + return (0); +} + +static inline void +pm_runtime_put(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); +} + static inline int -pm_runtime_get_if_active(struct device *dev) -#endif +pm_runtime_resume(struct device *dev __unused) { - return 1; + pr_debug("%s TODO\n", __func__); + return (1); } static inline int -pm_runtime_suspended(struct device *dev) +pm_runtime_get_sync(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); + return (1); +} + +static inline int +pm_runtime_get_if_in_use(struct device *dev __unused) +{ + pr_debug("%s TODO\n", __func__); + return (-EINVAL); +} + +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION < 60900 +static inline int +pm_runtime_get_if_active(struct device *dev __unused, bool x __unused) +#else +static inline int +pm_runtime_get_if_active(struct device *dev __unused) +#endif { - return 0; + pr_debug("%s TODO\n", __func__); + return (-EINVAL); } static inline int -pm_runtime_resume_and_get(struct device *dev) +pm_runtime_resume_and_get(struct device *dev __unused) { - return 0; + pr_debug("%s TODO\n", __func__); + return (1); } #endif /* _LINUXKPI_LINUX_PM_RUNTIME_H_ */