| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright(c) 2013-2016 Intel Corporation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of version 2 of the GNU General Public License as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 9 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 11 | | - * General Public License for more details. |
|---|
| 12 | 4 | */ |
|---|
| 13 | 5 | #include <linux/device.h> |
|---|
| 14 | 6 | #include <linux/sizes.h> |
|---|
| .. | .. |
|---|
| 31 | 23 | kfree(nd_dax); |
|---|
| 32 | 24 | } |
|---|
| 33 | 25 | |
|---|
| 34 | | -static struct device_type nd_dax_device_type = { |
|---|
| 35 | | - .name = "nd_dax", |
|---|
| 36 | | - .release = nd_dax_release, |
|---|
| 37 | | -}; |
|---|
| 38 | | - |
|---|
| 39 | | -bool is_nd_dax(struct device *dev) |
|---|
| 40 | | -{ |
|---|
| 41 | | - return dev ? dev->type == &nd_dax_device_type : false; |
|---|
| 42 | | -} |
|---|
| 43 | | -EXPORT_SYMBOL(is_nd_dax); |
|---|
| 44 | | - |
|---|
| 45 | 26 | struct nd_dax *to_nd_dax(struct device *dev) |
|---|
| 46 | 27 | { |
|---|
| 47 | 28 | struct nd_dax *nd_dax = container_of(dev, struct nd_dax, nd_pfn.dev); |
|---|
| .. | .. |
|---|
| 51 | 32 | } |
|---|
| 52 | 33 | EXPORT_SYMBOL(to_nd_dax); |
|---|
| 53 | 34 | |
|---|
| 54 | | -static const struct attribute_group *nd_dax_attribute_groups[] = { |
|---|
| 55 | | - &nd_pfn_attribute_group, |
|---|
| 56 | | - &nd_device_attribute_group, |
|---|
| 57 | | - &nd_numa_attribute_group, |
|---|
| 58 | | - NULL, |
|---|
| 35 | +static const struct device_type nd_dax_device_type = { |
|---|
| 36 | + .name = "nd_dax", |
|---|
| 37 | + .release = nd_dax_release, |
|---|
| 38 | + .groups = nd_pfn_attribute_groups, |
|---|
| 59 | 39 | }; |
|---|
| 40 | + |
|---|
| 41 | +bool is_nd_dax(struct device *dev) |
|---|
| 42 | +{ |
|---|
| 43 | + return dev ? dev->type == &nd_dax_device_type : false; |
|---|
| 44 | +} |
|---|
| 45 | +EXPORT_SYMBOL(is_nd_dax); |
|---|
| 60 | 46 | |
|---|
| 61 | 47 | static struct nd_dax *nd_dax_alloc(struct nd_region *nd_region) |
|---|
| 62 | 48 | { |
|---|
| .. | .. |
|---|
| 77 | 63 | |
|---|
| 78 | 64 | dev = &nd_pfn->dev; |
|---|
| 79 | 65 | dev_set_name(dev, "dax%d.%d", nd_region->id, nd_pfn->id); |
|---|
| 80 | | - dev->groups = nd_dax_attribute_groups; |
|---|
| 81 | 66 | dev->type = &nd_dax_device_type; |
|---|
| 82 | 67 | dev->parent = &nd_region->dev; |
|---|
| 83 | 68 | |
|---|