Guest User

GPIO Driver

a guest
Jan 22nd, 2023
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | Source Code | 0 0
  1.    
  2.     for (i = 0; i < NUMBER_OF_GPIOS; i++)
  3.     {
  4.         error_code
  5.           = request_irq(gpio_to_irq(gpio_list[i].gpio), irq_handlers[i],
  6.                         IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, gpio_list[i].label, NULL);
  7.         if (error_code)
  8.         {
  9.             pr_err("Could not get the requested IRQ for %s\n", DEVICE_NAME);
  10.             gpio_free_array(gpio_list, i);
  11.  
  12.             // Need to free the irqs already asked for
  13.             for (y = i; y > 0; y--)
  14.                 free_irq(gpio_list[y].gpio, NULL);
  15.             device_destroy(cl, devt);
  16.             unregister_chrdev_region(devt, NB_PERIPHERALS);
  17.             class_destroy(cl);
  18.             return error_code;
  19.         }
  20.     }
Tags: GPIO Driver
Advertisement
Add Comment
Please, Sign In to add comment