diff mbox series

[RFC,v2,01/18] cxl/hdm: Debug, use decoder name function

Message ID 20230604-dcd-type2-upstream-v2-1-f740c47e7916@intel.com
State New, archived
Headers show
Series DCD: Add support for Dynamic Capacity Devices (DCD) | expand

Commit Message

Ira Weiny Aug. 29, 2023, 5:20 a.m. UTC
The decoder enum has a name conversion function defined now.

Use that instead of open coding.

Suggested-by: Navneet Singh <navneet.singh@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>

---
Changes for v2:
[iweiny: new patch, split out]
---
 drivers/cxl/core/hdm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jonathan Cameron Aug. 29, 2023, 2:03 p.m. UTC | #1
On Mon, 28 Aug 2023 22:20:52 -0700
Ira Weiny <ira.weiny@intel.com> wrote:

> The decoder enum has a name conversion function defined now.
> 
> Use that instead of open coding.
> 
> Suggested-by: Navneet Singh <navneet.singh@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> 

Perhaps pull this one out so it can go upstream before the rest are ready,
or could be picked up from here.

Whilst we probably won't see the other decoder modes in here, there
is no reason why anyone reading the code should have to figure that out.
As such much better to use the more generic function.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> Changes for v2:
> [iweiny: new patch, split out]
> ---
>  drivers/cxl/core/hdm.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index b01a77b67511..a254f79dd4e8 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -550,8 +550,7 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
>  
>  	if (size > avail) {
>  		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
> -			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
> -			&avail);
> +			cxl_decoder_mode_name(cxled->mode), &avail);
>  		rc = -ENOSPC;
>  		goto out;
>  	}
>
Fan Ni Aug. 29, 2023, 9:48 p.m. UTC | #2
On Tue, Aug 29, 2023 at 03:03:20PM +0100, Jonathan Cameron wrote:
> On Mon, 28 Aug 2023 22:20:52 -0700
> Ira Weiny <ira.weiny@intel.com> wrote:
>
> > The decoder enum has a name conversion function defined now.
> >
> > Use that instead of open coding.
> >
> > Suggested-by: Navneet Singh <navneet.singh@intel.com>
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> >
>
> Perhaps pull this one out so it can go upstream before the rest are ready,
> or could be picked up from here.
>
> Whilst we probably won't see the other decoder modes in here, there
> is no reason why anyone reading the code should have to figure that out.
> As such much better to use the more generic function.
>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>

Agreed. This patch can be pulled out and picked up before the rest.


Reviewed-by: Fan Ni <fan.ni@samsung.com>


> > ---
> > Changes for v2:
> > [iweiny: new patch, split out]
> > ---
> >  drivers/cxl/core/hdm.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> > index b01a77b67511..a254f79dd4e8 100644
> > --- a/drivers/cxl/core/hdm.c
> > +++ b/drivers/cxl/core/hdm.c
> > @@ -550,8 +550,7 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
> >
> >  	if (size > avail) {
> >  		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
> > -			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
> > -			&avail);
> > +			cxl_decoder_mode_name(cxled->mode), &avail);
> >  		rc = -ENOSPC;
> >  		goto out;
> >  	}
> >
>
Dave Jiang Aug. 30, 2023, 8:32 p.m. UTC | #3
On 8/28/23 22:20, Ira Weiny wrote:
> The decoder enum has a name conversion function defined now.
> 
> Use that instead of open coding.
> 
> Suggested-by: Navneet Singh <navneet.singh@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>

As others said, send this upstream outside of the series.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> 
> ---
> Changes for v2:
> [iweiny: new patch, split out]
> ---
>   drivers/cxl/core/hdm.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index b01a77b67511..a254f79dd4e8 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -550,8 +550,7 @@ int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
>   
>   	if (size > avail) {
>   		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
> -			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
> -			&avail);
> +			cxl_decoder_mode_name(cxled->mode), &avail);
>   		rc = -ENOSPC;
>   		goto out;
>   	}
>
Ira Weiny Sept. 3, 2023, 2:55 a.m. UTC | #4
Jonathan Cameron wrote:
> On Mon, 28 Aug 2023 22:20:52 -0700
> Ira Weiny <ira.weiny@intel.com> wrote:
> 
> > The decoder enum has a name conversion function defined now.
> > 
> > Use that instead of open coding.
> > 
> > Suggested-by: Navneet Singh <navneet.singh@intel.com>
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> > 
> 
> Perhaps pull this one out so it can go upstream before the rest are ready,
> or could be picked up from here.

Good idea, sent separately.

https://lore.kernel.org/all/20230902-use-decoder-name-v1-1-06374ed7a400@intel.com/

Ira
diff mbox series

Patch

diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
index b01a77b67511..a254f79dd4e8 100644
--- a/drivers/cxl/core/hdm.c
+++ b/drivers/cxl/core/hdm.c
@@ -550,8 +550,7 @@  int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
 
 	if (size > avail) {
 		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
-			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
-			&avail);
+			cxl_decoder_mode_name(cxled->mode), &avail);
 		rc = -ENOSPC;
 		goto out;
 	}