All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Li <chenli@uniontech.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org, "Chen Li" <chenli@uniontech.com>,
	dri-devel@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH v3 1/2] radeon: fix coding issues reported from sparse
Date: Fri, 04 Jun 2021 15:52:19 +0800	[thread overview]
Message-ID: <878s3qcbik.wl-chenli@uniontech.com> (raw)
In-Reply-To: <0689a006-a0a2-698a-12d8-cb11156e469a@gmail.com>


Also fix some coding issues reported from sparse.

Signed-off-by: Chen Li <chenli@uniontech.com>
Acked-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_uvd.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index dfa9fdbe98da..85a1f2c31749 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -152,9 +152,11 @@ int radeon_uvd_init(struct radeon_device *rdev)
 
 			rdev->uvd.fw_header_present = true;
 
-			family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-			version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
-			version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+			family_id = (__force u32)(hdr->ucode_version) & 0xff;
+			version_major = (le32_to_cpu((__force __le32)(hdr->ucode_version))
+							 >> 24) & 0xff;
+			version_minor = (le32_to_cpu((__force __le32)(hdr->ucode_version))
+							 >> 8) & 0xff;
 			DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
 				 version_major, version_minor, family_id);
 
@@ -791,17 +793,17 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring,
 		return r;
 
 	/* stitch together an UVD create msg */
-	writel(cpu_to_le32(0x00000de4), &msg[0]);
+	writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
 	writel(0x0, (void __iomem *)&msg[1]);
-	writel(cpu_to_le32(handle), &msg[2]);
+	writel((__force u32)cpu_to_le32(handle), &msg[2]);
 	writel(0x0, &msg[3]);
 	writel(0x0, &msg[4]);
 	writel(0x0, &msg[5]);
 	writel(0x0, &msg[6]);
-	writel(cpu_to_le32(0x00000780), &msg[7]);
-	writel(cpu_to_le32(0x00000440), &msg[8]);
+	writel((__force u32)cpu_to_le32(0x00000780), &msg[7]);
+	writel((__force u32)cpu_to_le32(0x00000440), &msg[8]);
 	writel(0x0, &msg[9]);
-	writel(cpu_to_le32(0x01b37000), &msg[10]);
+	writel((__force u32)cpu_to_le32(0x01b37000), &msg[10]);
 	for (i = 11; i < 1024; ++i)
 		writel(0x0, &msg[i]);
 
@@ -827,9 +829,9 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring,
 		return r;
 
 	/* stitch together an UVD destroy msg */
-	writel(cpu_to_le32(0x00000de4), &msg[0]);
-	writel(cpu_to_le32(0x00000002), &msg[1]);
-	writel(cpu_to_le32(handle), &msg[2]);
+	writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
+	writel((__force u32)cpu_to_le32(0x00000002), &msg[1]);
+	writel((__force u32)cpu_to_le32(handle), &msg[2]);
 	writel(0x0, &msg[3]);
 	for (i = 4; i < 1024; ++i)
 		writel(0x0, &msg[i]);
-- 
2.31.1




WARNING: multiple messages have this Message-ID (diff)
From: Chen Li <chenli@uniontech.com>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org, "Chen Li" <chenli@uniontech.com>,
	dri-devel@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH v3 1/2] radeon: fix coding issues reported from sparse
Date: Fri, 04 Jun 2021 15:52:19 +0800	[thread overview]
Message-ID: <878s3qcbik.wl-chenli@uniontech.com> (raw)
In-Reply-To: <0689a006-a0a2-698a-12d8-cb11156e469a@gmail.com>


Also fix some coding issues reported from sparse.

Signed-off-by: Chen Li <chenli@uniontech.com>
Acked-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/radeon/radeon_uvd.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index dfa9fdbe98da..85a1f2c31749 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -152,9 +152,11 @@ int radeon_uvd_init(struct radeon_device *rdev)
 
 			rdev->uvd.fw_header_present = true;
 
-			family_id = le32_to_cpu(hdr->ucode_version) & 0xff;
-			version_major = (le32_to_cpu(hdr->ucode_version) >> 24) & 0xff;
-			version_minor = (le32_to_cpu(hdr->ucode_version) >> 8) & 0xff;
+			family_id = (__force u32)(hdr->ucode_version) & 0xff;
+			version_major = (le32_to_cpu((__force __le32)(hdr->ucode_version))
+							 >> 24) & 0xff;
+			version_minor = (le32_to_cpu((__force __le32)(hdr->ucode_version))
+							 >> 8) & 0xff;
 			DRM_INFO("Found UVD firmware Version: %u.%u Family ID: %u\n",
 				 version_major, version_minor, family_id);
 
