Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2419307pxu; Fri, 18 Dec 2020 12:49:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJypcUyK6LUsvaoRqn23Mod8XFB/5HcvcsvVKGULeiaEVIEyGnin8EvNj5rjLSrzHJEW7Oa0 X-Received: by 2002:a17:906:c1c6:: with SMTP id bw6mr5883897ejb.199.1608324551301; Fri, 18 Dec 2020 12:49:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608324551; cv=none; d=google.com; s=arc-20160816; b=MvtnYtSYdyrK77+YGJMnt3aKL1RC89VRSALDDc95yf4JkHOuQZOAMosA6qdRq3Wvr+ NUKh8nSy3F7EsTKf8eXcg5mWzP1HQjBExY82UyPZjYgi9ihniFH5qY5kOGsTKAV8P9ba 0VXxQe2cBFiIgRoYJ24fRr1ji5WtQkZa9TlennerUNV9d6l3FfmBP07MbdfvJ6noo116 RVv4nG0CWTRBnhqeDOttYlG+LIuZX85vwqpcivP47ifzPHBuxXThzMeMMQkCz2CUB9Dd JoTPEXyJmOdW8Q5qbE/WUwTiauLlA8XahdbP/9M8Nfmpn0yj6mJFGqFJyxZfqirufjGD b6GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CHpNSWEz7IxlEunBAvqrckY+hacS/RfitpwbipXC5us=; b=X7VAorh3xYdr0lPCrw8AyEdlMJiTARfhKlNjpcApaCqhB4nRMqD1/nKUtMtJvfYWRm fNXrfbpbpblUxIf0OYh5JC2Afc/bifgPISUY76PmCWDX7f17gdsbchgjiSeijkuqHeA+ uBfo2BdVNnMmbaDUz+B8YPX5fUIJ1WQJs6RNZJIW5Ts6ouSNIkQ2fpO20bMX1FrkS8eb UHUb/iZUdxd+q1RQ8vyxf+1hbC0oYRMb7uVR/j4+6+XQM9jMlzWPXIfvaGyYXlXtpKyG iv5g9oreOriaY7ZO0WMq6S/1PujryXMGePD/HK0CuC/K+8alTZcJmgzPu7XrKq2dCt3S nWqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=Qz5ePYox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u18si6536516eda.523.2020.12.18.12.48.48; Fri, 18 Dec 2020 12:49:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=Qz5ePYox; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733066AbgLRTBv (ORCPT + 99 others); Fri, 18 Dec 2020 14:01:51 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:3070 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726375AbgLRTB2 (ORCPT ); Fri, 18 Dec 2020 14:01:28 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0BIIviuG021973; Fri, 18 Dec 2020 20:00:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=CHpNSWEz7IxlEunBAvqrckY+hacS/RfitpwbipXC5us=; b=Qz5ePYox8Qh4MX2xgPGNjEgzM1c0mBn3+zgg7y4WQ3sd9qr+wIESfoReJbHKRIz9G0Zj z/8kHpkcoci5xX9mCWOyBhEg5G2QP2qwhMzecfSHJUm07EzJ883+uqHZl6ipIdaRg80I gBIkC7ZktYvArViZIcu1tP9tyRbE3CYSnb5TTCh8AGV2O6javJ9S69jkF3j7A1pRx7Wc Zz5aam9DiYWFXXRO+1y4Z1gC/i0uh5cR7Di9khEwQVIKhtGQ8wiohxi3adbiXFfygryF QQ7fFSwtpw7GCi8tlUwPj3jP6uXKqQCiLHhxcTNzN5+OMhsL1wbajxv4D78aLQTrWmu0 pg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 35cq03gdya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Dec 2020 20:00:30 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 46312100034; Fri, 18 Dec 2020 20:00:29 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 38E0D225E48; Fri, 18 Dec 2020 20:00:29 +0100 (CET) Received: from localhost (10.75.127.51) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 18 Dec 2020 20:00:28 +0100 From: Erwan Le Ray To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Maxime Coquelin , Alexandre Torgue CC: , , , , , Erwan Le Ray , Fabrice Gasnier , Valentin Caron Subject: [PATCH 2/8] serial: stm32: fix code cleaning warnings and checks Date: Fri, 18 Dec 2020 20:00:13 +0100 Message-ID: <20201218190020.1572-3-erwan.leray@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201218190020.1572-1-erwan.leray@foss.st.com> References: <20201218190020.1572-1-erwan.leray@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG3NODE2.st.com (10.75.127.8) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343,18.0.737 definitions=2020-12-18_12:2020-12-18,2020-12-18 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixes checkpatch --strict warnings and checks: - checkpatch --strict "Unnecessary parentheses" - checkpatch --strict "Blank lines aren't necessary before a close brace - checkpatch --strict "Alignment should match open parenthesis" - checkpatch --strict "Please don't use multiple blank lines" - checkpatch --strict "Comparison to NULL could be written ..." - visual check code ordering warning Signed-off-by: Erwan Le Ray diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c index 6248304a001f..a0ef86d71317 100644 --- a/drivers/tty/serial/stm32-usart.c +++ b/drivers/tty/serial/stm32-usart.c @@ -176,8 +176,7 @@ static int stm32_pending_rx(struct uart_port *port, u32 *sr, int *last_res, status = dmaengine_tx_status(stm32_port->rx_ch, stm32_port->rx_ch->cookie, &state); - if ((status == DMA_IN_PROGRESS) && - (*last_res != state.residue)) + if (status == DMA_IN_PROGRESS && (*last_res != state.residue)) return 1; else return 0; @@ -464,7 +463,7 @@ static irqreturn_t stm32_interrupt(int irq, void *ptr) writel_relaxed(USART_ICR_RTOCF, port->membase + ofs->icr); - if ((sr & USART_SR_WUF) && (ofs->icr != UNDEF_REG)) + if ((sr & USART_SR_WUF) && ofs->icr != UNDEF_REG) writel_relaxed(USART_ICR_WUCF, port->membase + ofs->icr); @@ -620,7 +619,6 @@ static void stm32_stop_rx(struct uart_port *port) stm32_clr_bits(port, ofs->cr1, stm32_port->cr1_irq); if (stm32_port->cr3_irq) stm32_clr_bits(port, ofs->cr3, stm32_port->cr3_irq); - } /* Handle breaks - ignored by us */ @@ -724,7 +722,7 @@ static unsigned int stm32_get_databits(struct ktermios *termios) } static void stm32_set_termios(struct uart_port *port, struct ktermios *termios, - struct ktermios *old) + struct ktermios *old) { struct stm32_port *stm32_port = to_stm32_port(port); struct stm32_usart_offsets *ofs = &stm32_port->info->ofs; @@ -923,7 +921,7 @@ stm32_verify_port(struct uart_port *port, struct serial_struct *ser) } static void stm32_pm(struct uart_port *port, unsigned int state, - unsigned int oldstate) + unsigned int oldstate) { struct stm32_port *stm32port = container_of(port, struct stm32_port, port); @@ -973,18 +971,17 @@ static int stm32_init_port(struct stm32_port *stm32port, struct resource *res; int ret; + ret = platform_get_irq(pdev, 0); + if (ret <= 0) + return ret ? : -ENODEV; + port->iotype = UPIO_MEM; port->flags = UPF_BOOT_AUTOCONF; port->ops = &stm32_uart_ops; port->dev = &pdev->dev; port->fifosize = stm32port->info->cfg.fifosize; port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); - - ret = platform_get_irq(pdev, 0); - if (ret <= 0) - return ret ? : -ENODEV; port->irq = ret; - port->rs485_config = stm32_config_rs485; ret = stm32_init_rs485(port, pdev); @@ -1101,8 +1098,8 @@ static int stm32_of_dma_rx_probe(struct stm32_port *stm32port, return -ENODEV; } stm32port->rx_buf = dma_alloc_coherent(&pdev->dev, RX_BUF_L, - &stm32port->rx_dma_buf, - GFP_KERNEL); + &stm32port->rx_dma_buf, + GFP_KERNEL); if (!stm32port->rx_buf) { ret = -ENOMEM; goto alloc_err; @@ -1177,8 +1174,8 @@ static int stm32_of_dma_tx_probe(struct stm32_port *stm32port, return -ENODEV; } stm32port->tx_buf = dma_alloc_coherent(&pdev->dev, TX_BUF_L, - &stm32port->tx_dma_buf, - GFP_KERNEL); + &stm32port->tx_dma_buf, + GFP_KERNEL); if (!stm32port->tx_buf) { ret = -ENOMEM; goto alloc_err; @@ -1322,7 +1319,6 @@ static int stm32_serial_remove(struct platform_device *pdev) return err; } - #ifdef CONFIG_SERIAL_STM32_CONSOLE static void stm32_console_putchar(struct uart_port *port, int ch) { @@ -1335,7 +1331,8 @@ static void stm32_console_putchar(struct uart_port *port, int ch) writel_relaxed(ch, port->membase + ofs->tdr); } -static void stm32_console_write(struct console *co, const char *s, unsigned cnt) +static void stm32_console_write(struct console *co, const char *s, + unsigned int cnt) { struct uart_port *port = &stm32_ports[co->index].port; struct stm32_port *stm32_port = to_stm32_port(port); @@ -1388,7 +1385,7 @@ static int stm32_console_setup(struct console *co, char *options) * this to be called during the uart port registration when the * driver gets probed and the port should be mapped at that point. */ - if (stm32port->port.mapbase == 0 || stm32port->port.membase == NULL) + if (stm32port->port.mapbase == 0 || !stm32port->port.membase) return -ENXIO; if (options) -- 2.17.1