[PATCH v4 3/5] gpio: msc313: MStar MSC313 GPIO driver

Arnd Bergmann arnd at kernel.org
Thu Dec 10 15:22:05 EST 2020

On Thu, Dec 10, 2020 at 4:49 PM Daniel Palmer <daniel at 0x0f.com> wrote:
> On Thu, 10 Dec 2020 at 23:28, Arnd Bergmann <arnd at kernel.org> wrote:
> > > > It would be helpful here to replace all the readb_relaxed/writeb_relaxed()
> > > > with normal readb()/writeb(). Don't use _relaxed() unless there is a strong
> > > > reason why you have to do it, and if you do, explain it in a comment what
> > > > the reason is.
> > >
> > > The reason is that readb()/writeb() will invoke the heavy memory
> > > barrier even though it's not needed for peripheral registers.
> > > I guess it doesn't actually make all that much difference in reality.
> >
> > Ah, I forgot you had that heavy barrier. It depends a bit on what you
> > use the GPIOs for then. For most uses I think the overhead does not
> > matter, but if there is any bit-banged I/O it might make a difference.
> Bit-banged buses are likely to happen I think as there is a lot of
> gpio compared to hardware peripherals.
> Anyhow, I'll add a comment for the readb_relaxed()/writeb_relaxed() usage.

In that case, maybe add an abstraction for register access in an inline
function that takes a pointer to your device-private data and the register
offset, so you have a good place to describe it once.


More information about the linux-arm-kernel mailing list