Skip to content

Commit 4028241

Browse files
committed
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
2 parents aa6085a + b1aabb8 commit 4028241

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

drivers/staging/gpib/agilent_82350b/agilent_82350b.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ static int agilent_82350b_accel_write(struct gpib_board *board, u8 *buffer,
182182
return retval;
183183
#endif
184184

185-
retval = agilent_82350b_write(board, buffer, 1, 0, &num_bytes);
186-
*bytes_written += num_bytes;
187-
if (retval < 0)
188-
return retval;
185+
if (fifotransferlength > 0) {
186+
retval = agilent_82350b_write(board, buffer, 1, 0, &num_bytes);
187+
*bytes_written += num_bytes;
188+
if (retval < 0)
189+
return retval;
190+
}
189191

190192
write_byte(tms_priv, tms_priv->imr0_bits & ~HR_BOIE, IMR0);
191193
for (i = 1; i < fifotransferlength;) {
@@ -217,7 +219,7 @@ static int agilent_82350b_accel_write(struct gpib_board *board, u8 *buffer,
217219
break;
218220
}
219221
write_byte(tms_priv, tms_priv->imr0_bits, IMR0);
220-
if (retval)
222+
if (retval < 0)
221223
return retval;
222224

223225
if (send_eoi) {

drivers/staging/gpib/fmh_gpib/fmh_gpib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,11 @@ void fmh_gpib_detach(struct gpib_board *board)
15171517
resource_size(e_priv->gpib_iomem_res));
15181518
}
15191519
fmh_gpib_generic_detach(board);
1520+
1521+
if (board->dev) {
1522+
put_device(board->dev);
1523+
board->dev = NULL;
1524+
}
15201525
}
15211526

15221527
static int fmh_gpib_pci_attach_impl(struct gpib_board *board,

drivers/staging/gpib/ni_usb/ni_usb_gpib.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,10 @@ static void ni_usb_soft_update_status(struct gpib_board *board, unsigned int ni_
327327
board->status &= ~clear_mask;
328328
board->status &= ~ni_usb_ibsta_mask;
329329
board->status |= ni_usb_ibsta & ni_usb_ibsta_mask;
330-
// FIXME should generate events on DTAS and DCAS
330+
if (ni_usb_ibsta & DCAS)
331+
push_gpib_event(board, EVENT_DEV_CLR);
332+
if (ni_usb_ibsta & DTAS)
333+
push_gpib_event(board, EVENT_DEV_TRG);
331334

332335
spin_lock_irqsave(&board->spinlock, flags);
333336
/* 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,
694697
*/
695698
break;
696699
case NIUSB_ATN_STATE_ERROR:
697-
retval = -EIO;
698-
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+
}
699706
break;
700707
case NIUSB_ADDRESSING_ERROR:
701708
retval = -EIO;

0 commit comments

Comments
 (0)