Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl/features: Remove the inline specifier from to_cxlfs()
@ 2025-05-21 23:36 alison.schofield
  2025-05-21 23:38 ` Dave Jiang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: alison.schofield @ 2025-05-21 23:36 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl

From: Alison Schofield <alison.schofield@intel.com>

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.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---

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-shiju.jose@huawei.com/


 drivers/cxl/core/features.c | 2 +-
 include/cxl/features.h      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
index 1498e2369c37..efe88c043227 100644
--- a/drivers/cxl/core/features.c
+++ b/drivers/cxl/core/features.c
@@ -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;
 }
diff --git a/include/cxl/features.h b/include/cxl/features.h
index 5f7f842765a5..b9297693dae7 100644
--- a/include/cxl/features.h
+++ b/include/cxl/features.h
@@ -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
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cxl/features: Remove the inline specifier from to_cxlfs()
  2025-05-21 23:36 [PATCH] cxl/features: Remove the inline specifier from to_cxlfs() alison.schofield
@ 2025-05-21 23:38 ` Dave Jiang
  2025-05-22  8:25 ` Jonathan Cameron
  2025-05-22  8:46 ` Shiju Jose
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Jiang @ 2025-05-21 23:38 UTC (permalink / raw)
  To: alison.schofield, Davidlohr Bueso, Jonathan Cameron, Vishal Verma,
	Ira Weiny, Dan Williams, Shiju Jose
  Cc: linux-cxl



On 5/21/25 4:36 PM, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> 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.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Thanks!

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 
> 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-shiju.jose@huawei.com/
> 
> 
>  drivers/cxl/core/features.c | 2 +-
>  include/cxl/features.h      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index 1498e2369c37..efe88c043227 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -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;
>  }
> diff --git a/include/cxl/features.h b/include/cxl/features.h
> index 5f7f842765a5..b9297693dae7 100644
> --- a/include/cxl/features.h
> +++ b/include/cxl/features.h
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cxl/features: Remove the inline specifier from to_cxlfs()
  2025-05-21 23:36 [PATCH] cxl/features: Remove the inline specifier from to_cxlfs() alison.schofield
  2025-05-21 23:38 ` Dave Jiang
@ 2025-05-22  8:25 ` Jonathan Cameron
  2025-05-22  8:46 ` Shiju Jose
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2025-05-22  8:25 UTC (permalink / raw)
  To: alison.schofield
  Cc: Davidlohr Bueso, Dave Jiang, Vishal Verma, Ira Weiny,
	Dan Williams, linux-cxl, shiju.jose

On Wed, 21 May 2025 16:36:23 -0700
alison.schofield@intel.com wrote:

> From: Alison Schofield <alison.schofield@intel.com>
> 
> 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.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Thanks for the quick turn around.

> ---
> 
> 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-shiju.jose@huawei.com/
> 
> 
>  drivers/cxl/core/features.c | 2 +-
>  include/cxl/features.h      | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c
> index 1498e2369c37..efe88c043227 100644
> --- a/drivers/cxl/core/features.c
> +++ b/drivers/cxl/core/features.c
> @@ -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;
>  }
> diff --git a/include/cxl/features.h b/include/cxl/features.h
> index 5f7f842765a5..b9297693dae7 100644
> --- a/include/cxl/features.h
> +++ b/include/cxl/features.h
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] cxl/features: Remove the inline specifier from to_cxlfs()
  2025-05-21 23:36 [PATCH] cxl/features: Remove the inline specifier from to_cxlfs() alison.schofield
  2025-05-21 23:38 ` Dave Jiang
  2025-05-22  8:25 ` Jonathan Cameron
@ 2025-05-22  8:46 ` Shiju Jose
  2 siblings, 0 replies; 4+ messages in thread
From: Shiju Jose @ 2025-05-22  8:46 UTC (permalink / raw)
  To: alison.schofield@intel.com, Davidlohr Bueso, Jonathan Cameron,
	Dave Jiang, Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl@vger.kernel.org

>-----Original Message-----
>From: alison.schofield@intel.com <alison.schofield@intel.com>
>Sent: 22 May 2025 00:36
>To: Davidlohr Bueso <dave@stgolabs.net>; Jonathan Cameron
><jonathan.cameron@huawei.com>; Dave Jiang <dave.jiang@intel.com>; Alison
>Schofield <alison.schofield@intel.com>; Vishal Verma
><vishal.l.verma@intel.com>; Ira Weiny <ira.weiny@intel.com>; Dan Williams
><dan.j.williams@intel.com>
>Cc: linux-cxl@vger.kernel.org
>Subject: [PATCH] cxl/features: Remove the inline specifier from to_cxlfs()
>
>From: Alison Schofield <alison.schofield@intel.com>
>
>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.
>
>Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Thanks Alison.

Reviewed-by: Shiju Jose <shiju.jose@huawei.com>
>---
>
>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-
>shiju.jose@huawei.com/
>
>
> drivers/cxl/core/features.c | 2 +-
> include/cxl/features.h      | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/cxl/core/features.c b/drivers/cxl/core/features.c index
>1498e2369c37..efe88c043227 100644
>--- a/drivers/cxl/core/features.c
>+++ b/drivers/cxl/core/features.c
>@@ -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;
> }
>diff --git a/include/cxl/features.h b/include/cxl/features.h index
>5f7f842765a5..b9297693dae7 100644
>--- a/include/cxl/features.h
>+++ b/include/cxl/features.h
>@@ -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
>--
>2.37.3
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-22  8:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 23:36 [PATCH] cxl/features: Remove the inline specifier from to_cxlfs() alison.schofield
2025-05-21 23:38 ` Dave Jiang
2025-05-22  8:25 ` Jonathan Cameron
2025-05-22  8:46 ` Shiju Jose

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox