Skip to contentSkip to conversation

drm/amdgpu: fix kernel-doc in amdgpu_ualink.c

PATCH In review Aryan Sinha 2 participants 4 messages Nov 4 – Nov 11

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: fix kernel-doc in amdgpu_ualink.c

The two comments do not describe what follows them. The one above
amdgpu_ualink_npa_vm_unmap_range() is missing the ualink prefix, and the other one for amdgpu_ualink_gart_npa_addr() sits above two defines instead of the function, so kernel-doc attaches it to the first defined one.

hence, Move the defines up and fix the name.
The description also had a stray blank line splitting it in two and said dst_accid_id where it meant dst_accel_id, so join & fix it back up.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +7 -10
index 6cd3927a7..f875209e5 100644
@@ -4631,7 +4631,7 @@ static int amdgpu_ualink_npa_vm_map_range(struct amdgpu_device *adev, struct amd
 }
 
 /**
- * amdgpu_npa_vm_unmap_range - Unmap a range from the NPA VM
+ * amdgpu_ualink_npa_vm_unmap_range - Unmap a range from the NPA VM
  * @adev: amdgpu device pointer
  * @bo: buffer object backing the mapping
  * @pte_flags: page table entry flags
@@ -4727,6 +4727,9 @@ static u64 amdgpu_ualink_npa_addr(struct amdgpu_device *adev, u32 type,
 	return npa;
 }
 
+#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_SHIFT		41
+#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_MASK		GENMASK_ULL(50, 41)
+
 /**
  * amdgpu_ualink_gart_npa_addr - Get GART-mapped NPA address for ring buffer
  * @adev: amdgpu device pointer
@@ -4734,18 +4737,12 @@ static u64 amdgpu_ualink_npa_addr(struct amdgpu_device *adev, u32 type,
  * @src_accel_id: Source accelerator ID
  * @dst_accel_id: Destination accelerator ID
  *
- * Computes the NPA address suitable for GART mapping by adding dst_accid_id to
- * NPA address to access remote by SDMA.
-
- * clears the source GPU ID bits from the NPA address which is set for
- * address-identification mode.
+ * Computes the NPA address suitable for GART mapping by adding dst_accel_id to
+ * NPA address to access remote by SDMA. It also clears the source GPU ID bits
+ * from the NPA address which is set for address-identification mode.
  *
  * Return: NPA address adjusted for GART mapping
  */
-
-#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_SHIFT		41
-#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_MASK		GENMASK_ULL(50, 41)
-
 static u64 amdgpu_ualink_gart_npa_addr(struct amdgpu_device *adev, u32 type,
 					u32 src_accel_id, u32 dst_accel_id)
 {
Signature · 1 line
2.46.0
#1 lore raw

PATCH 2/2 drm/amdgpu: use str_enable_disable() in amdgpu_ualink_set_irq_state()

Replace the open coded ternary with the helper from the string_choices.h. Same output.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +2 -1
index f875209e5..a307d165a 100644
@@ -34,6 +34,7 @@
 #include <linux/math.h>
 #include <linux/sysfs.h>
 #include <linux/string.h>
+#include <linux/string_choices.h>
 
 static void deactivate_accelerator(struct amdgpu_device *adev);
 static int amdgpu_ualink_remote_interrupt(struct amdgpu_device *adev,
@@ -6558,7 +6559,7 @@ static int amdgpu_ualink_set_irq_state(struct amdgpu_device *adev,
 	 * interrupt driver.
 	 */
 	dev_dbg(adev->dev, "ualink interrupt %s\n",
-		state == AMDGPU_IRQ_STATE_ENABLE ? "enable" : "disable");
+		str_enable_disable(state == AMDGPU_IRQ_STATE_ENABLE));
 	return 0;
 }
 
Signature · 1 line
2.46.0
Reviewed-by on v1 1/2
#2 lore raw
In reply to Aryan Sinha
Quoted 10 lines · Aryan Sinha

The two comments do not describe what follows them. The one above
amdgpu_ualink_npa_vm_unmap_range() is missing the ualink prefix, and the other one for amdgpu_ualink_gart_npa_addr() sits above two defines instead of the function, so kernel-doc attaches it to the first defined one.

hence, Move the defines up and fix the name.
The description also had a stray blank line splitting it in two and said dst_accid_id where it meant dst_accel_id, so join & fix it back up.

for patch 1. I'm skipping patch 2 because I find str_enable_disable() harder to understand and just as long to write as the current code.

Thanks!

Alex

Quoted 52 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c +7 -11
index 6cd3927a7..f875209e5 100644
@@ -4631,7 +4631,7 @@ static int amdgpu_ualink_npa_vm_map_range(struct amdgpu_device *adev, struct amd
 }
 
 /**
- * amdgpu_npa_vm_unmap_range - Unmap a range from the NPA VM
+ * amdgpu_ualink_npa_vm_unmap_range - Unmap a range from the NPA VM
  * @adev: amdgpu device pointer
  * @bo: buffer object backing the mapping
  * @pte_flags: page table entry flags
@@ -4727,6 +4727,9 @@ static u64 amdgpu_ualink_npa_addr(struct amdgpu_device *adev, u32 type,
        return npa;
 }
 
+#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_SHIFT                41
+#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_MASK         GENMASK_ULL(50, 41)
+
 /**
  * amdgpu_ualink_gart_npa_addr - Get GART-mapped NPA address for ring buffer
  * @adev: amdgpu device pointer
@@ -4734,18 +4737,12 @@ static u64 amdgpu_ualink_npa_addr(struct amdgpu_device *adev, u32 type,
  * @src_accel_id: Source accelerator ID
  * @dst_accel_id: Destination accelerator ID
  *
- * Computes the NPA address suitable for GART mapping by adding dst_accid_id to
- * NPA address to access remote by SDMA.
-
- * clears the source GPU ID bits from the NPA address which is set for
- * address-identification mode.
+ * Computes the NPA address suitable for GART mapping by adding dst_accel_id to
+ * NPA address to access remote by SDMA. It also clears the source GPU ID bits
+ * from the NPA address which is set for address-identification mode.
  *
  * Return: NPA address adjusted for GART mapping
  */
-
-#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_SHIFT                41
-#define AMDGPU_UALINK_GART_NPA_ADDR_GPUID_MASK         GENMASK_ULL(50, 41)
-
 static u64 amdgpu_ualink_gart_npa_addr(struct amdgpu_device *adev, u32 type,
                                        u32 src_accel_id, u32 dst_accel_id)
 {
--

2.46.0

#3 lore raw
Quoted 3 lines · Alex Deucher

for patch 1. I'm skipping patch 2 because I find str_enable_disable() harder to understand and just as long to write as the current code.

Thanks for the review, Alex. For what it's worth, the helpers were meant to keep these strings consistent across the tree, but it's your driver and your call, so consider patch 2 dropped. Thanks! Have a nice day ahead.

Aryan