linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Samuel Iglesias Gonsálvez" <siglesias@igalia.com>
To: Federico Vaga <federico.vaga@cern.ch>
Cc: Jens Taprogge <jens.taprogge@taprogge.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	industrypack-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] ipoctal: reset function istead of duplicate code
Date: Wed, 03 Sep 2014 09:52:36 +0200	[thread overview]
Message-ID: <1409730756.9087.6.camel@fourier> (raw)
In-Reply-To: <1409671901-4009-2-git-send-email-federico.vaga@cern.ch>

[-- Attachment #1: Type: text/plain, Size: 3458 bytes --]

On Tue, 2014-09-02 at 17:31 +0200, Federico Vaga wrote:
> Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
> ---
>  drivers/ipack/devices/ipoctal.c |   35 ++++++++++++++---------------------
>  1 file changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c
> index 90b96a1b..e531379 100644
> --- a/drivers/ipack/devices/ipoctal.c
> +++ b/drivers/ipack/devices/ipoctal.c
> @@ -55,6 +55,16 @@ struct ipoctal {
>  	u8 __iomem			*int_space;
>  };
>  
> +static void ipoctal_reset_channel(struct ipoctal_channel *channel)
> +{
> +	iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
> +	channel->rx_enable = 0;
> +	iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
> +	iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
> +	iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
> +	iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
> +}
> +
>  static int ipoctal_port_activate(struct tty_port *port, struct tty_struct *tty)
>  {
>  	struct ipoctal_channel *channel;
> @@ -306,10 +316,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
>  			channel->isr_rx_rdy_mask = ISR_RxRDY_FFULL_A;
>  		}
>  
> -		iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
> -		channel->rx_enable = 0;
> -		iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
> -		iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
> +		ipoctal_reset_channel(channel);
>  		iowrite8(MR1_CHRL_8_BITS | MR1_ERROR_CHAR | MR1_RxINT_RxRDY,
>  			 &channel->regs->w.mr); /* mr1 */
>  		iowrite8(0, &channel->regs->w.mr); /* mr2 */
> @@ -469,11 +476,7 @@ static void ipoctal_set_termios(struct tty_struct *tty,
>  	cflag = tty->termios.c_cflag;
>  
>  	/* Disable and reset everything before change the setup */
> -	iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
> +	ipoctal_reset_channel(channel);
>  
>  	/* Set Bits per chars */
>  	switch (cflag & CSIZE) {
> @@ -611,12 +614,7 @@ static void ipoctal_hangup(struct tty_struct *tty)
>  
>  	tty_port_hangup(&channel->tty_port);
>  
> -	iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
> -	channel->rx_enable = 0;
> -	iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
> +	ipoctal_reset_channel(channel);
>  
>  	clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
>  	wake_up_interruptible(&channel->tty_port.open_wait);
> @@ -629,12 +627,7 @@ static void ipoctal_shutdown(struct tty_struct *tty)
>  	if (channel == NULL)
>  		return;
>  
> -	iowrite8(CR_DISABLE_RX | CR_DISABLE_TX, &channel->regs->w.cr);
> -	channel->rx_enable = 0;
> -	iowrite8(CR_CMD_RESET_RX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_TX, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_ERR_STATUS, &channel->regs->w.cr);
> -	iowrite8(CR_CMD_RESET_MR, &channel->regs->w.cr);
> +	ipoctal_reset_channel(channel);
>  	clear_bit(ASYNCB_INITIALIZED, &channel->tty_port.flags);
>  }
>  

Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>

Sam



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2014-09-03  7:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 15:31 IPACK - ipack and ipoctal improvements Federico Vaga
2014-09-02 15:31 ` [PATCH 1/3] ipoctal: reset function istead of duplicate code Federico Vaga
2014-09-03  7:52   ` Samuel Iglesias Gonsálvez [this message]
2014-09-02 15:31 ` [PATCH 2/3] ipack: save carrier owner to allow device to get it Federico Vaga
2014-09-03  7:52   ` Samuel Iglesias Gonsálvez
2014-09-02 15:31 ` [PATCH 3/3] ipoctal: get carrier driver to avoid rmmod Federico Vaga
2014-09-03  7:53   ` Samuel Iglesias Gonsálvez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409730756.9087.6.camel@fourier \
    --to=siglesias@igalia.com \
    --cc=federico.vaga@cern.ch \
    --cc=gregkh@linuxfoundation.org \
    --cc=industrypack-devel@lists.sourceforge.net \
    --cc=jens.taprogge@taprogge.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).