cxl/features: Remove the inline specifier from to_cxlfs()
[email protected]
maintainerPATCH 1/1 cxl/features: Remove the inline specifier from to_cxlfs()
From: Alison Schofield <[email protected]>
to_cxlfs() was declared 'inline' in the header but only defined in drivers/cxl/core/features.c. This has worked because features.c was the only file using the function and the definition happened to be available in the same compilation unit.
However, in preparation for a second .c file using the header and needing to call the function, the inline specifier became an issue. Sparse flagged the declaration as invalid since 'inline' requires a visible definition at the point of use.
Defining the function in the header was considered but rejected, as it depends on internal symbols not visible at that level.
Remove the inline specifier to correct the linkage violation.
---
I intentionally did not add a Fixes Tag at the point this was introduced because there is no breakage until the second user comes along.
The second user is this patchset being reviewed:
[PATCH v6 0/8] cxl: support CXL memory RAS features
https://lore.kernel.org/linux-cxl/[email protected]/
drivers/cxl/core/features.c | 2 +- include/cxl/features.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/cxl/core/features.c +1 -1
@@ -36,7 +36,7 @@ static bool is_cxl_feature_exclusive(struct cxl_feat_entry *entry)return is_cxl_feature_exclusive_by_uuid (&entry->uuid); } -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) {return cxlds->cxlfs; }
include/cxl/features.h +1 -1
@@ -64,7 +64,7 @@ struct cxl_features_state {struct cxl_mailbox ;struct cxl_memdev ;#ifdef CONFIG_CXL_FEATURES -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds); +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds);int devm_cxl_setup_features (struct cxl_dev_state *cxlds);int devm_cxl_setup_fwctl (struct device *host,struct cxl_memdev *cxlmd);#else
base-commit: 92a09c47464d040866cf2b4cd052bc60555185fb
Signature · 1 line
2.37.3
Quoted 12 lines · On 5/21/25 4:36 PM, [email protected] wrote:
From: Alison Schofield <[email protected]>
to_cxlfs()was declared 'inline' in the header but only defined indrivers/cxl/core/features.c. This has worked becausefeatures.cwas the only file using the function and the definition happened to be available in the same compilation unit.However, in preparation for a second .c file using the header and needing to call the function, the inline specifier became an issue. Sparse flagged the declaration as invalid since 'inline' requires a visible definition at the point of use.
Quoted 6 lines
Defining the function in the header was considered but rejected, as it depends on internal symbols not visible at that level.
Remove the inline specifier to correct the linkage violation.
Signed-off-by Alison Schofield <[email protected]>
Thanks!
Quoted 43 lines
---
I intentionally did not add a Fixes Tag at the point this was introduced because there is no breakage until the second user comes along.
The second user is this patchset being reviewed:
[PATCH v6 0/8] cxl: support CXL memory RAS features
https://lore.kernel.org/linux-cxl/[email protected]/drivers/cxl/core/features.c | 2 +- include/cxl/features.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/features.c +1
-1@@ -36,7 +36,7 @@ static bool is_cxl_feature_exclusive(struct cxl_feat_entry *entry)return is_cxl_feature_exclusive_by_uuid (&entry->uuid); } -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) {return cxlds->cxlfs; }include/cxl/features.h +1
-1@@ -64,7 +64,7 @@ struct cxl_features_state {struct cxl_mailbox ;struct cxl_memdev ;#ifdef CONFIG_CXL_FEATURES -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds); +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds);int devm_cxl_setup_features (struct cxl_dev_state *cxlds);int devm_cxl_setup_fwctl (struct device *host,struct cxl_memdev *cxlmd);#else base-commit:
92a09c47464d040866cf2b4cd052bc60555185fb
Quoted 12 lines · On Wed, 21 May 2025 16:36:23 -0700 [email protected] wrote:
From: Alison Schofield <[email protected]>
to_cxlfs()was declared 'inline' in the header but only defined indrivers/cxl/core/features.c. This has worked becausefeatures.cwas the only file using the function and the definition happened to be available in the same compilation unit.However, in preparation for a second .c file using the header and needing to call the function, the inline specifier became an issue. Sparse flagged the declaration as invalid since 'inline' requires a visible definition at the point of use.
Quoted 6 lines
Defining the function in the header was considered but rejected, as it depends on internal symbols not visible at that level.
Remove the inline specifier to correct the linkage violation.
Signed-off-by Alison Schofield <[email protected]>
Thanks for the quick turn around.
Quoted 43 lines
---
I intentionally did not add a Fixes Tag at the point this was introduced because there is no breakage until the second user comes along.
The second user is this patchset being reviewed:
[PATCH v6 0/8] cxl: support CXL memory RAS features
https://lore.kernel.org/linux-cxl/[email protected]/drivers/cxl/core/features.c | 2 +- include/cxl/features.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/features.c +1
-1@@ -36,7 +36,7 @@ static bool is_cxl_feature_exclusive(struct cxl_feat_entry *entry)return is_cxl_feature_exclusive_by_uuid (&entry->uuid); } -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) {return cxlds->cxlfs; }include/cxl/features.h +1
-1@@ -64,7 +64,7 @@ struct cxl_features_state {struct cxl_mailbox ;struct cxl_memdev ;#ifdef CONFIG_CXL_FEATURES -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds); +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds);int devm_cxl_setup_features (struct cxl_dev_state *cxlds);int devm_cxl_setup_fwctl (struct device *host,struct cxl_memdev *cxlmd);#else base-commit:
92a09c47464d040866cf2b4cd052bc60555185fb
Quoted 23 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: 22 May 2025 00:36
To: Davidlohr Bueso <[email protected]>; Jonathan Cameron <[email protected]>; Dave Jiang <[email protected]>; Alison Schofield <[email protected]>; Vishal Verma <[email protected]>; Ira Weiny <[email protected]>; Dan Williams <[email protected]>
Cc: [email protected]
Subject: [PATCH] cxl/features: Remove the inline specifier fromto_cxlfs()From: Alison Schofield <[email protected]>
to_cxlfs()was declared 'inline' in the header but only defined indrivers/cxl/core/features.c. This has worked becausefeatures.cwas the only file using the function and the definition happened to be available in the same compilation unit.However, in preparation for a second .c file using the header and needing to call the function, the inline specifier became an issue.
Sparse flagged the declaration as invalid since 'inline' requires a visible definition at the point of use.
Quoted 6 lines
Defining the function in the header was considered but rejected, as it depends on internal symbols not visible at that level.
Remove the inline specifier to correct the linkage violation.
Signed-off-by Alison Schofield <[email protected]>
Thanks Alison.
Quoted 44 lines
---
I intentionally did not add a Fixes Tag at the point this was introduced because there is no breakage until the second user comes along.
The second user is this patchset being reviewed:
[PATCH v6 0/8] cxl: support CXL memory RAS features
https://lore.kernel.org/linux-cxl/20250521124749.817-1-
[email protected]/
drivers/cxl/core/features.c| 2 +-include/cxl/features.h| 2 +-2 files changed, 2 insertions(+), 2 deletions(-)drivers/cxl/core/features.c index renamed from drivers/cxl/core/features.c +0
-0
1498e2369c37..efe88c043227100644drivers/cxl/core/features.c +1
-1@@ -36,7 +36,7 @@ static bool is_cxl_feature_exclusive(struct cxl_feat_entry *entry)return is_cxl_feature_exclusive_by_uuid (&entry->uuid); } -inline struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) +struct cxl_features_state *to_cxlfs (struct cxl_dev_state *cxlds) {return cxlds->cxlfs;}
include/cxl/features.h index renamed from include/cxl/features.h +0
-0
5f7f842765a5..b9297693dae7100644include/cxl/features.h +0
-0@@ -64,7 +64,7 @@ struct cxl_features_state { struct cxl_mailbox; struct
cxl_memdev; #ifdefCONFIG_CXL_FEATURES-inline structcxl_features_state*to_cxlfs(structcxl_dev_state*cxlds);
+structcxl_features_state*to_cxlfs(structcxl_dev_state*cxlds); intdevm_cxl_setup_features(struct cxl_dev_state *cxlds); intdevm_cxl_setup_fwctl(struct device *host, struct cxl_memdev *cxlmd); #elsebase-commit:
92a09c47464d040866cf2b4cd052bc60555185fb--
2.37.3