From: Emil Velikov <emil.l.velikov@gmail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: "Thomas Hellstrom" <thellstrom@vmware.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
openchrome-devel@lists.freedesktop.org,
"Kevin Brace" <kevinbrace@gmx.com>,
"ML dri-devel" <dri-devel@lists.freedesktop.org>,
"Ira Weiny" <ira.weiny@intel.com>,
"Michel Dänzer" <michel@daenzer.net>,
"Mike Marshall" <hubcap@omnibond.com>
Subject: Re: [PATCH v2 1/4] drm/via: drop use of DRM(READ|WRITE) macros
Date: Tue, 23 Jul 2019 12:49:28 +0100 [thread overview]
Message-ID: <20190723114928.GA12807@arch-x1c3> (raw)
In-Reply-To: <20190722182731.GA791@ravnborg.org>
On 2019/07/22, Sam Ravnborg wrote:
> Hi Email.
>
> > > > IMHO a far better idea is to expand these macros as static inline functions.
> > > > The extra bonus here is that the pseudo-magical VIA_BASE will also disappear.
> > > >
> > > > Since all the VIA_READ8 are used for masking, one might as well drop
> > > > them in favour of via_mask().
>
> Like this:
> static inline u32 via_read(struct drm_via_private *dev_priv, u32 reg)
> {
> return readl((void __iomem *)(dev_priv->mmio->handle + reg));
> }
>
> static inline void via_write(struct drm_via_private *dev_priv, u32 reg,
> u32 val)
> {
> writel(val, (void __iomem *)(dev_priv->mmio->handle + reg));
> }
>
> static inline void via_write8(struct drm_via_private *dev_priv, u32 reg,
> u32 val)
> {
> writeb(val, (void __iomem *)(dev_priv->mmio->handle + reg));
> }
>
> static inline void via_write8_mask_or(struct drm_via_private *dev_priv,
> u32 reg, u32 mask)
> {
> u32 val;
>
> val = readb((void __iomem *)(dev_priv->mmio->handle + reg));
> writeb(val | mask, (void __iomem *)(dev_priv->mmio->handle + reg));
> }
>
> static inline void via_write8_mask_and(struct drm_via_private *dev_priv,
> u32 reg, u32 mask)
> {
> u32 val;
>
> val = readb((void __iomem *)(dev_priv->mmio->handle + reg));
> writeb(val & mask, (void __iomem *)(dev_priv->mmio->handle + reg));
> }
>
> Patches are almost ready, but if there is any quick feedback let me
> know.
>
Don't think I've seen any "mask_and" "mask_or" API in DRM. The common
theme seems to be:
mtk_cec_mask(driver_priv, offset, value, mask)
malidp_write32_mask(driver_priv, offset, mask, value)
nvif_mask(driver_priv, address, mask, value)
HTH
Emil
_______________________________________________
openchrome-devel mailing list
openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel
next prev parent reply other threads:[~2019-07-23 11:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-20 8:45 [PATCH v2 0/6] drm/via: drop use of deprecated headers drmP.h and drm_os_linux.h Sam Ravnborg
2019-07-20 8:45 ` [PATCH v2 1/4] drm/via: drop use of DRM(READ|WRITE) macros Sam Ravnborg
2019-07-22 15:38 ` Emil Velikov
2019-07-22 16:17 ` Sam Ravnborg
2019-07-22 16:27 ` Emil Velikov
2019-07-22 18:27 ` Sam Ravnborg
2019-07-23 11:49 ` Emil Velikov [this message]
2019-07-23 19:01 ` Sam Ravnborg
2019-07-20 8:45 ` [PATCH v2 2/4] drm/via: add VIA_WAIT_ON() Sam Ravnborg
2019-07-22 15:46 ` Emil Velikov
2019-07-22 16:18 ` Sam Ravnborg
2019-07-20 8:45 ` [PATCH v2 3/4] drm/via: make via_drv.h self-contained Sam Ravnborg
2019-07-22 16:21 ` Emil Velikov
2019-07-20 8:45 ` [PATCH v2 4/4] drm/via: drop use of drmP.h Sam Ravnborg
2019-07-22 16:22 ` Emil Velikov
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=20190723114928.GA12807@arch-x1c3 \
--to=emil.l.velikov@gmail.com \
--cc=airlied@linux.ie \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@embeddedor.com \
--cc=hubcap@omnibond.com \
--cc=ira.weiny@intel.com \
--cc=kevinbrace@gmx.com \
--cc=michel@daenzer.net \
--cc=openchrome-devel@lists.freedesktop.org \
--cc=sam@ravnborg.org \
--cc=thellstrom@vmware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox