-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LinuxKPI: add general module_driver(), use it for module_pci_driver()
Factor out module_pci_driver() from 366d68f 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
- Loading branch information
Bjoern A. Zeeb
authored and
Bjoern A. Zeeb
committed
Sep 5, 2024
1 parent
d52c319
commit f5c7fee
Showing
2 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <sys/cdefs.h> | ||
#include <linux/module.h> | ||
|
||
#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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters