[PATCH 1/8] staging: gpib: Fix request_system_control in gpio

From: Dave Penkler
Date: Fri Apr 18 2025 - 13:35:15 EST


The implementation of the bb_request_system_control function
confused setting controller-in-charge with becoming system-controller.

Remove setting controller-in-charge and add initialization of the
control lines for the system-controller role.

Fixes: 4cd654f84769 ("staging: gpib: Add gpio bitbang GPIB driver")
Tested-by: Dave Penkler <dpenkler@xxxxxxxxx>
Signed-off-by: Dave Penkler <dpenkler@xxxxxxxxx>
---
drivers/staging/gpib/gpio/gpib_bitbang.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c
index 9670522fe36e..29aab72c1f0f 100644
--- a/drivers/staging/gpib/gpio/gpib_bitbang.c
+++ b/drivers/staging/gpib/gpio/gpib_bitbang.c
@@ -889,9 +889,13 @@ static int bb_request_system_control(struct gpib_board *board, int request_contr
if (!request_control)
return -EINVAL;

- set_bit(CIC_NUM, &board->status);
- // drive DAV & EOI false, enable NRFD & NDAC irqs
- SET_DIR_WRITE(board->private_data);
+ gpiod_direction_output(REN, 1); /* user space must enable REN if needed */
+ gpiod_direction_output(IFC, 1); /* user space must toggle IFC if needed */
+ if (sn7516x)
+ gpiod_direction_output(DC, 0); /* enable ATN as output on SN75161/2 */
+
+ gpiod_direction_input(SRQ);
+
return 0;
}

--
2.49.0