diff options
author | Dan Williams <dan.j.williams@intel.com> | 2019-11-06 19:56:41 -0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2019-11-17 09:17:38 -0800 |
commit | 78c81cc89a40114d09a5ec0693cfd97831ffbe79 (patch) | |
tree | e4eda33f55368eef544375b5c487c1981924383e /drivers/nvdimm/btt_devs.c | |
parent | cda93d6965a162be87f9d6dc5fb28b99335860fe (diff) | |
download | linux-78c81cc89a40114d09a5ec0693cfd97831ffbe79.tar.bz2 |
libnvdimm: Move attribute groups to device type
Statically initialize the attribute groups for each libnvdimm
device_type. This is a preparation step for removing unnecessary exports
of attributes that can be included in the device_type by default.
Also take the opportunity to mark 'struct device_type' instances const.
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Link: https://lore.kernel.org/r/157309900111.1582359.2445687530383470348.stgit@dwillia2-desk3.amr.corp.intel.com
Diffstat (limited to 'drivers/nvdimm/btt_devs.c')
-rw-r--r-- | drivers/nvdimm/btt_devs.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index 3508a79110c7..05feb97e11ce 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -25,17 +25,6 @@ static void nd_btt_release(struct device *dev) kfree(nd_btt); } -static struct device_type nd_btt_device_type = { - .name = "nd_btt", - .release = nd_btt_release, -}; - -bool is_nd_btt(struct device *dev) -{ - return dev->type == &nd_btt_device_type; -} -EXPORT_SYMBOL(is_nd_btt); - struct nd_btt *to_nd_btt(struct device *dev) { struct nd_btt *nd_btt = container_of(dev, struct nd_btt, dev); @@ -178,6 +167,18 @@ static const struct attribute_group *nd_btt_attribute_groups[] = { NULL, }; +static const struct device_type nd_btt_device_type = { + .name = "nd_btt", + .release = nd_btt_release, + .groups = nd_btt_attribute_groups, +}; + +bool is_nd_btt(struct device *dev) +{ + return dev->type == &nd_btt_device_type; +} +EXPORT_SYMBOL(is_nd_btt); + static struct device *__nd_btt_create(struct nd_region *nd_region, unsigned long lbasize, u8 *uuid, struct nd_namespace_common *ndns) @@ -204,7 +205,6 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, dev_set_name(dev, "btt%d.%d", nd_region->id, nd_btt->id); dev->parent = &nd_region->dev; dev->type = &nd_btt_device_type; - dev->groups = nd_btt_attribute_groups; device_initialize(&nd_btt->dev); if (ndns && !__nd_attach_ndns(&nd_btt->dev, ndns, &nd_btt->ndns)) { dev_dbg(&ndns->dev, "failed, already claimed by %s\n", |