From nobody Thu Sep 05 12:48:04 2024 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 4Wzzfr5GGfz5Vyhr; Thu, 05 Sep 2024 12:48:04 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Wzzfr4lfCz4K86; Thu, 5 Sep 2024 12:48:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725540484; 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=gqGzRd5O0D7w8PHoaPcMzfzfqSL0ubY5fb7o4eIRrsg=; b=SXrWmnhJRoRbCOi8jc0+cCOrSwrb/KaaSI2ZjvQGXLgJQDXbGoyjzqNL2dmomXTN6gI8P3 6KcTFaUPf2/J4/35vT2idUpUz43aMdTEzZlqcW1VHydn0HORdzSz1UXjz0phBhLqNWguZs D0IMpFGjIMCR4S//ALRfBo7V9xN2Il4pp0wUsaMHEMnQcEyJsA9Y1RRadm5aD3iZPfReDm e91deJNKLpQwx3T03MI+SzIRCj1+IcAZ3/tfZvB2si5/niPqE5qdyM7Nhq6FZn61tREg14 v7iao+x6CmOG9zCaBUTTHXVYstIo5j7Iw++ckSYd35rpHyFBfmBaXLFHwyQltA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725540484; a=rsa-sha256; cv=none; b=FlP8UFVMZEjOuikCS+JYxX4tCaKUfnem7A8B/BxzhQ554BTTbmR1fZrukMW1l9XHSfDmcN VN/o9fXKlUWcEPlepmohsTdYaG8qoNwMgufRFxYqtB6Bo70WkGHwl8HTTaqpibx4/TZ86X 1nUiH6mwAEI0GSJ9oBSV7IBRFSPOwgnUInsAGJwg/oAq98JVn/+3yG/4xJuuD91a/Z347E +bOskW/NEjUpUmzdXxNV+Bh7o5dLvByrISIl20aw7wC4SxjZhQYV+1UZzNrJSIxsS8kldn XtwZKmu/gqbopbfIfzkLcziRQ7CPNH5vNhN52GQFahMPJcX20H4xnzRqEiS8UQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725540484; 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=gqGzRd5O0D7w8PHoaPcMzfzfqSL0ubY5fb7o4eIRrsg=; b=Ca82Z1/ASeSN5fkwzlSL0WF8bUG3TTmptKKEXpMEVjSqYXjfjxQLceWAxflqpW8BjTTf6H ZJdCGdn3APo9Z0gYxBQM7Xs5OpQ4DuPz/0B8qUfpaJE3YCVBwj1/yVW4k0Aa13ir01ijzL 0Zk+WvB47zu0glolZ3Br1mK+giQgUN3dqasK/Web261+gnNpFY1SJLG5lyhVDqN7vCxIN1 VZ6hSE0I2lI/Y3xPgv1UZhtD8qYdvOn+wjigPlHojjQGTiyj3kZk2HmvNCyE/hqgEs27uK bHn4kI0qBU42u+/clNa55fI0SNaIkSy3WVP/D1nqXqVg0NaX1ERhrZNPUxeGvg== 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 4Wzzfr4Lw2z17RZ; Thu, 5 Sep 2024 12:48:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 485Cm4M1063075; Thu, 5 Sep 2024 12:48:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 485Cm4kx063072; Thu, 5 Sep 2024 12:48:04 GMT (envelope-from git) Date: Thu, 5 Sep 2024 12:48:04 GMT Message-Id: <202409051248.485Cm4kx063072@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: f5c7feee7129 - main - LinuxKPI: add general module_driver(), use it for module_pci_driver() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a commit f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a Author: Bjoern A. Zeeb AuthorDate: 2024-08-28 14:21:33 +0000 Commit: Bjoern A. Zeeb CommitDate: 2024-09-05 12:46:21 +0000 LinuxKPI: add general module_driver(), use it for module_pci_driver() Factor out module_pci_driver() from 366d68f283793 into a general module_driver() so other bus attachments can also use the same kind of macro without duplicating all the lines. Redefine module_pci_driver() using the new general macro. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D46467 --- .../linuxkpi/common/include/linux/device/driver.h | 33 ++++++++++++++++++++++ sys/compat/linuxkpi/common/include/linux/pci.h | 21 ++------------ 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/device/driver.h b/sys/compat/linuxkpi/common/include/linux/device/driver.h new file mode 100644 index 000000000000..03b510c9c8b7 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/device/driver.h @@ -0,0 +1,33 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Bjoern A. Zeeb + * Copyright (c) 2024 The FreeBSD Foundation + * + * Portions of this software were developed by Björn Zeeb + * under sponsorship from the FreeBSD Foundation. + */ + +#ifndef LINUXKPI_LINUX_DEVICE_DRIVER_H +#define LINUXKPI_LINUX_DEVICE_DRIVER_H + +#include +#include + +#define module_driver(_drv, _regf, _unregf) \ +static inline int \ +__CONCAT(__CONCAT(_, _drv), _init)(void) \ +{ \ + return (_regf(&(_drv))); \ +} \ + \ +static inline void \ +__CONCAT(__CONCAT(_, _drv), _exit)(void) \ +{ \ + _unregf(&(_drv)); \ +} \ + \ +module_init(__CONCAT(__CONCAT(_, _drv), _init)); \ +module_exit(__CONCAT(__CONCAT(_, _drv), _exit)) + +#endif /* LINUXKPI_LINUX_DEVICE_DRIVER_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 9457599d31d3..36b970154ad2 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -36,6 +36,7 @@ #define CONFIG_PCI_MSI #include +#include #include #include @@ -274,24 +275,8 @@ extern spinlock_t pci_lock; #define __devexit_p(x) x -#define module_pci_driver(_driver) \ - \ -static inline int \ -_pci_init(void) \ -{ \ - \ - return (linux_pci_register_driver(&_driver)); \ -} \ - \ -static inline void \ -_pci_exit(void) \ -{ \ - \ - linux_pci_unregister_driver(&_driver); \ -} \ - \ -module_init(_pci_init); \ -module_exit(_pci_exit) +#define module_pci_driver(_drv) \ + module_driver(_drv, linux_pci_register_driver, linux_pci_unregister_driver) struct msi_msg { uint32_t data;