From: "Jan Beulich" Subject: Re: [PATCH RFC 4/8] ns16550: support DesignWare 8250 Date: Tue, 10 Sep 2013 16:28:42 +0100 Message-ID: <522F56CA02000078000F21A5@nat28.tlf.novell.com> References: <1378822681.10928.8.camel@kazak.uk.xensource.com> <1378822705-19310-4-git-send-email-ian.campbell@citrix.com> <522F50B602000078000F2064@nat28.tlf.novell.com> <1378825979.10928.22.camel@kazak.uk.xensource.com> <522F548B02000078000F20E0@nat28.tlf.novell.com> <1378826464.10928.26.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VJPry-0000nX-To for xen-devel@lists.xenproject.org; Tue, 10 Sep 2013 15:28:47 +0000 In-Reply-To: <1378826464.10928.26.camel@kazak.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: keir@xen.org, stefano.stabellini@eu.citrix.com, julien.grall@linaro.org, tim@xen.org, Josh Zhao , xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 10.09.13 at 17:21, Ian Campbell wrote: > On Tue, 2013-09-10 at 16:19 +0100, Jan Beulich wrote: >> >>> On 10.09.13 at 17:12, Ian Campbell wrote: >> > On Tue, 2013-09-10 at 16:02 +0100, Jan Beulich wrote: >> >> >>> On 10.09.13 at 16:18, Ian Campbell wrote: >> >> > @@ -233,6 +234,16 @@ static void ns16550_setup_preirq(struct ns16550 > *uart) >> >> > /* No interrupts. */ >> >> > ns_write_reg(uart, UART_IER, 0); >> >> > >> >> > + if ( uart->dw_usr_bsy && >> >> > + (ns_read_reg(uart, UART_IIR) & UART_IIR_BSY) == UART_IIR_BSY ) >> >> > + { >> >> > + /* DesignWare 8250 detects if LCR is written while the UART is >> >> > + * busy and raises a "busy detect" interrupt. Read the UART >> >> > + * Status Register to clear this state. >> >> > + */ >> >> > + (void)ns_read_reg(uart, UART_USR); >> >> >> >> Pointless cast? >> > >> > It's a hint to the compiler/reader that the return value is deliberately >> > discarded. We have a handful of these in the tree already. >> >> And over time I managed to remove another handful... > > Well, I guess I don't mind one way or another. What's the problem with > them? I'm viewing casts as dangerous in general, and hence advocate for removing them wherever not really needed. Casts to void I view as warranted only when needed to silence false positive compiler warnings. And in the case here: Ignoring function return values isn't that uncommon. And the comment already explains why the call is being made. Jan