]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
staging: gpib: Return -EINTR on device clear
authorDave Penkler <dpenkler@gmail.com>
Sun, 28 Sep 2025 11:33:59 +0000 (13:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:10:31 +0000 (14:10 +0100)
commit aaf2af1ed147ef49be65afb541a67255e9f60d15 upstream.

When the ATN (Attention) line is asserted during a read we get a
NIUSB_ATN_STATE_ERROR during a read. For the controller to send a
device clear it asserts ATN. Normally this is an error but in the case
of a device clear it should be regarded as an interrupt.

Return -EINTR when the Device Clear Active State (DCAS) is entered
else signal an error with dev_dbg with status instead of just dev_err.

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/gpib/ni_usb/ni_usb_gpib.c

index 73ea72f34c0a33a2276aaf95a939ba52fdf84282..4e9a654bf51f4fc9fcaf917bb2fdef48bb25e8ca 100644 (file)
@@ -694,8 +694,12 @@ static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length,
                 */
                break;
        case NIUSB_ATN_STATE_ERROR:
-               retval = -EIO;
-               dev_err(&usb_dev->dev, "read when ATN set\n");
+               if (status.ibsta & DCAS) {
+                       retval = -EINTR;
+               } else {
+                       retval = -EIO;
+                       dev_dbg(&usb_dev->dev, "read when ATN set stat: 0x%06x\n", status.ibsta);
+               }
                break;
        case NIUSB_ADDRESSING_ERROR:
                retval = -EIO;