From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Heiner Kallweit <hkallweit1@gmail.com>,
nic_swsd@realtek.com, "David S . Miller" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [PATCH v4 1/2] r8169: Dereference MMIO address immediately before use
Date: Thu, 01 Mar 2018 22:21:43 +0200 [thread overview]
Message-ID: <1519935703.10722.375.camel@linux.intel.com> (raw)
In-Reply-To: <ba9dc14c-e2f2-0f66-b163-72e44a709265@gmail.com>
On Thu, 2018-03-01 at 21:01 +0100, Heiner Kallweit wrote:
> Am 01.03.2018 um 12:27 schrieb Andy Shevchenko:
> > Next step might be a conversion of RTL_Wxx() / RTL_Rxx() macros
> > to inline functions for sake of type checking.
^^^^^
> > /* write/read MMIO register */
> > -#define RTL_W8(reg, val8) writeb ((val8), ioaddr + (reg))
> > -#define RTL_W16(reg, val16) writew ((val16), ioaddr + (reg))
> > -#define RTL_W32(reg, val32) writel ((val32), ioaddr + (reg))
> > -#define RTL_R8(reg) readb (ioaddr + (reg))
> > -#define RTL_R16(reg) readw (ioaddr + (reg))
> > -#define RTL_R32(reg) readl (ioaddr + (reg))
> > +#define RTL_W8(tp, reg, val8) writeb((val8), tp->mmio_addr +
> > (reg))
> > +#define RTL_W16(tp, reg, val16) writew((val16), tp-
> > >mmio_addr + (reg))
> > +#define RTL_W32(tp, reg, val32) writel((val32), tp-
> > >mmio_addr + (reg))
> > +#define RTL_R8(tp, reg) readb(tp->mmio_addr + (reg))
> > +#define RTL_R16(tp, reg) readw(tp->mmio_addr +
> > (reg))
> > +#define RTL_R32(tp, reg) readl(tp->mmio_addr +
> > (reg))
> I like te idea because I also found the frequent definition of
> variable ioaddr
> w/o explicit use quite ugly. Just instead of using macro's we could
> define
> RTL_R32 et al as inline functions.
I left a last paragraph in my commit message. I wouldn't really to do a
functional change right now. It may be easily done as simple followup,
plain to test, etc.
> In parallel to the readl API there's the ioread32() API. Even though I
> read
> somewhere that the readl API is a legacy API, I don't have an idea
> which one
> to prefer and why.
You don't need ioread*().
Or do you have an example of hardware that uses I/O instead of MMIO?
Rather some _relaxed variants might be useful.
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2018-03-01 20:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 11:27 [PATCH v4 1/2] r8169: Dereference MMIO address immediately before use Andy Shevchenko
2018-03-01 11:27 ` [PATCH v4 2/2] r8169: switch to device-managed functions in probe (part 2) Andy Shevchenko
2018-03-01 19:54 ` Heiner Kallweit
2018-03-01 20:15 ` Andy Shevchenko
2018-03-01 20:36 ` Heiner Kallweit
2018-03-02 13:38 ` Andy Shevchenko
2018-03-04 23:15 ` David Miller
2018-03-01 20:01 ` [PATCH v4 1/2] r8169: Dereference MMIO address immediately before use Heiner Kallweit
2018-03-01 20:21 ` Andy Shevchenko [this message]
2018-03-04 23:15 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519935703.10722.375.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.