On Sat, 20 Jul 2019 at 09:46, Sam Ravnborg <s...@ravnborg.org> wrote:
>
> The DRM_READ, DRM_WRITE macros comes from the deprecated drm_os_linux.h
> header file. Remove their use to remove this dependency.
>
> Replace the use of the macros with open coded variants.
>
> Signed-off-by: Sam Ravnborg <s...@ravnborg.org>
> Cc: Kevin Brace <kevinbr...@gmx.com>
> Cc: Thomas Hellstrom <thellst...@vmware.com>
> Cc: "Gustavo A. R. Silva" <gust...@embeddedor.com>
> Cc: Mike Marshall <hub...@omnibond.com>
> Cc: Ira Weiny <ira.we...@intel.com>
> Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
> Cc: Emil Velikov <emil.veli...@collabora.com>
> Cc: Michel Dänzer <mic...@daenzer.net>
> ---
>  drivers/gpu/drm/via/via_drv.h | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
> index 6d1ae834484c..d5a2b1ffd8c1 100644
> --- a/drivers/gpu/drm/via/via_drv.h
> +++ b/drivers/gpu/drm/via/via_drv.h
> @@ -115,10 +115,17 @@ enum via_family {
>  /* VIA MMIO register access */
>  #define VIA_BASE ((dev_priv->mmio))
>
> -#define VIA_READ(reg)          DRM_READ32(VIA_BASE, reg)
> -#define VIA_WRITE(reg, val)    DRM_WRITE32(VIA_BASE, reg, val)
> -#define VIA_READ8(reg)         DRM_READ8(VIA_BASE, reg)
> -#define VIA_WRITE8(reg, val)   DRM_WRITE8(VIA_BASE, reg, val)
> +#define VIA_READ(reg) \
> +       readl(((void __iomem *)VIA_BASE->handle) + (reg))
> +
> +#define VIA_WRITE(reg, val) \
> +       writel(val, ((void __iomem *)VIA_BASE->handle) + (reg))
> +
> +#define VIA_READ8(reg) \
> +       readb(((void __iomem *)VIA_BASE->handle) + (reg))
> +
> +#define VIA_WRITE8(reg, val) \
> +       writeb(val, ((void __iomem *)VIA_BASE->handle) + (reg))
>
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().

WDYT?
-Emil
_______________________________________________
openchrome-devel mailing list
openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel

Reply via email to