diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2024-08-28 14:21:33 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2024-09-05 12:46:21 +0000 |
| commit | f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a (patch) | |
| tree | 0f0d44daa2e9282dd80205bcd6b5227e22c899bc /sys/compat/linuxkpi/common/include/linux/device | |
| parent | d52c31904218c79424435b69b9ec4098885d800f (diff) | |
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/device')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/device/driver.h | 33 |
1 files changed, 33 insertions, 0 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 <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 */ |
