Re: [PATCH 11/13] nvdimm: Use more common logic testing styles and bare ; positions

2019-09-11 Thread Verma, Vishal L
On Wed, 2019-09-11 at 19:54 -0700, Joe Perches wrote:
> Avoid using uncommon logic testing styles to make the code a
> bit more like other kernel code.
> 
> e.g.:
>   if (foo) {
>   ;
>   } else {
>   
>   }
> 
> is typically written
> 
>   if (!foo) {
>   
>   }
> 

A lot of times the excessive inversions seem to result in a net loss of
readability - e.g.:



> diff --git a/drivers/nvdimm/region_devs.c
> b/drivers/nvdimm/region_devs.c
> index 65df07481909..6861e0997d21 100644
> --- a/drivers/nvdimm/region_devs.c
> +++ b/drivers/nvdimm/region_devs.c
> @@ -320,9 +320,7 @@ static ssize_t set_cookie_show(struct device *dev,
>   struct nd_interleave_set *nd_set = nd_region->nd_set;
>   ssize_t rc = 0;
>  
> - if (is_memory(dev) && nd_set)
> - /* pass, should be precluded by region_visible */;

For one, the comment is lost

> - else
> + if (!(is_memory(dev) && nd_set))

And it takes a moment to resolve between things such as:

if (!(A && B))
  vs.
if (!(A) && B)

And this is especially true if 'A' and 'B' are longer function calls,
split over multiple lines, or are themselves compound 'sections'.

I'm not opposed to /all/ such transformations -- for example, the ones
where the logical inversion can be 'consumed' by toggling a comparision
operator, as you have a few times in this patch, don't sacrifice any
readibility, and perhaps even improve it. 

>   return -ENXIO;
>  
>   /*
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 07/13] nvdimm: Use typical kernel brace styles

2019-09-11 Thread Joe Perches
Make the nvdimm code more like the rest of the kernel code to
improve readability.

Add balanced braces to multiple test blocks.
Remove else statements from blocks where the block above uses return.

e.g.:
if (foo) {
[code...];
return FOO;
} else if (bar) {
[code...];
return BAR;
} else
return BAZ;

becomes
if (foo) {
[code...];
return FOO;
}
if (bar) {
[code...];
return BAR;
}
return BAZ;

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/badrange.c   |  3 +-
 drivers/nvdimm/blk.c|  9 +++--
 drivers/nvdimm/btt.c|  5 +--
 drivers/nvdimm/btt_devs.c   |  4 +--
 drivers/nvdimm/bus.c| 10 +++---
 drivers/nvdimm/claim.c  |  7 ++--
 drivers/nvdimm/dax_devs.c   |  3 +-
 drivers/nvdimm/dimm_devs.c  | 13 ---
 drivers/nvdimm/label.c  | 13 +++
 drivers/nvdimm/namespace_devs.c | 78 ++---
 drivers/nvdimm/pfn_devs.c   | 24 +++--
 drivers/nvdimm/pmem.c   |  8 ++---
 drivers/nvdimm/region_devs.c| 10 +++---
 drivers/nvdimm/security.c   |  8 +++--
 14 files changed, 118 insertions(+), 77 deletions(-)

diff --git a/drivers/nvdimm/badrange.c b/drivers/nvdimm/badrange.c
index f2a742c6258a..681d99c59f52 100644
--- a/drivers/nvdimm/badrange.c
+++ b/drivers/nvdimm/badrange.c
@@ -206,8 +206,9 @@ static void __add_badblock_range(struct badblocks *bb, u64 
ns_offset, u64 len)
remaining -= done;
s += done;
}
-   } else
+   } else {
set_badblock(bb, start_sector, num_sectors);
+   }
 }
 
 static void badblocks_populate(struct badrange *badrange,
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
index 95acb48bfaed..db3973c7f506 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -301,13 +301,16 @@ static int nd_blk_probe(struct device *dev)
dev_set_drvdata(dev, nsblk);
 
ndns->rw_bytes = nsblk_rw_bytes;
+
if (is_nd_btt(dev))
return nvdimm_namespace_attach_btt(ndns);
-   else if (nd_btt_probe(dev, ndns) == 0) {
+
+   if (nd_btt_probe(dev, ndns) == 0) {
/* we'll come back as btt-blk */
return -ENXIO;
-   } else
-   return nsblk_attach_disk(nsblk);
+   }
+
+   return nsblk_attach_disk(nsblk);
 }
 
 static int nd_blk_remove(struct device *dev)
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 0927cbdc5cc6..39851edc2cc5 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -702,9 +702,10 @@ static int log_set_indices(struct arena_info *arena)
 * Only allow the known permutations of log/padding indices,
 * i.e. (0, 1), and (0, 2)
 */
