0

I'm testing a driver that I've built into the kernel and would like to verify that my DRIVER_exit command functions as expected. The DRIVER_init command executes automatically during boot, I assume the exit command does the same on shutdown. When testing the driver as a module I utilized insmod and rmmod to execute _init and _exit functions. Is there any command to trigger the exit function prematurely similar to rmmod? Alternatively is there a system log I can look at to see how my last shutdown sequence went?

2
  • 1
    If the driver is not too long, include it in the question if possib;e. Otherwise, including a link to the driver would be helpful. Commented Mar 13, 2016 at 22:23
  • Have you tried printk logging in your _init and _exit functions? BTW, a quick google search for printk in module _exit function shows a few questions on Stack Overflow that might be relevant. This question probably belongs on Stack Overflow, not here.
    – cas
    Commented Mar 14, 2016 at 1:11

1 Answer 1

0

If your driver is compiled statically in the kernel, it is not possible to call the exit function of your module because it is will be excluded from the kernel at linking time. Have a look at the __exit and __exitused definitions in include/linux/init.h

2
  • Nevertheless one may put some logic in to unbind (->remove() in the driver) callback.
    – 0andriy
    Commented Mar 14, 2016 at 7:59
  • Yeah, he explicitly asked about the exit function of the driver that he already has. But indeed, one may still unbind the driver at anytime as long as the .remove callback is present. Commented Mar 14, 2016 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.