Re: [PATCH 3/3] libnvdimm: Add sysfs numa_node to NVDIMM devices

From: Toshi Kani
Date: Wed Jun 03 2015 - 11:43:09 EST


On Tue, 2015-06-02 at 19:51 -0700, Dan Williams wrote:
> On Tue, Jun 2, 2015 at 6:01 PM, Dan Williams <dan.j.williams@xxxxxxxxx> wrote:
> > On Tue, Jun 2, 2015 at 5:26 PM, Toshi Kani <toshi.kani@xxxxxx> wrote:
:
> >>
> >> +#ifdef CONFIG_NUMA
> >> +static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr,
> >> + char *buf)
> >> +{
> >> + return sprintf(buf, "%d\n", dev->numa_node);
> >> +}
> >> +DEVICE_ATTR_RO(numa_node);
> >> +#endif
> >> +
> >> static struct attribute *nd_device_attributes[] = {
> >> &dev_attr_modalias.attr,
> >> &dev_attr_devtype.attr,
> >> +#ifdef CONFIG_NUMA
> >> + &dev_attr_numa_node.attr,
> >> +#endif
> >> NULL,
> >> };
> >
> > I'd prefer you define is_visible() in the nd_device_attribute_group
> > and gate showing this attribute on IS_ENABLED(CONFIG_NUMA) rather than
> > including these ifdef guards. The ifdef guards aren't necessary in
> > the CONFIG_NUMA=n case.
>
> I also think is_visible() should hide this attribute on is_nvdimm() devices.

Agreed. Will do.

Thanks,
-Toshi

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/