Skip to contentSkip to conversation

cxl: Fixed defined but not used warnings

PATCH Superseded Ben Widawsky 2 participants 10 messages Aug 30, 2021 – Sep 4, 2021

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

PATCH 1/3 cxl: Fixed defined but not used warnings

This fixes unused-const-variable warnings emitted by gcc when cxlmem.h is used by pretty much all files except pci.c

---
 include/uapi/linux/cxl_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cxl_mem.h +1 -1
index f6e8a005b113..1236dd9ffe23 100644
@@ -50,7 +50,7 @@ enum { CXL_CMDS };
 #define ___C(a, b) { b }
 static const struct {
 	const char *name;
-} cxl_command_names[] = { CXL_CMDS };
+} cxl_command_names[] __maybe_unused = { CXL_CMDS };
 
 /*
  * Here's how this actually breaks out:
Signature · 1 line
2.33.0
#1 lore raw

PATCH 2/3 cxl/core/mbox: Remove extra parameter docs

Fixed "Excess function parameter" warnings generated by the CHECK stage of build.

---
 drivers/cxl/core/mbox.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/cxl/core/mbox.c +0 -4
index 48a07cf2deb4..1b3335f5ed59 100644
@@ -640,10 +640,6 @@ EXPORT_SYMBOL_GPL(cxl_mem_enumerate_cmds);
 /**
  * cxl_mem_get_partition_info - Get partition info
  * @cxlm: The device to act on
- * @active_volatile_bytes: returned active volatile capacity; in bytes
- * @active_persistent_bytes: returned active persistent capacity; in bytes
- * @next_volatile_bytes: return next volatile capacity; in bytes
- * @next_persistent_bytes: return next persistent capacity; in bytes
  *
  * Retrieve the current partition info for the device specified.  The active
  * values are the current capacity in bytes.  If not 0, the 'next' values are
Signature · 1 line
2.33.0
#2 lore raw

Re: [PATCH 2/3] cxl/core/mbox: Remove extra parameter docs

Quoted 4 lines · Ben Widawsky

Fixed "Excess function parameter" warnings generated by the CHECK stage of build.

I'll add the:

Fixes bd0964c858ec ("cxl/mbox: Move mailbox and other non-PCI

specific infrastructure to the core")

...but otherwise looks good.

Quoted 23 lines
---
 drivers/cxl/core/mbox.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/cxl/core/mbox.c +0 -5
index 48a07cf2deb4..1b3335f5ed59 100644
@@ -640,10 +640,6 @@ EXPORT_SYMBOL_GPL(cxl_mem_enumerate_cmds);
 /**
  * cxl_mem_get_partition_info - Get partition info
  * @cxlm: The device to act on
- * @active_volatile_bytes: returned active volatile capacity; in bytes
- * @active_persistent_bytes: returned active persistent capacity; in bytes
- * @next_volatile_bytes: return next volatile capacity; in bytes
- * @next_persistent_bytes: return next persistent capacity; in bytes
  *
  * Retrieve the current partition info for the device specified.  The active
  * values are the current capacity in bytes.  If not 0, the 'next' values are
--

2.33.0

#3 lore raw

Re: [PATCH 2/3] cxl/core/mbox: Remove extra parameter docs

Quoted 7 lines · Dan Williams
Quoted 4 lines · Ben Widawsky

Fixed "Excess function parameter" warnings generated by the CHECK stage of build.

Quoted 6 lines

I'll add the:

Fixes bd0964c858ec ("cxl/mbox: Move mailbox and other non-PCI

specific infrastructure to the core")

...but otherwise looks good.

So this collided with Jonathan's wider comment to split out some of the changes from the "cxl/mbox: Move mailbox and other non-PCI specific infrastructure to the core" into precursor patches. So I ended up folding this change into a bigger cleanup of cxl_mem_get_partition_info(), but I'll add a Reported-by tag for my miss on the doc warning.

#4 lore raw

PATCH 3/3 cxl/docs: Remove undocumented references

In reply to Ben Widawsky

When the core pmem and regs implementation was added, there were no structured comments added. This change allows docs to be generated without warnings.

---
 Documentation/driver-api/cxl/memory-devices.rst | 6 ------
 1 file changed, 6 deletions(-)
Documentation/driver-api/cxl/memory-devices.rst +0 -6
index 356f70d28316..20e177fab487 100644
@@ -39,12 +39,6 @@ CXL Core
 .. kernel-doc:: drivers/cxl/core/bus.c
    :doc: cxl core
 
-.. kernel-doc:: drivers/cxl/core/pmem.c
-   :internal:
-
-.. kernel-doc:: drivers/cxl/core/regs.c
-   :internal:
-
 .. kernel-doc:: drivers/cxl/core/mbox.c
    :doc: cxl mbox
 
Signature · 1 line
2.33.0
#5 lore raw

Re: [PATCH 3/3] cxl/docs: Remove undocumented references

Quoted 5 lines · Ben Widawsky

When the core pmem and regs implementation was added, there were no structured comments added. This change allows docs to be generated without warnings.

Hmm, might be better to go the other and fix this with patches to add documentation. At least devm_cxl_add_nvdimm_bridge() would benefit and regs.c has some kernel-doc annotations, just needs the header section added.

#6 lore raw

Re: [PATCH 3/3] cxl/docs: Remove undocumented references

Quoted 11 lines · Dan Williams
Quoted 5 lines · Ben Widawsky

When the core pmem and regs implementation was added, there were no structured comments added. This change allows docs to be generated without warnings.

Hmm, might be better to go the other and fix this with patches to add documentation. At least devm_cxl_add_nvdimm_bridge() would benefit and regs.c has some kernel-doc annotations, just needs the header section added.

That'd be my preference, but I'll leave that to you if that's okay.

#7 lore raw
In reply to Ben Widawsky
Quoted 14 lines · Ben Widawsky

This fixes unused-const-variable warnings emitted by gcc when cxlmem.h is used by pretty much all files except pci.c

---
 include/uapi/linux/cxl_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cxl_mem.h +0 -0
index f6e8a005b113..1236dd9ffe23 100644

include/uapi/linux/cxl_mem.h enum { CXL_CMDS }; · line 53

Quoted 5 lines
include/uapi/linux/cxl_mem.h +1 -1
@@ -50,7 +50,7 @@ enum { CXL_CMDS };
 #define ___C(a, b) { b }
 static const struct {
        const char *name;
-} cxl_command_names[] = { CXL_CMDS };
+} cxl_command_names[] __maybe_unused = { CXL_CMDS };

Since this is a uapi header does this need to be the raw "__attribute__((__unused__))"?

#8 lore raw
Quoted 10 lines · Dan Williams
Quoted 9 lines · Ben Widawsky

This fixes unused-const-variable warnings emitted by gcc when cxlmem.h is used by pretty much all files except pci.c

---
 include/uapi/linux/cxl_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

include/uapi/linux/cxl_mem.h enum { CXL_CMDS }; · line 53

Quoted 10 lines
include/uapi/linux/cxl_mem.h +1 -1
index f6e8a005b113..1236dd9ffe23 100644
@@ -50,7 +50,7 @@ enum { CXL_CMDS };
 #define ___C(a, b) { b }
 static const struct {
        const char *name;
-} cxl_command_names[] = { CXL_CMDS };
+} cxl_command_names[] __maybe_unused = { CXL_CMDS };

Since this is a uapi header does this need to be the raw "__attribute__((__unused__))"?

Good catch. I grepped uapi dir and interestingly didn't find other examples of unused... Feeling a bit special snowflake now.

#9 lore raw

PATCH v2 1/1 cxl: Fixed defined but not used warnings

In reply to Ben Widawsky

This fixes unused-const-variable warnings emitted by gcc when cxlmem.h is used by pretty much all files except pci.c

---
v2: Replace __maybe_unused with __attribute__((__unused__)) (Dan)

---
 include/uapi/linux/cxl_mem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/linux/cxl_mem.h +1 -1
index f6e8a005b113..8d206f27bb6d 100644
@@ -50,7 +50,7 @@ enum { CXL_CMDS };
 #define ___C(a, b) { b }
 static const struct {
 	const char *name;
-} cxl_command_names[] = { CXL_CMDS };
+} cxl_command_names[] __attribute__((__unused__)) = { CXL_CMDS };
 
 /*
  * Here's how this actually breaks out:
Signature · 1 line
2.33.0