title: Driver code in kernel module doesn't execute?
body: <p>Why this kernel module doesn't do anything when i load it?</p>
  
  <pre><code>#include &lt;linux/init.h&gt;
  #include &lt;linux/module.h&gt;
  #include &lt;linux/platform_device.h&gt;
  
  #define DEVICE_NAME "hello-1.00.a"
  #define DRIVER_NAME "hello"
  MODULE_LICENSE("Dual BSD/GPL");
  
  static int hello_init(struct platform_device *pdev){
      printk(KERN_ALERT "Hello, world\n");
      return 0;
  }
  static int hello_exit(struct platform_device *pdev){
      printk(KERN_ALERT "Goodbye, cruel world\n");
      return 0;
  }
  
  static const struct of_device_id myled_of_match[] =
  {
      {.compatible = DEVICE_NAME},
      {},
  };
  
  MODULE_DEVICE_TABLE(of, myled_of_match);
  
  static struct platform_driver hello_driver =
      {
          .driver = {
          .name = DRIVER_NAME,
          .owner = THIS_MODULE,
          .of_match_table = myled_of_match
      },
      .probe = hello_init,
      .remove = hello_exit
  };
  
  module_platform_driver(hello_driver);
  </code></pre>
  
  <p>It musts print <code>Hello, world\n</code>, if i do <code>lsmod</code> the module appear to be loaded:</p>
  
  <pre><code>lsmod
  hello_world 1538 0 - Live 0xbf000000 (O)
  </code></pre>
  
  <p>but nothing is printed neither in the console nor in <code>dmesg</code>.</p>
  
  <p>If i use <code>module_init</code> and <code>module_exit</code> all works, but i need the pointer <code>platform_device *pdev</code> to the device, what can i do?</p>
  
  <p>EDIT:</p>
  
  <p>the original module looks like this:</p>
  
  <pre><code>#include &lt;linux/init.h&gt;
  #include &lt;linux/module.h&gt;
  
  static int hello_init(void){
      printk(KERN_ALERT "Hello, world\n");
      return 0;
  }
  
  static void hello_exit(void){
      printk(KERN_ALERT "Goodbye, cruel world\n");
  }
  
  
  module_init(hello_init);
  module_exit(hello_exit);
  </code></pre>
  
  <p>In my device tree blob is present this entry:</p>
  
  <pre><code>hello {
      compatible = "dglnt,hello-1.00.a";
      reg = &lt;0x41220000 0x10000&gt;;
  };
  </code></pre>