From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King - ARM Linux Subject: Re: [PATCH v3 10/15] serial: stm32-usart: Add STM32 USART Driver Date: Thu, 26 Mar 2015 15:46:18 +0000 Message-ID: <20150326154618.GO8656@n2100.arm.linux.org.uk> References: <1426197361-19290-1-git-send-email-maxime.coquelin@st.com> <1426197361-19290-11-git-send-email-maxime.coquelin@st.com> <5511ABAA.2010303@hurleysoftware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <5511ABAA.2010303-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Peter Hurley Cc: Maxime Coquelin , u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, afaerber-l3A5Bk7waGM@public.gmane.org, geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org, Rob Herring , Philipp Zabel , Linus Walleij , Arnd Bergmann , stefan-XLVq0VzYD2Y@public.gmane.org, pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org, pebolle-IWqWACnzNjzz+pZb47iToQ@public.gmane.org, Jonathan Corbet , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Daniel Lezcano , Thomas Gleixner , Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Joe Perches , Antti Palosaari , Tejun Heo List-Id: linux-gpio@vger.kernel.org On Tue, Mar 24, 2015 at 02:23:38PM -0400, Peter Hurley wrote: > Hi Maxime, > > On 03/12/2015 05:55 PM, Maxime Coquelin wrote: > > +static unsigned int stm32_get_mctrl(struct uart_port *port) > > +{ > > + /* > > + * This routine is used for geting signals of: DTR, DCD, DSR, RI, > > + * and CTS/RTS It's also worth noting that this comment is wrong. This is used to get the state of DCD, DSR, RI and CTS. DTR and RTS are *not* included because the core tracks their state. ... > > + stm32port->clk = devm_clk_get(&pdev->dev, NULL); > > + > > + if (WARN_ON(IS_ERR(stm32port->clk))) > > Do you really need a stack trace here? Could this be dev_err() instead? > > > + return -EINVAL; Also, propagate the error code. > > + > > + /* ensure that clk rate is correct by enabling the clk */ > > + clk_prepare_enable(stm32port->clk); And remember to check the return value of clk_prepare_enable(). -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753244AbbCZPrP (ORCPT ); Thu, 26 Mar 2015 11:47:15 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:44395 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752293AbbCZPrJ (ORCPT ); Thu, 26 Mar 2015 11:47:09 -0400 Date: Thu, 26 Mar 2015 15:46:18 +0000 From: Russell King - ARM Linux To: Peter Hurley Cc: Maxime Coquelin , u.kleine-koenig@pengutronix.de, afaerber@suse.de, geert@linux-m68k.org, Rob Herring , Philipp Zabel , Linus Walleij , Arnd Bergmann , stefan@agner.ch, pmeerw@pmeerw.net, pebolle@tiscali.nl, Jonathan Corbet , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Daniel Lezcano , Thomas Gleixner , Greg Kroah-Hartman , Jiri Slaby , Andrew Morton , "David S. Miller" , Mauro Carvalho Chehab , Joe Perches , Antti Palosaari , Tejun Heo , Will Deacon , Nikolay Borisov , Rusty Russell , Kees Cook , Michal Marek , linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v3 10/15] serial: stm32-usart: Add STM32 USART Driver Message-ID: <20150326154618.GO8656@n2100.arm.linux.org.uk> References: <1426197361-19290-1-git-send-email-maxime.coquelin@st.com> <1426197361-19290-11-git-send-email-maxime.coquelin@st.com> <5511ABAA.2010303@hurleysoftware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5511ABAA.2010303@hurleysoftware.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2015 at 02:23:38PM -0400, Peter Hurley wrote: > Hi Maxime, > > On 03/12/2015 05:55 PM, Maxime Coquelin wrote: > > +static unsigned int stm32_get_mctrl(struct uart_port *port) > > +{ > > + /* > > + * This routine is used for geting signals of: DTR, DCD, DSR, RI, > > + * and CTS/RTS It's also worth noting that this comment is wrong. This is used to get the state of DCD, DSR, RI and CTS. DTR and RTS are *not* included because the core tracks their state. ... > > + stm32port->clk = devm_clk_get(&pdev->dev, NULL); > > + > > + if (WARN_ON(IS_ERR(stm32port->clk))) > > Do you really need a stack trace here? Could this be dev_err() instead? > > > + return -EINVAL; Also, propagate the error code. > > + > > + /* ensure that clk rate is correct by enabling the clk */ > > + clk_prepare_enable(stm32port->clk); And remember to check the return value of clk_prepare_enable(). -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. From mboxrd@z Thu Jan 1 00:00:00 1970 From: linux@arm.linux.org.uk (Russell King - ARM Linux) Date: Thu, 26 Mar 2015 15:46:18 +0000 Subject: [PATCH v3 10/15] serial: stm32-usart: Add STM32 USART Driver In-Reply-To: <5511ABAA.2010303@hurleysoftware.com> References: <1426197361-19290-1-git-send-email-maxime.coquelin@st.com> <1426197361-19290-11-git-send-email-maxime.coquelin@st.com> <5511ABAA.2010303@hurleysoftware.com> Message-ID: <20150326154618.GO8656@n2100.arm.linux.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Tue, Mar 24, 2015 at 02:23:38PM -0400, Peter Hurley wrote: > Hi Maxime, > > On 03/12/2015 05:55 PM, Maxime Coquelin wrote: > > +static unsigned int stm32_get_mctrl(struct uart_port *port) > > +{ > > + /* > > + * This routine is used for geting signals of: DTR, DCD, DSR, RI, > > + * and CTS/RTS It's also worth noting that this comment is wrong. This is used to get the state of DCD, DSR, RI and CTS. DTR and RTS are *not* included because the core tracks their state. ... > > + stm32port->clk = devm_clk_get(&pdev->dev, NULL); > > + > > + if (WARN_ON(IS_ERR(stm32port->clk))) > > Do you really need a stack trace here? Could this be dev_err() instead? > > > + return -EINVAL; Also, propagate the error code. > > + > > + /* ensure that clk rate is correct by enabling the clk */ > > + clk_prepare_enable(stm32port->clk); And remember to check the return value of clk_prepare_enable(). -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.