ipack/devices/ipoctal: rework disable TX when the TX buffer is empty
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>
Mon, 10 Dec 2012 10:50:02 +0000 (11:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2013 02:24:38 +0000 (18:24 -0800)
Depending of the device, it disables the TX mode in different places when there
is no more data to transmit.

This patch reorder them and disable the TX mode in the same place.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ipack/devices/ipoctal.c

index 850f10506a792982763c61c2ad1b6ba17b652acb..f2875f0f14d4297c3d48df45a7c7fedb98af4ca2 100644 (file)
@@ -177,10 +177,6 @@ static void ipoctal_irq_tx(struct ipoctal_channel *channel)
        (*pointer_write)++;
        *pointer_write = *pointer_write % PAGE_SIZE;
        channel->nb_bytes--;
-
-       if (channel->nb_bytes == 0 &&
-           channel->board_id != IPACK1_DEVICE_ID_SBS_OCTAL_485)
-               iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
 }
 
 static void ipoctal_irq_channel(struct ipoctal_channel *channel)
@@ -196,14 +192,14 @@ static void ipoctal_irq_channel(struct ipoctal_channel *channel)
        isr = ioread8(&channel->block_regs->r.isr);
        sr = ioread8(&channel->regs->r.sr);
 
-       /* In case of RS-485, change from TX to RX when finishing TX.
-        * Half-duplex. */
-       if ((channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) &&
-           (sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
-               iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
-               iowrite8(CR_CMD_NEGATE_RTSN, &channel->regs->w.cr);
-               iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
+       if ((sr & SR_TX_EMPTY) && (channel->nb_bytes == 0)) {
                iowrite8(CR_DISABLE_TX, &channel->regs->w.cr);
+               /* In case of RS-485, change from TX to RX when finishing TX.
+                * Half-duplex. */
+               if (channel->board_id == IPACK1_DEVICE_ID_SBS_OCTAL_485) {
+                       iowrite8(CR_CMD_NEGATE_RTSN, &channel->regs->w.cr);
+                       iowrite8(CR_ENABLE_RX, &channel->regs->w.cr);
+               }
        }
 
        /* RX data */
This page took 0.025334 seconds and 5 git commands to generate.