title: How to get complete dependency list of kernel modules at runtime
body: <p>Is there a way to list down from command line the complete dependency list of kernel modules loaded in the kernel at runtime?</p>
  
  <p>Let me clarify my question a little bit. </p>
  
  <p>What I am  trying to do:</p>
  
  <ol>
  <li>I get a list of all loaded modules using <code>lsmod</code></li>
  <li>Then remove/unload currently loaded kernel modules by running a loop. I am using <code>modprobe -r</code>. This step fails (obviously) as some modules are in use.
  (I can switch to using <code>rmmod -r</code>, but don't want to as it is unsafe and can crash the system.)</li>
  <li>Then I want to load the modules one by one again.</li>
  </ol>
  
  <p>It is step 2 that is failing, as I cannot get all the module dependencies before using <code>modprobe -r</code>.</p>
  
  <p>Any ideas, suggestions or comments ?</p>