All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: cast to unsigned int for 32-bit portability
@ 2019-05-16 21:19 Abramov, Slava
       [not found] ` <BN6PR12MB14097E1091DBF08BEFCB547BFE0A0-/b2+HYfkarS5FCRSDc2eTQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Abramov, Slava @ 2019-05-16 21:19 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Deucher, Alexander, Pan, Xinhui


[-- Attachment #1.1: Type: text/plain, Size: 1113 bytes --]

Without casting, 64-bit division is used implicitly causing DEPMOD
failure when building 32-bit kernel.

Signed-off-by: Slava Abramov <slava.abramov-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index da1dc40b9b14..0499620ec972 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -764,8 +764,9 @@ static ssize_t amdgpu_ras_sysfs_badpages_read(struct file *f,
  struct amdgpu_device *adev = con->adev;
  const unsigned int element_size =
  sizeof("0xabcdabcd : 0x12345678 : R\n") - 1;
- unsigned int start = (ppos + element_size - 1) / element_size;
- unsigned int end = (ppos + count - 1) / element_size;
+ unsigned int start =
+ (unsigned int) (ppos + element_size - 1) / element_size;
+ unsigned int end = (unsigned int) (ppos + count - 1) / element_size;
  ssize_t s = 0;
  struct ras_badpage *bps = NULL;
  unsigned int bps_count = 0;
--
2.17.1



[-- Attachment #1.2: Type: text/html, Size: 2381 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: cast to unsigned int for 32-bit portability
       [not found] ` <BN6PR12MB14097E1091DBF08BEFCB547BFE0A0-/b2+HYfkarS5FCRSDc2eTQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
@ 2019-05-17 16:34   ` Pan, Xinhui
  0 siblings, 0 replies; 2+ messages in thread
From: Pan, Xinhui @ 2019-05-17 16:34 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Abramov, Slava
  Cc: Deucher, Alexander


[-- Attachment #1.1: Type: text/plain, Size: 1434 bytes --]

better to use div64_ul(x, y) for compatiblity.
________________________________
From: Abramov, Slava
Sent: Friday, May 17, 2019 5:19:54 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Pan, Xinhui; Deucher, Alexander
Subject: [PATCH] drm/amdgpu: cast to unsigned int for 32-bit portability


Without casting, 64-bit division is used implicitly causing DEPMOD
failure when building 32-bit kernel.

Signed-off-by: Slava Abramov <slava.abramov-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index da1dc40b9b14..0499620ec972 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -764,8 +764,9 @@ static ssize_t amdgpu_ras_sysfs_badpages_read(struct file *f,
  struct amdgpu_device *adev = con->adev;
  const unsigned int element_size =
  sizeof("0xabcdabcd : 0x12345678 : R\n") - 1;
- unsigned int start = (ppos + element_size - 1) / element_size;
- unsigned int end = (ppos + count - 1) / element_size;
+ unsigned int start =
+ (unsigned int) (ppos + element_size - 1) / element_size;
+ unsigned int end = (unsigned int) (ppos + count - 1) / element_size;
  ssize_t s = 0;
  struct ras_badpage *bps = NULL;
  unsigned int bps_count = 0;
--
2.17.1



[-- Attachment #1.2: Type: text/html, Size: 3109 bytes --]

[-- Attachment #2: Type: text/plain, Size: 153 bytes --]

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-17 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 21:19 [PATCH] drm/amdgpu: cast to unsigned int for 32-bit portability Abramov, Slava
     [not found] ` <BN6PR12MB14097E1091DBF08BEFCB547BFE0A0-/b2+HYfkarS5FCRSDc2eTQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-05-17 16:34   ` Pan, Xinhui

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.