@@ -791,17 +793,17 @@ int radeon_uvd_get_create_msg(struct radeon_device *rdev, int ring,
 		return r;
 
 	/* stitch together an UVD create msg */
-	writel(cpu_to_le32(0x00000de4), &msg[0]);
+	writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
 	writel(0x0, (void __iomem *)&msg[1]);
-	writel(cpu_to_le32(handle), &msg[2]);
+	writel((__force u32)cpu_to_le32(handle), &msg[2]);
 	writel(0x0, &msg[3]);
 	writel(0x0, &msg[4]);
 	writel(0x0, &msg[5]);
 	writel(0x0, &msg[6]);
-	writel(cpu_to_le32(0x00000780), &msg[7]);
-	writel(cpu_to_le32(0x00000440), &msg[8]);
+	writel((__force u32)cpu_to_le32(0x00000780), &msg[7]);
+	writel((__force u32)cpu_to_le32(0x00000440), &msg[8]);
 	writel(0x0, &msg[9]);
-	writel(cpu_to_le32(0x01b37000), &msg[10]);
+	writel((__force u32)cpu_to_le32(0x01b37000), &msg[10]);
 	for (i = 11; i < 1024; ++i)
 		writel(0x0, &msg[i]);
 
@@ -827,9 +829,9 @@ int radeon_uvd_get_destroy_msg(struct radeon_device *rdev, int ring,
 		return r;
 
 	/* stitch together an UVD destroy msg */
-	writel(cpu_to_le32(0x00000de4), &msg[0]);
-	writel(cpu_to_le32(0x00000002), &msg[1]);
-	writel(cpu_to_le32(handle), &msg[2]);
+	writel((__force u32)cpu_to_le32(0x00000de4), &msg[0]);
+	writel((__force u32)cpu_to_le32(0x00000002), &msg[1]);
+	writel((__force u32)cpu_to_le32(handle), &msg[2]);
 	writel(0x0, &msg[3]);
 	for (i = 4; i < 1024; ++i)
 		writel(0x0, &msg[i]);
-- 
2.31.1



_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2021-06-05  6:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03  5:35 [PATCH] radeon: use memcpy_to/fromio for UVD fw upload Chen Li
2021-06-03  5:35 ` Chen Li
2021-06-03 19:21 ` Alex Deucher
2021-06-03 19:21   ` Alex Deucher
2021-06-04  3:00   ` [PATCH v2 0/2] " Chen Li
2021-06-04  3:00     ` Chen Li
2021-06-04  3:02 ` [PATCH v2 1/2] radeon: fix coding issues reported from sparse Chen Li
2021-06-04  3:02   ` Chen Li
2021-06-04  7:14   ` Christian König
2021-06-04  7:14     ` Christian König
2021-06-04  3:04 ` [PATCH v2 2/2] radeon: use memcpy_to/fromio for UVD fw upload Chen Li
2021-06-04  3:04   ` Chen Li
2021-06-04  7:18   ` Christian König
2021-06-04  7:18     ` Christian König
2021-06-04  7:50     ` [PATCH v3 0/2] " Chen Li
2021-06-04  7:50       ` Chen Li
2021-06-04  7:52     ` Chen Li [this message]
2021-06-04  7:52       ` [PATCH v3 1/2] radeon: fix coding issues reported from sparse Chen Li
2021-06-04  7:53     ` [PATCH v3 2/2] radeon: use memcpy_to/fromio for UVD fw upload Chen Li
2021-06-04  7:53       ` Chen Li
2021-06-04  8:08       ` Christian König
2021-06-04  8:08         ` Christian König
2021-06-04  8:28         ` Chen Li
2021-06-04  8:28           ` Chen Li
2021-06-04  8:31           ` Christian König
2021-06-04  8:31             ` Christian König
2021-06-04  8:37             ` Chen Li
2021-06-04  8:37               ` Chen Li
2021-06-04  8:38         ` [PATCH v4 0/2] " Chen Li
2021-06-04  8:38           ` Chen Li
2021-06-04  8:40         ` [PATCH v4 1/2] radeon: fix coding issues reported from sparse Chen Li
2021-06-04  8:40           ` Chen Li
2021-06-04 17:19           ` Alex Deucher
2021-06-04 17:19             ` Alex Deucher
2021-06-04  8:43         ` [PATCH v4 2/2] radeon: use memcpy_to/fromio for UVD fw upload Chen Li
2021-06-04  8:43           ` Chen Li
2021-06-04  8:47           ` Christian König
2021-06-04  8:47             ` Christian König
2021-06-04 17:21           ` Alex Deucher
2021-06-04 17:21             ` Alex Deucher

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=878s3qcbik.wl-chenli@uniontech.com \
    --to=chenli@uniontech.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    /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.