diff options
| author | Federico Vaga <federico.vaga@cern.ch> | 2014-09-02 11:31:39 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 02:13:13 -0400 |
| commit | 78f22bc29e6e367f272a7fc700baa4d4263d376a (patch) | |
| tree | 30f761625d8d08677109dc0abe500deb0650f2ff /drivers | |
| parent | e0b04f2e94baca0f8135e7d5648c21be2e29d831 (diff) | |
ipoctal: reset function istead of duplicate code
Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/ipack/devices/ipoctal.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index e41bef048c23..a1514a79e487 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c | |||
| @@ -55,6 +55,16 @@ struct ipoctal { | |||
| 55 | u8 __iomem *int_space; | 55 | u8 __iomem *int_space; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | static void ipoctal_reset_channel(struct ipoctal_channel *channel) | ||
| 59 | { | ||
| 60 | iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); | ||
| 61 | channel->rx_enable = 0; | ||
| 62 | iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); | ||
| 63 | iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); | ||
| 64 | iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr); | ||
| 65 | iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr); | ||
| 66 | } | ||
| 67 | |||
| 58 | static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) | 68 | static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty) |
| 59 | { | 69 | { |
| 60 | struct ipoctal_channel *channel; | 70 | struct ipoctal_channel *channel; |
| @@ -304,10 +314,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr, | |||
| 304 | channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_A; | 314 | channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_A; |
| 305 | } | 315 | } |
| 306 | 316 | ||
| 307 | iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); | 317 | ipoctal_reset_channel(channel); |
| 308 | channel->rx_enable = 0; | ||
| 309 | iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); | ||
| 310 | iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); | ||
| 311 | iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY, | 318 | iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY, |
| 312 | &channel->regs->w.mr); /* mr1 */ | 319 | &channel->regs->w.mr); /* mr1 */ |
| 313 | iowrite8(0, &channel->regs->w.mr); /* mr2 */ | 320 | iowrite8(0, &channel->regs->w.mr); /* mr2 */ |
| @@ -467,11 +474,7 @@ static void ipoctal_set_termios(struct tty_struct *tty, | |||
| 467 | cflag = tty->termios.c_cflag; | 474 | cflag = tty->termios.c_cflag; |
| 468 | 475 | ||
| 469 | /* Disable and reset everything before change the setup */ | 476 | /* Disable and reset everything before change the setup */ |
| 470 | iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); | 477 | ipoctal_reset_channel(channel); |
| 471 | iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); | ||
| 472 | iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); | ||
| 473 | iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr); | ||
| 474 | iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr); | ||
| 475 | 478 | ||
| 476 | /* Set Bits per chars */ | 479 | /* Set Bits per chars */ |
| 477 | switch (cflag & CSIZE) { | 480 | switch (cflag & CSIZE) { |
| @@ -609,12 +612,7 @@ static void ipoctal_hangup(struct tty_struct *tty) | |||
| 609 | 612 | ||
| 610 | tty_port_hangup(&channel->tty_port); | 613 | tty_port_hangup(&channel->tty_port); |
| 611 | 614 | ||
| 612 | iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); | 615 | ipoctal_reset_channel(channel); |
| 613 | channel->rx_enable = 0; | ||
| 614 | iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); | ||
| 615 | iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); | ||
| 616 | iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr); | ||
| 617 | iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr); | ||
| 618 | 616 | ||
| 619 | clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags); | 617 | clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags); |
| 620 | wake_up_interruptible(&channel->tty_port.open_wait); | 618 | wake_up_interruptible(&channel->tty_port.open_wait); |
| @@ -627,12 +625,7 @@ static void ipoctal_shutdown(struct tty_struct *tty) | |||
| 627 | if (channel == NULL) | 625 | if (channel == NULL) |
| 628 | return; | 626 | return; |
| 629 | 627 | ||
| 630 | iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr); | 628 | ipoctal_reset_channel(channel); |
| 631 | channel->rx_enable = 0; | ||
| 632 | iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr); | ||
| 633 | iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr); | ||
| 634 | iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr); | ||
| 635 | iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr); | ||
| 636 | clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags); | 629 | clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags); |
| 637 | } | 630 | } |
| 638 | 631 | ||
