From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.com>
Cc: Magnus Damm <magnus.damm@gmail.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
Nobuhiro Iwamatsu <iwamatsu@nigauri.org>,
Yoshihiro Kaneko <ykaneko0929@gmail.com>,
Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>,
Koji Matsuoka <koji.matsuoka.xm@renesas.com>,
Wolfram Sang <wsa@the-dreams.de>,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
linux-serial@vger.kernel.org, linux-sh@vger.kernel.org,
Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH v3 07/33] serial: sh-sci: Improve readability of sampling rate configuration
Date: Fri, 21 Aug 2015 20:02:31 +0200 [thread overview]
Message-ID: <1440180177-6924-8-git-send-email-geert+renesas@glider.be> (raw)
In-Reply-To: <1440180177-6924-1-git-send-email-geert+renesas@glider.be>
Reorder sampling_rate assignment for consistency in all cases of the
switch statement.
Avoid using the ternary conditional operator to make it more clear that
the value is overridden by platform data.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v3:
- Reworded one-line summary,
v2:
- New.
---
drivers/tty/serial/sh-sci.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index dbb4bbdac37ce0d8..9502f52d4b55808a 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2205,7 +2205,6 @@ static int sci_init_single(struct platform_device *dev,
{
struct uart_port *port = &sci_port->port;
const struct resource *res;
- unsigned int sampling_rate;
unsigned int i;
int ret;
@@ -2250,37 +2249,37 @@ static int sci_init_single(struct platform_device *dev,
port->fifosize = 256;
sci_port->overrun_reg = SCxSR;
sci_port->overrun_mask = SCIFA_ORER;
- sampling_rate = 16;
+ sci_port->sampling_rate = 16;
break;
case PORT_HSCIF:
port->fifosize = 128;
- sampling_rate = 0;
sci_port->overrun_reg = SCLSR;
sci_port->overrun_mask = SCLSR_ORER;
+ sci_port->sampling_rate = 0;
break;
case PORT_SCIFA:
port->fifosize = 64;
sci_port->overrun_reg = SCxSR;
sci_port->overrun_mask = SCIFA_ORER;
- sampling_rate = 16;
+ sci_port->sampling_rate = 16;
break;
case PORT_SCIF:
port->fifosize = 16;
if (p->regtype == SCIx_SH7705_SCIF_REGTYPE) {
sci_port->overrun_reg = SCxSR;
sci_port->overrun_mask = SCIFA_ORER;
- sampling_rate = 16;
+ sci_port->sampling_rate = 16;
} else {
sci_port->overrun_reg = SCLSR;
sci_port->overrun_mask = SCLSR_ORER;
- sampling_rate = 32;
+ sci_port->sampling_rate = 32;
}
break;
default:
port->fifosize = 1;
sci_port->overrun_reg = SCxSR;
sci_port->overrun_mask = SCI_ORER;
- sampling_rate = 32;
+ sci_port->sampling_rate = 32;
break;
}
@@ -2288,8 +2287,8 @@ static int sci_init_single(struct platform_device *dev,
* match the SoC datasheet, this should be investigated. Let platform
* data override the sampling rate for now.
*/
- sci_port->sampling_rate = p->sampling_rate ? p->sampling_rate
- : sampling_rate;
+ if (p->sampling_rate)
+ sci_port->sampling_rate = p->sampling_rate;
if (!early) {
sci_port->iclk = clk_get(&dev->dev, "sci_ick");
--
1.9.1
next prev parent reply other threads:[~2015-08-21 18:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 18:02 [PATCH v3 00/33] serial: sh-sci: Miscellaneous and DMA Improvements Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 01/33] serial: sh-sci: Replace buggy big #ifdef by runtime logic Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 02/33] serial: sh-sci: Prevent compiler warnings on 64-bit Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 03/33] serial: sh-sci: Correct SCIF_ERROR_CLEAR for plain SCIF Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 04/33] serial: sh-sci: Use SCIF_DR instead of hardcoded literal 1 Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 05/33] serial: sh-sci: Use SCSMR_CKS instead of hardcoded literal 3 Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 06/33] serial: sh-sci: Drop path in reference to serial_core.c Geert Uytterhoeven
2015-08-21 18:02 ` Geert Uytterhoeven [this message]
2015-08-21 18:02 ` [PATCH v3 08/33] serial: sh-sci: Make sci_irq_desc[] const Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 09/33] serial: sh-sci: Make sci_regmap[] const Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 10/33] serial: sh-sci: Remove useless memory allocation failure printks Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 11/33] serial: sh-sci: Remove bogus sci_handle_fifo_overrun() call on (H)SCIF Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 12/33] serial: sh-sci: Return IRQ_HANDLED when overrun if detected Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 13/33] serial: sh-sci: Improve DMA error messages Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 14/33] serial: sh-sci: Improve comments for DMA timeout calculation Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 15/33] serial: sh-sci: Handle DMA init failures inside sci_request_dma() Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 16/33] serial: sh-sci: Use correct device for DMA mapping with IOMMU Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 17/33] serial: sh-sci: Use min_t()/max_t() instead of casts Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 18/33] serial: sh-sci: Switch to dma_map_single() for DMA transmission Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 19/33] serial: sh-sci: Fix TX buffer mapping leak Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 20/33] serial: sh-sci: Use DMA submission helpers instead of open-coding Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 21/33] serial: sh-sci: Switch to generic DMA residue handling Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 22/33] serial: sh-sci: Stop acknowledging DMA transmit completions Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 23/33] serial: sh-sci: Simplify sci_submit_rx() error handling Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 24/33] serial: sh-sci: Do not resubmit DMA descriptors Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 25/33] serial: sh-sci: Fix exclusion of work_fn_rx and sci_dma_rx_complete Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 26/33] serial: sh-sci: Fix race condition between RX worker and cleanup Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 27/33] serial: sh-sci: Pass scatterlist to sci_dma_rx_push() Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 28/33] serial: sh-sci: Use tty_insert_flip_string() for DMA receive Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 29/33] serial: sh-sci: Use incrementing pointers instead of stack array Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 30/33] serial: sh-sci: Fix NULL pointer dereference if HIGHMEM is enabled Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 31/33] serial: sh-sci: Don't call sci_rx_interrupt() on error when using DMA Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 32/33] serial: sh-sci: Don't kick tx in sci_er_interrupt() " Geert Uytterhoeven
2015-08-21 18:02 ` [PATCH v3 33/33] serial: sh-sci: Don't call sci_dma_rx_push() if no data has arrived Geert Uytterhoeven
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=1440180177-6924-8-git-send-email-geert+renesas@glider.be \
--to=geert+renesas@glider.be \
--cc=g.liakhovetski@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=iwamatsu@nigauri.org \
--cc=jslaby@suse.com \
--cc=kazuya.mizuguchi.ks@renesas.com \
--cc=koji.matsuoka.xm@renesas.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=wsa@the-dreams.de \
--cc=ykaneko0929@gmail.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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).