<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Am 17.10.24 um 18:25 schrieb Sunil Khatri:<br>
    <blockquote type="cite" cite="mid:20241017162531.1551442-3-sunil.khatri@amd.com">
      <pre class="moz-quote-pre" wrap="">Use the helper function amdgpu_ip_block_suspend where
same checks and calls are repeated.</pre>
    </blockquote>
    <br>
    I strongly suggest to squash this patch and the next one together.<br>
    <br>
    <blockquote type="cite" cite="mid:20241017162531.1551442-3-sunil.khatri@amd.com">
      <pre class="moz-quote-pre" wrap="">

Signed-off-by: Sunil Khatri <a class="moz-txt-link-rfc2396E" href="mailto:sunil.khatri@amd.com"><sunil.khatri@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 48c9b9b06905..df57efa019ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -364,6 +364,7 @@ int amdgpu_device_ip_wait_for_idle(struct amdgpu_device *adev,
                                   enum amd_ip_block_type block_type);
 bool amdgpu_device_ip_is_valid(struct amdgpu_device *adev,
                              enum amd_ip_block_type block_type);
+int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block);
 
 #define AMDGPU_MAX_IP_NUM 16
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b7277bef7463..f69aba68e7b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -272,6 +272,23 @@ void amdgpu_reg_state_sysfs_fini(struct amdgpu_device *adev)
        sysfs_remove_bin_file(&adev->dev->kobj, &bin_attr_reg_state);
 }
 
+int amdgpu_ip_block_suspend(struct amdgpu_ip_block *ip_block)
+{
+       int r;
+
+       if (ip_block->version->funcs->suspend) {
+               r = ip_block->version->funcs->suspend(ip_block);
+               if (r) {
+                       dev_err(ip_block->adev->dev,
+                               "suspend of IP block <%s> failed %d\n",
+                               ip_block->version->funcs->name, r);
+                       return r;
+               }
+       }</pre>
    </blockquote>
    <br>
    Please add "i<span style="white-space: pre-wrap">p_blocks->status.hw = false;" and remove that from the callers as well.

Apart from that looks good to me,
Christian.
</span><br>
    <blockquote type="cite" cite="mid:20241017162531.1551442-3-sunil.khatri@amd.com">
      <pre class="moz-quote-pre" wrap="">
+
+       return 0;
+}
+
 /**
  * DOC: board_info
  *
</pre>
    </blockquote>
    <br>
  </body>
</html>