Re: [PATCH 05/26] cxl/core: Simplify cxl_dpa_set_mode()

Alison Schofield
2024-05-03T20:33:11Z

On Fri, May 03, 2024 at 12:09:27PM -0700, Ira Weiny wrote:

snip

>
> > > diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> > > index 7d97790b893d..66b8419fd0c3 100644
> > > --- a/drivers/cxl/core/hdm.c
> > > +++ b/drivers/cxl/core/hdm.c
> > > @@ -411,44 +411,35 @@ int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
> > > struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> > > struct cxl_dev_state *cxlds = cxlmd->cxlds;
> > > struct device *dev = &cxled->cxld.dev;
> > > - int rc;
> > >
> > > + guard(rwsem_write)(&cxl_dpa_rwsem);
> > > + if (cxled->cxld.flags & CXL_DECODER_F_ENABLE)
> > > + return -EBUSY;
> > > +
> > > + /*
> > > + * Check that the mode is supported by the current partition
> > > + * configuration
> > > + */
> > > switch (mode) {
> > > case CXL_DECODER_RAM:
> > > + if (!resource_size(&cxlds->ram_res)) {
> > > + dev_dbg(dev, "no available ram capacity\n");
> > > + return -ENXIO;
> > > + }
> > > + break;
> > > case CXL_DECODER_PMEM:
> > > + if (!resource_size(&cxlds->pmem_res)) {
> > > + dev_dbg(dev, "no available pmem capacity\n");
> > > + return -ENXIO;
> > > + }
> > > break;
> > > default:
> > > dev_dbg(dev, "unsupported mode: %d\n", mode);
> > > return -EINVAL;
> > > }
> > >
> >
> > delete extra line
>
> You don't like the space following the switch?
>
> Ira

Sorry - looks fine. Ignore my comment.