Skip to contentSkip to conversation

gpu/cuda: set unused gdrcopy functions arguments

PATCH Applied [email protected] 2 participants 2 messages Mar 9, 2022 – Mar 10, 2022 DRM drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpu/cuda: set unused gdrcopy functions arguments

From: Elena Agostini <[email protected]>

Without enabling gdrcopy, dpdk build has warnings about unused gdrcopy functions input parameters.

This patch set them to __rte_unused .

Fixes 24c7759 ("gpu/cuda: map GPU memory with GDRCopy")
---
 drivers/gpu/cuda/gdrcopy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/cuda/gdrcopy.c +2 -2
index 96e768b97b..3126d246eb 100644
@@ -80,7 +80,7 @@ gdrcopy_open(gdr_t *g)
 #endif
 
 int
-gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t size, void **h_addr)
+gdrcopy_pin(__rte_unused gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, __rte_unused uint64_t d_addr, __rte_unused size_t size, __rte_unused void **h_addr)
 {
 #ifdef DRIVERS_GPU_CUDA_GDRCOPY_H
 	if (*gdrc_h == NULL) {
@@ -116,7 +116,7 @@ gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t si
 }
 
 int
-gdrcopy_unpin(gdr_t gdrc_h, __rte_unused gdr_mh_t mh, void *d_addr, size_t size)
+gdrcopy_unpin(gdr_t gdrc_h, __rte_unused gdr_mh_t mh, __rte_unused void *d_addr, __rte_unused size_t size)
 {
 	if (gdrc_h == NULL)
 		return -EINVAL;
Signature · 1 line
2.17.1
#1 lore raw

10/03/2022 01:06, [email protected]:

Quoted 4 lines

From: Elena Agostini <[email protected]>

Without enabling gdrcopy, dpdk build has warnings about unused gdrcopy functions input parameters.

As developers we should test with --werror option given to meson, so we don't miss such details.
This is what the script devtools/test-meson-builds.sh does.

Quoted 3 lines

This patch set them to __rte_unused .

Fixes 24c7759 ("gpu/cuda: map GPU memory with GDRCopy")

Let's keep this casing of GDRCopy in the new title.

drivers/gpu/cuda/gdrcopy.c gdrcopy_open(gdr_t *g) · line 83

Quoted 5 lines

---
int

drivers/gpu/cuda/gdrcopy.c +1 -1
-gdrcopy_pin(gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, uint64_t d_addr, size_t size, void **h_addr)
+gdrcopy_pin(__rte_unused gdr_t *gdrc_h, __rte_unused gdr_mh_t *mh, __rte_unused uint64_t d_addr, __rte_unused size_t size, __rte_unused void **h_addr)

While at it, break the too long line.

It seems my compiler is smart enough to not require the unused attribute for parameters used in another branch of #ifdef.
But it is probably required for some old compilers.

Applied, thanks.