Skip to content

Commit 8da1ce7

Browse files
dpenklergregkh
authored andcommitted
staging: gpib: Remove atn_asserted global variable
atn_asserted was introduced to deal with an issue where certain models of the Raspberry Pi would lose interrupts under heavy load. Using a combination of edge and level interrupts the problem was resolved so the work-around is no longer needed. This patch removes the work-around. Tested-by: Dave Penkler <dpenkler@gmail.com> Signed-off-by: Dave Penkler <dpenkler@gmail.com> Link: https://lore.kernel.org/r/20250418173434.2892-6-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b56611d commit 8da1ce7

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/staging/gpib/gpio/gpib_bitbang.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ struct bb_priv {
306306
int dav_seq;
307307
long all_irqs;
308308
int dav_idle;
309-
int atn_asserted;
310309

311310
enum talker_function_state talker_state;
312311
enum listener_function_state listener_state;
@@ -614,7 +613,8 @@ static irqreturn_t bb_NRFD_interrupt(int irq, void *arg)
614613
goto nrfd_exit;
615614
}
616615

617-
if (priv->atn_asserted && priv->w_cnt >= priv->length) { // test for end of transfer
616+
if (priv->w_cnt >= priv->length) { // test for missed NDAC end of transfer
617+
dev_err(board->gpib_dev, "Unexpected NRFD exit\n");
618618
priv->write_done = 1;
619619
priv->w_busy = 0;
620620
wake_up_interruptible(&board->wait);
@@ -686,14 +686,14 @@ static irqreturn_t bb_NDAC_interrupt(int irq, void *arg)
686686

687687
dbg_printk(3, "accepted %zu\n", priv->w_cnt - 1);
688688

689-
if (!priv->atn_asserted && priv->w_cnt >= priv->length) { // test for end of transfer
689+
gpiod_set_value(DAV, 1); // Data not available
690+
priv->dav_tx = 1;
691+
priv->phase = 510;
692+
693+
if (priv->w_cnt >= priv->length) { // test for end of transfer
690694
priv->write_done = 1;
691695
priv->w_busy = 0;
692696
wake_up_interruptible(&board->wait);
693-
} else {
694-
gpiod_set_value(DAV, 1); // Data not available
695-
priv->dav_tx = 1;
696-
priv->phase = 510;
697697
}
698698

699699
ndac_exit:
@@ -850,6 +850,7 @@ static void set_atn(struct gpib_board *board, int atn_asserted)
850850
priv->listener_state = listener_addressed;
851851
if (priv->talker_state == talker_active)
852852
priv->talker_state = talker_addressed;
853+
SET_DIR_WRITE(priv); // need to be able to read bus NRFD/NDAC
853854
} else {
854855
if (priv->listener_state == listener_addressed) {
855856
priv->listener_state = listener_active;
@@ -859,7 +860,6 @@ static void set_atn(struct gpib_board *board, int atn_asserted)
859860
priv->talker_state = talker_active;
860861
}
861862
gpiod_direction_output(_ATN, !atn_asserted);
862-
priv->atn_asserted = atn_asserted;
863863
}
864864

865865
static int bb_take_control(struct gpib_board *board, int synchronous)

0 commit comments

Comments
 (0)