Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global variables in linux .ko for multiple devices [closed]

I have a Wi-Fi driver (a .ko file) for embedded Linux system and there are two identical Wi-Fi devices on my board. After insmod-ing the .ko file into the kernel, the system is able to drive these two Wi-Fi devices.

My question is: if the driver's source code contains global variables (and static variables), do these two devices share the same set of variables? Or, there will be two driver instances for each device?

Thanks!

like image 403
guan boshen Avatar asked Dec 19 '22 17:12

guan boshen


1 Answers

Linux kernel modules are linked into the kernel the same as any files would be normally in C. If they have global variables, there is only one copy of each global variable. They can even use global variables from other modules.

like image 71
user253751 Avatar answered Jan 12 '23 23:01

user253751