[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC 4/8] ns16550: support DesignWare 8250



>>> On 10.09.13 at 17:21, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> On Tue, 2013-09-10 at 16:19 +0100, Jan Beulich wrote:
>> >>> On 10.09.13 at 17:12, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
>> > On Tue, 2013-09-10 at 16:02 +0100, Jan Beulich wrote:
>> >> >>> On 10.09.13 at 16:18, Ian Campbell <ian.campbell@xxxxxxxxxx> 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.