All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Pramod Gurav <gpramod@codeaurora.org>,
	linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: gregkh@linuxfoundation.org, bryanh@codeaurora.org, jslaby@suse.cz
Subject: Re: [PATCH v2 1/2] tty: serial: msm: Add mask value for UART_DM registers
Date: Wed, 08 Apr 2015 16:31:52 -0700	[thread overview]
Message-ID: <5525BA68.7060602@codeaurora.org> (raw)
In-Reply-To: <1428499733-21963-1-git-send-email-gpramod@codeaurora.org>

On 04/08/15 06:28, Pramod Gurav wrote:
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index b73889c..4c1e9ea 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -432,8 +432,13 @@ static int msm_set_baud_rate(struct uart_port *port, unsigned int baud)
>  	/* RX stale watermark */
>  	rxstale = entry->rxstale;
>  	watermark = UART_IPR_STALE_LSB & rxstale;
> -	watermark |= UART_IPR_RXSTALE_LAST;
> -	watermark |= UART_IPR_STALE_TIMEOUT_MSB & (rxstale << 2);
> +	if (msm_port->is_uartdm)
> +		watermark |= UART_DM_IPR_STALE_TIMEOUT_MSB & (rxstale << 2);
> +	else {
> +		watermark |= UART_IPR_RXSTALE_LAST;
> +		watermark |= UART_IPR_STALE_TIMEOUT_MSB & (rxstale << 2);
> +	}
> +
>  	msm_write(port, watermark, UART_IPR);
>  

This could be written like so:

if (msm_port->is_uartdm) {
	mask = UART_DM_IPR_STALE_TIMEOUT_MSB;
} else {
	watermark |= UART_IPR_RXSTALE_LAST;
	mask = UART_IPR_STALE_TIMEOUT_MSB;
}

watermark |= mask & (rxstale << 2);

so that we don't duplicate the rfr_level << 2 part.

>  	/* set RX watermark */
> @@ -496,9 +501,15 @@ static int msm_startup(struct uart_port *port)
>  
>  	/* set automatic RFR level */
>  	data = msm_read(port, UART_MR1);
> -	data &= ~UART_MR1_AUTO_RFR_LEVEL1;
> +	if (msm_port->is_uartdm) {
> +		data &= ~UART_DM_MR1_AUTO_RFR_LEVEL1;
> +		data |= UART_DM_MR1_AUTO_RFR_LEVEL1 & (rfr_level << 2);
> +	} else {
> +		data &= ~UART_MR1_AUTO_RFR_LEVEL1;
> +		data |= UART_MR1_AUTO_RFR_LEVEL1 & (rfr_level << 2);
> +	}
> +
>  	data &= ~UART_MR1_AUTO_RFR_LEVEL0;
> -	data |= UART_MR1_AUTO_RFR_LEVEL1 & (rfr_level << 2);
>  	data |= UART_MR1_AUTO_RFR_LEVEL0 & rfr_level;
>  	msm_write(port, data, UART_MR1);
>  	return 0;

This could be written like so:

if (msm_port->is_uartdm)
	mask = UART_DM_MR1_AUTO_RFR_LEVEL1;
else
	mask = UART_MR1_AUTO_RFR_LEVE1;

data &= ~mask;
data &= ~UART_MR1_AUTO_RFR_LEVEL0;
data |= mask & (rfr_level << 2);
data |= UART_MR1_AUTO_RFR_LEVEL0 & rfr_level;

so that we don't duplicate the rfr_level << 2 part.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

      parent reply	other threads:[~2015-04-08 23:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 13:28 [PATCH v2 1/2] tty: serial: msm: Add mask value for UART_DM registers Pramod Gurav
2015-04-08 13:28 ` [PATCH v2 2/2] tty: serial: msm: Disable pclk when port is closed Pramod Gurav
2015-04-08 23:51   ` Stephen Boyd
2015-04-09  5:36     ` Pramod Gurav
2015-04-09 14:04       ` Stephen Boyd
2015-04-08 23:31 ` Stephen Boyd [this message]

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=5525BA68.7060602@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=bryanh@codeaurora.org \
    --cc=gpramod@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.