From the course: Linux Device Drivers: Reading, Writing, and Debugging

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Module parameters in device driver code

Module parameters in device driver code

- [Instructor] Let's look at parameters for modules a little bit more. This is valuable because when you write a driver, you may well want to have some parameters, not only for important functionality, but sometimes to say, turn on debug mode, a secret mode that you have that will dump more information or whatever. So let's investigate. If you want to have parameters, then there's some macros that you put in your driver source code. For example, there's one called module_param, all in lowercase, where you put the name of the variable that will get set and it's type and then permission modes. The permission modes represent what the file underneath the SIS module directory will have. If the permission modes you give are zero, then there will not be a file showing up underneath SIS module. And you can have the permissions be writeable, for example. And if they're writeable, that means from user space, somebody could write a value into that file and it would change the variable in your…

Contents