staging driver fixes for 6.18-rc3

Here are some small staging driver fixes for the gpib subsystem to
 resolve some reported issues.  Included in here are:
   - memory leak fixes
   - error code fixes
   - proper protocol fixes
 
 All of these have been in linux-next for almost 2 weeks now with no
 reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCaP4l4g8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ym2zACgq0WPUJl3X/5+M0sWs9rd4afh2TMAn1RlLJZE
 1Qj5OIhSn1v5SfkLyqXf
 =Wn6c
 -----END PGP SIGNATURE-----

Merge tag 'staging-6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
 "Here are some small staging driver fixes for the gpib subsystem to
  resolve some reported issues. Included in here are:

   - memory leak fixes

   - error code fixes

   - proper protocol fixes

  All of these have been in linux-next for almost 2 weeks now with no
  reported issues"

* tag 'staging-6.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: gpib: Fix device reference leak in fmh_gpib driver
  staging: gpib: Return -EINTR on device clear
  staging: gpib: Fix sending clear and trigger events
  staging: gpib: Fix no EOI on 1 and 2 byte writes
This commit is contained in:
Linus Torvalds 2025-10-26 10:29:45 -07:00
commit 40282418e1
3 changed files with 22 additions and 8 deletions

View File

@ -182,10 +182,12 @@ static int agilent_82350b_accel_write(struct gpib_board *board, u8 *buffer,
return retval;
#endif
retval = agilent_82350b_write(board, buffer, 1, 0, &num_bytes);
*bytes_written += num_bytes;
if (retval < 0)
return retval;
if (fifotransferlength > 0) {
retval = agilent_82350b_write(board, buffer, 1, 0, &num_bytes);
*bytes_written += num_bytes;
if (retval < 0)
return retval;
}
write_byte(tms_priv, tms_priv->imr0_bits & ~HR_BOIE, IMR0);
for (i = 1; i < fifotransferlength;) {
@ -217,7 +219,7 @@ static int agilent_82350b_accel_write(struct gpib_board *board, u8 *buffer,
break;
}
write_byte(tms_priv, tms_priv->imr0_bits, IMR0);
if (retval)
if (retval < 0)
return retval;
if (send_eoi) {

View File

@ -1517,6 +1517,11 @@ void fmh_gpib_detach(struct gpib_board *board)
resource_size(e_priv->gpib_iomem_res));
}
fmh_gpib_generic_detach(board);
if (board->dev) {
put_device(board->dev);
board->dev = NULL;
}
}
static int fmh_gpib_pci_attach_impl(struct gpib_board *board,

View File

@ -327,7 +327,10 @@ static void ni_usb_soft_update_status(struct gpib_board *board, unsigned int ni_
board->status &= ~clear_mask;
board->status &= ~ni_usb_ibsta_mask;
board->status |= ni_usb_ibsta & ni_usb_ibsta_mask;
// FIXME should generate events on DTAS and DCAS
if (ni_usb_ibsta & DCAS)
push_gpib_event(board, EVENT_DEV_CLR);
if (ni_usb_ibsta & DTAS)
push_gpib_event(board, EVENT_DEV_TRG);
spin_lock_irqsave(&board->spinlock, flags);
/* remove set status bits from monitored set why ?***/
@ -694,8 +697,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;