Linuxデバイスドライバ開発 class_create
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
* Linuxデバイスドライバ開発 class_create [#oa9eec21]
#seo(description,Linuxのデバイスドライバの書き方をメモ)
#seo(keywords,Linux, Device Driver)
以前の[[Linuxデバイスドライバ開発 デバイスクラス]] などで...
#highlight(c){{
$ make
make -C /lib/modules/6.8.0-45-generic/build M=/home/devel...
make[1]: ディレクトリ '/usr/src/linux-headers-6.8.0-45-ge...
warning: the compiler differs from the one used to build ...
The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubunt...
You are using: gcc-13 (Ubuntu 13.2.0-23ubuntu...
CC [M] /home/developer/work/skel_drv/skel_drv.o
In file included from /home/developer/work/skel_drv/skel_...
/home/developer/work/skel_drv/skel_drv.c: In function ‘sk...
./include/linux/init.h:184:22: error: passing argument 1 ...
184 | #define THIS_MODULE (&__this_module)
| ~^~~~~~~~~~~~~~~
| |
| struct module *
/home/developer/work/skel_drv/skel_drv.c:64:39: note: in ...
64 | skel_drv_class = class_create(THIS_MODULE...
| ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
from /home/developer/work/skel_drv/skel_...
./include/linux/device/class.h:228:54: note: expected ‘co...
228 | struct class * __must_check class_create(const ch...
| ~~~~~~~~...
/home/developer/work/skel_drv/skel_drv.c:64:26: error: to...
64 | skel_drv_class = class_create(THIS_MODULE...
| ^~~~~~~~~~~~
./include/linux/device/class.h:228:29: note: declared here
228 | struct class * __must_check class_create(const ch...
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:243: /home/developer...
make[2]: *** [/usr/src/linux-headers-6.8.0-45-generic/Mak...
make[1]: *** [Makefile:240: __sub-make] エラー 2
make[1]: ディレクトリ '/usr/src/linux-headers-6.8.0-45-ge...
make: *** [Makefile:7: default] エラー 2
}}
修正は大層なものではなく、THIS_MODULEの引数が不要になった...
#highlight(c){{
--- skel_drv.c.orig 2022-05-12 17:31:49.000000000 +0900
+++ skel_drv.c 2024-11-14 14:31:22.708723534 +0900
@@ -61,7 +61,9 @@
}
/* デバイスクラスを作成する */
- skel_drv_class = class_create(THIS_MODULE, SKEL_DRV_NAM...
+// skel_drv_class = class_create(THIS_MODULE, SKEL_DRV_N...
+ /* kernel-6.4 以降はAPI仕様が変更 */
+ skel_drv_class = class_create(SKEL_DRV_NAME);
if (IS_ERR(skel_drv_class)) {
pr_err("SKEL_DRV: class_create failed\n");
goto unregister_region;
}}
#highlight(end)
#br
#include(Linuxデバイスドライバ開発,notitle)
#br
#htmlinsert(amazon_book.html);
終了行:
* Linuxデバイスドライバ開発 class_create [#oa9eec21]
#seo(description,Linuxのデバイスドライバの書き方をメモ)
#seo(keywords,Linux, Device Driver)
以前の[[Linuxデバイスドライバ開発 デバイスクラス]] などで...
#highlight(c){{
$ make
make -C /lib/modules/6.8.0-45-generic/build M=/home/devel...
make[1]: ディレクトリ '/usr/src/linux-headers-6.8.0-45-ge...
warning: the compiler differs from the one used to build ...
The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubunt...
You are using: gcc-13 (Ubuntu 13.2.0-23ubuntu...
CC [M] /home/developer/work/skel_drv/skel_drv.o
In file included from /home/developer/work/skel_drv/skel_...
/home/developer/work/skel_drv/skel_drv.c: In function ‘sk...
./include/linux/init.h:184:22: error: passing argument 1 ...
184 | #define THIS_MODULE (&__this_module)
| ~^~~~~~~~~~~~~~~
| |
| struct module *
/home/developer/work/skel_drv/skel_drv.c:64:39: note: in ...
64 | skel_drv_class = class_create(THIS_MODULE...
| ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
from /home/developer/work/skel_drv/skel_...
./include/linux/device/class.h:228:54: note: expected ‘co...
228 | struct class * __must_check class_create(const ch...
| ~~~~~~~~...
/home/developer/work/skel_drv/skel_drv.c:64:26: error: to...
64 | skel_drv_class = class_create(THIS_MODULE...
| ^~~~~~~~~~~~
./include/linux/device/class.h:228:29: note: declared here
228 | struct class * __must_check class_create(const ch...
| ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:243: /home/developer...
make[2]: *** [/usr/src/linux-headers-6.8.0-45-generic/Mak...
make[1]: *** [Makefile:240: __sub-make] エラー 2
make[1]: ディレクトリ '/usr/src/linux-headers-6.8.0-45-ge...
make: *** [Makefile:7: default] エラー 2
}}
修正は大層なものではなく、THIS_MODULEの引数が不要になった...
#highlight(c){{
--- skel_drv.c.orig 2022-05-12 17:31:49.000000000 +0900
+++ skel_drv.c 2024-11-14 14:31:22.708723534 +0900
@@ -61,7 +61,9 @@
}
/* デバイスクラスを作成する */
- skel_drv_class = class_create(THIS_MODULE, SKEL_DRV_NAM...
+// skel_drv_class = class_create(THIS_MODULE, SKEL_DRV_N...
+ /* kernel-6.4 以降はAPI仕様が変更 */
+ skel_drv_class = class_create(SKEL_DRV_NAME);
if (IS_ERR(skel_drv_class)) {
pr_err("SKEL_DRV: class_create failed\n");
goto unregister_region;
}}
#highlight(end)
#br
#include(Linuxデバイスドライバ開発,notitle)
#br
#htmlinsert(amazon_book.html);
ページ名: