usb: otg: modify default to n for usb2.0
[firefly-linux-kernel-4.4.55.git] / drivers / nvdimm / region_devs.c
index 7384455792bfb629ed6a2b9a5dbe40d1f58f2627..9521696c9385dfac222e146291c8a2750b30c9a7 100644 (file)
@@ -134,62 +134,6 @@ int nd_region_to_nstype(struct nd_region *nd_region)
 }
 EXPORT_SYMBOL(nd_region_to_nstype);
 
-static int is_uuid_busy(struct device *dev, void *data)
-{
-       struct nd_region *nd_region = to_nd_region(dev->parent);
-       u8 *uuid = data;
-
-       switch (nd_region_to_nstype(nd_region)) {
-       case ND_DEVICE_NAMESPACE_PMEM: {
-               struct nd_namespace_pmem *nspm = to_nd_namespace_pmem(dev);
-
-               if (!nspm->uuid)
-                       break;
-               if (memcmp(uuid, nspm->uuid, NSLABEL_UUID_LEN) == 0)
-                       return -EBUSY;
-               break;
-       }
-       case ND_DEVICE_NAMESPACE_BLK: {
-               struct nd_namespace_blk *nsblk = to_nd_namespace_blk(dev);
-
-               if (!nsblk->uuid)
-                       break;
-               if (memcmp(uuid, nsblk->uuid, NSLABEL_UUID_LEN) == 0)
-                       return -EBUSY;
-               break;
-       }
-       default:
-               break;
-       }
-
-       return 0;
-}
-
-static int is_namespace_uuid_busy(struct device *dev, void *data)
-{
-       if (is_nd_pmem(dev) || is_nd_blk(dev))
-               return device_for_each_child(dev, data, is_uuid_busy);
-       return 0;
-}
-
-/**
- * nd_is_uuid_unique - verify that no other namespace has @uuid
- * @dev: any device on a nvdimm_bus
- * @uuid: uuid to check
- */
-bool nd_is_uuid_unique(struct device *dev, u8 *uuid)
-{
-       struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev);
-
-       if (!nvdimm_bus)
-               return false;
-       WARN_ON_ONCE(!is_nvdimm_bus_locked(&nvdimm_bus->dev));
-       if (device_for_each_child(&nvdimm_bus->dev, uuid,
-                               is_namespace_uuid_busy) != 0)
-               return false;
-       return true;
-}
-
 static ssize_t size_show(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
@@ -345,6 +289,23 @@ static ssize_t btt_seed_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(btt_seed);
 
+static ssize_t pfn_seed_show(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       struct nd_region *nd_region = to_nd_region(dev);
+       ssize_t rc;
+
+       nvdimm_bus_lock(dev);
+       if (nd_region->pfn_seed)
+               rc = sprintf(buf, "%s\n", dev_name(nd_region->pfn_seed));
+       else
+               rc = sprintf(buf, "\n");
+       nvdimm_bus_unlock(dev);
+
+       return rc;
+}
+static DEVICE_ATTR_RO(pfn_seed);
+
 static ssize_t read_only_show(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
@@ -373,6 +334,7 @@ static struct attribute *nd_region_attributes[] = {
        &dev_attr_nstype.attr,
        &dev_attr_mappings.attr,
        &dev_attr_btt_seed.attr,
+       &dev_attr_pfn_seed.attr,
        &dev_attr_read_only.attr,
        &dev_attr_set_cookie.attr,
        &dev_attr_available_size.attr,
@@ -740,10 +702,12 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
        nd_region->provider_data = ndr_desc->provider_data;
        nd_region->nd_set = ndr_desc->nd_set;
        nd_region->num_lanes = ndr_desc->num_lanes;
+       nd_region->flags = ndr_desc->flags;
        nd_region->ro = ro;
        nd_region->numa_node = ndr_desc->numa_node;
        ida_init(&nd_region->ns_ida);
        ida_init(&nd_region->btt_ida);
+       ida_init(&nd_region->pfn_ida);
        dev = &nd_region->dev;
        dev_set_name(dev, "region%d", nd_region->id);
        dev->parent = &nvdimm_bus->dev;