mirror of
https://github.com/opnsense/src.git
synced 2026-02-24 18:30:55 -05:00
Factor out module_pci_driver() from 366d68f283 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
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D46467
(cherry picked from commit f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a)
33 lines
859 B
C
33 lines
859 B
C
/*-
|
|
* 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 */
|