Driver complexity reduction

S

spin89

Guest
Hello everyone,

i'm writing GPIO event driver. Which will be used for GPIO monitoring.
Half through, I realized that my design is too complicated. Soo I started considering other options. Currently my driver is capable of handling multiple GPIOs and multiple requests. Now I want to redesign it to handle only one GPIO and only one request at the time. With this modification problem will occur when I will want to monitor multiple GPIOs at the same time. For that I will have to insert multiple instances of the same driver.
I'm wondering, if this kind of implementation is used and if it is a good practise?

TY for your help and have a nice day. :D
 


Hello everyone,

i'm writing GPIO event driver. Which will be used for GPIO monitoring.
Half through, I realized that my design is too complicated. Soo I started considering other options. Currently my driver is capable of handling multiple GPIOs and multiple requests. Now I want to redesign it to handle only one GPIO and only one request at the time. With this modification problem will occur when I will want to monitor multiple GPIOs at the same time. For that I will have to insert multiple instances of the same driver.
I'm wondering, if this kind of implementation is used and if it is a good practise?

TY for your help and have a nice day. :D
I wish I knew..... :( I keep looking around here, hoping I can use my skills to help out SOME people, but..... Ah well, someone'll come along sooner or later to help you..... :3
 
I have the same problem :D :D TY anyway :D
I wish I knew..... :( I keep looking around here, hoping I can use my skills to help out SOME people, but..... Ah well, someone'll come along sooner or later to help you..... :3
 
I feel like a general case is needed.

Basically it comes to, if it is OK to have multiple instances of the same driver inserted.


Example:
You are working on RPI2 and you have a driver named GPIO_MONITOR.
GPIO_MONITOR lets you monitor events occurring on GPIOX (X is a number of some GPIO) through file created in '/dev' directory.
You wish to monitor events on GPIO5 and GPIO6.
You use following commands:

> insmod GPIO_MONITOR.ko gpio_num=5
> insmod GPIO_MONITOR.ko gpio_num=6

Files created by the driver are '/dev/gpio_monitor_05' and '/dev/gpio_monitor_06'.

> (cat /dev/gpio_monitor_05 > LOG_GPIO5)&
> (cat /dev/gpio_monitor_06 > LOG_GPIO6)&

All the events are logged into LOG_GPIO5 and LOG_GPIO6 file.

If 'lsmod' command is used. You will see that there are two instances
of the GPIO_MONITOR driver used. One for GPIO5 and one for GPIO6.


I hope that explains it a little better :D
 
Last edited:

Staff online

Members online


Top