title: Problem finding undefined gpio number is raspberry pi 3
body: <p>I am trying to create a driver to access rpi gpio,here is my code:</p>
  <pre><code>#include &lt;linux/init.h&gt;
  #include &lt;linux/gpio.h&gt;
  #include &lt;linux/module.h&gt;
  
  
  static int hello_init(void)
  {
      int i=0;
      for(i=0;i&lt;50;i++){
          if(!gpio_is_valid(i)){
              printk(KERN_INFO &quot;nope&quot;);
          }
          else{
              printk(KERN_INFO &quot;yup&quot;);
          }
      }
          printk(KERN_INFO &quot;Hello\n&quot;);
  
          return 0;
  }
  
  static void hello_exit(void)
  {
          printk(KERN_INFO &quot;bye\n&quot;);
  }
  
  module_init(hello_init);
  module_exit(hello_exit);
  </code></pre>
  <p>the problem is with <code>gpio_is_valid</code>.It always returns 0 for any value of i. I got it from <a href="https://www.kernel.org/doc/Documentation/gpio/gpio-legacy.txt" rel="nofollow noreferrer">https://www.kernel.org/doc/Documentation/gpio/gpio-legacy.txt</a>. Does this not work now, because it's &quot;legacy&quot;. if so, what are the workarounds for the same?</p>