<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
</head>
<body dir="ltr">
<div dir="auto" style="direction:ltr; margin:0; padding:0; font-family:sans-serif; font-size:11pt; color:black">
better to use div64_ul(x, y) for compatiblity.</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Abramov, Slava<br>
<b>Sent:</b> Friday, May 17, 2019 5:19:54 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Pan, Xinhui; Deucher, Alexander<br>
<b>Subject:</b> [PATCH] drm/amdgpu: cast to unsigned int for 32-bit portability</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0"></p>
<div>Without casting, 64-bit division is used implicitly causing DEPMOD</div>
<div>failure when building 32-bit kernel.</div>
<div><br>
</div>
<div>Signed-off-by: Slava Abramov <slava.abramov@amd.com></div>
<div>---</div>
<div> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--</div>
<div> 1 file changed, 3 insertions(+), 2 deletions(-)</div>
<div><br>
</div>
<div>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</div>
<div>index da1dc40b9b14..0499620ec972 100644</div>
<div>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</div>
<div>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c</div>
<div>@@ -764,8 +764,9 @@ static ssize_t amdgpu_ras_sysfs_badpages_read(struct file *f,</div>
<div> <span style="white-space:pre"> </span>struct amdgpu_device *adev = con->adev;</div>
<div> <span style="white-space:pre"> </span>const unsigned int element_size =</div>
<div> <span style="white-space:pre"> </span>sizeof("0xabcdabcd : 0x12345678 : R\n") - 1;</div>
<div>-<span style="white-space:pre"> </span>unsigned int start = (ppos + element_size - 1) / element_size;</div>
<div>-<span style="white-space:pre"> </span>unsigned int end = (ppos + count - 1) / element_size;</div>
<div>+<span style="white-space:pre"> </span>unsigned int start =</div>
<div>+<span style="white-space:pre"> </span>(unsigned int) (ppos + element_size - 1) / element_size;</div>
<div>+<span style="white-space:pre"> </span>unsigned int end = (unsigned int) (ppos + count - 1) / element_size;</div>
<div> <span style="white-space:pre"> </span>ssize_t s = 0;</div>
<div> <span style="white-space:pre"> </span>struct ras_badpage *bps = NULL;</div>
<div> <span style="white-space:pre"> </span>unsigned int bps_count = 0;</div>
<div>-- </div>
<div>2.17.1</div>
<div><br>
</div>
<br>
<p></p>
</div>
</div>
</body>
</html>