From fe259b52b77d4a617bc99dac03dc70ccf244140c Mon Sep 17 00:00:00 2001 From: masnagam Date: Sun, 20 Jul 2025 08:52:02 +0900 Subject: [PATCH] =?UTF-8?q?driver:=20`=5F=5Finit`=20=E3=81=A8=20`=5F=5Fexi?= =?UTF-8?q?t`=20=E3=82=92=E6=8C=87=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit モジュールの初期化および終了関数にそれぞれ `__init` と `__exit` を指定 した.これらマクロを使用していなくても大きな問題は発生しないと考えられ るが,一般的な作法として追加した. これらマクロの説明は以下を参照: * https://tldp.org/LDP/lkmpg/2.4/html/x281.htm * https://fastbitlab.com/linux-device-driver-programming-lecture-18-__init-and-__exit-macros/ * https://shnoh171.github.io/linux%20kernel/2019/09/01/linux-kernel-module-basics.html --- driver/driver_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driver/driver_module.c b/driver/driver_module.c index 7e2e695..7df41b6 100644 --- a/driver/driver_module.c +++ b/driver/driver_module.c @@ -17,7 +17,7 @@ #include "firmware.h" #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,4) -static int m_init(void) +static int __init m_init(void) #else int init_module(void) #endif @@ -53,7 +53,7 @@ int init_module(void) } #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,15,4) -static void m_cleanup(void) +static void __exit m_cleanup(void) #else void cleanup_module(void) #endif