From nobody Tue May 17 23:38:11 2022 X-Original-To: dev-commits-src-branches@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 50EB61ADE8ED; Tue, 17 May 2022 23:38:12 +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 4L2sxc1BQCz3DZH; Tue, 17 May 2022 23:38:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652830692; 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=R5WpXV70+o312F0znaYiGG1ZdlVIUZBrLTks+M7Sp2A=; b=nQKRQJR4OHDHPfvNd2IIT6XYrJUc4QDY9WmOKOlzfocpZ4YiwFu5+nSOoDZgCupG6hwsZp L7GjzhJwGqymr/Vrb5Se7egWrRAWIMGnrBcq2gDxwZo7EDSLY/5PPZRcM2P4RjoUi2Ax/4 K3UvWxJvtxzLFuggdD16XtcnUwd89jUlhtJWg6MKGe1ZhlArrHMSa0JHVMEwFl0ZDwy2RD YxDhwAOHCvuTMi2nNnOHiQvL3bzXED/OPXwEEcpSjXYHhpobDyv7BBVhJl2vn2514QkZ0i NRLqzxTHWpdJ4jI6HRLCe289lGniOraA7MNJZLAEHL9vnMSwNwqUMSfhGUKENA== 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 044991E39D; Tue, 17 May 2022 23:38:12 +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 24HNcBbh011367; Tue, 17 May 2022 23:38:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24HNcBHP011366; Tue, 17 May 2022 23:38:11 GMT (envelope-from git) Date: Tue, 17 May 2022 23:38:11 GMT Message-Id: <202205172338.24HNcBHP011366@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 5f684c7cb8ee - stable/13 - Deprecate the 'devclass' argument from *DRIVER_MODULE() macros. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5f684c7cb8ee9a1dfb5263514738aca3704660dd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652830692; 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=R5WpXV70+o312F0znaYiGG1ZdlVIUZBrLTks+M7Sp2A=; b=XxdgowrPO38lrxGCmvUXvVWLQq9h8zmunaqc0IS5gQODwNUvyA7yi1wm0HGVyY/7XI+tBq blOCooxxZilWazdgBs9kGKOqQ71aYodHxr0YLZeqxoHWB47XDTbXFCPyo9rac3SNub/h+f uSrDiRp//p46r2VLFNxbL7+PZrYSv/UumUajdAGJri0KTI1IbDUgr6CFCD6e+zXoUiOzgG JUvCaoWom2D03vXjZg+aO8EC57THWQCV9dqAuxu4LBpiPGVk80W7dqwbJpfEyb5HNaC4jw FidvtrwLZ/q/oofVxO1avg7ZCA7iCNsATFs5OjA8Qwpcq62KqQWBIlSuYODnaw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652830692; a=rsa-sha256; cv=none; b=M5YuhSpX8M8zfPMfhRmHORHszv3z71+96xHvWVpc35RiWnAxJDFAGaE47qXXuji8AY2vio EiuzA7TrqhHPy7CGWb7OkhR7NxX7noYCnqlckBWQQzB/jxWxIi+HEUk0WvFbOlvlFikoTh n0k2DhYWszdoEz7USnWNzroHFtiizem4HIMXG0qkGW8M6tODe2N8Rm8Z7r8HbhIVQsHP42 2M15KUF3QHveyJmFbWumEcY10ilhdz3aBBOEiTpmG9dEt1cg04ghrJ4aehuz7voHvbNq4Y R9A9jNjbLbAAFPEj6GBGylQU3xGyIK7HeXDTL3Ak93rTGsuxz8JCts7it9ewXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=5f684c7cb8ee9a1dfb5263514738aca3704660dd commit 5f684c7cb8ee9a1dfb5263514738aca3704660dd Author: John Baldwin AuthorDate: 2022-04-19 17:43:06 +0000 Commit: John Baldwin CommitDate: 2022-05-17 21:17:18 +0000 Deprecate the 'devclass' argument from *DRIVER_MODULE() macros. This argument is useless for the vast majority of drivers. For now, use __VA_ARGS__ wrapper macros so that that the *DRIVER_MODULE() macros accept both the old version (with a devclass) and the new version (which omits the argument and stores NULL in the driver_module_data structure). This provides an API compatiblity shim that can be merged to older stable branches. Once all drivers relevant to 14.0 (both in and out of tree) have been updated, the API compat shims can be dropped. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D34963 (cherry picked from commit 2a99dd30dfaac98fea79f084b3a13c45199e1348) (cherry picked from commit 0fdf5bc531fbde4fa80a85614ba40230062ebde4) (cherry picked from commit b7d4192598fed6581be627fc767f06a62195dfd5) --- share/man/man9/DRIVER_MODULE.9 | 26 ++++++++++--------- share/man/man9/driver.9 | 6 ++--- sys/sys/bus.h | 57 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 65 insertions(+), 24 deletions(-) diff --git a/share/man/man9/DRIVER_MODULE.9 b/share/man/man9/DRIVER_MODULE.9 index 5d5927fba1e8..15f4a87c2276 100644 --- a/share/man/man9/DRIVER_MODULE.9 +++ b/share/man/man9/DRIVER_MODULE.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 24, 2021 +.Dd April 19, 2022 .Dt DRIVER_MODULE 9 .Os .Sh NAME @@ -42,10 +42,10 @@ .In sys/kernel.h .In sys/bus.h .In sys/module.h -.Fn DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" -.Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int order" -.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "int pass" -.Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "devclass_t devclass" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" +.Fn DRIVER_MODULE name busname "driver_t driver" "modeventhand_t evh" "void *arg" +.Fn DRIVER_MODULE_ORDERED name busname "driver_t driver" "modeventhand_t evh" "void *arg" "int order" +.Fn EARLY_DRIVER_MODULE name busname "driver_t driver" "modeventhand_t evh" "void *arg" "int pass" +.Fn EARLY_DRIVER_MODULE_ORDERED name busname "driver_t driver" "modeventhand_t evh" "void *arg" "enum sysinit_elem_order order" "int pass" .Sh DESCRIPTION The .Fn DRIVER_MODULE @@ -74,9 +74,9 @@ which is a pretty clean way of making front ends for different cards using the same driver on the same or different buses. For example, the following is allowed: .Pp -.Fn DRIVER_MODULE foo isa foo_driver foo_devclass NULL NULL ; +.Fn DRIVER_MODULE foo isa foo_driver NULL NULL ; .Pp -.Fn DRIVER_MODULE foo pci foo_driver foo_devclass NULL NULL ; +.Fn DRIVER_MODULE foo pci foo_driver NULL NULL ; .Pp .Fa driver is the driver of type @@ -86,11 +86,6 @@ two most important parts of the call to .Fn DRIVER_MODULE . .Pp The -.Fa devclass -argument contains the kernel-internal information about the device, -which will be used within the kernel driver module. -.Pp -The .Fa evh argument is the event handler which is called when the driver (or module) is loaded or unloaded (see @@ -146,6 +141,13 @@ for a specific pass level. .Xr module 9 , .Xr MODULE_PNP_INFO 9 , .Xr SYSINIT 9 +.Sh HISTORY +Prior to +.Fx 14.0 , +these macros accepted an additional +.Vt devclass_t +argument after +.Fa driver . .Sh AUTHORS This manual page was written by .An Alexander Langer Aq Mt alex@FreeBSD.org . diff --git a/share/man/man9/driver.9 b/share/man/man9/driver.9 index e801a188c732..5c47e39eb3d9 100644 --- a/share/man/man9/driver.9 +++ b/share/man/man9/driver.9 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2020 +.Dd April 19, 2022 .Dt DRIVER 9 .Os .Sh NAME @@ -67,9 +67,7 @@ static driver_t foo_driver = { sizeof(struct foo_softc) }; -static devclass_t foo_devclass; - -DRIVER_MODULE(foo, bogo, foo_driver, foo_devclass, NULL, NULL); +DRIVER_MODULE(foo, bogo, foo_driver, NULL, NULL); .Ed .Sh DESCRIPTION Each driver in the kernel is described by a diff --git a/sys/sys/bus.h b/sys/sys/bus.h index 1fc7fdf25aca..af2be5c5583b 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -779,14 +779,17 @@ struct driver_module_data { int dmd_pass; }; -#define EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ +#define _DRIVER_MODULE_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) \ + NAME + +#define _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ evh, arg, order, pass) \ \ static struct driver_module_data name##_##busname##_driver_mod = { \ evh, arg, \ #busname, \ (kobj_class_t) &driver, \ - &devclass, \ + devclass, \ pass \ }; \ \ @@ -798,19 +801,57 @@ static moduledata_t name##_##busname##_mod = { \ DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \ SI_SUB_DRIVERS, order) -#define EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \ - EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ +#define EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + order, pass) \ + _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, NULL, evh, \ + arg, order, pass) + +#define EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ + evh, arg, order, pass) \ + _EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, &devclass, \ + evh, arg, order, pass) + +#define EARLY_DRIVER_MODULE_ORDERED(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, EARLY_DRIVER_MODULE_ORDERED8, \ + EARLY_DRIVER_MODULE_ORDERED7)(__VA_ARGS__) + +#define EARLY_DRIVER_MODULE7(name, busname, driver, devclass, evh, arg, pass) \ + EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ evh, arg, SI_ORDER_MIDDLE, pass) -#define DRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\ +#define EARLY_DRIVER_MODULE6(name, busname, driver, evh, arg, pass) \ + EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + SI_ORDER_MIDDLE, pass) + +#define EARLY_DRIVER_MODULE(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, \ + EARLY_DRIVER_MODULE7, EARLY_DRIVER_MODULE6)(__VA_ARGS__) + +#define DRIVER_MODULE_ORDERED7(name, busname, driver, devclass, evh, arg,\ order) \ - EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass, \ + EARLY_DRIVER_MODULE_ORDERED8(name, busname, driver, devclass, \ evh, arg, order, BUS_PASS_DEFAULT) -#define DRIVER_MODULE(name, busname, driver, devclass, evh, arg) \ - EARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, \ +#define DRIVER_MODULE_ORDERED6(name, busname, driver, evh, arg, order) \ + EARLY_DRIVER_MODULE_ORDERED7(name, busname, driver, evh, arg, \ + order, BUS_PASS_DEFAULT) + +#define DRIVER_MODULE_ORDERED(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, \ + DRIVER_MODULE_ORDERED7, DRIVER_MODULE_ORDERED6)(__VA_ARGS__) + +#define DRIVER_MODULE6(name, busname, driver, devclass, evh, arg) \ + EARLY_DRIVER_MODULE7(name, busname, driver, devclass, evh, arg, \ BUS_PASS_DEFAULT) +#define DRIVER_MODULE5(name, busname, driver, evh, arg) \ + EARLY_DRIVER_MODULE6(name, busname, driver, evh, arg, \ + BUS_PASS_DEFAULT) + +#define DRIVER_MODULE(...) \ + _DRIVER_MODULE_MACRO(__VA_ARGS__, INVALID, INVALID, \ + DRIVER_MODULE6, DRIVER_MODULE5)(__VA_ARGS__) + /** * Generic ivar accessor generation macros for bus drivers */