gpiolib-cdev.c (f91ca89e924eb287915522664a31afc71a49c05b) gpiolib-cdev.c (c4e98006092b59898111ccf7552c7b9c7f137236)
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/anon_inodes.h>
4#include <linux/atomic.h>
5#include <linux/bitmap.h>
6#include <linux/build_bug.h>
7#include <linux/cdev.h>
8#include <linux/cleanup.h>

--- 1551 unchanged lines hidden (view full) ---

1560 unsigned int i;
1561 u64 flags, edflags;
1562 int ret;
1563
1564 for (i = 0; i < lr->num_lines; i++) {
1565 line = &lr->lines[i];
1566 desc = lr->lines[i].desc;
1567 flags = gpio_v2_line_config_flags(lc, i);
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/anon_inodes.h>
4#include <linux/atomic.h>
5#include <linux/bitmap.h>
6#include <linux/build_bug.h>
7#include <linux/cdev.h>
8#include <linux/cleanup.h>

--- 1551 unchanged lines hidden (view full) ---

1560 unsigned int i;
1561 u64 flags, edflags;
1562 int ret;
1563
1564 for (i = 0; i < lr->num_lines; i++) {
1565 line = &lr->lines[i];
1566 desc = lr->lines[i].desc;
1567 flags = gpio_v2_line_config_flags(lc, i);
1568 gpio_v2_line_config_flags_to_desc_flags(flags, &desc->flags);
1569 edflags = flags & GPIO_V2_LINE_EDGE_DETECTOR_FLAGS;
1570 /*
1568 /*
1571 * Lines have to be requested explicitly for input
1572 * or output, else the line will be treated "as is".
1569 * Lines not explicitly reconfigured as input or output
1570 * are left unchanged.
1573 */
1571 */
1572 if (!(flags & GPIO_V2_LINE_DIRECTION_FLAGS))
1573 continue;
1574 gpio_v2_line_config_flags_to_desc_flags(flags, &desc->flags);
1575 edflags = flags & GPIO_V2_LINE_EDGE_DETECTOR_FLAGS;
1574 if (flags & GPIO_V2_LINE_FLAG_OUTPUT) {
1575 int val = gpio_v2_line_config_output_value(lc, i);
1576
1577 edge_detector_stop(line);
1578 ret = gpiod_direction_output(desc, val);
1579 if (ret)
1580 return ret;
1576 if (flags & GPIO_V2_LINE_FLAG_OUTPUT) {
1577 int val = gpio_v2_line_config_output_value(lc, i);
1578
1579 edge_detector_stop(line);
1580 ret = gpiod_direction_output(desc, val);
1581 if (ret)
1582 return ret;
1581 } else if (flags & GPIO_V2_LINE_FLAG_INPUT) {
1583 } else {
1582 ret = gpiod_direction_input(desc);
1583 if (ret)
1584 return ret;
1585
1586 ret = edge_detector_update(line, lc, i, edflags);
1587 if (ret)
1588 return ret;
1589 }

--- 1413 unchanged lines hidden ---
1584 ret = gpiod_direction_input(desc);
1585 if (ret)
1586 return ret;
1587
1588 ret = edge_detector_update(line, lc, i, edflags);
1589 if (ret)
1590 return ret;
1591 }

--- 1413 unchanged lines hidden ---