linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/29] treewide: Convert comma separated statements
@ 2020-08-25  4:55 Joe Perches
  2020-08-25  4:56 ` [PATCH 13/29] bcache: Avoid " Joe Perches
  2020-09-09  2:09 ` [PATCH 00/29] treewide: Convert " Martin K. Petersen
  0 siblings, 2 replies; 5+ messages in thread
From: Joe Perches @ 2020-08-25  4:55 UTC (permalink / raw)
  To: Jiri Kosina, oprofile-list, linux-ide, drbd-dev, linux-media,
	dri-devel, linaro-mm-sig, intel-gfx, linux-hwmon, linux-input,
	linux-bcache, netdev, linuxppc-dev, linux-arm-kernel,
	linux-fsdevel, reiserfs-devel, linux-nfs
  Cc: linux-doc, linux-kernel, linux-alpha, linux-ia64, sparclinux,
	linux-block, linux-mtd, linux-s390, linux-scsi, devel,
	linux-fbdev, linux-pm, linux-kselftest

There are many comma separated statements in the kernel.
See:https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2008201856110.2524@hadrien/

Convert the comma separated statements that are in if/do/while blocks
to use braces and semicolons.

Many comma separated statements still exist but those are changes for
another day.

Joe Perches (29):
  coding-style.rst: Avoid comma statements
  alpha: Avoid comma separated statements
  ia64: Avoid comma separated statements
  sparc: Avoid comma separated statements
  ata: Avoid comma separated statements
  drbd: Avoid comma separated statements
  lp: Avoid comma separated statements
  dma-buf: Avoid comma separated statements
  drm/gma500: Avoid comma separated statements
  drm/i915: Avoid comma separated statements
  hwmon: (scmi-hwmon): Avoid comma separated statements
  Input: MT - Avoid comma separated statements
  bcache: Avoid comma separated statements
  media: Avoid comma separated statements
  mtd: Avoid comma separated statements
  8390: Avoid comma separated statements
  fs_enet: Avoid comma separated statements
  wan: sbni: Avoid comma separated statements
  s390/tty3270: Avoid comma separated statements
  scai/arm: Avoid comma separated statements
  media: atomisp: Avoid comma separated statements
  video: fbdev: Avoid comma separated statements
  fuse: Avoid comma separated statements
  reiserfs: Avoid comma separated statements
  lib/zlib: Avoid comma separated statements
  lib: zstd: Avoid comma separated statements
  ipv6: fib6: Avoid comma separated statements
  sunrpc: Avoid comma separated statements
  tools: Avoid comma separated statements

 Documentation/process/coding-style.rst        |  17 +
 arch/alpha/kernel/pci_iommu.c                 |   8 +-
 arch/alpha/oprofile/op_model_ev4.c            |  22 +-
 arch/alpha/oprofile/op_model_ev5.c            |   8 +-
 arch/ia64/kernel/smpboot.c                    |   7 +-
 arch/sparc/kernel/smp_64.c                    |   7 +-
 drivers/ata/pata_icside.c                     |  21 +-
 drivers/block/drbd/drbd_receiver.c            |   6 +-
 drivers/char/lp.c                             |   6 +-
 drivers/dma-buf/st-dma-fence.c                |   7 +-
 drivers/gpu/drm/gma500/mdfld_intel_display.c  |  44 ++-
 drivers/gpu/drm/i915/gt/gen8_ppgtt.c          |   8 +-
 drivers/gpu/drm/i915/gt/intel_gt_requests.c   |   6 +-
 .../gpu/drm/i915/gt/selftest_workarounds.c    |   6 +-
 drivers/gpu/drm/i915/intel_runtime_pm.c       |   6 +-
 drivers/hwmon/scmi-hwmon.c                    |   6 +-
 drivers/input/input-mt.c                      |  11 +-
 drivers/md/bcache/bset.c                      |  12 +-
 drivers/md/bcache/sysfs.c                     |   6 +-
 drivers/media/i2c/msp3400-kthreads.c          |  12 +-
 drivers/media/pci/bt8xx/bttv-cards.c          |   6 +-
 drivers/media/pci/saa7134/saa7134-video.c     |   7 +-
 drivers/mtd/devices/lart.c                    |  10 +-
 drivers/net/ethernet/8390/axnet_cs.c          |  19 +-
 drivers/net/ethernet/8390/lib8390.c           |  14 +-
 drivers/net/ethernet/8390/pcnet_cs.c          |   6 +-
 .../ethernet/freescale/fs_enet/fs_enet-main.c |  11 +-
 drivers/net/wan/sbni.c                        | 101 +++---
 drivers/s390/char/tty3270.c                   |   6 +-
 drivers/scsi/arm/cumana_2.c                   |  19 +-
 drivers/scsi/arm/eesox.c                      |   9 +-
 drivers/scsi/arm/powertec.c                   |   9 +-
 .../media/atomisp/pci/atomisp_subdev.c        |   6 +-
 drivers/video/fbdev/tgafb.c                   |  12 +-
 fs/fuse/dir.c                                 |  24 +-
 fs/reiserfs/fix_node.c                        |  36 ++-
 lib/zlib_deflate/deftree.c                    |  49 ++-
 lib/zstd/compress.c                           | 120 ++++---
 lib/zstd/fse_compress.c                       |  24 +-
 lib/zstd/huf_compress.c                       |   6 +-
 net/ipv6/ip6_fib.c                            |  12 +-
 net/sunrpc/sysctl.c                           |   6 +-
 tools/lib/subcmd/help.c                       |  10 +-
 tools/power/cpupower/utils/cpufreq-set.c      |  14 +-
 tools/testing/selftests/vm/gup_benchmark.c    |  18 +-
 tools/testing/selftests/vm/userfaultfd.c      | 296 +++++++++++-------
 46 files changed, 694 insertions(+), 382 deletions(-)

-- 
2.26.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 13/29] bcache: Avoid comma separated statements
  2020-08-25  4:55 [PATCH 00/29] treewide: Convert comma separated statements Joe Perches
@ 2020-08-25  4:56 ` Joe Perches
  2021-01-30 18:59   ` Joe Perches
  2020-09-09  2:09 ` [PATCH 00/29] treewide: Convert " Martin K. Petersen
  1 sibling, 1 reply; 5+ messages in thread
From: Joe Perches @ 2020-08-25  4:56 UTC (permalink / raw)
  To: Jiri Kosina, Coly Li, Kent Overstreet; +Cc: linux-bcache, linux-kernel

Use semicolons and braces.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/md/bcache/bset.c  | 12 ++++++++----
 drivers/md/bcache/sysfs.c |  6 ++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 67a2c47f4201..94d38e8a59b3 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
 	for (j = inorder_next(0, t->size);
 	     j;
 	     j = inorder_next(j, t->size)) {
-		while (bkey_to_cacheline(t, k) < cacheline)
-			prev = k, k = bkey_next(k);
+		while (bkey_to_cacheline(t, k) < cacheline) {
+			prev = k;
+			k = bkey_next(k);
+		}
 
 		t->prev[j] = bkey_u64s(prev);
 		t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
@@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
 	status = BTREE_INSERT_STATUS_INSERT;
 
 	while (m != bset_bkey_last(i) &&
-	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
-		prev = m, m = bkey_next(m);
+	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
+		prev = m;
+		m = bkey_next(m);
+	}
 
 	/* prev is in the tree, if we merge we're done */
 	status = BTREE_INSERT_STATUS_BACK_MERGE;
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index ac06c0bc3c0a..1878c5ee53b6 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
 			--n;
 
 		while (cached < p + n &&
-		       *cached == BTREE_PRIO)
-			cached++, n--;
+		       *cached == BTREE_PRIO) {
+			cached++;
+			n--;
+		}
 
 		for (i = 0; i < n; i++)
 			sum += INITIAL_PRIO - cached[i];
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 00/29] treewide: Convert comma separated statements
  2020-08-25  4:55 [PATCH 00/29] treewide: Convert comma separated statements Joe Perches
  2020-08-25  4:56 ` [PATCH 13/29] bcache: Avoid " Joe Perches
