
You need a proper permission to configure GPIO when `ioctl()` or/and `open()`
when `refcount` == 0.

You get the value of `ERR_PERM(-6)` when `read()` if you opened it with
`O_WRONLY`. So keep the value in your variable when writing as you can not
retreive the value from the register. In the same way, you get `ERR_PERM` when
you `write()` if you opend it with `O_RDONLY`. That is intuitive, I think.

e.g.

```
open("/dev/gpio1", O_WRONLY);
open("/dev/gpio2", O_RDONLY);

open("/dev/gpio3", O_WRONLY, GPIO_SPD_FAST);

open("/dev/gpio4", O_RDONLY, GPIO_INT_FALLING | GPIO_INT_RISING);
open("/dev/gpio4", O_RDONLY, GPIO_CONF_PULLDOWN | GPIO_INT_RISING);
ioctl(fd, C_EVENT, user_defined_isr);

open("/dev/gpio5", O_RDWR); --> ERR_UNDEF(-1)

```
