dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: jfalempe@redhat.com, airlied@redhat.com, airlied@gmail.com,
	daniel@ffwll.ch
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 1/4] drm/ast: Remove little-endianism from I/O helpers
Date: Tue, 21 Feb 2023 16:57:42 +0100	[thread overview]
Message-ID: <20230221155745.27484-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20230221155745.27484-1-tzimmermann@suse.de>

Replace one call to ast_io_write16() with two calls to ast_io_write8()
in ast_set_index_reg(). The combined 16-bit-wide write of an index
register and the corresponding data register only works on little-
endian systems. Write both registers independent from each other.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/ast/ast_drv.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index d51b81fea9c8..1f46162adb64 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -282,7 +282,9 @@ static inline void ast_set_index_reg(struct ast_private *ast,
 				     uint32_t base, uint8_t index,
 				     uint8_t val)
 {
-	ast_io_write16(ast, base, ((u16)val << 8) | index);
+	ast_io_write8(ast, base, index);
+	++base;
+	ast_io_write8(ast, base, val);
 }
 
 void ast_set_index_reg_mask(struct ast_private *ast,
-- 
2.39.2


  reply	other threads:[~2023-02-21 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 15:57 [PATCH 0/4] drm/ast: Use struct ast_device Thomas Zimmermann
2023-02-21 15:57 ` Thomas Zimmermann [this message]
2023-02-28 10:15   ` [PATCH 1/4] drm/ast: Remove little-endianism from I/O helpers Javier Martinez Canillas
2023-02-21 15:57 ` [PATCH 2/4] drm/ast: Rework definition of I/O read and write helpers Thomas Zimmermann
2023-02-28 10:25   ` Javier Martinez Canillas
2023-02-21 15:57 ` [PATCH 3/4] drm/ast: Rename struct ast_private to struct ast_device Thomas Zimmermann
2023-02-28 10:32   ` Javier Martinez Canillas
2023-02-21 15:57 ` [PATCH 4/4] drm/ast: Rename to_ast_private() to to_ast_device() Thomas Zimmermann
2023-02-28 10:33   ` Javier Martinez Canillas

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=20230221155745.27484-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jfalempe@redhat.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