@ 2020-09-09  2:09 ` Martin K. Petersen
  1 sibling, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2020-09-09  2:09 UTC (permalink / raw)
  To: linuxppc-dev, linux-ide, dri-devel, linux-hwmon, Joe Perches,
	oprofile-list, linux-fsdevel, linux-media, linaro-mm-sig,
	drbd-dev, intel-gfx, linux-arm-kernel, linux-input, linux-nfs,
	netdev, reiserfs-devel, linux-bcache, Jiri Kosina
  Cc: Martin K . Petersen, sparclinux, linux-mtd, linux-s390,
	linux-doc, linux-block, linux-ia64, linux-pm, linux-kselftest,
	linux-fbdev, devel, linux-scsi, linux-alpha, linux-kernel

On Mon, 24 Aug 2020 21:55:57 -0700, Joe Perches wrote:

> There are many comma separated statements in the kernel.
> See:https://lore.kernel.org/lkml/alpine.DEB.2.22.394.2008201856110.2524@hadrien/
> 
> Convert the comma separated statements that are in if/do/while blocks
> to use braces and semicolons.
> 
> Many comma separated statements still exist but those are changes for
> another day.
> 
> [...]

Applied to 5.10/scsi-queue, thanks!

[01/29] coding-style.rst: Avoid comma statements
        (no commit info)
[02/29] alpha: Avoid comma separated statements
        (no commit info)
[03/29] ia64: Avoid comma separated statements
        (no commit info)
[04/29] sparc: Avoid comma separated statements
        (no commit info)
[05/29] ata: Avoid comma separated statements
        (no commit info)
[06/29] drbd: Avoid comma separated statements
        (no commit info)
[07/29] lp: Avoid comma separated statements
        (no commit info)
[08/29] dma-buf: Avoid comma separated statements
        (no commit info)
[09/29] drm/gma500: Avoid comma separated statements
        (no commit info)
[10/29] drm/i915: Avoid comma separated statements
        (no commit info)
[11/29] hwmon: (scmi-hwmon): Avoid comma separated statements
        (no commit info)
[12/29] Input: MT - Avoid comma separated statements
        (no commit info)
[13/29] bcache: Avoid comma separated statements
        (no commit info)
[14/29] media: Avoid comma separated statements
        (no commit info)
[15/29] mtd: Avoid comma separated statements
        (no commit info)
[16/29] 8390: Avoid comma separated statements
        (no commit info)
[17/29] fs_enet: Avoid comma separated statements
        (no commit info)
[18/29] wan: sbni: Avoid comma separated statements
        (no commit info)
[19/29] s390/tty3270: Avoid comma separated statements
        (no commit info)
[20/29] scsi: arm: Avoid comma separated statements
        https://git.kernel.org/mkp/scsi/c/a08a07326510
[21/29] media: atomisp: Avoid comma separated statements
        (no commit info)
[22/29] video: fbdev: Avoid comma separated statements
        (no commit info)
[23/29] fuse: Avoid comma separated statements
        (no commit info)
[24/29] reiserfs: Avoid comma separated statements
        (no commit info)
[25/29] lib/zlib: Avoid comma separated statements
        (no commit info)
[26/29] lib: zstd: Avoid comma separated statements
        (no commit info)
[27/29] ipv6: fib6: Avoid comma separated statements
        (no commit info)
[28/29] sunrpc: Avoid comma separated statements
        (no commit info)
[29/29] tools: Avoid comma separated statements
        (no commit info)

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 13/29] bcache: Avoid comma separated statements
  2020-08-25  4:56 ` [PATCH 13/29] bcache: Avoid " Joe Perches
@ 2021-01-30 18:59   ` Joe Perches
  2021-01-31 15:58     ` Coly Li
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2021-01-30 18:59 UTC (permalink / raw)
  To: Jiri Kosina, Coly Li, Kent Overstreet; +Cc: linux-bcache, linux-kernel

On Mon, 2020-08-24 at 21:56 -0700, Joe Perches wrote:
> Use semicolons and braces.

ping?

> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/md/bcache/bset.c  | 12 ++++++++----
>  drivers/md/bcache/sysfs.c |  6 ++++--
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
> index 67a2c47f4201..94d38e8a59b3 100644
> --- a/drivers/md/bcache/bset.c
> +++ b/drivers/md/bcache/bset.c
> @@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
>  	for (j = inorder_next(0, t->size);
>  	     j;
>  	     j = inorder_next(j, t->size)) {
> -		while (bkey_to_cacheline(t, k) < cacheline)
> -			prev = k, k = bkey_next(k);
> +		while (bkey_to_cacheline(t, k) < cacheline) {
> +			prev = k;
> +			k = bkey_next(k);
> +		}
>  
> 
>  		t->prev[j] = bkey_u64s(prev);
>  		t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
> @@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
>  	status = BTREE_INSERT_STATUS_INSERT;
>  
> 
>  	while (m != bset_bkey_last(i) &&
> -	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
> -		prev = m, m = bkey_next(m);
> +	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
> +		prev = m;
> +		m = bkey_next(m);
> +	}
>  
> 
>  	/* prev is in the tree, if we merge we're done */
>  	status = BTREE_INSERT_STATUS_BACK_MERGE;
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index ac06c0bc3c0a..1878c5ee53b6 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
>  			--n;
>  
> 
>  		while (cached < p + n &&
> -		       *cached == BTREE_PRIO)
> -			cached++, n--;
> +		       *cached == BTREE_PRIO) {
> +			cached++;
> +			n--;
> +		}
>  
> 
>  		for (i = 0; i < n; i++)
>  			sum += INITIAL_PRIO - cached[i];



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 13/29] bcache: Avoid comma separated statements
  2021-01-30 18:59   ` Joe Perches
@ 2021-01-31 15:58     ` Coly Li
  0 siblings, 0 replies; 5+ messages in thread
From: Coly Li @ 2021-01-31 15:58 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-bcache, linux-kernel, Jiri Kosina, Kent Overstreet

On 1/31/21 2:59 AM, Joe Perches wrote:
> On Mon, 2020-08-24 at 21:56 -0700, Joe Perches wrote:
>> Use semicolons and braces.
> 
> ping?

It is in my for-next now, thanks for reminding.


Coly Li


> 
>> Signed-off-by: Joe Perches <joe@perches.com>
>> ---
>>  drivers/md/bcache/bset.c  | 12 ++++++++----
>>  drivers/md/bcache/sysfs.c |  6 ++++--
>>  2 files changed, 12 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
>> index 67a2c47f4201..94d38e8a59b3 100644
>> --- a/drivers/md/bcache/bset.c
>> +++ b/drivers/md/bcache/bset.c
>> @@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
>>  	for (j = inorder_next(0, t->size);
>>  	     j;
>>  	     j = inorder_next(j, t->size)) {
>> -		while (bkey_to_cacheline(t, k) < cacheline)
>> -			prev = k, k = bkey_next(k);
>> +		while (bkey_to_cacheline(t, k) < cacheline) {
>> +			prev = k;
>> +			k = bkey_next(k);
>> +		}
>>  
>>
>>  		t->prev[j] = bkey_u64s(prev);
>>  		t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
>> @@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
>>  	status = BTREE_INSERT_STATUS_INSERT;
>>  
>>
>>  	while (m != bset_bkey_last(i) &&
>> -	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
>> -		prev = m, m = bkey_next(m);
>> +	       bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
>> +		prev = m;
>> +		m = bkey_next(m);
>> +	}
>>  
>>
>>  	/* prev is in the tree, if we merge we're done */
>>  	status = BTREE_INSERT_STATUS_BACK_MERGE;
>> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
>> index ac06c0bc3c0a..1878c5ee53b6 100644
>> --- a/drivers/md/bcache/sysfs.c
>> +++ b/drivers/md/bcache/sysfs.c
>> @@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
>>  			--n;
>>  
>>
>>  		while (cached < p + n &&
>> -		       *cached == BTREE_PRIO)
>> -			cached++, n--;
>> +		       *cached == BTREE_PRIO) {
>> +			cached++;
>> +			n--;
>> +		}
>>  
>>
>>  		for (i = 0; i < n; i++)
>>  			sum += INITIAL_PRIO - cached[i];
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-31 15:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25  4:55 [PATCH 00/29] treewide: Convert comma separated statements Joe Perches
2020-08-25  4:56 ` [PATCH 13/29] bcache: Avoid " Joe Perches
2021-01-30 18:59   ` Joe Perches
2021-01-31 15:58     ` Coly Li
2020-09-09  2:09 ` [PATCH 00/29] treewide: Convert " Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).