Skip to content

Commit aaf2af1

Browse files
dpenklergregkh
authored andcommitted
staging: gpib: Return -EINTR on device clear
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 <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 92a2b74 commit aaf2af1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/staging/gpib/ni_usb/ni_usb_gpib.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,8 +697,12 @@ static int ni_usb_read(struct gpib_board *board, u8 *buffer, size_t length,
697697
*/
698698
break;
699699
case NIUSB_ATN_STATE_ERROR:
700-
retval = -EIO;
701-
dev_err(&usb_dev->dev, "read when ATN set\n");
700+
if (status.ibsta & DCAS) {
701+
retval = -EINTR;
702+
} else {
703+
retval = -EIO;
704+
dev_dbg(&usb_dev->dev, "read when ATN set stat: 0x%06x\n", status.ibsta);
705+
}
702706
break;
703707
case NIUSB_ADDRESSING_ERROR:
704708
retval = -EIO;

0 commit comments

Comments
 (0)