NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-evbarm/52574: awingpio(4) pin enumeration is broken



>Number:         52574
>Category:       port-evbarm
>Synopsis:       awingpio(4) pin enumeration is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-evbarm-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 27 13:05:00 +0000 2017
>Originator:     Tobias Nygren
>Release:        current
>Organization:
>Environment:
>Description:
In awin_gpio_config_pins(), any pins that are marked as in use by device drivers are skipped and not registered with the gpio subsystem. 

The code allocates pins sequentially. So for example if pin 10 is in use, the logical and physical pin numbers are off by one from pin 10 and upwards.

But the handlers for GPIO read/write ioctls interpret the pin number argument as a physical pin, not a logical pin.

This makes it impossible to access upper GPIO pins (ioctl returns EINVAL because it thinks the pin number is too large).

>How-To-Repeat:

>Fix:
Option 1: all pins should be registered with the gpio subsystem but accessing inuse pins should return EBUSY.

Option 2: read/write ioctls need to perform a logical-to-physical translation of pin numbers.

I'm not sure which option is the best.



Home | Main Index | Thread Index | Old Index