gpiolib: cdev: add GPIO_V2_LINE_FLAG_EDGE_BOTH and use it in edge_irq_thread()
Add GPIO_V2_LINE_FLAG_EDGE_BOTH macro and use it in edge_irq_thread() to improve readability of edge handling cases. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
Родитель
43ddebdd09
Коммит
5e2ca893d7
|
@ -510,6 +510,8 @@ struct linereq {
|
|||
(GPIO_V2_LINE_FLAG_EDGE_RISING | \
|
||||
GPIO_V2_LINE_FLAG_EDGE_FALLING)
|
||||
|
||||
#define GPIO_V2_LINE_FLAG_EDGE_BOTH GPIO_V2_LINE_EDGE_FLAGS
|
||||
|
||||
#define GPIO_V2_LINE_VALID_FLAGS \
|
||||
(GPIO_V2_LINE_FLAG_ACTIVE_LOW | \
|
||||
GPIO_V2_LINE_DIRECTION_FLAGS | \
|
||||
|
@ -560,8 +562,7 @@ static irqreturn_t edge_irq_thread(int irq, void *p)
|
|||
line->timestamp_ns = 0;
|
||||
|
||||
eflags = READ_ONCE(line->eflags);
|
||||
if (eflags == (GPIO_V2_LINE_FLAG_EDGE_RISING |
|
||||
GPIO_V2_LINE_FLAG_EDGE_FALLING)) {
|
||||
if (eflags == GPIO_V2_LINE_FLAG_EDGE_BOTH) {
|
||||
int level = gpiod_get_value_cansleep(line->desc);
|
||||
|
||||
if (level)
|
||||
|
|
Загрузка…
Ссылка в новой задаче