[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b962b00c-64d7-0b55-2fde-5a3ea04d8671@schinagl.nl>
Date: Fri, 31 Mar 2017 15:54:52 +0200
From: Olliver Schinagl <o.schinagl@...imaker.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Laxman Dewangan <ldewangan@...dia.com>,
Stephen Warren <swarren@...dotorg.org>,
Thierry Reding <thierry.reding@...il.com>,
Alexandre Courbot <gnurou@...il.com>,
"David S . Miller" <davem@...emloft.net>
Cc: dev@...ux-sunxi.org, Ed Blake <ed.blake@...tec.com>,
Alexander Sverdlin <alexander.sverdlin@...ia.com>,
Yegor Yefremov <yegorslists@...glemail.com>,
Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@...el.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Heiko Stuebner <heiko@...ech.de>,
Jason Uy <jason.uy@...adcom.com>,
Douglas Anderson <dianders@...omium.org>,
Peter Hurley <peter@...leysoftware.com>,
Tony Lindgren <tony@...mide.com>, Vignesh R <vigneshr@...com>,
Thor Thayer <tthayer@...nsource.altera.com>,
David Lechner <david@...hnology.com>,
Jan Kiszka <jan.kiszka@...mens.com>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org, sparclinux@...r.kernel.org
Subject: Re: [PATCH] serial: Do not treat the IIR register as a bitfield
Hey Andy,
On 30-03-17 11:56, Andy Shevchenko wrote:
> On Wed, 2017-03-29 at 20:44 +0200, Olliver Schinagl wrote:
>> It seems that at some point, someone made the assumption that the UART
>> Interrupt ID Register was a bitfield and started to check if certain
>> bits where set.
>>
>> Actually however the register contains interrupt ID's where only the
>> MSB
>> seems to be used singular and the rest share at least one bit. Thus
>> doing bitfield operations is wrong.
>>
>> This patch cleans up the serial_reg include file by ordering it and
>> replacing the UART_IIR_ID 'mask' with a proper mask for the register.
>> The OMAP uart appears to have used the two commonly 'reserved' bits 4
>> and 5 and thus get an UART_IIR_EXT_MASK for these two bits.
>>
>> This patch then goes over all UART_IIR_* users and changes the code
>> from
>> bitfield checking, to ID checking instead.
>
>
> Looking to implementation I would rather go with some helper like
>
> int serial_in_IIR(port, [additional mask])
> {
> return port->serial_in(port, UART_IIR) & (_IIR_MASK [| additional
> mask]);
> }
As I just wrote a simply static inline helper function in serial_core.h,
I just figured that the helper will only work for some of the calls. All
interrupt checks in xxx_serial_in() obviously can't rely on this. So do
you still want this helper function added for the other cases? Or have
all implementations do the masking manually?
And then, is iir = serial_port_in(up, UART_IIR) & UART_IIR_MASK;
preferred over splitting it over two lines, like I did?
Finally, why rename it to _IIR_MASK, I assume a typo here?
Olliver
>
Powered by blists - more mailing lists