]> www.infradead.org Git - users/willy/linux.git/commitdiff
staging: gpib: Fix request_system_control in gpio
authorDave Penkler <dpenkler@gmail.com>
Fri, 18 Apr 2025 17:34:27 +0000 (19:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 14:08:26 +0000 (16:08 +0200)
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@gmail.com>
Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Link: https://lore.kernel.org/r/20250418173434.2892-2-dpenkler@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/gpio/gpib_bitbang.c

index 9670522fe36e58d593628ae3bf55302e487bfbdd..29aab72c1f0fc4239f689402939285d62b332940 100644 (file)
@@ -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;
 }