-   if ((log_index[0] == 0) && ((log_index[1] == 1) || (log_index[1] == 2)))
+   if ((log_index[0] == 0) &&
+   ((log_index[1] == 1) || (log_index[1] == 2))) {
; /* known index possibilities */
-   else {
+   } else {
dev_err(to_dev(arena), "Found an unknown padding scheme\n");
return -ENXIO;
}
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
index f6429842f1b6..9e0f17045e69 100644
--- a/drivers/nvdimm/btt_devs.c
+++ b/drivers/nvdimm/btt_devs.c
@@ -139,9 +139,9 @@ static ssize_t size_show(struct device *dev,
ssize_t rc;
 
nd_device_lock(dev);
-   if (dev->driver)
+   if (dev->driver) {
rc = sprintf(buf, "%llu\n", nd_btt->size);
-   else {
+   } else {
/* no size to convey if the btt instance is disabled */
rc = -ENXIO;
}
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 5ffd61c9c4b7..620f07ac306c 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -857,9 +857,9 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
 
if (nvdimm && cmd == ND_CMD_GET_CONFIG_DATA && idx == 1)
return in_field[1];
-   else if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2)
+   if (nvdimm && cmd == ND_CMD_VENDOR && idx == 2)
return out_field[1];
-   else if (!nvdimm && cmd == ND_CMD_ARS_STATUS && idx == 2) {
+   if (!nvdimm && cmd == ND_CMD_ARS_STATUS && idx == 2) {
/*
 * Per table 9-276 ARS Data in ACPI 6.1, out_field[1] is
 * "Size of Output Buffer in bytes, including this
@@ -876,7 +876,8 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
if (out_field[1] - 4 == remainder)
return remainder;
return out_field[1] - 8;
-   } else if (cmd == ND_CMD_CALL) {
+   }
+   if (cmd == ND_CMD_CALL) {
struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *)in_field;
 

[PATCH 13/13] nvdimm: Miscellaneous neatening

2019-09-11 Thread Joe Perches
Random neatening, mostly trivially wrapping to 80 columns, to make the
code a bit more kernel style compatible.

Use casts to (u64) and not (unsigned long long)

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/badrange.c   |   3 +-
 drivers/nvdimm/blk.c|  18 ---
 drivers/nvdimm/btt.c|  22 
 drivers/nvdimm/btt_devs.c   |  42 +---
 drivers/nvdimm/bus.c|  25 -
 drivers/nvdimm/claim.c  |  11 ++--
 drivers/nvdimm/core.c   |   4 +-
 drivers/nvdimm/dimm_devs.c  |  18 ---
 drivers/nvdimm/label.c  |  35 +++--
 drivers/nvdimm/label.h  |   6 ++-
 drivers/nvdimm/namespace_devs.c | 109 +++-
 drivers/nvdimm/nd-core.h|  13 ++---
 drivers/nvdimm/nd.h |  26 +-
 drivers/nvdimm/nd_virtio.c  |   3 +-
 drivers/nvdimm/pfn_devs.c   |  43 
 drivers/nvdimm/pmem.c   |  14 +++---
 drivers/nvdimm/region_devs.c|  36 +++--
 drivers/nvdimm/security.c   |  28 +--
 drivers/nvdimm/virtio_pmem.c|   4 +-
 19 files changed, 254 insertions(+), 206 deletions(-)

diff --git a/drivers/nvdimm/badrange.c b/drivers/nvdimm/badrange.c
index 681d99c59f52..4d231643c095 100644
--- a/drivers/nvdimm/badrange.c
+++ b/drivers/nvdimm/badrange.c
@@ -24,7 +24,8 @@ void badrange_init(struct badrange *badrange)
 EXPORT_SYMBOL_GPL(badrange_init);
 
 static void append_badrange_entry(struct badrange *badrange,
- struct badrange_entry *bre, u64 addr, u64 
length)
+ struct badrange_entry *bre,
+ u64 addr, u64 length)
 {
lockdep_assert_held(&badrange->lock);
bre->start = addr;
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
index db3973c7f506..fc15aa9220c8 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -29,7 +29,8 @@ static u32 nsblk_sector_size(struct nd_namespace_blk *nsblk)
 }
 
 static resource_size_t to_dev_offset(struct nd_namespace_blk *nsblk,
-resource_size_t ns_offset, unsigned int 
len)
+resource_size_t ns_offset,
+unsigned int len)
 {
int i;
 
@@ -61,7 +62,8 @@ static struct nd_blk_region *to_ndbr(struct nd_namespace_blk 
*nsblk)
 
 #ifdef CONFIG_BLK_DEV_INTEGRITY
 static int nd_blk_rw_integrity(struct nd_namespace_blk *nsblk,
-  struct bio_integrity_payload *bip, u64 lba, int 
rw)
+  struct bio_integrity_payload *bip,
+  u64 lba, int rw)
 {
struct nd_blk_region *ndbr = to_ndbr(nsblk);
unsigned int len = nsblk_meta_size(nsblk);
@@ -107,7 +109,8 @@ static int nd_blk_rw_integrity(struct nd_namespace_blk 
*nsblk,
 
 #else /* CONFIG_BLK_DEV_INTEGRITY */
 static int nd_blk_rw_integrity(struct nd_namespace_blk *nsblk,
-  struct bio_integrity_payload *bip, u64 lba, int 
rw)
+  struct bio_integrity_payload *bip,
+  u64 lba, int rw)
 {
return 0;
 }
@@ -115,7 +118,8 @@ static int nd_blk_rw_integrity(struct nd_namespace_blk 
*nsblk,
 
 static int nsblk_do_bvec(struct nd_namespace_blk *nsblk,
 struct bio_integrity_payload *bip, struct page *page,
-unsigned int len, unsigned int off, int rw, sector_t 
sector)
+unsigned int len, unsigned int off, int rw,
+sector_t sector)
 {
struct nd_blk_region *ndbr = to_ndbr(nsblk);
resource_size_t dev_offset, ns_offset;
@@ -187,9 +191,9 @@ static blk_qc_t nd_blk_make_request(struct request_queue 
*q, struct bio *bio)
bvec.bv_offset, rw, iter.bi_sector);
if (err) {
dev_dbg(&nsblk->common.dev,
-   "io error in %s sector %lld, len %d,\n",
-   (rw == READ) ? "READ" : "WRITE",
-   (unsigned long long)iter.bi_sector, len);
+   "io error in %s sector %lld, len %d\n",
+   rw == READ ? "READ" : "WRITE",
+   (u64)iter.bi_sector, len);
bio->bi_status = errno_to_blk_status(err);
break;
}
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 0df4461fe607..6c18d7bba6af 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -589,7 +589,8 @@ static int btt_freelist_init(struct arena_info *arena)
 * to complete the map write. So fix up the map.
 */
ret = btt_map_write(arena, le32_to_cpu(log_new.lba),
-   le32_to_cpu(log_new.new_ma

[PATCH 06/13] nvdimm: Add and remove blank lines

2019-09-11 Thread Joe Perches
Use a more common kernel style.

Remove unnecessary multiple blank lines.
Remove blank lines before and after braces.
Add blank lines after functions definitions and enums.
Add blank lines around #define pr_fmt.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/btt.c| 2 --
 drivers/nvdimm/bus.c| 5 ++---
 drivers/nvdimm/dimm.c   | 1 -
 drivers/nvdimm/dimm_devs.c  | 2 ++
 drivers/nvdimm/label.c  | 1 -
 drivers/nvdimm/namespace_devs.c | 5 -
 drivers/nvdimm/nd-core.h| 4 
 drivers/nvdimm/nd.h | 6 ++
 drivers/nvdimm/nd_virtio.c  | 1 -
 drivers/nvdimm/region_devs.c| 1 +
 drivers/nvdimm/security.c   | 2 --
 11 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 28b65413abd8..0927cbdc5cc6 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1354,7 +1354,6 @@ static int btt_write_pg(struct btt *btt, struct 
bio_integrity_payload *bip,
while (arena->rtt[i] == (RTT_VALID | new_postmap))
cpu_relax();
 
-
if (new_postmap >= arena->internal_nlba) {
ret = -EIO;
goto out_lane;
@@ -1496,7 +1495,6 @@ static int btt_rw_page(struct block_device *bdev, 
sector_t sector,
return rc;
 }
 
-
 static int btt_getgeo(struct block_device *bd, struct hd_geometry *geo)
 {
/* some standard values */
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 35591f492d27..5ffd61c9c4b7 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -2,7 +2,9 @@
 /*
  * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 #include 
@@ -643,7 +645,6 @@ int nvdimm_revalidate_disk(struct gendisk *disk)
set_disk_ro(disk, 1);
 
return 0;
-
 }
 EXPORT_SYMBOL(nvdimm_revalidate_disk);
 
@@ -881,7 +882,6 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
return pkg->nd_size_out;
}
 
-
return UINT_MAX;
 }
 EXPORT_SYMBOL_GPL(nd_cmd_out_size);
@@ -940,7 +940,6 @@ static int nd_pmem_forget_poison_check(struct device *dev, 
void *data)
return -EBUSY;
 
return 0;
-
 }
 
 static int nd_ns_forget_poison_check(struct device *dev, void *data)
diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c
index 916710ae647f..5783c6d6dbdc 100644
--- a/drivers/nvdimm/dimm.c
+++ b/drivers/nvdimm/dimm.c
@@ -62,7 +62,6 @@ static int nvdimm_probe(struct device *dev)
if (rc < 0)
dev_dbg(dev, "failed to unlock dimm: %d\n", rc);
 
-
/*
 * EACCES failures reading the namespace label-area-properties
 * are interpreted as the DIMM capacity being locked but the
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index cb5598b3c389..873df96795b0 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -2,7 +2,9 @@
 /*
  * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
  */
+
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
 #include 
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index 5700d9b35b8f..bf58357927c4 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -972,7 +972,6 @@ static int __blk_label_update(struct nd_region *nd_region,
}
/* from here on we need to abort on error */
 
-
/* assign all resources to the namespace before writing the labels */
nsblk->res = NULL;
nsblk->num_resources = 0;
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 2bf4b6344926..600df84b4d2d 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -367,7 +367,6 @@ resource_size_t nd_namespace_blk_validate(struct 
nd_namespace_blk *nsblk)
 }
 EXPORT_SYMBOL(nd_namespace_blk_validate);
 
-
 static int nd_namespace_label_update(struct nd_region *nd_region,
 struct device *dev)
 {
@@ -543,7 +542,6 @@ static resource_size_t init_dpa_allocation(struct 
nd_label_id *label_id,
return rc ? n : 0;
 }
 
-
 /**
  * space_valid() - validate free dpa space against constraints
  * @nd_region: hosting region of the free space
@@ -2009,7 +2007,6 @@ static struct device *create_namespace_pmem(struct 
nd_region *nd_region,
if (namespace_label_has(ndd, abstraction_guid))
nspm->nsio.common.claim_class
= to_nvdimm_cclass(&label0->abstraction_guid);
-
}
 
if (!nspm->alt_name || !nspm->uuid) {
@@ -2217,7 +2214,6 @@ static int add_namespace_resource(struct nd_region 
*nd_region,
 static struct device *create_namespace_blk(struct nd_region *nd_region,
   struct nd_namespace_label *nd_label, 
int count)
 {
-
struct nd_mapping *nd_mapping = &n

[PATCH 12/13] nvdimm: namespace_devs: Change progess typo to progress

2019-09-11 Thread Joe Perches
Typing is hard.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/namespace_devs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 7a16340f9853..253f07d97b73 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -1718,7 +1718,7 @@ struct nd_namespace_common 
*nvdimm_namespace_common_probe(struct device *dev)
return ERR_PTR(-ENODEV);
 
/*
-* Flush any in-progess probes / removals in the driver
+* Flush any in-progress probes / removals in the driver
 * for the raw personality of this namespace.
 */
nd_device_lock(&ndns->dev);
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 11/13] nvdimm: Use more common logic testing styles and bare ; positions

2019-09-11 Thread Joe Perches
Avoid using uncommon logic testing styles to make the code a
bit more like other kernel code.

e.g.:
if (foo) {
;
} else {

}

is typically written

if (!foo) {

}

Also put bare semicolons before the comment not after the comment

e.g.:

if (foo) {
/* comment */;
} else if (bar) {

} else {
baz;
}

is typically written

if (foo) {
;   /* comment */
} else if (bar) {

} else {
baz;
}

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/claim.c  |  4 +---
 drivers/nvdimm/dimm_devs.c  | 11 --
 drivers/nvdimm/label.c  |  4 +---
 drivers/nvdimm/namespace_devs.c | 46 +++--
 drivers/nvdimm/region_devs.c|  4 +---
 5 files changed, 28 insertions(+), 41 deletions(-)

diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 3732925aadb8..244631f5308c 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -149,9 +149,7 @@ ssize_t nd_namespace_store(struct device *dev,
return -ENOMEM;
strim(name);
 
-   if (strncmp(name, "namespace", 9) == 0 || strcmp(name, "") == 0) {
-   /* pass */;
-   } else {
+   if (!(strncmp(name, "namespace", 9) == 0 || strcmp(name, "") == 0)) {
len = -EINVAL;
goto out;
}
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 4df85dd72682..cac62bb726bb 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -593,13 +593,10 @@ int alias_dpa_busy(struct device *dev, void *data)
 * looking to validate against PMEM aliasing collision rules
 * (i.e. BLK is allocated after all aliased PMEM).
 */
-   if (info->res) {
-   if (info->res->start >= nd_mapping->start &&
-   info->res->start < map_end)
-   /* pass */;
-   else
-   return 0;
-   }
+   if (info->res &&
+   (info->res->start < nd_mapping->start ||
+info->res->start >= map_end))
+   return 0;
 
 retry:
/*
diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index e4632dbebead..ae466c6faa90 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -1180,9 +1180,7 @@ static int init_labels(struct nd_mapping *nd_mapping, int 
num_labels)
mutex_unlock(&nd_mapping->lock);
}
 
-   if (ndd->ns_current == -1 || ndd->ns_next == -1)
-   /* pass */;
-   else
+   if (ndd->ns_current != -1 && ndd->ns_next != -1)
return max(num_labels, old_num_labels);
 
nsindex = to_namespace_index(ndd, 0);
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 8c75ef84bad7..7a16340f9853 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -162,7 +162,7 @@ unsigned int pmem_sector_size(struct nd_namespace_common 
*ndns)
 
nspm = to_nd_namespace_pmem(&ndns->dev);
if (nspm->lbasize == 0 || nspm->lbasize == 512)
-   /* default */;
+   ;   /* default */
else if (nspm->lbasize == 4096)
return 4096;
else
@@ -387,7 +387,7 @@ static int nd_namespace_label_update(struct nd_region 
*nd_region,
resource_size_t size = resource_size(&nspm->nsio.res);
 
if (size == 0 && nspm->uuid)
-   /* delete allocation */;
+   ;   /* delete allocation */
else if (!nspm->uuid)
return 0;
 
@@ -398,7 +398,7 @@ static int nd_namespace_label_update(struct nd_region 
*nd_region,
resource_size_t size = nd_namespace_blk_size(nsblk);
 
if (size == 0 && nsblk->uuid)
-   /* delete allocation */;
+   ;   /* delete allocation */
else if (!nsblk->uuid || !nsblk->lbasize)
return 0;
 
@@ -1900,10 +1900,8 @@ static int select_pmem_id(struct nd_region *nd_region, 
u8 *pmem_id)
hw_end = hw_start + nd_mapping->size;
pmem_start = __le64_to_cpu(nd_label->dpa);
pmem_end = pmem_start + __le64_to_cpu(nd_label->rawsize);
-   if (pmem_start >= hw_start && pmem_start < hw_end &&
-   pmem_end <= hw_end && pmem_end > hw_start) {
-   /* pass */;
-   } else {
+   if (!(pmem_start >= hw_start && pmem_start < hw_end &&
+ pmem_end <= hw_end && pmem_end > hw_start)) {
dev_dbg(&nd_region->dev, "%s invalid label for %pUb\n",
d

[PATCH 10/13] nvdimm: namespace_devs: Move assignment operators

2019-09-11 Thread Joe Perches
Kernel code uses assignment operators where the statement is split
on multiple lines on the first line.

Move 2 unusual uses.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/namespace_devs.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
index 70e1d752c12c..8c75ef84bad7 100644
--- a/drivers/nvdimm/namespace_devs.c
+++ b/drivers/nvdimm/namespace_devs.c
@@ -2023,8 +2023,8 @@ static struct device *create_namespace_pmem(struct 
nd_region *nd_region,
nspm->lbasize = __le64_to_cpu(label0->lbasize);
ndd = to_ndd(nd_mapping);
if (namespace_label_has(ndd, abstraction_guid))
-   nspm->nsio.common.claim_class
-   = to_nvdimm_cclass(&label0->abstraction_guid);
+   nspm->nsio.common.claim_class =
+   to_nvdimm_cclass(&label0->abstraction_guid);
}
 
if (!nspm->alt_name || !nspm->uuid) {
@@ -2267,8 +2267,8 @@ static struct device *create_namespace_blk(struct 
nd_region *nd_region,
nsblk->uuid = kmemdup(nd_label->uuid, NSLABEL_UUID_LEN,
  GFP_KERNEL);
if (namespace_label_has(ndd, abstraction_guid))
-   nsblk->common.claim_class
-   = to_nvdimm_cclass(&nd_label->abstraction_guid);
+   nsblk->common.claim_class =
+   to_nvdimm_cclass(&nd_label->abstraction_guid);
if (!nsblk->uuid)
goto blk_err;
memcpy(name, nd_label->name, NSLABEL_NAME_LEN);
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 09/13] nvdimm: btt.h: Neaten #defines to improve readability

2019-09-11 Thread Joe Perches
Use tab alignment to make the content and macro a bit more intelligible.

Use the BIT and BIT_ULL macros.
Convert MAP_LBA_MASK to use the already defined shift masks.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/btt.h | 54 ++--
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/nvdimm/btt.h b/drivers/nvdimm/btt.h
index 1da76da3e159..fb0f4546153f 100644
--- a/drivers/nvdimm/btt.h
+++ b/drivers/nvdimm/btt.h
@@ -10,34 +10,34 @@
 #include 
 #include 
 
-#define BTT_SIG_LEN 16
-#define BTT_SIG "BTT_ARENA_INFO\0"
-#define MAP_ENT_SIZE 4
-#define MAP_TRIM_SHIFT 31
-#define MAP_TRIM_MASK (1 << MAP_TRIM_SHIFT)
-#define MAP_ERR_SHIFT 30
-#define MAP_ERR_MASK (1 << MAP_ERR_SHIFT)
-#define MAP_LBA_MASK (~((1 << MAP_TRIM_SHIFT) | (1 << MAP_ERR_SHIFT)))
-#define MAP_ENT_NORMAL 0xC000
-#define LOG_GRP_SIZE sizeof(struct log_group)
-#define LOG_ENT_SIZE sizeof(struct log_entry)
-#define ARENA_MIN_SIZE (1UL << 24) /* 16 MB */
-#define ARENA_MAX_SIZE (1ULL << 39)/* 512 GB */
-#define RTT_VALID (1UL << 31)
-#define RTT_INVALID 0
-#define BTT_PG_SIZE 4096
-#define BTT_DEFAULT_NFREE ND_MAX_LANES
-#define LOG_SEQ_INIT 1
-
-#define IB_FLAG_ERROR 0x0001
-#define IB_FLAG_ERROR_MASK 0x0001
-
-#define ent_lba(ent) (ent & MAP_LBA_MASK)
-#define ent_e_flag(ent) (!!(ent & MAP_ERR_MASK))
-#define ent_z_flag(ent) (!!(ent & MAP_TRIM_MASK))
-#define set_e_flag(ent) (ent |= MAP_ERR_MASK)
+#define BTT_SIG_LEN16
+#define BTT_SIG"BTT_ARENA_INFO\0"
+#define MAP_ENT_SIZE   4
+#define MAP_TRIM_SHIFT 31
+#define MAP_TRIM_MASK  BIT(MAP_TRIM_SHIFT)
+#define MAP_ERR_SHIFT  30
+#define MAP_ERR_MASK   BIT(MAP_ERR_SHIFT)
+#define MAP_LBA_MASK   (~(MAP_TRIM_MASK | MAP_ERR_MASK))
+#define MAP_ENT_NORMAL 0xC000
+#define LOG_GRP_SIZE   sizeof(struct log_group)
+#define LOG_ENT_SIZE   sizeof(struct log_entry)
+#define ARENA_MIN_SIZE BIT(24) /* 16 MB */
+#define ARENA_MAX_SIZE BIT_ULL(39) /* 512 GB */
+#define RTT_VALID  BIT(31)
+#define RTT_INVALID0
+#define BTT_PG_SIZE4096
+#define BTT_DEFAULT_NFREE  ND_MAX_LANES
+#define LOG_SEQ_INIT   1
+
+#define IB_FLAG_ERROR  0x0001
+#define IB_FLAG_ERROR_MASK 0x0001
+
+#define ent_lba(ent)   ((ent) & MAP_LBA_MASK)
+#define ent_e_flag(ent)(!!((ent) & MAP_ERR_MASK))
+#define ent_z_flag(ent)(!!((ent) & MAP_TRIM_MASK))
+#define set_e_flag(ent)((ent) |= MAP_ERR_MASK)
 /* 'normal' is both e and z flags set */
-#define ent_normal(ent) (ent_e_flag(ent) && ent_z_flag(ent))
+#define ent_normal(ent)(ent_e_flag(ent) && ent_z_flag(ent))
 
 enum btt_init_state {
INIT_UNCHECKED = 0,
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 08/13] nvdimm: Use typical kernel style indentation

2019-09-11 Thread Joe Perches
Make the nvdimm code more like the rest of the kernel.

Avoid indentation of labels and spaces where tabs should be used.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/btt.c | 2 +-
 drivers/nvdimm/region_devs.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 39851edc2cc5..0df4461fe607 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1320,7 +1320,7 @@ static int btt_write_pg(struct btt *btt, struct 
bio_integrity_payload *bip,
u32 cur_len;
int e_flag;
 
-   retry:
+retry:
lane = nd_region_acquire_lane(btt->nd_region);
 
ret = lba_to_arena(btt, sector, &premap, &arena);
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c
index 16dfdbdbf1c8..65df07481909 100644
--- a/drivers/nvdimm/region_devs.c
+++ b/drivers/nvdimm/region_devs.c
@@ -1044,7 +1044,7 @@ static struct nd_region *nd_region_create(struct 
nvdimm_bus *nvdimm_bus,
if (!nd_region->lane)
goto err_percpu;
 
-for (i = 0; i < nr_cpu_ids; i++) {
+   for (i = 0; i < nr_cpu_ids; i++) {
struct nd_percpu_lane *ndl;
 
ndl = per_cpu_ptr(nd_region->lane, i);
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 05/13] nvdimm: Use "unsigned int" in preference to "unsigned"

2019-09-11 Thread Joe Perches
Use the more common kernel type.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/label.c | 2 +-
 drivers/nvdimm/nd.h| 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
index 2c780c5352dc..5700d9b35b8f 100644
--- a/drivers/nvdimm/label.c
+++ b/drivers/nvdimm/label.c
@@ -34,7 +34,7 @@ static u32 best_seq(u32 a, u32 b)
return a;
 }
 
-unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd)
+unsigned int sizeof_namespace_label(struct nvdimm_drvdata *ndd)
 {
return ndd->nslabel_size;
 }
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h
index c10a4b94d44a..1636061b1f93 100644
--- a/drivers/nvdimm/nd.h
+++ b/drivers/nvdimm/nd.h
@@ -81,7 +81,7 @@ static inline struct nd_namespace_index 
*to_next_namespace_index(
return to_namespace_index(ndd, ndd->ns_next);
 }
 
-unsigned sizeof_namespace_label(struct nvdimm_drvdata *ndd);
+unsigned int sizeof_namespace_label(struct nvdimm_drvdata *ndd);
 
 #define namespace_label_has(ndd, field)\
(offsetof(struct nd_namespace_label, field) \
@@ -170,9 +170,9 @@ struct nd_blk_region {
 /*
  * Lookup next in the repeating sequence of 01, 10, and 11.
  */
-static inline unsigned nd_inc_seq(unsigned seq)
+static inline unsigned int nd_inc_seq(unsigned int seq)
 {
-   static const unsigned next[] = { 0, 2, 3, 1 };
+   static const unsigned int next[] = { 0, 2, 3, 1 };
 
return next[seq & 3];
 }
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 04/13] nvdimm: Use a more common kernel spacing style

2019-09-11 Thread Joe Perches
Use the more common kernel spacing styles per line.

git diff -w shows no difference.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/badrange.c   |  4 ++--
 drivers/nvdimm/blk.c|  2 +-
 drivers/nvdimm/btt.c|  4 ++--
 drivers/nvdimm/btt_devs.c   |  2 +-
 drivers/nvdimm/bus.c| 14 +++---
 drivers/nvdimm/core.c   |  2 +-
 drivers/nvdimm/label.c  | 28 ++--
 drivers/nvdimm/namespace_devs.c | 22 +++---
 drivers/nvdimm/nd-core.h|  2 +-
 drivers/nvdimm/nd.h |  4 ++--
 drivers/nvdimm/pfn_devs.c   |  6 +++---
 drivers/nvdimm/pmem.c   |  2 +-
 drivers/nvdimm/region.c |  2 +-
 drivers/nvdimm/region_devs.c|  2 +-
 drivers/nvdimm/security.c   | 18 +-
 15 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/drivers/nvdimm/badrange.c b/drivers/nvdimm/badrange.c
index b997c2007b83..f2a742c6258a 100644
--- a/drivers/nvdimm/badrange.c
+++ b/drivers/nvdimm/badrange.c
@@ -165,11 +165,11 @@ EXPORT_SYMBOL_GPL(badrange_forget);
 static void set_badblock(struct badblocks *bb, sector_t s, int num)
 {
dev_dbg(bb->dev, "Found a bad range (0x%llx, 0x%llx)\n",
-   (u64) s * 512, (u64) num * 512);
+   (u64)s * 512, (u64)num * 512);
/* this isn't an error as the hardware will still throw an exception */
if (badblocks_set(bb, s, num, 1))
dev_info_once(bb->dev, "%s: failed for sector %llx\n",
- __func__, (u64) s);
+ __func__, (u64)s);
 }
 
 /**
diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
index edd3e1664edc..95acb48bfaed 100644
--- a/drivers/nvdimm/blk.c
+++ b/drivers/nvdimm/blk.c
@@ -189,7 +189,7 @@ static blk_qc_t nd_blk_make_request(struct request_queue 
*q, struct bio *bio)
dev_dbg(&nsblk->common.dev,
"io error in %s sector %lld, len %d,\n",
(rw == READ) ? "READ" : "WRITE",
-   (unsigned long long) iter.bi_sector, len);
+   (unsigned long long)iter.bi_sector, len);
bio->bi_status = errno_to_blk_status(err);
break;
}
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 9cad4dca6eac..28b65413abd8 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1007,7 +1007,7 @@ static int btt_arena_write_layout(struct arena_info 
*arena)
super->info2off = cpu_to_le64(arena->info2off - arena->infooff);
 
super->flags = 0;
-   sum = nd_sb_checksum((struct nd_gen_sb *) super);
+   sum = nd_sb_checksum((struct nd_gen_sb *)super);
super->checksum = cpu_to_le64(sum);
 
ret = btt_info_write(arena, super);
@@ -1469,7 +1469,7 @@ static blk_qc_t btt_make_request(struct request_queue *q, 
struct bio *bio)
"io error in %s sector %lld, len %d,\n",
(op_is_write(bio_op(bio))) ? "WRITE" :
"READ",
-   (unsigned long long) iter.bi_sector, len);
+   (unsigned long long)iter.bi_sector, len);
bio->bi_status = errno_to_blk_status(err);
break;
}
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c
index 9c4cbda834be..f6429842f1b6 100644
--- a/drivers/nvdimm/btt_devs.c
+++ b/drivers/nvdimm/btt_devs.c
@@ -256,7 +256,7 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct 
btt_sb *super)
 
checksum = le64_to_cpu(super->checksum);
super->checksum = 0;
-   if (checksum != nd_sb_checksum((struct nd_gen_sb *) super))
+   if (checksum != nd_sb_checksum((struct nd_gen_sb *)super))
return false;
super->checksum = cpu_to_le64(checksum);
 
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 6d4d4c72ac92..35591f492d27 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -876,7 +876,7 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
return remainder;
return out_field[1] - 8;
} else if (cmd == ND_CMD_CALL) {
-   struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *) in_field;
+   struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *)in_field;
 
return pkg->nd_size_out;
}
@@ -984,7 +984,7 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct 
nvdimm *nvdimm,
const struct nd_cmd_desc *desc = NULL;
unsigned int cmd = _IOC_NR(ioctl_cmd);
struct device *dev = &nvdimm_bus->dev;
-   void __user *p = (void __user *) arg;
+   void __user *p = (void __user *)arg;
char *out_env = NULL, *in_env = NULL;
const char *cmd_name, *dimm_name;
u32 in_len = 0, out_len = 0;
@@ -1073,7 +

[PATCH 03/13] nvdimm: Use octal permissions

2019-09-11 Thread Joe Perches
Avoid the use of the S_IRUGO define and use 0444 to improve readability
and use a more common kernel style.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/btt.c | 39 ++-
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 6362d96dfc16..9cad4dca6eac 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -229,27 +229,24 @@ static void arena_debugfs_init(struct arena_info *a, 
struct dentry *parent,
return;
a->debugfs_dir = d;
 
-   debugfs_create_x64("size", S_IRUGO, d, &a->size);
-   debugfs_create_x64("external_lba_start", S_IRUGO, d,
-  &a->external_lba_start);
-   debugfs_create_x32("internal_nlba", S_IRUGO, d, &a->internal_nlba);
-   debugfs_create_u32("internal_lbasize", S_IRUGO, d,
-  &a->internal_lbasize);
-   debugfs_create_x32("external_nlba", S_IRUGO, d, &a->external_nlba);
-   debugfs_create_u32("external_lbasize", S_IRUGO, d,
-  &a->external_lbasize);
-   debugfs_create_u32("nfree", S_IRUGO, d, &a->nfree);
-   debugfs_create_u16("version_major", S_IRUGO, d, &a->version_major);
-   debugfs_create_u16("version_minor", S_IRUGO, d, &a->version_minor);
-   debugfs_create_x64("nextoff", S_IRUGO, d, &a->nextoff);
-   debugfs_create_x64("infooff", S_IRUGO, d, &a->infooff);
-   debugfs_create_x64("dataoff", S_IRUGO, d, &a->dataoff);
-   debugfs_create_x64("mapoff", S_IRUGO, d, &a->mapoff);
-   debugfs_create_x64("logoff", S_IRUGO, d, &a->logoff);
-   debugfs_create_x64("info2off", S_IRUGO, d, &a->info2off);
-   debugfs_create_x32("flags", S_IRUGO, d, &a->flags);
-   debugfs_create_u32("log_index_0", S_IRUGO, d, &a->log_index[0]);
-   debugfs_create_u32("log_index_1", S_IRUGO, d, &a->log_index[1]);
+   debugfs_create_x64("size", 0444, d, &a->size);
+   debugfs_create_x64("external_lba_start", 0444, d, 
&a->external_lba_start);
+   debugfs_create_x32("internal_nlba", 0444, d, &a->internal_nlba);
+   debugfs_create_u32("internal_lbasize", 0444, d, &a->internal_lbasize);
+   debugfs_create_x32("external_nlba", 0444, d, &a->external_nlba);
+   debugfs_create_u32("external_lbasize", 0444, d, &a->external_lbasize);
+   debugfs_create_u32("nfree", 0444, d, &a->nfree);
+   debugfs_create_u16("version_major", 0444, d, &a->version_major);
+   debugfs_create_u16("version_minor", 0444, d, &a->version_minor);
+   debugfs_create_x64("nextoff", 0444, d, &a->nextoff);
+   debugfs_create_x64("infooff", 0444, d, &a->infooff);
+   debugfs_create_x64("dataoff", 0444, d, &a->dataoff);
+   debugfs_create_x64("mapoff", 0444, d, &a->mapoff);
+   debugfs_create_x64("logoff", 0444, d, &a->logoff);
+   debugfs_create_x64("info2off", 0444, d, &a->info2off);
+   debugfs_create_x32("flags", 0444, d, &a->flags);
+   debugfs_create_u32("log_index_0", 0444, d, &a->log_index[0]);
+   debugfs_create_u32("log_index_1", 0444, d, &a->log_index[1]);
 }
 
 static void btt_debugfs_init(struct btt *btt)
-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH 02/13] nvdimm: Move logical continuations to previous line

2019-09-11 Thread Joe Perches
Make the logical continuation style more like the rest of the kernel.

No change in object files.

Signed-off-by: Joe Perches 
---
 drivers/nvdimm/btt.c|  9 +
 drivers/nvdimm/bus.c|  4 ++--
 drivers/nvdimm/claim.c  |  4 ++--
 drivers/nvdimm/dimm_devs.c  | 23 ---
 drivers/nvdimm/label.c  |  8 
 drivers/nvdimm/namespace_devs.c | 40 +---
 drivers/nvdimm/pfn_devs.c   | 17 +
 drivers/nvdimm/pmem.c   |  5 +++--
 drivers/nvdimm/region.c |  6 +++---
 drivers/nvdimm/region_devs.c| 23 ---
 drivers/nvdimm/security.c   | 34 --
 11 files changed, 93 insertions(+), 80 deletions(-)

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index d3e187ac43eb..6362d96dfc16 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -603,8 +603,9 @@ static int btt_freelist_init(struct arena_info *arena)
 
 static bool ent_is_padding(struct log_entry *ent)
 {
-   return (ent->lba == 0) && (ent->old_map == 0) && (ent->new_map == 0)
-   && (ent->seq == 0);
+   return (ent->lba == 0) &&
+   (ent->old_map == 0) && (ent->new_map == 0) &&
+   (ent->seq == 0);
 }
 
 /*
@@ -1337,8 +1338,8 @@ static int btt_write_pg(struct btt *btt, struct 
bio_integrity_payload *bip,
if (btt_is_badblock(btt, arena, arena->freelist[lane].block))
arena->freelist[lane].has_err = 1;
 
-   if (mutex_is_locked(&arena->err_lock)
-   || arena->freelist[lane].has_err) {
+   if (mutex_is_locked(&arena->err_lock) ||
+   arena->freelist[lane].has_err) {
nd_region_release_lane(btt->nd_region, lane);
 
ret = arena_clear_freelist_error(arena, lane);
diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
index 83b6fcbb252d..6d4d4c72ac92 100644
--- a/drivers/nvdimm/bus.c
+++ b/drivers/nvdimm/bus.c
@@ -189,8 +189,8 @@ static int nvdimm_clear_badblocks_region(struct device 
*dev, void *data)
ndr_end = nd_region->ndr_start + nd_region->ndr_size - 1;
 
/* make sure we are in the region */
-   if (ctx->phys < nd_region->ndr_start
-   || (ctx->phys + ctx->cleared) > ndr_end)
+   if (ctx->phys < nd_region->ndr_start ||
+   (ctx->phys + ctx->cleared) > ndr_end)
return 0;
 
sector = (ctx->phys - nd_region->ndr_start) / 512;
diff --git a/drivers/nvdimm/claim.c b/drivers/nvdimm/claim.c
index 62f3afaa7d27..ff66a3cc349c 100644
--- a/drivers/nvdimm/claim.c
+++ b/drivers/nvdimm/claim.c
@@ -274,8 +274,8 @@ static int nsio_rw_bytes(struct nd_namespace_common *ndns,
}
 
if (unlikely(is_bad_pmem(&nsio->bb, sector, sz_align))) {
-   if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512)
-   && !(flags & NVDIMM_IO_ATOMIC)) {
+   if (IS_ALIGNED(offset, 512) && IS_ALIGNED(size, 512) &&
+   !(flags & NVDIMM_IO_ATOMIC)) {
long cleared;
 
might_sleep();
diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
index 52b00078939b..cb5598b3c389 100644
--- a/drivers/nvdimm/dimm_devs.c
+++ b/drivers/nvdimm/dimm_devs.c
@@ -437,10 +437,11 @@ static umode_t nvdimm_visible(struct kobject *kobj, 
struct attribute *a, int n)
 
if (a == &dev_attr_security.attr) {
/* Are there any state mutation ops (make writable)? */
-   if (nvdimm->sec.ops->freeze || nvdimm->sec.ops->disable
-   || nvdimm->sec.ops->change_key
-   || nvdimm->sec.ops->erase
-   || nvdimm->sec.ops->overwrite)
+   if (nvdimm->sec.ops->freeze ||
+   nvdimm->sec.ops->disable ||
+   nvdimm->sec.ops->change_key ||
+   nvdimm->sec.ops->erase ||
+   nvdimm->sec.ops->overwrite)
return a->mode;
return 0444;
}
@@ -516,8 +517,9 @@ int nvdimm_security_setup_events(struct device *dev)
 {
struct nvdimm *nvdimm = to_nvdimm(dev);
 
-   if (!nvdimm->sec.flags || !nvdimm->sec.ops
-   || !nvdimm->sec.ops->overwrite)
+   if (!nvdimm->sec.flags ||
+   !nvdimm->sec.ops ||
+   !nvdimm->sec.ops->overwrite)
return 0;
nvdimm->sec.overwrite_state = sysfs_get_dirent(dev->kobj.sd, 
"security");
if (!nvdimm->sec.overwrite_state)
@@ -589,8 +591,8 @@ int alias_dpa_busy(struct device *dev, void *data)
 * (i.e. BLK is allocated after all aliased PMEM).
 */
if (info->res) {
-   if (info->res->start >= nd_mapping->start
-   && info->res->start < map_end)
+   if (info->res->start >= nd_mapping->start &&
+   info->res->start < map_en

[PATCH 00/13] nvdimm: Use more common kernel coding style

2019-09-11 Thread Joe Perches
Rather than have a local coding style, use the typical kernel style.

Joe Perches (13):
  nvdimm: Use more typical whitespace
  nvdimm: Move logical continuations to previous line
  nvdimm: Use octal permissions
  nvdimm: Use a more common kernel spacing style
  nvdimm: Use "unsigned int" in preference to "unsigned"
  nvdimm: Add and remove blank lines
  nvdimm: Use typical kernel brace styles
  nvdimm: Use typical kernel style indentation
  nvdimm: btt.h: Neaten #defines to improve readability
  nvdimm: namespace_devs: Move assignment operators
  nvdimm: Use more common logic testing styles and bare ; positions
  nvdimm: namespace_devs: Change progess typo to progress
  nvdimm: Miscellaneous neatening

 drivers/nvdimm/badrange.c   |  22 +-
 drivers/nvdimm/blk.c|  39 ++--
 drivers/nvdimm/btt.c| 249 +++--
 drivers/nvdimm/btt.h|  56 ++---
 drivers/nvdimm/btt_devs.c   |  68 +++---
 drivers/nvdimm/bus.c| 138 ++--
 drivers/nvdimm/claim.c  |  50 ++---
 drivers/nvdimm/core.c   |  42 ++--
 drivers/nvdimm/dax_devs.c   |   3 +-
 drivers/nvdimm/dimm.c   |   3 +-
 drivers/nvdimm/dimm_devs.c  | 107 -
 drivers/nvdimm/e820.c   |   2 +-
 drivers/nvdimm/label.c  | 213 +-
 drivers/nvdimm/label.h  |   6 +-
 drivers/nvdimm/namespace_devs.c | 472 +---
 drivers/nvdimm/nd-core.h|  31 +--
 drivers/nvdimm/nd.h |  94 
 drivers/nvdimm/nd_virtio.c  |  20 +-
 drivers/nvdimm/of_pmem.c|   6 +-
 drivers/nvdimm/pfn_devs.c   | 136 ++--
 drivers/nvdimm/pmem.c   |  57 ++---
 drivers/nvdimm/pmem.h   |   2 +-
 drivers/nvdimm/region.c |  20 +-
 drivers/nvdimm/region_devs.c| 160 +++---
 drivers/nvdimm/security.c   | 138 ++--
 drivers/nvdimm/virtio_pmem.c|  10 +-
 26 files changed, 1115 insertions(+), 1029 deletions(-)

-- 
2.15.0

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [Ksummit-discuss] [PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Jens Axboe
On 9/11/19 12:43 PM, Dan Carpenter wrote:
> On Wed, Sep 11, 2019 at 08:48:59AM -0700, Dan Williams wrote:
>> +Coding Style Addendum
>> +-
>> +libnvdimm expects multi-line statements to be double indented. I.e.
>> +
>> +if (x...
>> +&& ...y) {
> 
> That looks horrible and it causes a checkpatch warning.  :(  Why not
> do it the same way that everyone else does it.
> 
>   if (blah_blah_x && <-- && has to be on the first line for checkpatch
>   blah_blah_y) { <-- [tab][space][space][space][space]blah
> 
> Now all the conditions are aligned visually which makes it readable.
> They aren't aligned with the indent block so it's easy to tell the
> inside from the if condition.
> 
> I kind of hate all this extra documentation because now everyone thinks
> they can invent new hoops to jump through.

FWIW, I completely agree with Dan (Carpenter) here. I absolutely
dislike having these kinds of files, and with subsystems imposing weird
restrictions on style (like the quoted example, yuck).

Additionally, it would seem saner to standardize rules around when
code is expected to hit the maintainers hands for kernel releases. Both
yours and Martins deals with that, there really shouldn't be the need
to have this specified in detail per sub-system.

-- 
Jens Axboe

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


~~ EHS风险识别、评估控制及应急管理

2019-09-11 Thread 您好:
07133714161
 转发邮件信息 
发 件 人:krkt...@uibr.com
发 送 日 期:2019-9-125:04:15
收 件 人:linux-nvdimm@lists.01.org
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [Ksummit-discuss] [PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Joe Perches
On Wed, 2019-09-11 at 08:48 -0700, Dan Williams wrote:
> Document the basic policies of the libnvdimm subsystem and provide a first
> example of a Maintainer Entry Profile for others to duplicate and edit.
[]
> +Coding Style Addendum
> +-
> +libnvdimm expects multi-line statements to be double indented. I.e.
> +
> +if (x...
> +&& ...y) {

I don't find a good reason to do this.

> diff --git a/MAINTAINERS b/MAINTAINERS
[]
> @@ -9185,6 +9185,7 @@ M:  Dan Williams 
>  M:   Vishal Verma 
>  M:   Dave Jiang 
>  L:   linux-nvdimm@lists.01.org
> +P:   Documentation/nvdimm/maintainer-entry-profile.rst

I also think the indirection to a separate
file is not a good thing.

Separate styles for individual subsystems is
not something I would want to encourage.

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [Ksummit-discuss] [PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Dan Carpenter
On Wed, Sep 11, 2019 at 08:48:59AM -0700, Dan Williams wrote:
> +Coding Style Addendum
> +-
> +libnvdimm expects multi-line statements to be double indented. I.e.
> +
> +if (x...
> +&& ...y) {

That looks horrible and it causes a checkpatch warning.  :(  Why not
do it the same way that everyone else does it.

if (blah_blah_x && <-- && has to be on the first line for checkpatch
blah_blah_y) { <-- [tab][space][space][space][space]blah

Now all the conditions are aligned visually which makes it readable.
They aren't aligned with the indent block so it's easy to tell the
inside from the if condition.

I kind of hate all this extra documentation because now everyone thinks
they can invent new hoops to jump through.

Speaking of hoops, the BPF documentation says that you have to figure
out which tree a patch applies to instead of just working against
linux-next.  Is there an automated way to do that?  I looked through my
inbox and there are a bunch of patches marked as going through the
bpf-next tree but about half were marked incorrectly so it looks like
everyone who tries to tag their patches is going to do it badly anyway.

regards,
dan carpenter

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Dave Jiang



On 9/11/19 8:48 AM, Dan Williams wrote:
> Document the basic policies of the libnvdimm subsystem and provide a first
> example of a Maintainer Entry Profile for others to duplicate and edit.
> 
> Cc: Vishal Verma 
> Cc: Dave Jiang 
> Signed-off-by: Dan Williams 

Acked-by: Dave Jiang 

> ---
>  Documentation/nvdimm/maintainer-entry-profile.rst |   64 
> +
>  MAINTAINERS   |4 +
>  2 files changed, 68 insertions(+)
>  create mode 100644 Documentation/nvdimm/maintainer-entry-profile.rst
> 
> diff --git a/Documentation/nvdimm/maintainer-entry-profile.rst 
> b/Documentation/nvdimm/maintainer-entry-profile.rst
> new file mode 100644
> index ..c102950f2257
> --- /dev/null
> +++ b/Documentation/nvdimm/maintainer-entry-profile.rst
> @@ -0,0 +1,64 @@
> +LIBNVDIMM Maintainer Entry Profile
> +==
> +
> +Overview
> +
> +The libnvdimm subsystem manages persistent memory across multiple
> +architectures. The mailing list, is tracked by patchwork here:
> +https://patchwork.kernel.org/project/linux-nvdimm/list/
> +...and that instance is configured to give feedback to submitters on
> +patch acceptance and upstream merge. Patches are merged to either the
> +'libnvdimm-fixes', or 'libnvdimm-for-next' branch. Those branches are
> +available here:
> +https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/
> +
> +In general patches can be submitted against the latest -rc, however if
> +the incoming code change is dependent on other pending changes then the
> +patch should be based on the libnvdimm-for-next branch. However, since
> +persistent memory sits at the intersection of storage and memory there
> +are cases where patches are more suitable to be merged through a
> +Filesystem or the Memory Management tree. When in doubt copy the nvdimm
> +list and the maintainers will help route.
> +
> +Submissions will be exposed to the kbuild robot for compile regression
> +testing. It helps to get a success notification from that infrastructure
> +before submitting, but it is not required.
> +
> +
> +Submit Checklist Addendum
> +-
> +There are unit tests for the subsystem via the ndctl utility:
> +https://github.com/pmem/ndctl
> +Those tests need to be passed before the patches go upstream, but not
> +necessarily before initial posting. Contact the list if you need help
> +getting the test environment set up.
> +
> +
> +Key Cycle Dates
> +---
> +New submissions can be sent at any time, but if they intend to hit the
> +next merge window they should be sent before -rc4, and ideally
> +stabilized in the libnvdimm-for-next branch by -rc6. Of course if a
> +patch set requires more than 2 weeks of review -rc4 is already too late
> +and some patches may require multiple development cycles to review.
> +
> +
> +Coding Style Addendum
> +-
> +libnvdimm expects multi-line statements to be double indented. I.e.
> +
> +if (x...
> +&& ...y) {
> +
> +
> +Review Cadence
> +--
> +In general, please wait up to one week before pinging for feedback. A
> +private mail reminder is preferred. Alternatively ask for other
> +developers that have Reviewed-by tags for libnvdimm changes to take a
> +look and offer their opinion.
> +
> +
> +Style Cleanup Patches
> +-
> +Standalone style-cleanups are welcome.
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e5d111a86e61..2be1e18a368e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9185,6 +9185,7 @@ M:  Dan Williams 
>  M:   Vishal Verma 
>  M:   Dave Jiang 
>  L:   linux-nvdimm@lists.01.org
> +P:   Documentation/nvdimm/maintainer-entry-profile.rst
>  Q:   https://patchwork.kernel.org/project/linux-nvdimm/list/
>  S:   Supported
>  F:   drivers/nvdimm/blk.c
> @@ -9195,6 +9196,7 @@ M:  Vishal Verma 
>  M:   Dan Williams 
>  M:   Dave Jiang 
>  L:   linux-nvdimm@lists.01.org
> +P:   Documentation/nvdimm/maintainer-entry-profile.rst
>  Q:   https://patchwork.kernel.org/project/linux-nvdimm/list/
>  S:   Supported
>  F:   drivers/nvdimm/btt*
> @@ -9204,6 +9206,7 @@ M:  Dan Williams 
>  M:   Vishal Verma 
>  M:   Dave Jiang 
>  L:   linux-nvdimm@lists.01.org
> +P:   Documentation/nvdimm/maintainer-entry-profile.rst
>  Q:   https://patchwork.kernel.org/project/linux-nvdimm/list/
>  S:   Supported
>  F:   drivers/nvdimm/pmem*
> @@ -9223,6 +9226,7 @@ M:  Dave Jiang 
>  M:   Keith Busch 
>  M:   Ira Weiny 
>  L:   linux-nvdimm@lists.01.org
> +P:   Documentation/nvdimm/maintainer-entry-profile.rst
>  Q:   https://patchwork.kernel.org/project/linux-nvdimm/list/
>  T:   git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
>  S:   Supported
> 
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [Ksummit-discuss] [PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Vishal Verma
> Document the basic policies of the libnvdimm subsystem and provide a first
> example of a Maintainer Entry Profile for others to duplicate and edit.
> 
> Cc: Vishal Verma 
> Cc: Dave Jiang 
> Signed-off-by: Dan Williams 
> ---
>  Documentation/nvdimm/maintainer-entry-profile.rst |   64 
> +
>  MAINTAINERS   |4 +
>  2 files changed, 68 insertions(+)
>  create mode 100644 Documentation/nvdimm/maintainer-entry-profile.rst
> 
Looks good to me,
Acked-by: Vishal Verma 

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [Ksummit-discuss] [PATCH v2 2/3] Maintainer Handbook: Maintainer Entry Profile

2019-09-11 Thread Verma, Vishal L
On Wed, 2019-09-11 at 08:48 -0700, Dan Williams wrote:

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3f171339df53..e5d111a86e61 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -98,6 +98,10 @@ Descriptions of section entries:
>  Obsolete:Old code. Something tagged obsolete generally means
>   it has been replaced by a better system and you
>   should be using that.
> + P: Subsystem Profile document for more details submitting
> +patches to the given subsystem. This is either an in-tree file,
> +or a URI. See Documentation/maintainer/maintainer-entry-profile.rst
> +for details.

Considering each maintainer entry or driver may not have a subdirectory
under Documentation/ to put these under, would it be better to collect
them in one place, say Documentation/maintainer-entry-profiles/ ?
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH v2 0/3] Maintainer Entry Profiles

2019-09-11 Thread Martin K. Petersen


Hi Dan!

> At last years Plumbers Conference I proposed the Maintainer Entry
> Profile as a document that a maintainer can provide to set contributor
> expectations and provide fodder for a discussion between maintainers
> about the merits of different maintainer policies.

This looks pretty good to me.

After the Plumbers session last year I wrote this for SCSI based on a
prior version by Christoph. It's gone a bit stale but I'll update it to
match your template.

-- 
Martin K. Petersen  Oracle Linux Engineering




Linux SCSI Subsystem Patch Submission Guidelines

Martin K. Petersen 


Release cycles and when to submit patches
=
Each release cycle consists of:

* an 8 week submission window in which new core features and driver updates
  are added (scsi-queue)

* a 2 week merge window where it is customary not to post patches

* an 8 week stabilization window before final release where only bug fix
  patches are merged (scsi-fixes)

The submission/stabilization cycle may be shorter or longer than 8 weeks.
However, 8 weeks is the most common. Note that the code *submission window*
for the *next* kernel release overlaps with the *stabilization window* for the
*current* release:

+-+-+-+-
| Week  1 | 2 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |  11  |  12  | 13 | 14 | .
+-+-+-+-

+-+-+-+
| 4.x merge   |4.x stabilization window | 4.x release |
| window  | rc1 rc2 rc3 rc4 rc5 rc6 rc7 rc8 | |
+-+-+-+
| Merge fixes | Big bug fixes.small |   Stable|
+-+-+-+

  +-+-+-
  |4.x+1 submission window  | 4.x+1 merge | 4.x+1 stabili-
  | | window  | zation window
  | | | rc1 rc2 rc3 ...
  +-+-+-
  | Big features/updates..small | Merge fixes | Big bug fixes..
  +-+-+-


Bug Fixes (4.x/scsi-fixes)
~~
During the two week merge window only fixes related to the merge process or
any critical functional deficiences discovered in the newly submitted code
will be merged.

During the subsequent stabilization window (rc cycle) the expectation is that
bug fix patches will become increasingly smaller and simpler. In other words:
There may be enough fallout from a merged driver update to justify sending a
5-patch remedial bug fix series during rc1/rc2. But at the end of the rc cycle
patches must be trivial one-liners.

After the final 4.x has been released, subsequent bug fixes will have to go
through the stable-kernel-rules.rst process.


New Features/Core Code Changes/Driver Updates (4.x+1/scsi-queue)

New features for 4.x+1 should be sent to linux-scsi once the merge window is
over. I.e. once rc1 has been released. This ensures there is enough time to
undergo several review cycles before the submission window is closed.

At the end of the submission window (rc7/rc8) the expectation is that posted
patches will be small and fairly simple. No patch series.

Only critical patches are merged during the last (rc8) submission window week
to ensure sufficient zeroday test robot and linux-next coverage before sending
Linus the final pull request.


GIT Trees
=
The SCSI patch submission trees can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git

There are two concurrently active branches:

* 4.x/scsi-fixes for bug fixes to the current kernel rc

* 4.x+1/scsi-queue for new features and driver submissions for the next merge
  window

Both trees are usually based on Linus' 4.x-rc1.

Patches accepted into 4.x/scsi-fixes are typically submitted to Linus on a
weekly basis. Patches accepted into 4.x+1/scsi-queue are submitted at the
beginning of the merge window.

It is sometimes necessary to set up a separate 4.x+1/scsi-postmerge branch
which contains patches that depend on newly merged functionality in other
subsystems such as block or libata. The postmerge tree will be submitted to
Linus at the end of the merge window once all external dependencies have been
merged.


Patch Submission Process

* All modifications to files under drivers/scsi should go through the SCSI
  tree.

* Read Documentation/process/submitting-patches.rst

* Send the patch or patch series to linux-

[PATCH v2 2/3] Maintainer Handbook: Maintainer Entry Profile

2019-09-11 Thread Dan Williams
As presented at the 2018 Linux Plumbers conference [1], the Maintainer
Entry Profile (formerly Subsystem Profile) is proposed as a way to reduce
friction between committers and maintainers and encourage conversations
amongst maintainers about common best practices. While coding-style,
submit-checklist, and submitting-drivers lay out some common expectations
there remain local customs and maintainer preferences that vary by
subsystem.

The profile contains short answers to some of the common policy questions a
contributor might have that are local to the subsystem / device-driver, or
otherwise not covered by the top-level process documents.

Overview: General introduction to how the subsystem operates
Submit Checklist Addendum: Mechanical items that gate submission staging
Key Cycle Dates:
 - Last -rc for new feature submissions: Expected lead time for submissions
 - Last -rc to merge features: Deadline for merge decisions
Coding Style Addendum: Clarifications of local style preferences
Resubmit Cadence: When to ping the maintainer
Checkpatch / Style Cleanups: Policy on pure cleanup patches

See Documentation/maintainer/maintainer-entry-profile.rst for more details,
and a follow-on example profile for the libnvdimm subsystem.

[1]: https://linuxplumbersconf.org/event/2/contributions/59/

Cc: Jonathan Corbet 
Cc: Thomas Gleixner 
Cc: Mauro Carvalho Chehab 
Cc: Steve French 
Cc: Greg Kroah-Hartman 
Cc: Linus Torvalds 
Cc: Tobin C. Harding 
Cc: Olof Johansson 
Cc: Martin K. Petersen 
Cc: Daniel Vetter 
Cc: Joe Perches 
Cc: Dmitry Vyukov 
Cc: Alexandre Belloni 
Signed-off-by: Dan Williams 
---
 Documentation/maintainer/index.rst |1 
 .../maintainer/maintainer-entry-profile.rst|   99 
 MAINTAINERS|4 +
 3 files changed, 104 insertions(+)
 create mode 100644 Documentation/maintainer/maintainer-entry-profile.rst

diff --git a/Documentation/maintainer/index.rst 
b/Documentation/maintainer/index.rst
index 56e2c09dfa39..d904e74e1159 100644
--- a/Documentation/maintainer/index.rst
+++ b/Documentation/maintainer/index.rst
@@ -12,4 +12,5 @@ additions to this manual.
configure-git
rebasing-and-merging
pull-requests
+   maintainer-entry-profile
 
diff --git a/Documentation/maintainer/maintainer-entry-profile.rst 
b/Documentation/maintainer/maintainer-entry-profile.rst
new file mode 100644
index ..aaedf4d6dbf7
--- /dev/null
+++ b/Documentation/maintainer/maintainer-entry-profile.rst
@@ -0,0 +1,99 @@
+.. _maintainerentryprofile:
+
+Maintainer Entry Profile
+
+
+The Maintainer Entry Profile supplements the top-level process documents
+(coding-style, submitting-patches...) with subsystem/device-driver-local
+customs as well as details about the patch submission lifecycle. A
+contributor uses this document to level set their expectations and avoid
+common mistakes, maintainers may use these profiles to look across
+subsystems for opportunities to converge on common practices.
+
+
+Overview
+
+Provide an introduction to how the subsystem operates. While MAINTAINERS
+tells the contributor where to send patches for which files, it does not
+convey other subsystem-local infrastructure and mechanisms that aid
+development.
+Example questions to consider:
+- Are there notifications when patches are applied to the local tree, or
+  merged upstream?
+- Does the subsystem have a patchwork instance?
+- Any bots or CI infrastructure that watches the list?
+- Git branches that are pulled into -next?
+- What branch should contributors submit against?
+- Links to any other Maintainer Entry Profiles? For example a
+  device-driver may point to an entry for its parent subsystem. This makes
+  the contributor aware of obligations a maintainer may have have for
+  other maintainers in the submission chain.
+
+
+Submit Checklist Addendum
+-
+List mandatory and advisory criteria, beyond the common "submit-checklist",
+for a patch to be considered healthy enough for maintainer attention.
+For example: "pass checkpatch.pl with no errors, or warning. Pass the
+unit test detailed at $URI".
+
+
+Key Cycle Dates
+---
+One of the common misunderstandings of submitters is that patches can be
+sent at any time before the merge window closes and can still be
+considered for the next -rc1. The reality is that most patches need to
+be settled in soaking in linux-next in advance of the merge window
+opening. Clarify for the submitter the key dates (in terms rc release
+week) that patches might considered for merging and when patches need to
+wait for the next -rc. At a minimum:
+- Last -rc for new feature submissions:
+  New feature submissions targeting the next merge window should have
+  their first posting for consideration before this point. Patches that
+  are submitted after this point should be clear that they are targeting
+  the NEXT+1 merge window, or should come with 

[PATCH v2 3/3] libnvdimm, MAINTAINERS: Maintainer Entry Profile

2019-09-11 Thread Dan Williams
Document the basic policies of the libnvdimm subsystem and provide a first
example of a Maintainer Entry Profile for others to duplicate and edit.

Cc: Vishal Verma 
Cc: Dave Jiang 
Signed-off-by: Dan Williams 
---
 Documentation/nvdimm/maintainer-entry-profile.rst |   64 +
 MAINTAINERS   |4 +
 2 files changed, 68 insertions(+)
 create mode 100644 Documentation/nvdimm/maintainer-entry-profile.rst

diff --git a/Documentation/nvdimm/maintainer-entry-profile.rst 
b/Documentation/nvdimm/maintainer-entry-profile.rst
new file mode 100644
index ..c102950f2257
--- /dev/null
+++ b/Documentation/nvdimm/maintainer-entry-profile.rst
@@ -0,0 +1,64 @@
+LIBNVDIMM Maintainer Entry Profile
+==
+
+Overview
+
+The libnvdimm subsystem manages persistent memory across multiple
+architectures. The mailing list, is tracked by patchwork here:
+https://patchwork.kernel.org/project/linux-nvdimm/list/
+...and that instance is configured to give feedback to submitters on
+patch acceptance and upstream merge. Patches are merged to either the
+'libnvdimm-fixes', or 'libnvdimm-for-next' branch. Those branches are
+available here:
+https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git/
+
+In general patches can be submitted against the latest -rc, however if
+the incoming code change is dependent on other pending changes then the
+patch should be based on the libnvdimm-for-next branch. However, since
+persistent memory sits at the intersection of storage and memory there
+are cases where patches are more suitable to be merged through a
+Filesystem or the Memory Management tree. When in doubt copy the nvdimm
+list and the maintainers will help route.
+
+Submissions will be exposed to the kbuild robot for compile regression
+testing. It helps to get a success notification from that infrastructure
+before submitting, but it is not required.
+
+
+Submit Checklist Addendum
+-
+There are unit tests for the subsystem via the ndctl utility:
+https://github.com/pmem/ndctl
+Those tests need to be passed before the patches go upstream, but not
+necessarily before initial posting. Contact the list if you need help
+getting the test environment set up.
+
+
+Key Cycle Dates
+---
+New submissions can be sent at any time, but if they intend to hit the
+next merge window they should be sent before -rc4, and ideally
+stabilized in the libnvdimm-for-next branch by -rc6. Of course if a
+patch set requires more than 2 weeks of review -rc4 is already too late
+and some patches may require multiple development cycles to review.
+
+
+Coding Style Addendum
+-
+libnvdimm expects multi-line statements to be double indented. I.e.
+
+if (x...
+&& ...y) {
+
+
+Review Cadence
+--
+In general, please wait up to one week before pinging for feedback. A
+private mail reminder is preferred. Alternatively ask for other
+developers that have Reviewed-by tags for libnvdimm changes to take a
+look and offer their opinion.
+
+
+Style Cleanup Patches
+-
+Standalone style-cleanups are welcome.
diff --git a/MAINTAINERS b/MAINTAINERS
index e5d111a86e61..2be1e18a368e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9185,6 +9185,7 @@ M:Dan Williams 
 M: Vishal Verma 
 M: Dave Jiang 
 L: linux-nvdimm@lists.01.org
+P: Documentation/nvdimm/maintainer-entry-profile.rst
 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
 S: Supported
 F: drivers/nvdimm/blk.c
@@ -9195,6 +9196,7 @@ M:Vishal Verma 
 M: Dan Williams 
 M: Dave Jiang 
 L: linux-nvdimm@lists.01.org
+P: Documentation/nvdimm/maintainer-entry-profile.rst
 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
 S: Supported
 F: drivers/nvdimm/btt*
@@ -9204,6 +9206,7 @@ M:Dan Williams 
 M: Vishal Verma 
 M: Dave Jiang 
 L: linux-nvdimm@lists.01.org
+P: Documentation/nvdimm/maintainer-entry-profile.rst
 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
 S: Supported
 F: drivers/nvdimm/pmem*
@@ -9223,6 +9226,7 @@ M:Dave Jiang 
 M: Keith Busch 
 M: Ira Weiny 
 L: linux-nvdimm@lists.01.org
+P: Documentation/nvdimm/maintainer-entry-profile.rst
 Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
 T: git git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git
 S: Supported

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH v2 0/3] Maintainer Entry Profiles

2019-09-11 Thread Dan Williams
Changes since v1 [1]:
- Simplify the profile to a hopefully non-controversial set of
  attributes that address the most common sources of contributor
  confusion, or maintainer frustration.
- Rename "Subsystem Profile" to "Maintainer Entry Profile". Not every
  entry in MAINTAINERS represents a full subsystem. There may be driver
  local considerations to communicate to a submitter in addition to wider
  subsystem guidelines. 
- Delete the old P: tag in MAINTAINERS rather than convert to a new E:
  tag (Joe Perches).
[1]:  
http://lore.kernel.org/r/154225759358.2499188.15268218778137905050.st...@dwillia2-desk3.amr.corp.intel.com

---

At last years Plumbers Conference I proposed the Maintainer Entry
Profile as a document that a maintainer can provide to set contributor
expectations and provide fodder for a discussion between maintainers
about the merits of different maintainer policies.

For those that did not attend, the goal of the Maintainer Entry Profile,
and the Maintainer Handbook more generally, is to provide a desk
reference for maintainers both new and experienced. The session
introduction was:

The first rule of kernel maintenance is that there are no hard and
fast rules. That state of affairs is both a blessing and a curse. It
has served the community well to be adaptable to the different
people and different problem spaces that inhabit the kernel
community. However, that variability also leads to inconsistent
experiences for contributors, little to no guidance for new
contributors, and unnecessary stress on current maintainers. There
are quite a few of people who have been around long enough to make
enough mistakes that they have gained some hard earned proficiency.
However if the kernel community expects to keep growing it needs to
be able both scale the maintainers it has and ramp new ones without
necessarily let them make a decades worth of mistakes to learn the
ropes. 

To be clear, the proposed document does not impose or suggest new
rules. Instead it provides an outlet to document the unwritten rules
and policies in effect for each subsystem, and that each subsystem
might decide differently for whatever reason.


---

Dan Williams (3):
  MAINTAINERS: Reclaim the P: tag for Maintainer Entry Profile
  Maintainer Handbook: Maintainer Entry Profile
  libnvdimm, MAINTAINERS: Maintainer Entry Profile


 Documentation/maintainer/index.rst |1 
 .../maintainer/maintainer-entry-profile.rst|   99 
 Documentation/nvdimm/maintainer-entry-profile.rst  |   64 +
 MAINTAINERS|   20 ++--
 4 files changed, 175 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/maintainer/maintainer-entry-profile.rst
 create mode 100644 Documentation/nvdimm/maintainer-entry-profile.rst
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


[PATCH v2 1/3] MAINTAINERS: Reclaim the P: tag for Maintainer Entry Profile

2019-09-11 Thread Dan Williams
Fixup some P: entries to be M: and delete the others that do not include an
email address. The P: tag will be used to indicate the location of a
Profile for a given MAINTAINERS entry.

Cc: Joe Perches 
Signed-off-by: Dan Williams 
---
 MAINTAINERS |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index e7a47b5210fd..3f171339df53 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -76,7 +76,6 @@ trivial patch so apply some common sense.
 
 Descriptions of section entries:
 
-   P: Person (obsolete)
M: Mail patches to: FullName 
R: Designated reviewer: FullName 
   These reviewers should be CCed on patches.
@@ -811,7 +810,7 @@ S:  Orphan
 F: drivers/usb/gadget/udc/amd5536udc.*
 
 AMD GEODE PROCESSOR/CHIPSET SUPPORT
-P: Andres Salomon 
+M: Andres Salomon 
 L: linux-ge...@lists.infradead.org (moderated for non-subscribers)
 W: 
http://www.amd.com/us-en/ConnectivitySolutions/TechnicalResources/0,,50_2334_2452_11363,00.html
 S: Supported
@@ -10085,7 +10084,6 @@ F:  drivers/staging/media/tegra-vde/
 
 MEDIA INPUT INFRASTRUCTURE (V4L/DVB)
 M: Mauro Carvalho Chehab 
-P: LinuxTV.org Project
 L: linux-me...@vger.kernel.org
 W: https://linuxtv.org
 Q: http://patchwork.kernel.org/project/linux-media/list/
@@ -13452,7 +13450,6 @@ S:  Maintained
 F: arch/mips/ralink
 
 RALINK RT2X00 WIRELESS LAN DRIVER
-P: rt2x00 project
 M: Stanislaw Gruszka 
 M: Helmut Schaa 
 L: linux-wirel...@vger.kernel.org
@@ -13787,7 +13784,6 @@ S:  Supported
 F: drivers/net/ethernet/rocker/
 
 ROCKETPORT DRIVER
-P: Comtrol Corp.
 W: http://www.comtrol.com
 S: Maintained
 F: Documentation/driver-api/serial/rocket.rst
@@ -14668,15 +14664,13 @@ F:drivers/video/fbdev/simplefb.c
 F: include/linux/platform_data/simplefb.h
 
 SIMTEC EB110ATX (Chalice CATS)
-P: Ben Dooks
-P: Vincent Sanders 
+M: Vincent Sanders 
 M: Simtec Linux Team 
 W: http://www.simtec.co.uk/products/EB110ATX/
 S: Supported
 
 SIMTEC EB2410ITX (BAST)
-P: Ben Dooks
-P: Vincent Sanders 
+M: Vincent Sanders 
 M: Simtec Linux Team 
 W: http://www.simtec.co.uk/products/EB2410ITX/
 S: Supported

___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


Re: [PATCH 1/2] libnvdimm/altmap: Track namespace boundaries in altmap

2019-09-11 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 

-- 
Johannes ThumshirnSUSE Labs Filesystems
jthumsh...@suse.de+49 911 74053 689
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5
90409 Nürnberg
Germany
(HRB 247165, AG München)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
___
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm