Re: [PATCH RFC v2 07/18] cxl/mem: Expose device dynamic capacity configuration

From: Ira Weiny
Date: Fri Sep 08 2023 - 19:22:42 EST


Dave Jiang wrote:
>
>
> On 8/28/23 22:20, ira.weiny@xxxxxxxxx wrote:
> > From: Navneet Singh <navneet.singh@xxxxxxxxx>
> >

[snip]

> > +
> > +static umode_t cxl_dc_visible(struct kobject *kobj, struct attribute *a, int n)
> > +{
> > + struct device *dev = kobj_to_dev(kobj);
> > + struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
> > + struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlmd->cxlds);
> > +
> > + /* Not a memory device */
> > + if (!mds)
> > + return 0;
> > +
> > + if (a == &dev_attr_region_count.attr)
> > + return a->mode;
> > +
> > + if (n < mds->nr_dc_region)
> > + return a->mode;
>
> I would add a comment on who you are checking against nr_dc_region to
> make it obvious.

Sounds good.

Thanks!
Ira