treewide: Convert comma separated statements
Subsystems (43)
cover treewide: Convert comma separated statements
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(-)
Signature · 1 line
2.26.0
PATCH 1/29 coding-style.rst: Avoid comma statements
Commas are not how statements are terminated.
Always use semicolons and braces if necessary.
--- Documentation/process/coding-style.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Documentation/process/coding-style.rst +17 -0
@@ -69,9 +69,26 @@ something to hide: if (condition) do_this; do_something_everytime; +Don't use commas to avoid using braces: + +.. code-block:: c + + if (condition) + do_this(), do_that(); + +Always uses braces for multiple statements: + +.. code-block:: c + + if (condition) { + do_this(); + do_that(); + } + Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions. + Outside of comments, documentation and except in Kconfig, spaces are never used for indentation, and the above example is deliberately broken.
Signature · 1 line
2.26.0
Re: [PATCH 01/29] coding-style.rst: Avoid comma statements
Quoted 2 lines · Joe Perches
Commas are not how statements are terminated.
Always use semicolons and braces if necessary.
ping?
Quoted 40 lines
Signed-off-by Joe Perches <[email protected]>---
Documentation/process/coding-style.rst | 17 +++++++++++++++++1 file changed, 17 insertions(+)Documentation/process/coding-style.rst +0
-0@@ -69,9 +69,26 @@ something to hide: if (condition) do_this; do_something_everytime;Documentation/process/coding-style.rst +16
-0+Don't use commas to avoid using braces: + +.. code-block:: c + + if (condition) + do_this(), do_that(); + +Always uses braces for multiple statements: + +.. code-block:: c + + if (condition) { + do_this(); + do_that(); + } +Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions.
+
Outside of comments, documentation and except inKconfig, spaces are never used for indentation, and the above example is deliberately broken.
Jonathan Corbet
maintainerRe: [PATCH 01/29] coding-style.rst: Avoid comma statements
Quoted 5 lines · Joe Perches
Quoted 2 lines · Joe Perches
Commas are not how statements are terminated.
Always use semicolons and braces if necessary.ping?
Hey, it's only been five months and some...you gotta stop rushing maintainers this way :)
I guess at the time I assumed that somebody would take care of the 29-part set as a whole. I've now applied this piece, thanks.
jon
PATCH 2/29 alpha: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- arch/alpha/kernel/pci_iommu.c | 8 +++++--- arch/alpha/oprofile/op_model_ev4.c | 22 ++++++++++++++-------- arch/alpha/oprofile/op_model_ev5.c | 8 +++++--- 3 files changed, 24 insertions(+), 14 deletions(-)
arch/alpha/kernel/pci_iommu.c +5 -3
@@ -161,10 +161,12 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, goto again; } -if (ptes[p+i]) - p =ALIGN (p + i +1 , mask +1 ), i =0 ; -else +if (ptes[p+i]) { + p =ALIGN (p + i +1 , mask +1 ); + i =0 ; + }else { i = i +1 ; + } }if (i < n) {
arch/alpha/oprofile/op_model_ev4.c +14 -8
@@ -46,18 +46,24 @@ ev4_reg_setup(struct op_register_config *reg,map it onto one of the possible values, and write it back. */ count = ctr[0 ].count; -if (count <=4096 ) - count =4096 , hilo =1 ; -else - count =65536 , hilo =0 ; +if (count <=4096 ) { + count =4096 ; + hilo =1 ; + }else { + count =65536 ; + hilo =0 ; + } ctr[0 ].count = count; ctl |= (ctr[0 ].enabled && hilo) <<3 ; count = ctr[1 ].count; -if (count <=256 ) - count =256 , hilo =1 ; -else - count =4096 , hilo =0 ; +if (count <=256 ) { + count =256 ; + hilo =1 ; + }else { + count =4096 ; + hilo =0 ; + } ctr[1 ].count = count; ctl |= (ctr[1 ].enabled && hilo);
arch/alpha/oprofile/op_model_ev5.c +5 -3
@@ -92,9 +92,11 @@ common_reg_setup(struct op_register_config *reg,if (!ctr[i].enabled)continue ; -if (count <=256 ) - count =256 , hilo =3 , max =256 ; -else { +if (count <=256 ) { + max =256 ; + hilo =3 ; + count =256 ; + }else { max = (i ==2 ?16384 :65536 ); hilo =2 ;if (count > max)
Signature · 1 line
2.26.0
Re: [PATCH 02/29] alpha: Avoid comma separated statements
Quoted 8 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>--- arch/alpha/kernel/pci_iommu.c | 8 +++++--- arch/alpha/oprofile/op_model_ev4.c | 22 ++++++++++++++-------- arch/alpha/oprofile/op_model_ev5.c | 8 +++++--- 3 files changed, 24 insertions(+), 14 deletions(-)
For oprofile:
Re: [PATCH 02/29] alpha: Avoid comma separated statements
In reply to Joe PerchesQuoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 90 lines
Signed-off-by Joe Perches <[email protected]>---
arch/alpha/kernel/pci_iommu.c | 8 +++++--- arch/alpha/oprofile/op_model_ev4.c | 22 ++++++++++++++-------- arch/alpha/oprofile/op_model_ev5.c | 8 +++++--- 3 files changed, 24 insertions(+), 14 deletions(-)arch/alpha/kernel/pci_iommu.c +0
-0@@ -161,10 +161,12 @@ iommu_arena_find_pages(struct device *dev, struct pci_iommu_arena *arena, goto again; }arch/alpha/kernel/pci_iommu.c +4
-3-if (ptes[p+i]) - p =ALIGN (p + i +1 , mask +1 ), i =0 ; -else +if (ptes[p+i]) { + p =ALIGN (p + i +1 , mask +1 ); + i =0 ; + }else {i = i + 1;
arch/alpha/kernel/pci_iommu.c +1
-0+ }}
if (i < n) {
arch/alpha/oprofile/op_model_ev4.c +0
-0@@ -46,18 +46,24 @@ ev4_reg_setup(struct op_register_config *reg,map it onto one of the possible values, and write it back. */
count = ctr[0].count;
arch/alpha/oprofile/op_model_ev4.c +7
-4-if (count <=4096 ) - count =4096 , hilo =1 ; -else - count =65536 , hilo =0 ; +if (count <=4096 ) { + count =4096 ; + hilo =1 ; + }else { + count =65536 ; + hilo =0 ; + }ctr[0].count = count;
ctl |= (ctr[0].enabled && hilo) << 3;count = ctr[1].count;
arch/alpha/oprofile/op_model_ev4.c +7
-4-if (count <=256 ) - count =256 , hilo =1 ; -else - count =4096 , hilo =0 ; +if (count <=256 ) { + count =256 ; + hilo =1 ; + }else { + count =4096 ; + hilo =0 ; + }ctr[1].count = count;
ctl |= (ctr[1].enabled && hilo);arch/alpha/oprofile/op_model_ev5.c +0
-0@@ -92,9 +92,11 @@ common_reg_setup(struct op_register_config *reg, if (!ctr[i].enabled) continue;arch/alpha/oprofile/op_model_ev5.c +5
-3-if (count <=256 ) - count =256 , hilo =3 , max =256 ; -else { +if (count <=256 ) { + max =256 ; + hilo =3 ; + count =256 ; + }else {max = (i == 2 ? 16384 : 65536); hilo = 2;
if (count > max)
Re: [PATCH 02/29] alpha: Avoid comma separated statements
Quoted 11 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 6 lines
Signed-off-by Joe Perches <[email protected]>---
arch/alpha/kernel/pci_iommu.c | 8 +++++--- arch/alpha/oprofile/op_model_ev4.c | 22 ++++++++++++++-------- arch/alpha/oprofile/op_model_ev5.c | 8 +++++---
This patch should be rebased as oprofile is going to be removed in 5.12. A branch is in linux-next.
-Robert
Quoted 1 line
Quoted 1 line
3 files changed, 24 insertions(+), 14 deletions(-)
Re: [PATCH 02/29] alpha: Avoid comma separated statements
Quoted 7 lines · Robert Richter
Quoted 6 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Signed-off-by Joe Perches <[email protected]>---
arch/alpha/kernel/pci_iommu.c | 8 +++++--- arch/alpha/oprofile/op_model_ev4.c | 22 ++++++++++++++-------- arch/alpha/oprofile/op_model_ev5.c | 8 +++++---This patch should be rebased as oprofile is going to be removed in 5.12. A branch is in linux-next.
git am --include=arch/alpha/kernel/pci_iommu.c
PATCH 3/29 ia64: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- arch/ia64/kernel/smpboot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/ia64/kernel/smpboot.c +5 -2
@@ -224,8 +224,11 @@ get_delta (long *rt, long *master) go[SLAVE ] =0 ; t1 =ia64_get_itc (); -if (t1 - t0 < best_t1 - best_t0) - best_t0 = t0, best_t1 = t1, best_tm = tm; +if (t1 - t0 < best_t1 - best_t0) { + best_t0 = t0; + best_t1 = t1; + best_tm = tm; + } } *rt = best_t1 - best_t0;
Signature · 1 line
2.26.0
Re: [PATCH 03/29] ia64: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 25 lines
Signed-off-by Joe Perches <[email protected]>---
arch/ia64/kernel/smpboot.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)arch/ia64/kernel/smpboot.c +0
-0@@ -224,8 +224,11 @@ get_delta (long *rt, long *master) go[SLAVE] = 0; t1 = ia64_get_itc();arch/ia64/kernel/smpboot.c +5
-2-if (t1 - t0 < best_t1 - best_t0) - best_t0 = t0, best_t1 = t1, best_tm = tm; +if (t1 - t0 < best_t1 - best_t0) { + best_t0 = t0; + best_t1 = t1; + best_tm = tm; + }}
*rt =
best_t1-best_t0;
PATCH 4/29 sparc: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- arch/sparc/kernel/smp_64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/sparc/kernel/smp_64.c +5 -2
@@ -186,8 +186,11 @@ static inline long get_delta (long *rt, long *master)wmb (); t1 = tick_ops->get_tick (); -if (t1 - t0 < best_t1 - best_t0) - best_t0 = t0, best_t1 = t1, best_tm = tm; +if (t1 - t0 < best_t1 - best_t0) { + best_t0 = t0; + best_t1 = t1; + best_tm = tm; + } } *rt = best_t1 - best_t0;
Signature · 1 line
2.26.0
Re: [PATCH 04/29] sparc: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 25 lines
Signed-off-by Joe Perches <[email protected]>---
arch/sparc/kernel/smp_64.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)arch/sparc/kernel/smp_64.c +0
-0@@ -186,8 +186,11 @@ static inline long get_delta (long *rt, long *master) wmb(); t1 = tick_ops->get_tick();arch/sparc/kernel/smp_64.c +5
-2-if (t1 - t0 < best_t1 - best_t0) - best_t0 = t0, best_t1 = t1, best_tm = tm; +if (t1 - t0 < best_t1 - best_t0) { + best_t0 = t0; + best_t1 = t1; + best_tm = tm; + }}
*rt =
best_t1-best_t0;
PATCH 5/29 ata: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/ata/pata_icside.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/ata/pata_icside.c +13 -8
@@ -202,14 +202,19 @@ static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev* Choose the IOMD cycle timing which ensure that the interface * satisfies the measured active, recovery and cycle times. */ -if (t.active <=50 && t.recover <=375 && t.cycle <=425 ) - iomd_type ='D' , cycle =187 ; -else if (t.active <=125 && t.recover <=375 && t.cycle <=500 ) - iomd_type ='C' , cycle =250 ; -else if (t.active <=200 && t.recover <=550 && t.cycle <=750 ) - iomd_type ='B' , cycle =437 ; -else - iomd_type ='A' , cycle =562 ; +if (t.active <=50 && t.recover <=375 && t.cycle <=425 ) { + iomd_type ='D' ; + cycle =187 ; + }else if (t.active <=125 && t.recover <=375 && t.cycle <=500 ) { + iomd_type ='C' ; + cycle =250 ; + }else if (t.active <=200 && t.recover <=550 && t.cycle <=750 ) { + iomd_type ='B' ; + cycle =437 ; + }else { + iomd_type ='A' ; + cycle =562 ; + }ata_dev_info (adev,"timings: act %dns rec %dns cyc %dns (%c)\n" , t.active, t.recover, t.cycle, iomd_type);
Signature · 1 line
2.26.0
Re: [PATCH 05/29] ata: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 38 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/ata/pata_icside.c | 21 +++++++++++++--------1 file changed, 13 insertions(+), 8 deletions(-)drivers/ata/pata_icside.c +13
-8@@ -202,14 +202,19 @@ static void pata_icside_set_dmamode(struct ata_port *ap, struct ata_device *adev* Choose the IOMD cycle timing which ensure that the interface * satisfies the measured active, recovery and cycle times. */ -if (t.active <=50 && t.recover <=375 && t.cycle <=425 ) - iomd_type ='D' , cycle =187 ; -else if (t.active <=125 && t.recover <=375 && t.cycle <=500 ) - iomd_type ='C' , cycle =250 ; -else if (t.active <=200 && t.recover <=550 && t.cycle <=750 ) - iomd_type ='B' , cycle =437 ; -else - iomd_type ='A' , cycle =562 ; +if (t.active <=50 && t.recover <=375 && t.cycle <=425 ) { + iomd_type ='D' ; + cycle =187 ; + }else if (t.active <=125 && t.recover <=375 && t.cycle <=500 ) { + iomd_type ='C' ; + cycle =250 ; + }else if (t.active <=200 && t.recover <=550 && t.cycle <=750 ) { + iomd_type ='B' ; + cycle =437 ; + }else { + iomd_type ='A' ; + cycle =562 ; + }
ata_dev_info(adev, "timings: act %dns rec %dns cyc %dns (%c)\n", t.active, t.recover, t.cycle, iomd_type);
Jens Axboe
maintainerRe: [PATCH 05/29] ata: Avoid comma separated statements
Quoted 4 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Queued for 5.12.
Signature · 1 line
Jens Axboe
PATCH 6/29 drbd: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/block/drbd/drbd_receiver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/block/drbd/drbd_receiver.c +4 -2
@@ -111,8 +111,10 @@ static struct page *page_chain_tail(struct page *page, int *len) {struct page *tmp;int i =1 ; -while ((tmp =page_chain_next (page))) - ++i, page = tmp; +while ((tmp =page_chain_next (page))) { + ++i; + page = tmp; + }if (len) *len = i;return page;
Signature · 1 line
2.26.0
Re: [PATCH 06/29] drbd: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 22 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/block/drbd/drbd_receiver.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)drivers/block/drbd/drbd_receiver.c +4
-2@@ -111,8 +111,10 @@ static struct page *page_chain_tail(struct page *page, int *len) { struct page *tmp; int i = 1; -while ((tmp =page_chain_next (page))) - ++i, page = tmp; +while ((tmp =page_chain_next (page))) { + ++i; + page = tmp; + } if (len) *len = i; return page;
Jens Axboe
maintainerRe: [PATCH 06/29] drbd: Avoid comma separated statements
Quoted 4 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Queued for 5.12.
Signature · 1 line
Jens Axboe
PATCH 7/29 lp: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/char/lp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/char/lp.c +4 -2
@@ -853,8 +853,10 @@ static void lp_console_write(struct console *co, const char *s, count--;do { written =parport_write (port, crlf, i); -if (written >0 ) - i -= written, crlf += written; +if (written >0 ) { + i -= written; + crlf += written; + } }while (i >0 && (CONSOLE_LP_STRICT || written >0 )); } }while (count >0 && (CONSOLE_LP_STRICT || written >0 ));
Signature · 1 line
2.26.0
PATCH 8/29 dma-buf: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/dma-buf/st-dma-fence.c +5 -2
@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg)dma_fence_signal (f1);smp_store_mb (cb.seen, false); -if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }if (!t->before)dma_fence_signal (f1);
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
Am 25.08.20 um 06:56 schrieb Joe Perches:
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Quoted 12 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +0
-0@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg)dma_fence_signal (f1);smp_store_mb (cb.seen, false);
drivers/dma-buf/st-dma-fence.c static int thread_signal_callback(void *arg) · line 481
Quoted 10 lines
drivers/dma-buf/st-dma-fence.c +5
-2-if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }if (!t->before)dma_fence_signal (f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
Hello Joe,
Quoted 7 lines · Christian König
Am 25.08.20 um 06:56 schrieb Joe Perches:
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>Acked-by Christian König <[email protected]>
FWIW,
Quoted 21 lines
Quoted 21 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +5
-2@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg)dma_fence_signal (f1);smp_store_mb (cb.seen, false); -if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }
Quoted 3 lines
drivers/dma-buf/st-dma-fence.c static int thread_signal_callback(void *arg) · line 481
Quoted 2 lines
drivers/dma-buf/st-dma-fence.c +0
-0if (!t->before)dma_fence_signal (f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
In reply to Joe PerchesHi Joe,
Nice, I only see three of these on the linux-media list, so I'll only look at those, but I'm pleased to see this is treewide ;-)
Definitely prefer this.
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Quoted 13 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +0
-0@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg)dma_fence_signal (f1);smp_store_mb (cb.seen, false);
drivers/dma-buf/st-dma-fence.c static int thread_signal_callback(void *arg) · line 481
Quoted 10 lines
drivers/dma-buf/st-dma-fence.c +5
-2-if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }if (!t->before)dma_fence_signal (f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
Quoted 2 lines · Kieran Bingham
I'm pleased to see this is treewide ;-)
Definitely prefer this.
These are only the comma uses in if/do/while blocks that would also need braces as separate statements.
There a multiple dozens more just with single statements terminated by commas and not semicolons.
See: https://lore.kernel.org/patchwork/patch/1291033/
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
In reply to Joe PerchesQuoted 1 line · Joe Perches
Use semicolons and braces.
Ping?
Quoted 23 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/dma-buf/st-dma-fence.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +0
-0@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1);
smp_store_mb(cb.seen, false);drivers/dma-buf/st-dma-fence.c +5
-2-if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }
Quoted 2 lines
if (!t->before)
dma_fence_signal(f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 5 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>
Do you have commit rights to drm-misc-next?
Quoted 22 lines
Quoted 22 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +5
-2@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1); smp_store_mb(cb.seen, false); -if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }
Quoted 3 lines
Quoted 2 lines
if (!t->before)
dma_fence_signal(f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
Quoted 8 lines · Christian König
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 4 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Reviewed-by Christian König <[email protected]>Do you have commit rights to drm-misc-next?
No.
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
---
drivers/dma-buf/st-dma-fence.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +5
-2@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1); smp_store_mb(cb.seen, false); -if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }
Quoted 4 lines
Quoted 3 lines
drivers/dma-buf/st-dma-fence.c static int thread_signal_callback(void *arg) · line 481
Quoted 2 lines
drivers/dma-buf/st-dma-fence.c +0
-0if (!t->before) dma_fence_signal(f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König
maintainerRe: [PATCH 08/29] dma-buf: Avoid comma separated statements
Am 31.01.21 um 18:39 schrieb Joe Perches:
Quoted 10 lines · Christian König
Quoted 8 lines
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 4 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Reviewed-by Christian König <[email protected]>Do you have commit rights to drm-misc-next?
No.
Pushed.
Thanks for the help,
Christian.
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma-fence.c +5
-2@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1); smp_store_mb(cb.seen, false); -if (!f2 ||dma_fence_add_callback (f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; +if (!f2 || +dma_fence_add_callback (f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
drivers/dma-buf/st-dma-fence.c static int thread_signal_callback(void *arg) · line 481
Quoted 2 lines
drivers/dma-buf/st-dma-fence.c +0
-0if (!t->before) dma_fence_signal(f1);
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 08/29] dma-buf: Avoid comma separated statements
In reply to Christian KönigThis is entirely unrelated to this thread, but I noticed when going through dri- devel that this email is somehow dated two days in the future from now.
Quoted 43 lines · Christian König
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 5 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Reviewed-by Christian König <[email protected]>Do you have commit rights to drm-misc-next?
Quoted 24 lines
Quoted 24 lines
---
drivers/dma-buf/st-dma-fence.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma- renamed from drivers/dma-buf/st-dma-fence.c +0
-0
fence.c
indexe593064341c8..c8a12d7ad71a100644drivers/dma-buf/st-dma-fence.c +0
-0@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1);smp_store_mb(cb.seen, false);
- if (!f2 ||dma_fence_add_callback(f2, &cb.cb, simple_callback))
- miss++, cb.seen = true;
+ if (!f2 ||
+dma_fence_add_callback(f2, &cb.cb, simple_callback)) { + miss++;
+ cb.seen = true;
+ }Quoted 3 lines
Quoted 2 lines
if (!t->before)
dma_fence_signal(f1);_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 13 lines
Sincerely, Lyude Paul (she/her) Software Engineer at Red Hat Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've asked me a question, are waiting for a review/merge on a patch, etc. and I haven't responded in a while, please feel free to send me another email to check on my status. I don't bite! _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Linaro-mm-sig] [PATCH 08/29] dma-buf: Avoid comma separated statements
Yeah, known issue.
An NTP server which I don't have access to has gone bananas and sometimes spits out invalid time stamps.
Only thing I can do is wait for an admin to take care of this.
Christian.
Am 01.02.21 um 22:54 schrieb Lyude Paul:
Quoted 44 lines
This is entirely unrelated to this thread, but I noticed when going through dri- devel that this email is somehow dated two days in the future from now.
Quoted 40 lines · Christian König
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 5 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Reviewed-by Christian König <[email protected]>Do you have commit rights to drm-misc-next?
Quoted 24 lines
Quoted 24 lines
--- drivers/dma-buf/st-dma-fence.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma- renamed from drivers/dma-buf/st-dma-fence.c +0
-0
fence.c
indexe593064341c8..c8a12d7ad71a100644drivers/dma-buf/st-dma-fence.c +5
-2@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1); smp_store_mb(cb.seen, false); - if (!f2 || dma_fence_add_callback(f2, &cb.cb, simple_callback)) - miss++, cb.seen = true; + if (!f2 || + dma_fence_add_callback(f2, &cb.cb, simple_callback)) { + miss++; + cb.seen = true; + }Quoted 2 lines
Quoted 2 lines
if (!t->before)
dma_fence_signal(f1);_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Linaro-mm-sig] [PATCH 08/29] dma-buf: Avoid comma separated statements
Quoted 6 lines · Christian König
Yeah, known issue.
An NTP server which I don't have access to has gone bananas and sometimes spits out invalid time stamps.
Only thing I can do is wait for an admin to take care of this.
haha it's ok! I just thought it was mildly entertaining to see, as my email client formatted the message timestamp "Next Wednesday" :)
Quoted 51 lines
Christian.
Am 01.02.21 um 22:54 schrieb Lyude Paul:
Quoted 46 lines
This is entirely unrelated to this thread, but I noticed when going through dri-
devel that this email is somehow dated two days in the future from now.Quoted 41 lines · Christian König
Am 30.01.21 um 19:47 schrieb Joe Perches:
Quoted 5 lines · Joe Perches
Quoted 1 line
Use semicolons and braces.
Ping?
Quoted 1 line
Signed-off-by Joe Perches <[email protected]>Reviewed-by Christian König <[email protected]>Do you have commit rights to drm-misc-next?
Quoted 25 lines
Quoted 25 lines
---
drivers/dma-buf/st-dma-fence.c | 7 +++++--1 file changed, 5 insertions(+), 2 deletions(-)drivers/dma-buf/st-dma- renamed from drivers/dma-buf/st-dma-fence.c +0
-0
fence.c
indexe593064341c8..c8a12d7ad71a100644drivers/dma-buf/st-dma-fence.c +0
-0@@ -471,8 +471,11 @@ static int thread_signal_callback(void *arg) dma_fence_signal(f1);smp_store_mb(cb.seen, false);
- if (!f2 ||dma_fence_add_callback(f2, &cb.cb, simple_callback))
- miss++, cb.seen = true;
+ if (!f2 ||
+dma_fence_add_callback(f2, &cb.cb, simple_callback)) {
+ miss++;
+ cb.seen = true;
+ }Quoted 2 lines
Quoted 2 lines
if (!t->before)
dma_fence_signal(f1);_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 13 lines
Sincerely, Lyude Paul (she/her) Software Engineer at Red Hat Note: I deal with a lot of emails and have a lot of bugs on my plate. If you've asked me a question, are waiting for a review/merge on a patch, etc. and I haven't responded in a while, please feel free to send me another email to check on my status. I don't bite! _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/29 drm/gma500: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/gpu/drm/gma500/mdfld_intel_display.c | 44 +++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-)
drivers/gpu/drm/gma500/mdfld_intel_display.c +28 -16
@@ -824,33 +824,45 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,if ((ksel ==KSEL_CRYSTAL_19 ) || (ksel ==KSEL_BYPASS_19 )) { refclk =19200 ; -if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + } }else if (ksel ==KSEL_BYPASS_25 ) { refclk =25000 ; -if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + } }else if ((ksel ==KSEL_BYPASS_83_100 ) && dev_priv->core_freq ==166 ) { refclk =83000 ; -if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + } }else if ((ksel ==KSEL_BYPASS_83_100 ) && (dev_priv->core_freq ==100 || dev_priv->core_freq ==200 )) { refclk =100000 ; -if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + } }if (is_mipi)
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/29] drm/gma500: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
Ping?
Quoted 74 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/gpu/drm/gma500/mdfld_intel_display.c | 44 +++++++++++++-------1 file changed, 28 insertions(+), 16 deletions(-)drivers/gpu/drm/gma500/mdfld_intel_display.c +0
-0@@ -824,33 +824,45 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc, if ((ksel == KSEL_CRYSTAL_19) || (ksel == KSEL_BYPASS_19)) { refclk = 19200;drivers/gpu/drm/gma500/mdfld_intel_display.c +7
-4-if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + }} else if (ksel ==
KSEL_BYPASS_25) { refclk = 25000;drivers/gpu/drm/gma500/mdfld_intel_display.c +7
-4-if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + }} else if ((ksel ==
KSEL_BYPASS_83_100) &&dev_priv->core_freq== 166) { refclk = 83000;drivers/gpu/drm/gma500/mdfld_intel_display.c +7
-4-if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + }} else if ((ksel ==
KSEL_BYPASS_83_100) && (dev_priv->core_freq== 100 ||dev_priv->core_freq== 200)) { refclk = 100000;drivers/gpu/drm/gma500/mdfld_intel_display.c +7
-4-if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + }}
Quoted 1 line
if (
is_mipi)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patrik Jakobsson
maintainerRe: [PATCH 09/29] drm/gma500: Avoid comma separated statements
Quoted 5 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
Ping?
This entire file is going away so perhaps just drop the patch to avoid a conflict.
-Patrik
Quoted 75 lines
Quoted 75 lines
Signed-off-by Joe Perches <[email protected]>--- drivers/gpu/drm/gma500/mdfld_intel_display.c | 44 +++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-)drivers/gpu/drm/gma500/mdfld_intel_display.c +28
-16@@ -824,33 +824,45 @@ static int mdfld_crtc_mode_set(struct drm_crtc *crtc,if ((ksel ==KSEL_CRYSTAL_19 ) || (ksel ==KSEL_BYPASS_19 )) { refclk =19200 ; -if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + } }else if (ksel ==KSEL_BYPASS_25 ) { refclk =25000 ; -if (is_mipi || is_mipi2) - clk_n =1 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =1 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =1 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =1 ; + clk_p2 =10 ; + } }else if ((ksel ==KSEL_BYPASS_83_100 ) && dev_priv->core_freq ==166 ) { refclk =83000 ; -if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + } }else if ((ksel ==KSEL_BYPASS_83_100 ) && (dev_priv->core_freq ==100 || dev_priv->core_freq ==200 )) { refclk =100000 ; -if (is_mipi || is_mipi2) - clk_n =4 , clk_p2 =8 ; -else if (is_hdmi) - clk_n =4 , clk_p2 =10 ; +if (is_mipi || is_mipi2) { + clk_n =4 ; + clk_p2 =8 ; + }else if (is_hdmi) { + clk_n =4 ; + clk_p2 =10 ; + }}
Quoted 3 lines
Quoted 1 line
if (
is_mipi)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/29 drm/i915: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 8 +++++--- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 6 ++++-- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 6 ++++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 6 ++++-- 4 files changed, 17 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/gen8_ppgtt.c +5 -3
@@ -323,10 +323,12 @@ static int __gen8_ppgtt_alloc(struct i915_address_space * const vm, }spin_lock (&pd->lock); -if (likely (!pd->entry[idx])) +if (likely (!pd->entry[idx])) {set_pd_entry (pd, idx, pt); -else - alloc = pt, pt = pd->entry[idx]; + }else { + alloc = pt; + pt = pd->entry[idx]; + } }if (lvl) {
drivers/gpu/drm/i915/gt/intel_gt_requests.c +4 -2
@@ -139,8 +139,10 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)LIST_HEAD (free); interruptible = true; -if (unlikely (timeout <0 )) - timeout = -timeout, interruptible = false; +if (unlikely (timeout <0 )) { + timeout = -timeout; + interruptible = false; + }flush_submission (gt, timeout);/* kick the ksoftirqd tasklets */ spin_lock (&timelines->lock);
drivers/gpu/drm/i915/gt/selftest_workarounds.c +4 -2
@@ -521,8 +521,10 @@ static int check_dirty_whitelist(struct intel_context *ce) srm =MI_STORE_REGISTER_MEM ; lrm =MI_LOAD_REGISTER_MEM ; -if (INTEL_GEN (engine->i915) >=8 ) - lrm++, srm++; +if (INTEL_GEN (engine->i915) >=8 ) { + lrm++; + srm++; + }pr_debug ("%s: Writing garbage to %x\n" , engine->name, reg);
drivers/gpu/drm/i915/intel_runtime_pm.c +4 -2
@@ -201,8 +201,10 @@ __print_intel_runtime_pm_wakeref(struct drm_printer *p,unsigned long rep; rep =1 ; -while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) - rep++, i++; +while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) { + rep++; + i++; + }__print_depot_stack (stack, buf,PAGE_SIZE ,2 );drm_printf (p,"Wakeref x%lu taken at:\n%s" , rep, buf); }
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/29] drm/i915: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
Ping?
Quoted 83 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 8 +++++--- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 6 ++++-- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 6 ++++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 6 ++++-- 4 files changed, 17 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gt/gen8_ppgtt.c +0
-0@@ -323,10 +323,12 @@ static int __gen8_ppgtt_alloc(struct i915_address_space * const vm, }
spin_lock(&pd->lock);drivers/gpu/drm/i915/gt/gen8_ppgtt.c +1
-1-if (likely (!pd->entry[idx])) +if (likely (!pd->entry[idx])) {
set_pd_entry(pd, idx, pt);drivers/gpu/drm/i915/gt/gen8_ppgtt.c +4
-2-else - alloc = pt, pt = pd->entry[idx]; + }else { + alloc = pt; + pt = pd->entry[idx]; + }}
if (lvl) {
drivers/gpu/drm/i915/gt/intel_gt_requests.c +0
-0@@ -139,8 +139,10 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout) LIST_HEAD(free);interruptible = true;
drivers/gpu/drm/i915/gt/intel_gt_requests.c +4
-2-if (unlikely (timeout <0 )) - timeout = -timeout, interruptible = false; +if (unlikely (timeout <0 )) { + timeout = -timeout; + interruptible = false; + }
flush_submission(gt, timeout); /* kick the ksoftirqd tasklets */spin_lock(&timelines->lock);drivers/gpu/drm/i915/gt/selftest_workarounds.c +0
-0@@ -521,8 +521,10 @@ static int check_dirty_whitelist(struct intel_context *ce)srm =
MI_STORE_REGISTER_MEM;
lrm =MI_LOAD_REGISTER_MEM;drivers/gpu/drm/i915/gt/selftest_workarounds.c +4
-2-if (INTEL_GEN (engine->i915) >=8 ) - lrm++, srm++; +if (INTEL_GEN (engine->i915) >=8 ) { + lrm++; + srm++; + }
pr_debug("%s: Writing garbage to %x\n", engine->name, reg);drivers/gpu/drm/i915/intel_runtime_pm.c +0
-0@@ -201,8 +201,10 @@ __print_intel_runtime_pm_wakeref(struct drm_printer *p, unsigned long rep;rep = 1;
drivers/gpu/drm/i915/intel_runtime_pm.c +4
-2-while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) - rep++, i++; +while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) { + rep++; + i++; + }
Quoted 3 lines
__print_depot_stack(stack, buf, PAGE_SIZE, 2);drm_printf(p, "Wakeref x%lu taken at:\n%s", rep, buf); }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula
maintainerRe: [PATCH 10/29] drm/i915: Avoid comma separated statements
Quoted 4 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
Ping?
Seems to have fallen between the cracks.
The first two hunks have been fixed, the last two are still there. Care to respin and rebase against drm-tip (or linux-next) please?
BR,
Jani.
Quoted 89 lines
Quoted 87 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 8 +++++--- drivers/gpu/drm/i915/gt/intel_gt_requests.c | 6 ++++-- drivers/gpu/drm/i915/gt/selftest_workarounds.c | 6 ++++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 6 ++++-- 4 files changed, 17 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gt/gen8_ppgtt.c +0
-0@@ -323,10 +323,12 @@ static int __gen8_ppgtt_alloc(struct i915_address_space * const vm, }
spin_lock(&pd->lock);drivers/gpu/drm/i915/gt/gen8_ppgtt.c +1
-1-if (likely (!pd->entry[idx])) +if (likely (!pd->entry[idx])) {
set_pd_entry(pd, idx, pt);drivers/gpu/drm/i915/gt/gen8_ppgtt.c +4
-2-else - alloc = pt, pt = pd->entry[idx]; + }else { + alloc = pt; + pt = pd->entry[idx]; + }}
if (lvl) {
drivers/gpu/drm/i915/gt/intel_gt_requests.c +0
-0@@ -139,8 +139,10 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout) LIST_HEAD(free);interruptible = true;
drivers/gpu/drm/i915/gt/intel_gt_requests.c +4
-2-if (unlikely (timeout <0 )) - timeout = -timeout, interruptible = false; +if (unlikely (timeout <0 )) { + timeout = -timeout; + interruptible = false; + }
flush_submission(gt, timeout); /* kick the ksoftirqd tasklets */spin_lock(&timelines->lock);drivers/gpu/drm/i915/gt/selftest_workarounds.c +0
-0@@ -521,8 +521,10 @@ static int check_dirty_whitelist(struct intel_context *ce)srm =
MI_STORE_REGISTER_MEM;
lrm =MI_LOAD_REGISTER_MEM;drivers/gpu/drm/i915/gt/selftest_workarounds.c +4
-2-if (INTEL_GEN (engine->i915) >=8 ) - lrm++, srm++; +if (INTEL_GEN (engine->i915) >=8 ) { + lrm++; + srm++; + }
pr_debug("%s: Writing garbage to %x\n", engine->name, reg);drivers/gpu/drm/i915/intel_runtime_pm.c +0
-0@@ -201,8 +201,10 @@ __print_intel_runtime_pm_wakeref(struct drm_printer *p, unsigned long rep;rep = 1;
drivers/gpu/drm/i915/intel_runtime_pm.c +4
-2-while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) - rep++, i++; +while (i +1 < dbg->count && dbg->owners[i +1 ] == stack) { + rep++; + i++; + }
__print_depot_stack(stack, buf, PAGE_SIZE, 2);drm_printf(p, "Wakeref x%lu taken at:\n%s", rep, buf); }
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/29 hwmon: (scmi-hwmon): Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/hwmon/scmi-hwmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwmon/scmi-hwmon.c +4 -2
@@ -202,8 +202,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) } } -if (nr_count[hwmon_temp]) - nr_count[hwmon_chip]++, nr_types++; +if (nr_count[hwmon_temp]) { + nr_count[hwmon_chip]++; + nr_types++; + } scmi_hwmon_chan =devm_kcalloc (dev, nr_types,sizeof (*scmi_hwmon_chan),GFP_KERNEL );
Signature · 1 line
2.26.0
Re: [PATCH 11/29] hwmon: (scmi-hwmon): Avoid comma separated statements
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
Thanks,
Guenter
Quoted 21 lines
--- drivers/hwmon/scmi-hwmon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/hwmon/scmi-hwmon.c +4
-2@@ -202,8 +202,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) } } -if (nr_count[hwmon_temp]) - nr_count[hwmon_chip]++, nr_types++; +if (nr_count[hwmon_temp]) { + nr_count[hwmon_chip]++; + nr_types++; + } scmi_hwmon_chan =devm_kcalloc (dev, nr_types,sizeof (*scmi_hwmon_chan),GFP_KERNEL );
PATCH 12/29 Input: MT - Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/input/input-mt.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/input/input-mt.c +7 -4
@@ -323,11 +323,14 @@ static int adjust_dual(int *begin, int step, int *end, int eq, int mu) p = begin + step; s = p == end ? f +1 : *p; -for (; p != end; p += step) -if (*p < f) - s = f, f = *p; -else if (*p < s) +for (; p != end; p += step) { +if (*p < f) { + s = f; + f = *p; + }else if (*p < s) { s = *p; + } + } c = (f + s +1 ) /2 ;if (c ==0 || (c > mu && (!eq || mu >0 )))
Signature · 1 line
2.26.0
Re: [PATCH 12/29] Input: MT - Avoid comma separated statements
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry
PATCH 13/29 bcache: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/md/bcache/bset.c | 12 ++++++++---- drivers/md/bcache/sysfs.c | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/md/bcache/bset.c +8 -4
@@ -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 ;
drivers/md/bcache/sysfs.c +4 -2
@@ -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];
Signature · 1 line
2.26.0
Re: [PATCH 13/29] bcache: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 58 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/md/bcache/bset.c | 12 ++++++++----
drivers/md/bcache/sysfs.c | 6 ++++--2 files changed, 12 insertions(+), 6 deletions(-)drivers/md/bcache/bset.c +4
-2@@ -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);drivers/md/bcache/bset.c +0
-0@@ -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)&&drivers/md/bcache/bset.c +4
-2- 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;drivers/md/bcache/sysfs.c +0
-0@@ -1071,8 +1071,10 @@ SHOW(__bch_cache) --n;while (cached < p + n &&
drivers/md/bcache/sysfs.c +4
-2- *cached == BTREE_PRIO) - cached++, n--; + *cached == BTREE_PRIO) { + cached++; + n--; + }for (i = 0; i < n; i++)
sum +=INITIAL_PRIO- cached[i];
Re: [PATCH 13/29] bcache: Avoid comma separated statements
Quoted 4 lines · Joe Perches
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
It is in my for-next now, thanks for reminding.
Coly Li
Quoted 61 lines
Quoted 59 lines
Signed-off-by Joe Perches <[email protected]>---
drivers/md/bcache/bset.c | 12 ++++++++----
drivers/md/bcache/sysfs.c | 6 ++++--2 files changed, 12 insertions(+), 6 deletions(-)drivers/md/bcache/bset.c +4
-2@@ -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);drivers/md/bcache/bset.c +0
-0@@ -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)&&drivers/md/bcache/bset.c +4
-2- 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;drivers/md/bcache/sysfs.c +0
-0@@ -1071,8 +1071,10 @@ SHOW(__bch_cache) --n;while (cached < p + n &&
drivers/md/bcache/sysfs.c +4
-2- *cached == BTREE_PRIO) - cached++, n--; + *cached == BTREE_PRIO) { + cached++; + n--; + }for (i = 0; i < n; i++)
sum +=INITIAL_PRIO- cached[i];
PATCH 14/29 media: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/media/i2c/msp3400-kthreads.c | 12 ++++++++---- drivers/media/pci/bt8xx/bttv-cards.c | 6 ++++-- drivers/media/pci/saa7134/saa7134-video.c | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-)
drivers/media/i2c/msp3400-kthreads.c +8 -4
@@ -549,8 +549,10 @@ int msp3400c_thread(void *data) val =msp_read_dsp (client,0x1b );if (val >32767 ) val -=65536 ; -if (val1 < val) - val1 = val, max1 = i; +if (val1 < val) { + val1 = val; + max1 = i; + }dev_dbg_lvl (&client->dev,1 , msp_debug,"carrier1 val: %5d / %s\n" , val, cd[i].name); }
@@ -586,8 +588,10 @@ int msp3400c_thread(void *data) val =msp_read_dsp (client,0x1b );if (val >32767 ) val -=65536 ; -if (val2 < val) - val2 = val, max2 = i; +if (val2 < val) { + val2 = val; + max2 = i; + }dev_dbg_lvl (&client->dev,1 , msp_debug,"carrier2 val: %5d / %s\n" , val, cd[i].name); }
drivers/media/pci/bt8xx/bttv-cards.c +4 -2
@@ -3934,8 +3934,10 @@ static void osprey_eeprom(struct bttv *btv, const u8 ee[256])if (checksum != ee[21 ])return ; cardid = BTTV_BOARD_OSPREY1x0_848; -for (i =12 ; i <21 ; i++) - serial *=10 , serial += ee[i] -'0' ; +for (i =12 ; i <21 ; i++) { + serial *=10 ; + serial += ee[i] -'0' ; + } } }else {unsigned short type;
drivers/media/pci/saa7134/saa7134-video.c +5 -2
@@ -868,8 +868,11 @@ static int buffer_activate(struct saa7134_dev *dev, lines_uv = dev->height >> dev->fmt->vshift; base2 = base + bpl * dev->height; base3 = base2 + bpl_uv * lines_uv; -if (dev->fmt->uvswap) - tmp = base2, base2 = base3, base3 = tmp; +if (dev->fmt->uvswap) { + tmp = base2; + base2 = base3; + base3 = tmp; + }video_dbg ("uv: bpl=%ld lines=%ld base2/3=%ld/%ld\n" , bpl_uv,lines_uv,base2,base3);if (V4L2_FIELD_HAS_BOTH (dev->field)) {
Signature · 1 line
2.26.0
Re: [PATCH 14/29] media: Avoid comma separated statements
Quoted 61 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>--- drivers/media/i2c/msp3400-kthreads.c | 12 ++++++++---- drivers/media/pci/bt8xx/bttv-cards.c | 6 ++++-- drivers/media/pci/saa7134/saa7134-video.c | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-)drivers/media/i2c/msp3400-kthreads.c +8
-4@@ -549,8 +549,10 @@ int msp3400c_thread(void *data) val =msp_read_dsp (client,0x1b );if (val >32767 ) val -=65536 ; -if (val1 < val) - val1 = val, max1 = i; +if (val1 < val) { + val1 = val; + max1 = i; + }dev_dbg_lvl (&client->dev,1 , msp_debug,"carrier1 val: %5d / %s\n" , val, cd[i].name); }@@ -586,8 +588,10 @@ int msp3400c_thread(void *data) val =msp_read_dsp (client,0x1b );if (val >32767 ) val -=65536 ; -if (val2 < val) - val2 = val, max2 = i; +if (val2 < val) { + val2 = val; + max2 = i; + }dev_dbg_lvl (&client->dev,1 , msp_debug,"carrier2 val: %5d / %s\n" , val, cd[i].name); }drivers/media/pci/bt8xx/bttv-cards.c +4
-2@@ -3934,8 +3934,10 @@ static void osprey_eeprom(struct bttv *btv, const u8 ee[256])if (checksum != ee[21 ])return ; cardid = BTTV_BOARD_OSPREY1x0_848; -for (i =12 ; i <21 ; i++) - serial *=10 , serial += ee[i] -'0' ; +for (i =12 ; i <21 ; i++) { + serial *=10 ; + serial += ee[i] -'0' ; + } } }else {unsigned short type;drivers/media/pci/saa7134/saa7134-video.c +0
-0
drivers/media/pci/saa7134/saa7134-video.c static int buffer_activate(struct saa7134_dev *dev, · line 874
Quoted 9 lines
drivers/media/pci/saa7134/saa7134-video.c +4
-2@@ -868,8 +868,11 @@ static int buffer_activate(struct saa7134_dev *dev, lines_uv = dev->height >> dev->fmt->vshift; base2 = base + bpl * dev->height; base3 = base2 + bpl_uv * lines_uv; -if (dev->fmt->uvswap) - tmp = base2, base2 = base3, base3 = tmp; +if (dev->fmt->uvswap) { + tmp = base2; + base2 = base3; + base3 = tmp;
Don't we have any swap macro helpers for this?
Anyway, that would be out of scope of this patch series.
Quoted 5 lines
drivers/media/pci/saa7134/saa7134-video.c +1
-0+ }video_dbg ("uv: bpl=%ld lines=%ld base2/3=%ld/%ld\n" , bpl_uv,lines_uv,base2,base3);if (V4L2_FIELD_HAS_BOTH (dev->field)) {
PATCH 15/29 mtd: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/mtd/devices/lart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mtd/devices/lart.c +8 -2
@@ -436,7 +436,10 @@ static int flash_read (struct mtd_info *mtd,loff_t from,size_t len,size_t *retle {int gap =BUSWIDTH - (from & (BUSWIDTH -1 )); -while (len && gap--) *buf++ =read8 (from++), len--; +while (len && gap--) { + *buf++ =read8 (from++); + len--; + } }/* now we read dwords until we reach a non-dword boundary */
@@ -518,7 +521,10 @@ static int flash_write (struct mtd_info *mtd,loff_t to,size_t len,size_t *retlen i = n =0 ;while (gap--) tmp[i++] =0xFF ; -while (len && i <BUSWIDTH ) tmp[i++] = buf[n++], len--; +while (len && i <BUSWIDTH ) { + tmp[i++] = buf[n++]; + len--; + }while (i <BUSWIDTH ) tmp[i++] =0xFF ;if (!write_dword (aligned,*((__u32 *) tmp)))return (-EIO );
Signature · 6 lines
2.26.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH 15/29] mtd: Avoid comma separated statements
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.
Miquel
PATCH 16/29 8390: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/net/ethernet/8390/axnet_cs.c | 19 ++++++++++++------- drivers/net/ethernet/8390/lib8390.c | 14 +++++++++----- drivers/net/ethernet/8390/pcnet_cs.c | 6 ++++-- 3 files changed, 25 insertions(+), 14 deletions(-)
drivers/net/ethernet/8390/axnet_cs.c +12 -7
@@ -657,8 +657,10 @@ static void block_input(struct net_device *dev, int count,outb_p (E8390_RREAD +E8390_START , nic_base +AXNET_CMD );insw (nic_base +AXNET_DATAPORT ,buf,count>>1 ); -if (count &0x01 ) - buf[count-1 ] =inb (nic_base +AXNET_DATAPORT ), xfer_count++; +if (count &0x01 ) { + buf[count-1 ] =inb (nic_base +AXNET_DATAPORT ); + xfer_count++; + } }
@@ -1270,10 +1272,12 @@ static void ei_tx_intr(struct net_device *dev) ei_local->txing =1 ;NS8390_trigger_send (dev, ei_local->tx2, ei_local->tx_start_page +6 );netif_trans_update (dev); - ei_local->tx2 =-1 , + ei_local->tx2 =-1 ; ei_local->lasttx =2 ; - } -else ei_local->lasttx =20 , ei_local->txing =0 ; + }else { + ei_local->lasttx =20 ; + ei_local->txing =0 ; + } }else if (ei_local->tx2 <0 ) {
@@ -1289,9 +1293,10 @@ static void ei_tx_intr(struct net_device *dev)netif_trans_update (dev); ei_local->tx1 =-1 ; ei_local->lasttx =1 ; + }else { + ei_local->lasttx =10 ; + ei_local->txing =0 ; } -else - ei_local->lasttx =10 , ei_local->txing =0 ; }// else // netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n",
drivers/net/ethernet/8390/lib8390.c +9 -5
@@ -597,10 +597,12 @@ static void ei_tx_intr(struct net_device *dev) ei_local->txing =1 ;NS8390_trigger_send (dev, ei_local->tx2, ei_local->tx_start_page +6 );netif_trans_update (dev); - ei_local->tx2 =-1 , + ei_local->tx2 =-1 ; ei_local->lasttx =2 ; - }else - ei_local->lasttx =20 , ei_local->txing =0 ; + }else { + ei_local->lasttx =20 ; + ei_local->txing =0 ; + } }else if (ei_local->tx2 <0 ) {if (ei_local->lasttx !=2 && ei_local->lasttx !=-2 ) pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n",
@@ -612,8 +614,10 @@ static void ei_tx_intr(struct net_device *dev)netif_trans_update (dev); ei_local->tx1 =-1 ; ei_local->lasttx =1 ; - }else - ei_local->lasttx =10 , ei_local->txing =0 ; + }else { + ei_local->lasttx =10 ; + ei_local->txing =0 ; + } }/* else netdev_warn(dev, "unexpected TX-done interrupt, lasttx=%d\n", ei_local->lasttx);
drivers/net/ethernet/8390/pcnet_cs.c +4 -2
@@ -1178,8 +1178,10 @@ static void dma_block_input(struct net_device *dev, int count,outb_p (E8390_RREAD +E8390_START , nic_base +PCNET_CMD );insw (nic_base +PCNET_DATAPORT ,buf,count>>1 ); -if (count &0x01 ) - buf[count-1 ] =inb (nic_base +PCNET_DATAPORT ), xfer_count++; +if (count &0x01 ) { + buf[count-1 ] =inb (nic_base +PCNET_DATAPORT ); + xfer_count++; + }/* This was for the ALPHA version only, but enough people have been encountering problems that it is still here. */
Signature · 1 line
2.26.0
Re: [PATCH 16/29] 8390: Avoid comma separated statements
From: Joe Perches <[email protected]>
Date: Mon, 24 Aug 2020 21:56:13 -0700
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 17/29 fs_enet: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +7 -4
@@ -562,10 +562,13 @@ fs_enet_start_xmit(struct sk_buff *skb, struct net_device *dev) BD_ENET_TX_TC);CBDS_SC (bdp,BD_ENET_TX_READY ); -if ((CBDR_SC (bdp) &BD_ENET_TX_WRAP ) ==0 ) - bdp++, curidx++; -else - bdp = fep->tx_bd_base, curidx =0 ; +if ((CBDR_SC (bdp) &BD_ENET_TX_WRAP ) ==0 ) { + bdp++; + curidx++; + }else { + bdp = fep->tx_bd_base; + curidx =0 ; + } len =skb_frag_size (frag); CBDW_BUFADDR(bdp, skb_frag_dma_map(fep->dev, frag, 0, len,
Signature · 1 line
2.26.0
Re: [PATCH 17/29] fs_enet: Avoid comma separated statements
From: Joe Perches <[email protected]>
Date: Mon, 24 Aug 2020 21:56:14 -0700
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 18/29 wan: sbni: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/net/wan/sbni.c | 101 +++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 43 deletions(-)
drivers/net/wan/sbni.c +58 -43
@@ -260,11 +260,12 @@ static int __init sbni_init(struct net_device *dev)return sbni_isa_probe ( dev );/* otherwise we have to perform search our adapter */ -if ( io[ num ] !=-1 ) - dev->base_addr = io[ num ], +if ( io[ num ] !=-1 ) { + dev->base_addr = io[ num ]; dev->irq = irq[ num ]; -else if ( scandone || io[0 ] !=-1 ) + }else if ( scandone || io[0 ] !=-1 ) {return -ENODEV ; + }/* if io[ num ] contains non-zero address, then that is on ISA bus */ if ( dev->base_addr )
@@ -399,12 +400,13 @@ sbni_probe1( struct net_device *dev, unsigned long ioaddr, int irq ) nl->maxframe =DEFAULT_FRAME_LEN ; nl->csr1.rate = baud[ num ]; -if ( (nl->cur_rxl_index = rxl[ num ]) ==-1 ) +if ( (nl->cur_rxl_index = rxl[ num ]) ==-1 ) {/* autotune rxl */ - nl->cur_rxl_index =DEF_RXL , + nl->cur_rxl_index =DEF_RXL ; nl->delta_rxl =DEF_RXL_DELTA ; -else + }else { nl->delta_rxl =0 ; + } nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ];if (inb ( ioaddr +CSR0 ) &0x01 ) nl->state |=FL_SLOW_MODE ;
@@ -512,13 +514,15 @@ sbni_interrupt( int irq, void *dev_id )do { repeat =0 ; -if (inb ( dev->base_addr +CSR0 ) & (RC_RDY |TR_RDY ) ) -handle_channel ( dev ), +if (inb ( dev->base_addr +CSR0 ) & (RC_RDY |TR_RDY ) ) { +handle_channel ( dev ); repeat =1 ; + }if ( nl->second &&/* second channel present */ - (inb ( nl->second->base_addr+CSR0 ) & (RC_RDY |TR_RDY )) ) -handle_channel ( nl->second ), + (inb ( nl->second->base_addr+CSR0 ) & (RC_RDY |TR_RDY )) ) { +handle_channel ( nl->second ); repeat =1 ; + } }while ( repeat );if ( nl->second )
@@ -610,11 +614,12 @@ recv_frame( struct net_device *dev ) nl->state |=FL_PREV_OK ;if ( framelen >4 ) nl->in_stats.all_rx_number++; - }else - nl->state &= ~FL_PREV_OK , -change_level ( dev ), - nl->in_stats.all_rx_number++, + }else { + nl->state &= ~FL_PREV_OK ; +change_level ( dev ); + nl->in_stats.all_rx_number++; nl->in_stats.bad_rx_number++; + }return !frame_ok || framelen >4 ; }
@@ -689,9 +694,10 @@ download_data( struct net_device *dev, u32 *crc_p ) *crc_p =calc_crc32 ( *crc_p, skb->data + nl->outpos, len );/* if packet too short we should write some more bytes to pad */ -for ( len = nl->framelen - len; len--; ) -outb (0 , dev->base_addr +DAT ), +for ( len = nl->framelen - len; len--; ) { +outb (0 , dev->base_addr +DAT ); *crc_p =CRC32 (0 , *crc_p ); + } }
@@ -703,9 +709,10 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,int frame_ok; -if ( is_first ) - nl->wait_frameno = frameno, +if ( is_first ) { + nl->wait_frameno = frameno; nl->inppos =0 ; + }if ( nl->wait_frameno == frameno ) {
@@ -717,33 +724,35 @@ upload_data( struct net_device *dev, unsigned framelen, unsigned frameno,* error was occurred... drop entire packet */ else if( (frame_ok = skip_tail( dev->base_addr, framelen, crc )) - != 0 ) - nl->wait_frameno = 0, - nl->inppos = 0, + != 0 ) { + nl->wait_frameno =0 ; + nl->inppos =0 ;#ifdef CONFIG_SBNI_MULTILINE - nl->master->stats.rx_errors++, + nl->master->stats.rx_errors++; nl->master->stats.rx_missed_errors++;#else - dev->stats.rx_errors++, + dev->stats.rx_errors++; dev->stats.rx_missed_errors++;#endif + }/* now skip all frames until is_first != 0 */ }else frame_ok =skip_tail ( dev->base_addr, framelen, crc ); -if ( is_first && !frame_ok ) +if ( is_first && !frame_ok ) {/* * Frame has been broken, but we had already stored * is_first... Drop entire packet. */ - nl->wait_frameno =0 , + nl->wait_frameno =0 ;#ifdef CONFIG_SBNI_MULTILINE - nl->master->stats.rx_errors++, + nl->master->stats.rx_errors++; nl->master->stats.rx_crc_errors++;#else - dev->stats.rx_errors++, + dev->stats.rx_errors++; dev->stats.rx_crc_errors++;#endif + }return frame_ok; }
@@ -782,17 +791,18 @@ interpret_ack( struct net_device *dev, unsigned ack )if ( nl->state &FL_WAIT_ACK ) { nl->outpos += nl->framelen; -if ( --nl->tx_frameno ) +if ( --nl->tx_frameno ) { nl->framelen = min_t(unsigned int, nl->maxframe, nl->tx_buf_p->len - nl->outpos); - else - send_complete( dev ), + }else { +send_complete ( dev );#ifdef CONFIG_SBNI_MULTILINE netif_wake_queue ( nl->master );#else netif_wake_queue ( dev );#endif + } } }
@@ -872,16 +882,17 @@ drop_xmit_queue( struct net_device *dev ) {struct net_local *nl =netdev_priv (dev); -if ( nl->tx_buf_p ) -dev_kfree_skb_any ( nl->tx_buf_p ), - nl->tx_buf_p =NULL , +if ( nl->tx_buf_p ) { +dev_kfree_skb_any ( nl->tx_buf_p ); + nl->tx_buf_p =NULL ;#ifdef CONFIG_SBNI_MULTILINE - nl->master->stats.tx_errors++, + nl->master->stats.tx_errors++; nl->master->stats.tx_carrier_errors++;#else - dev->stats.tx_errors++, + dev->stats.tx_errors++; dev->stats.tx_carrier_errors++;#endif + } nl->tx_frameno =0 ; nl->framelen =0 ;
@@ -1327,12 +1338,13 @@ sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd )spin_lock ( &nl->lock ); flags = *(struct sbni_flags *) &ifr->ifr_ifru; -if ( flags.fixed_rxl ) - nl->delta_rxl =0 , +if ( flags.fixed_rxl ) { + nl->delta_rxl =0 ; nl->cur_rxl_index = flags.rxl; -else - nl->delta_rxl =DEF_RXL_DELTA , + }else { + nl->delta_rxl =DEF_RXL_DELTA ; nl->cur_rxl_index =DEF_RXL ; + } nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ]; nl->csr1.rate = flags.rate;
@@ -1526,13 +1538,16 @@ sbni_setup( char *p ) (*dest[ parm ])[ n ] =simple_strtol ( p, &p,0 );if ( !*p || *p ==')' )return 1 ; -if ( *p ==';' ) - ++p, ++n, parm =0 ; -else if ( *p++ !=',' ) +if ( *p ==';' ) { + ++p; + ++n; + parm =0 ; + }else if ( *p++ !=',' ) {break ; -else + }else {if ( ++parm >=5 )break ; + } } bad_param:pr_err ("Error in sbni kernel parameter!\n" );
Signature · 1 line
2.26.0
Re: [PATCH 18/29] wan: sbni: Avoid comma separated statements
From: Joe Perches <[email protected]>
Date: Mon, 24 Aug 2020 21:56:15 -0700
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 19/29 s390/tty3270: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/s390/char/tty3270.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/s390/char/tty3270.c +4 -2
@@ -424,8 +424,10 @@ tty3270_update(struct timer_list *t)* last output position matches the start address * of this line. */ -if (s->string[1 ] == sba[0 ] && s->string[2 ] == sba[1 ]) - str +=3 , len -=3 ; +if (s->string[1 ] == sba[0 ] && s->string[2 ] == sba[1 ]) { + str +=3 ; + len -=3 ; + }if (raw3270_request_add_data (wrq, str, len) !=0 )break ;list_del_init (&s->update);
Signature · 1 line
2.26.0
Re: [PATCH 19/29] s390/tty3270: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 22 lines
Signed-off-by Joe Perches <[email protected]>---
�drivers/s390/char/tty3270.c | 6 ++++-- �1 file changed, 4 insertions(+), 2 deletions(-)drivers/s390/char/tty3270.c +0
-0@@ -424,8 +424,10 @@ tty3270_update(struct timer_list *t)� * last output position matches the start address
� * of this line.
� */drivers/s390/char/tty3270.c +4
-2-if (s->string[1 ] == sba[0 ] && s->string[2 ] == sba[1 ]) - str +=3 , len -=3 ; +if (s->string[1 ] == sba[0 ] && s->string[2 ] == sba[1 ]) { + str +=3 ; + len -=3 ; + }� if (
raw3270_request_add_data(wrq, str, len)!= 0)
� break;
�list_del_init(&s->update);
PATCH 20/29 scai/arm: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/scsi/arm/cumana_2.c | 19 +++++++++++-------- drivers/scsi/arm/eesox.c | 9 +++++---- drivers/scsi/arm/powertec.c | 9 +++++---- 3 files changed, 21 insertions(+), 16 deletions(-)
drivers/scsi/arm/cumana_2.c +11 -8
@@ -166,14 +166,15 @@ cumanascsi_2_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, bufs =copy_SCp_to_sg (&info->sg[0 ], SCp,NR_SG ); -if (direction ==DMA_OUT ) - map_dir =DMA_TO_DEVICE , - dma_dir =DMA_MODE_WRITE , +if (direction ==DMA_OUT ) { + map_dir =DMA_TO_DEVICE ; + dma_dir =DMA_MODE_WRITE ; alatch_dir =ALATCH_DMA_OUT ; -else - map_dir =DMA_FROM_DEVICE , - dma_dir =DMA_MODE_READ , + }else { + map_dir =DMA_FROM_DEVICE ; + dma_dir =DMA_MODE_READ ; alatch_dir =ALATCH_DMA_IN ; + }dma_map_sg (dev, info->sg, bufs, map_dir);
@@ -326,10 +327,12 @@ cumanascsi_2_set_proc_info(struct Scsi_Host *host, char *buffer, int length)cumanascsi_2_terminator_ctl (host,0 ); else ret = -EINVAL ; - }else + }else { ret = -EINVAL ; - }else + } + }else { ret = -EINVAL ; + }return ret; }
drivers/scsi/arm/eesox.c +5 -4
@@ -165,12 +165,13 @@ eesoxscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, bufs =copy_SCp_to_sg (&info->sg[0 ], SCp,NR_SG ); -if (direction ==DMA_OUT ) - map_dir =DMA_TO_DEVICE , +if (direction ==DMA_OUT ) { + map_dir =DMA_TO_DEVICE ; dma_dir =DMA_MODE_WRITE ; -else - map_dir =DMA_FROM_DEVICE , + }else { + map_dir =DMA_FROM_DEVICE ; dma_dir =DMA_MODE_READ ; + }dma_map_sg (dev, info->sg, bufs, map_dir);
drivers/scsi/arm/powertec.c +5 -4
@@ -138,12 +138,13 @@ powertecscsi_dma_setup(struct Scsi_Host *host, struct scsi_pointer *SCp, bufs =copy_SCp_to_sg (&info->sg[0 ], SCp,NR_SG ); -if (direction ==DMA_OUT ) - map_dir =DMA_TO_DEVICE , +if (direction ==DMA_OUT ) { + map_dir =DMA_TO_DEVICE ; dma_dir =DMA_MODE_WRITE ; -else - map_dir =DMA_FROM_DEVICE , + }else { + map_dir =DMA_FROM_DEVICE ; dma_dir =DMA_MODE_READ ; + }dma_map_sg (dev, info->sg, bufs, map_dir);
Signature · 1 line
2.26.0
PATCH 21/29 media: atomisp: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +4 -2
@@ -410,8 +410,10 @@ int atomisp_subdev_set_selection(struct v4l2_subdev *sd,if (atomisp_subdev_format_conversion (isp_sd, isp_sd->capture_pad) - && crop[pad]->width && crop[pad]->height) - crop[pad]->width -= padding_w, crop[pad]->height -= padding_h; + && crop[pad]->width && crop[pad]->height) { + crop[pad]->width -= padding_w; + crop[pad]->height -= padding_h; + }/* if subdev type is SOC camera,we do not need to set DVS */ if (isp->inputs[isp_sd->input_curr].type ==SOC_CAMERA )
Signature · 1 line
2.26.0
Re: [PATCH 21/29] media: atomisp: Avoid comma separated statements
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Quoted 22 lines
--- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/media/atomisp/pci/atomisp_subdev.c +4
-2@@ -410,8 +410,10 @@ int atomisp_subdev_set_selection(struct v4l2_subdev *sd,if (atomisp_subdev_format_conversion (isp_sd, isp_sd->capture_pad) - && crop[pad]->width && crop[pad]->height) - crop[pad]->width -= padding_w, crop[pad]->height -= padding_h; + && crop[pad]->width && crop[pad]->height) { + crop[pad]->width -= padding_w; + crop[pad]->height -= padding_h; + }/* if subdev type is SOC camera,we do not need to set DVS */ if (isp->inputs[isp_sd->input_curr].type ==SOC_CAMERA )
PATCH 22/29 video: fbdev: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- drivers/video/fbdev/tgafb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/video/fbdev/tgafb.c +8 -4
@@ -989,8 +989,10 @@ tgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)/* We can fill 2k pixels per operation. Notice blocks that fit the width of the screen so that we can take advantage of this and fill more than one line per write. */ -if (width = line_length) - width *= height, height =1 ; +if (width = line_length) { + width *= height; + height =1 ; + }/* The write into the frame buffer must be aligned to 4 bytes, but we are allowed to encode the offset within the word in
@@ -1171,8 +1173,10 @@ copyarea_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy,More than anything else, these control how we do copies. */ depos = dy * line_length + dx; sepos = sy * line_length + sx; -if (backward) - depos += width, sepos += width; +if (backward) { + depos += width; + sepos += width; + }/* Next copy full words at a time. */ n32 = width /32 ;
Signature · 1 line
2.26.0
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 22/29] video: fbdev: Avoid comma separated statements
Quoted 3 lines · Joe Perches
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied to drm-misc-next tree, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Quoted 35 lines
--- drivers/video/fbdev/tgafb.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/video/fbdev/tgafb.c +8
-4@@ -989,8 +989,10 @@ tgafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)/* We can fill 2k pixels per operation. Notice blocks that fit the width of the screen so that we can take advantage of this and fill more than one line per write. */ -if (width = line_length) - width *= height, height =1 ; +if (width = line_length) { + width *= height; + height =1 ; + }/* The write into the frame buffer must be aligned to 4 bytes, but we are allowed to encode the offset within the word in @@ -1171,8 +1173,10 @@ copyarea_8bpp(struct fb_info *info, u32 dx, u32 dy, u32 sx, u32 sy,More than anything else, these control how we do copies. */ depos = dy * line_length + dx; sepos = sy * line_length + sx; -if (backward) - depos += width, sepos += width; +if (backward) { + depos += width; + sepos += width; + }/* Next copy full words at a time. */ n32 = width /32 ;
PATCH 23/29 fuse: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- fs/fuse/dir.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
fs/fuse/dir.c +16 -8
@@ -1362,14 +1362,22 @@ static void iattr_to_fattr(struct fuse_conn *fc, struct iattr *iattr, {unsigned ivalid = iattr->ia_valid; -if (ivalid &ATTR_MODE ) - arg->valid |=FATTR_MODE , arg->mode = iattr->ia_mode; -if (ivalid &ATTR_UID ) - arg->valid |=FATTR_UID , arg->uid =from_kuid (fc->user_ns, iattr->ia_uid); -if (ivalid &ATTR_GID ) - arg->valid |=FATTR_GID , arg->gid =from_kgid (fc->user_ns, iattr->ia_gid); -if (ivalid &ATTR_SIZE ) - arg->valid |=FATTR_SIZE , arg->size = iattr->ia_size; +if (ivalid &ATTR_MODE ) { + arg->valid |=FATTR_MODE ; + arg->mode = iattr->ia_mode; + } +if (ivalid &ATTR_UID ) { + arg->valid |=FATTR_UID ; + arg->uid =from_kuid (fc->user_ns, iattr->ia_uid); + } +if (ivalid &ATTR_GID ) { + arg->valid |=FATTR_GID ; + arg->gid =from_kgid (fc->user_ns, iattr->ia_gid); + } +if (ivalid &ATTR_SIZE ) { + arg->valid |=FATTR_SIZE ; + arg->size = iattr->ia_size; + }if (ivalid &ATTR_ATIME ) { arg->valid |=FATTR_ATIME ; arg->atime = iattr->ia_atime.tv_sec;
Signature · 1 line
2.26.0
Re: [PATCH 23/29] fuse: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 41 lines
Signed-off-by Joe Perches <[email protected]>---
fs/fuse/dir.c | 24 ++++++++++++++++--------1 file changed, 16 insertions(+), 8 deletions(-)fs/fuse/dir.c +0
-0@@ -1362,14 +1362,22 @@ static void iattr_to_fattr(struct fuse_conn *fc, struct iattr *iattr, { unsigned ivalid = iattr->ia_valid;fs/fuse/dir.c +16
-8-if (ivalid &ATTR_MODE ) - arg->valid |=FATTR_MODE , arg->mode = iattr->ia_mode; -if (ivalid &ATTR_UID ) - arg->valid |=FATTR_UID , arg->uid =from_kuid (fc->user_ns, iattr->ia_uid); -if (ivalid &ATTR_GID ) - arg->valid |=FATTR_GID , arg->gid =from_kgid (fc->user_ns, iattr->ia_gid); -if (ivalid &ATTR_SIZE ) - arg->valid |=FATTR_SIZE , arg->size = iattr->ia_size; +if (ivalid &ATTR_MODE ) { + arg->valid |=FATTR_MODE ; + arg->mode = iattr->ia_mode; + } +if (ivalid &ATTR_UID ) { + arg->valid |=FATTR_UID ; + arg->uid =from_kuid (fc->user_ns, iattr->ia_uid); + } +if (ivalid &ATTR_GID ) { + arg->valid |=FATTR_GID ; + arg->gid =from_kgid (fc->user_ns, iattr->ia_gid); + } +if (ivalid &ATTR_SIZE ) { + arg->valid |=FATTR_SIZE ; + arg->size = iattr->ia_size; + }if (ivalid &
ATTR_ATIME) {arg->valid|=FATTR_ATIME;arg->atime=iattr->ia_atime.tv_sec;
Miklos Szeredi
maintainerRe: [PATCH 23/29] fuse: Avoid comma separated statements
In reply to Joe PerchesQuoted 2 lines · Joe Perches
Use semicolons and braces.
Reference to coding style doc? Or other important reason? Or just personal preference?
Thanks,
Miklos
PATCH 24/29 reiserfs: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- fs/reiserfs/fix_node.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-)
fs/reiserfs/fix_node.c +24 -12
@@ -235,8 +235,10 @@ static void check_left(struct tree_balance *tb, int h, int cur_free) d_size =0 , ih_size =IH_SIZE ;/* first item may be merge with last item in left neighbor */ -if (vi->vi_type &VI_TYPE_LEFT_MERGEABLE ) - d_size = -((int )IH_SIZE ), ih_size =0 ; +if (vi->vi_type &VI_TYPE_LEFT_MERGEABLE ) { + d_size = -((int )IH_SIZE ); + ih_size =0 ; + } tb->lnum[0 ] =0 ; for (i = 0; i < vn->vn_nr_item;
@@ -321,8 +323,10 @@ static void check_right(struct tree_balance *tb, int h, int cur_free) d_size =0 , ih_size =IH_SIZE ;/* last item may be merge with first item in right neighbor */ -if (vi->vi_type &VI_TYPE_RIGHT_MERGEABLE ) - d_size = -(int )IH_SIZE , ih_size =0 ; +if (vi->vi_type &VI_TYPE_RIGHT_MERGEABLE ) { + d_size = -(int )IH_SIZE ; + ih_size =0 ; + } tb->rnum[0 ] =0 ; for (i = vn->vn_nr_item - 1; i >= 0;
@@ -1534,8 +1538,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) nver1 =get_num_ver (vn->vn_mode, tb, h,0 ,-1 ,0 ,-1 , snum012 +NOTHING_SHIFT_FLOW ,FLOW ); -if (nver > nver1) - nset =NOTHING_SHIFT_FLOW , nver = nver1; +if (nver > nver1) { + nset =NOTHING_SHIFT_FLOW ; + nver = nver1; + } }/*
@@ -1559,8 +1565,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) ((tb->lbytes !=-1 ) ?1 :0 ), tb->lbytes,0 ,-1 , snum012 + LEFT_SHIFT_FLOW, FLOW); -if (lnver > lnver1) - lset =LEFT_SHIFT_FLOW , lnver = lnver1; +if (lnver > lnver1) { + lset =LEFT_SHIFT_FLOW ; + lnver = lnver1; + } }/*
@@ -1590,8 +1598,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) tb->rbytes, snum012 + RIGHT_SHIFT_FLOW, FLOW); -if (rnver > rnver1) - rset =RIGHT_SHIFT_FLOW , rnver = rnver1; +if (rnver > rnver1) { + rset =RIGHT_SHIFT_FLOW ; + rnver = rnver1; + } }/*
@@ -1622,8 +1632,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) ((tb->rbytes != -1) ? 1 : 0)), tb->rbytes, snum012 + LR_SHIFT_FLOW, FLOW); -if (lrnver > lrnver1) - lrset =LR_SHIFT_FLOW , lrnver = lrnver1; +if (lrnver > lrnver1) { + lrset =LR_SHIFT_FLOW ; + lrnver = lrnver1; + } }/*
Signature · 1 line
2.26.0
Re: [PATCH 24/29] reiserfs: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 96 lines
Signed-off-by Joe Perches <[email protected]>---
fs/reiserfs/fix_node.c | 36 ++++++++++++++++++++++++------------1 file changed, 24 insertions(+), 12 deletions(-)fs/reiserfs/fix_node.c +0
-0@@ -235,8 +235,10 @@ static void check_left(struct tree_balance *tb, int h, int cur_free) d_size = 0, ih_size = IH_SIZE;/* first item may be merge with last item in left neighbor */
fs/reiserfs/fix_node.c +4
-2-if (vi->vi_type &VI_TYPE_LEFT_MERGEABLE ) - d_size = -((int )IH_SIZE ), ih_size =0 ; +if (vi->vi_type &VI_TYPE_LEFT_MERGEABLE ) { + d_size = -((int )IH_SIZE ); + ih_size =0 ; + }tb->lnum[0] = 0;
for (i = 0; i <vn->vn_nr_item;fs/reiserfs/fix_node.c +0
-0@@ -321,8 +323,10 @@ static void check_right(struct tree_balance *tb, int h, int cur_free) d_size = 0, ih_size = IH_SIZE;/* last item may be merge with first item in right neighbor */
fs/reiserfs/fix_node.c +4
-2-if (vi->vi_type &VI_TYPE_RIGHT_MERGEABLE ) - d_size = -(int )IH_SIZE , ih_size =0 ; +if (vi->vi_type &VI_TYPE_RIGHT_MERGEABLE ) { + d_size = -(int )IH_SIZE ; + ih_size =0 ; + }tb->rnum[0] = 0;
for (i =vn->vn_nr_item- 1; i >= 0;fs/reiserfs/fix_node.c +4
-2@@ -1534,8 +1538,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) nver1 = get_num_ver(vn->vn_mode, tb, h, 0, -1, 0, -1, snum012 + NOTHING_SHIFT_FLOW, FLOW); -if (nver > nver1) - nset =NOTHING_SHIFT_FLOW , nver = nver1; +if (nver > nver1) { + nset =NOTHING_SHIFT_FLOW ; + nver = nver1; + } }/*
fs/reiserfs/fix_node.c +4
-2@@ -1559,8 +1565,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) ((tb->lbytes != -1) ? 1 : 0), tb->lbytes, 0, -1, snum012 + LEFT_SHIFT_FLOW, FLOW); -if (lnver > lnver1) - lset =LEFT_SHIFT_FLOW , lnver = lnver1; +if (lnver > lnver1) { + lset =LEFT_SHIFT_FLOW ; + lnver = lnver1; + } }/*
fs/reiserfs/fix_node.c +0
-0@@ -1590,8 +1598,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) tb->rbytes, snum012 + RIGHT_SHIFT_FLOW, FLOW);fs/reiserfs/fix_node.c +4
-2-if (rnver > rnver1) - rset =RIGHT_SHIFT_FLOW , rnver = rnver1; +if (rnver > rnver1) { + rset =RIGHT_SHIFT_FLOW ; + rnver = rnver1; + }}
/*
fs/reiserfs/fix_node.c +4
-2@@ -1622,8 +1632,10 @@ static int ip_check_balance(struct tree_balance *tb, int h) ((tb->rbytes != -1) ? 1 : 0)), tb->rbytes, snum012 + LR_SHIFT_FLOW, FLOW); -if (lrnver > lrnver1) - lrset =LR_SHIFT_FLOW , lrnver = lrnver1; +if (lrnver > lrnver1) { + lrset =LR_SHIFT_FLOW ; + lrnver = lrnver1; + } }/*
PATCH 25/29 lib/zlib: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- lib/zlib_deflate/deftree.c | 49 +++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-)
lib/zlib_deflate/deftree.c +35 -14
@@ -217,10 +217,22 @@ static void tr_static_init(void)/* Construct the codes of the static literal tree */ for (bits =0 ; bits <=MAX_BITS ; bits++) bl_count[bits] =0 ; n =0 ; -while (n <=143 ) static_ltree[n++].Len =8 , bl_count[8 ]++; -while (n <=255 ) static_ltree[n++].Len =9 , bl_count[9 ]++; -while (n <=279 ) static_ltree[n++].Len =7 , bl_count[7 ]++; -while (n <=287 ) static_ltree[n++].Len =8 , bl_count[8 ]++; +while (n <=143 ) { + static_ltree[n++].Len =8 ; + bl_count[8 ]++; + } +while (n <=255 ) { + static_ltree[n++].Len =9 ; + bl_count[9 ]++; + } +while (n <=279 ) { + static_ltree[n++].Len =7 ; + bl_count[7 ]++; + } +while (n <=287 ) { + static_ltree[n++].Len =8 ; + bl_count[8 ]++; + }/* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones)
@@ -378,7 +390,10 @@ static void gen_bitlen(for (h = s->heap_max+1 ; h <HEAP_SIZE ; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len +1 ; -if (bits > max_length) bits = max_length, overflow++; +if (bits > max_length) { + bits = max_length; + overflow++; + } tree[n].Len = (ush )bits;/* We overwrite tree[n].Dad which is no longer needed */
@@ -497,7 +512,7 @@ static void build_tree(* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ - s->heap_len =0 , s->heap_max =HEAP_SIZE ; + s->heap_len =0 ; s->heap_max =HEAP_SIZE ;for (n =0 ; n < elems; n++) {if (tree[n].Freq !=0 ) {
@@ -583,7 +598,10 @@ static void scan_tree(int max_count =7 ;/* max repeat count */ int min_count =4 ;/* min repeat count */ -if (nextlen ==0 ) max_count =138 , min_count =3 ; +if (nextlen ==0 ) { + max_count =138 ; + min_count =3 ; + } tree[max_code+1 ].Len = (ush )0xffff ;/* guard */ for (n =0 ; n <= max_code; n++) {
@@ -602,11 +620,11 @@ static void scan_tree( } count =0 ; prevlen = curlen;if (nextlen ==0 ) { - max_count =138 , min_count =3 ; + max_count =138 ; min_count =3 ; }else if (curlen == nextlen) { - max_count =6 , min_count =3 ; + max_count =6 ; min_count =3 ; }else { - max_count =7 , min_count =4 ; + max_count =7 ; min_count =4 ; } } }
@@ -630,7 +648,10 @@ static void send_tree(int min_count =4 ;/* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ -if (nextlen ==0 ) max_count =138 , min_count =3 ; +if (nextlen ==0 ) { + max_count =138 ; + min_count =3 ; + }for (n =0 ; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1 ].Len;
@@ -654,11 +675,11 @@ static void send_tree( } count =0 ; prevlen = curlen;if (nextlen ==0 ) { - max_count =138 , min_count =3 ; + max_count =138 ; min_count =3 ; }else if (curlen == nextlen) { - max_count =6 , min_count =3 ; + max_count =6 ; min_count =3 ; }else { - max_count =7 , min_count =4 ; + max_count =7 ; min_count =4 ; } } }
Signature · 1 line
2.26.0
Re: [PATCH 25/29] lib/zlib: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 117 lines
Signed-off-by Joe Perches <[email protected]>---
lib/zlib_deflate/deftree.c | 49 +++++++++++++++++++++++++++-----------1 file changed, 35 insertions(+), 14 deletions(-)lib/zlib_deflate/deftree.c +20
-5@@ -217,10 +217,22 @@ static void tr_static_init(void) /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; -while (n <=143 ) static_ltree[n++].Len =8 , bl_count[8 ]++; -while (n <=255 ) static_ltree[n++].Len =9 , bl_count[9 ]++; -while (n <=279 ) static_ltree[n++].Len =7 , bl_count[7 ]++; -while (n <=287 ) static_ltree[n++].Len =8 , bl_count[8 ]++; +while (n <=143 ) { + static_ltree[n++].Len =8 ; + bl_count[8 ]++; + } +while (n <=255 ) { + static_ltree[n++].Len =9 ; + bl_count[9 ]++; + } +while (n <=279 ) { + static_ltree[n++].Len =7 ; + bl_count[7 ]++; + } +while (n <=287 ) { + static_ltree[n++].Len =8 ; + bl_count[8 ]++; + } /* Codes 286 and 287 do not exist, but we must include them in the* tree construction to get a canonical Huffman tree (longest code * all ones) @@ -378,7 +390,10 @@ static void gen_bitlen( for (h = s->heap_max+1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; -if (bits > max_length) bits = max_length, overflow++; +if (bits > max_length) { + bits = max_length; + overflow++; + } tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */lib/zlib_deflate/deftree.c +1
-1@@ -497,7 +512,7 @@ static void build_tree(* heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ - s->heap_len =0 , s->heap_max =HEAP_SIZE ; + s->heap_len =0 ; s->heap_max =HEAP_SIZE ;for (n = 0; n < elems; n++) {
if (tree[n].Freq != 0) {lib/zlib_deflate/deftree.c +0
-0@@ -583,7 +598,10 @@ static void scan_tree(int
max_count= 7; /* max repeat count */
intmin_count= 4; /* min repeat count */lib/zlib_deflate/deftree.c +4
-1-if (nextlen ==0 ) max_count =138 , min_count =3 ; +if (nextlen ==0 ) { + max_count =138 ; + min_count =3 ; + }tree[max_code+1].Len = (ush)0xffff; /* guard */
for (n = 0; n <=
max_code; n++) {lib/zlib_deflate/deftree.c +3
-3@@ -602,11 +620,11 @@ static void scan_tree( } count = 0; prevlen = curlen; if (nextlen == 0) { - max_count =138 , min_count =3 ; + max_count =138 ; min_count =3 ; } else if (curlen == nextlen) { - max_count =6 , min_count =3 ; + max_count =6 ; min_count =3 ; } else { - max_count =7 , min_count =4 ; + max_count =7 ; min_count =4 ; } } }@@ -630,7 +648,10 @@ static void send_tree(int
min_count= 4; /* min repeat count *//* tree[max_code+1].Len = -1; */ /* guard already set */
lib/zlib_deflate/deftree.c +4
-1-if (nextlen ==0 ) max_count =138 , min_count =3 ; +if (nextlen ==0 ) { + max_count =138 ; + min_count =3 ; + }for (n = 0; n <=
max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len;lib/zlib_deflate/deftree.c +3
-3@@ -654,11 +675,11 @@ static void send_tree( } count = 0; prevlen = curlen; if (nextlen == 0) { - max_count =138 , min_count =3 ; + max_count =138 ; min_count =3 ; } else if (curlen == nextlen) { - max_count =6 , min_count =3 ; + max_count =6 ; min_count =3 ; } else { - max_count =7 , min_count =4 ; + max_count =7 ; min_count =4 ; } } }
PATCH 26/29 lib: zstd: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- lib/zstd/compress.c | 120 ++++++++++++++++++++++++++-------------- lib/zstd/fse_compress.c | 24 +++++--- lib/zstd/huf_compress.c | 6 +- 3 files changed, 100 insertions(+), 50 deletions(-)
lib/zstd/compress.c +80 -40
@@ -629,12 +629,17 @@ ZSTD_STATIC size_t ZSTD_compressSequences_internal(ZSTD_CCtx *zc, void *dst, siz/* Sequences Header */ if ((oend - op) <3 /*max nbSeq Size*/ +1 /*seqHead */ )return ERROR (dstSize_tooSmall); -if (nbSeq <0x7F ) +if (nbSeq <0x7F ) { *op++ = (BYTE )nbSeq; -else if (nbSeq <LONGNBSEQ ) - op[0 ] = (BYTE )((nbSeq >>8 ) +0x80 ), op[1 ] = (BYTE )nbSeq, op +=2 ; -else - op[0 ] =0xFF ,ZSTD_writeLE16 (op +1 , (U16 )(nbSeq -LONGNBSEQ )), op +=3 ; + }else if (nbSeq <LONGNBSEQ ) { + op[0 ] = (BYTE )((nbSeq >>8 ) +0x80 ); + op[1 ] = (BYTE )nbSeq; + op +=2 ; + }else { + op[0 ] =0xFF ; +ZSTD_writeLE16 (op +1 , (U16 )(nbSeq -LONGNBSEQ )); + op +=3 ; + }if (nbSeq ==0 )return op - ostart;
@@ -1025,10 +1030,13 @@ void ZSTD_compressBlock_fast_generic(ZSTD_CCtx *cctx, const void *src, size_t sr ip += (ip == lowest); {U32 const maxRep = (U32 )(ip - lowest); -if (offset_2 > maxRep) - offsetSaved = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - offsetSaved = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + offsetSaved = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + offsetSaved = offset_1; offset_1 =0 ; + } }/* Main Search Loop */
@@ -1273,10 +1281,14 @@ void ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx *cctx, const void *src, siz ip += (ip == lowest); {U32 const maxRep = (U32 )(ip - lowest); -if (offset_2 > maxRep) - offsetSaved = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - offsetSaved = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + offsetSaved = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + offsetSaved = offset_1; + offset_1 =0 ; + } }/* Main Search Loop */
@@ -1686,8 +1698,10 @@ static size_t ZSTD_insertBtAndFindBestMatch(ZSTD_CCtx *zc, const BYTE *const ip,if (matchLength > bestLength) {if (matchLength > matchEndIdx - matchIndex) matchEndIdx = matchIndex + (U32 )matchLength; -if ((4 * (int )(matchLength - bestLength)) > (int )(ZSTD_highbit32 (curr - matchIndex +1 ) -ZSTD_highbit32 ((U32 )offsetPtr[0 ] +1 ))) - bestLength = matchLength, *offsetPtr =ZSTD_REP_MOVE + curr - matchIndex; +if ((4 * (int )(matchLength - bestLength)) > (int )(ZSTD_highbit32 (curr - matchIndex +1 ) -ZSTD_highbit32 ((U32 )offsetPtr[0 ] +1 ))) { + bestLength = matchLength; + *offsetPtr =ZSTD_REP_MOVE + curr - matchIndex; + }if (ip + matchLength == iend)/* equal : no way to know if inf or sup */ break ;/* drop, to guarantee consistency (miss a little bit of compression) */ }
@@ -1916,10 +1930,14 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src ctx->nextToUpdate3 = ctx->nextToUpdate; {U32 const maxRep = (U32 )(ip - base); -if (offset_2 > maxRep) - savedOffset = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - savedOffset = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + savedOffset = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + savedOffset = offset_1; + offset_1 =0 ; + } }/* Match Loop */
@@ -1940,8 +1958,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src {size_t offsetFound =99999999 ;size_t const ml2 =searchMax (ctx, ip, iend, &offsetFound, maxSearches, mls); -if (ml2 > matchLength) - matchLength = ml2, start = ip, offset = offsetFound; +if (ml2 > matchLength) { + matchLength = ml2; + start = ip; + offset = offsetFound; + } }if (matchLength <EQUAL_READ32 ) {
@@ -1957,8 +1978,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcsize_t const mlRep =ZSTD_count (ip +EQUAL_READ32 , ip +EQUAL_READ32 - offset_1, iend) +EQUAL_READ32 ;int const gain2 = (int )(mlRep *3 );int const gain1 = (int )(matchLength *3 -ZSTD_highbit32 ((U32 )offset +1 ) +1 ); -if ((mlRep >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = mlRep, offset =0 , start = ip; +if ((mlRep >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = mlRep; + offset =0 ; + start = ip; + } } {size_t offset2 =99999999 ;
@@ -1966,7 +1990,7 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcint const gain2 = (int )(ml2 *4 -ZSTD_highbit32 ((U32 )offset2 +1 ));/* raw approx */ int const gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +4 );if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue ;/* search a better one */ } }
@@ -1978,8 +2002,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcsize_t const ml2 =ZSTD_count (ip +EQUAL_READ32 , ip +EQUAL_READ32 - offset_1, iend) +EQUAL_READ32 ;int const gain2 = (int )(ml2 *4 );int const gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +1 ); -if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = ml2, offset =0 , start = ip; +if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = ml2; + offset =0 ; + start = ip; + } } {size_t offset2 =99999999 ;
@@ -1987,7 +2014,7 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcint const gain2 = (int )(ml2 *4 -ZSTD_highbit32 ((U32 )offset2 +1 ));/* raw approx */ int const gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +7 );if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue ; } }
@@ -2110,8 +2137,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, si {size_t offsetFound =99999999 ;size_t const ml2 =searchMax (ctx, ip, iend, &offsetFound, maxSearches, mls); -if (ml2 > matchLength) - matchLength = ml2, start = ip, offset = offsetFound; +if (ml2 > matchLength) { + matchLength = ml2; + start = ip; + offset = offsetFound; + } }if (matchLength <EQUAL_READ32 ) {
@@ -2138,8 +2168,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siEQUAL_READ32 ;int const gain2 = (int )(repLength *3 );int const gain1 = (int )(matchLength *3 -ZSTD_highbit32 ((U32 )offset +1 ) +1 ); -if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = repLength, offset =0 , start = ip; +if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = repLength; + offset =0 ; + start = ip; + } } }
@@ -2150,7 +2183,7 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siint const gain2 = (int )(ml2 *4 -ZSTD_highbit32 ((U32 )offset2 +1 ));/* raw approx */ int const gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +4 );if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue ;/* search a better one */ } }
@@ -2173,8 +2206,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siEQUAL_READ32 ;int gain2 = (int )(repLength *4 );int gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +1 ); -if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = repLength, offset =0 , start = ip; +if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = repLength; + offset =0 ; + start = ip; + } } }
@@ -2185,7 +2221,7 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siint const gain2 = (int )(ml2 *4 -ZSTD_highbit32 ((U32 )offset2 +1 ));/* raw approx */ int const gain1 = (int )(matchLength *4 -ZSTD_highbit32 ((U32 )offset +1 ) +7 );if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { - matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue ; } }
@@ -3159,10 +3195,12 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *size_t cSize;size_t const iSize = zcs->inBuffPos - zcs->inToCompress;size_t oSize = oend - op; -if (oSize >=ZSTD_compressBound (iSize)) +if (oSize >=ZSTD_compressBound (iSize)) { cDst = op;/* compress directly into output buffer (avoid flush stage) */ -else - cDst = zcs->outBuff, oSize = zcs->outBuffSize; + }else { + cDst = zcs->outBuff; + oSize = zcs->outBuffSize; + } cSize = (flush == zsf_end) ?ZSTD_compressEnd (zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompress, iSize) :ZSTD_compressContinue (zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompress, iSize);if (ZSTD_isError (cSize))
@@ -3171,8 +3209,10 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t * zcs->frameEnded =1 ;/* prepare next block */ zcs->inBuffTarget = zcs->inBuffPos + zcs->blockSize; -if (zcs->inBuffTarget > zcs->inBuffSize) - zcs->inBuffPos =0 , zcs->inBuffTarget = zcs->blockSize;/* note : inBuffSize >= blockSize */ +if (zcs->inBuffTarget > zcs->inBuffSize) { + zcs->inBuffPos =0 ; + zcs->inBuffTarget = zcs->blockSize; + }/* note : inBuffSize >= blockSize */ zcs->inToCompress = zcs->inBuffPos;if (cDst == op) { op += cSize;
lib/zstd/fse_compress.c +16 -8
@@ -271,8 +271,10 @@ static size_t FSE_writeNCount_generic(void *header, size_t headerBufferSize, con previous0 = (count ==1 );if (remaining <1 )return ERROR (GENERIC ); -while (remaining < threshold) - nbBits--, threshold >>=1 ; +while (remaining < threshold) { + nbBits--; + threshold >>=1 ; + } }if (bitCount >16 ) {if ((!writeIsSafe) && (out > oend -2 ))
@@ -569,8 +571,10 @@ static size_t FSE_normalizeM2(short *norm, U32 tableLog, const unsigned *count,find max, then give all remaining points to max */ U32 maxV =0 , maxC =0 ;for (s =0 ; s <= maxSymbolValue; s++) -if (count[s] > maxC) - maxV = s, maxC = count[s]; +if (count[s] > maxC) { + maxV = s; + maxC = count[s]; + } norm[maxV] += (short )ToDistribute;return 0 ; }
@@ -578,8 +582,10 @@ static size_t FSE_normalizeM2(short *norm, U32 tableLog, const unsigned *count,if (total ==0 ) {/* all of the symbols were low enough for the lowOne or lowThreshold */ for (s =0 ; ToDistribute >0 ; s = (s +1 ) % (maxSymbolValue +1 )) -if (norm[s] >0 ) - ToDistribute--, norm[s]++; +if (norm[s] >0 ) { + ToDistribute--; + norm[s]++; + }return 0 ; }
@@ -644,8 +650,10 @@ size_t FSE_normalizeCount(short *normalizedCounter, unsigned tableLog, const unsU64 restToBeat = vStep * rtbTable[proba]; proba += (count[s] * step) - ((U64 )proba << scale) > restToBeat; } -if (proba > largestP) - largestP = proba, largest = s; +if (proba > largestP) { + largestP = proba; + largest = s; + } normalizedCounter[s] = proba; stillToDistribute -= proba; }
lib/zstd/huf_compress.c +4 -2
@@ -404,8 +404,10 @@ static void HUF_sort(nodeElt *huffNode, const U32 *count, U32 maxSymbolValue)U32 const c = count[n];U32 const r =BIT_highbit32 (c +1 ) +1 ;U32 pos = rank[r].curr++; -while ((pos > rank[r].base) && (c > huffNode[pos -1 ].count)) - huffNode[pos] = huffNode[pos -1 ], pos--; +while ((pos > rank[r].base) && (c > huffNode[pos -1 ].count)) { + huffNode[pos] = huffNode[pos -1 ]; + pos--; + } huffNode[pos].count = c; huffNode[pos].byte = (BYTE )n; }
Signature · 1 line
2.26.0
Re: [PATCH 26/29] lib: zstd: Avoid comma separated statements
Quoted 1 line · Joe Perches
Use semicolons and braces.
ping?
Quoted 334 lines
Signed-off-by Joe Perches <[email protected]>---
lib/zstd/compress.c | 120 ++++++++++++++++++++++++++-------------- lib/zstd/fse_compress.c | 24 +++++--- lib/zstd/huf_compress.c | 6 +- 3 files changed, 100 insertions(+), 50 deletions(-)lib/zstd/compress.c +10
-5@@ -629,12 +629,17 @@ ZSTD_STATIC size_t ZSTD_compressSequences_internal(ZSTD_CCtx *zc, void *dst, siz /* Sequences Header */ if ((oend - op) < 3 /*max nbSeq Size*/ + 1 /*seqHead */) return ERROR(dstSize_tooSmall); -if (nbSeq <0x7F ) +if (nbSeq <0x7F ) { *op++ = (BYTE)nbSeq; -else if (nbSeq <LONGNBSEQ ) - op[0 ] = (BYTE )((nbSeq >>8 ) +0x80 ), op[1 ] = (BYTE )nbSeq, op +=2 ; -else - op[0 ] =0xFF ,ZSTD_writeLE16 (op +1 , (U16 )(nbSeq -LONGNBSEQ )), op +=3 ; + }else if (nbSeq <LONGNBSEQ ) { + op[0 ] = (BYTE )((nbSeq >>8 ) +0x80 ); + op[1 ] = (BYTE )nbSeq; + op +=2 ; + }else { + op[0 ] =0xFF ; +ZSTD_writeLE16 (op +1 , (U16 )(nbSeq -LONGNBSEQ )); + op +=3 ; + } if (nbSeq == 0) return op - ostart;lib/zstd/compress.c +7
-4@@ -1025,10 +1030,13 @@ void ZSTD_compressBlock_fast_generic(ZSTD_CCtx *cctx, const void *src, size_t sr ip += (ip == lowest); { U32 const maxRep = (U32)(ip - lowest); -if (offset_2 > maxRep) - offsetSaved = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - offsetSaved = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + offsetSaved = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + offsetSaved = offset_1; offset_1 =0 ; + } }/* Main Search Loop */
lib/zstd/compress.c +8
-4@@ -1273,10 +1281,14 @@ void ZSTD_compressBlock_doubleFast_generic(ZSTD_CCtx *cctx, const void *src, siz ip += (ip == lowest); { U32 const maxRep = (U32)(ip - lowest); -if (offset_2 > maxRep) - offsetSaved = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - offsetSaved = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + offsetSaved = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + offsetSaved = offset_1; + offset_1 =0 ; + } }/* Main Search Loop */
lib/zstd/compress.c +4
-2@@ -1686,8 +1698,10 @@ static size_t ZSTD_insertBtAndFindBestMatch(ZSTD_CCtx *zc, const BYTE *const ip, if (matchLength > bestLength) { if (matchLength > matchEndIdx - matchIndex) matchEndIdx = matchIndex + (U32)matchLength; -if ((4 * (int )(matchLength - bestLength)) > (int )(ZSTD_highbit32 (curr - matchIndex +1 ) -ZSTD_highbit32 ((U32 )offsetPtr[0 ] +1 ))) - bestLength = matchLength, *offsetPtr =ZSTD_REP_MOVE + curr - matchIndex; +if ((4 * (int )(matchLength - bestLength)) > (int )(ZSTD_highbit32 (curr - matchIndex +1 ) -ZSTD_highbit32 ((U32 )offsetPtr[0 ] +1 ))) { + bestLength = matchLength; + *offsetPtr =ZSTD_REP_MOVE + curr - matchIndex; + }if (ip + matchLength == iend) /* equal : no way to know if inf or sup */
break; /* drop, to guarantee consistency (miss a little bit of compression) */
}lib/zstd/compress.c +8
-4@@ -1916,10 +1930,14 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src ctx->nextToUpdate3 = ctx->nextToUpdate; { U32 const maxRep = (U32)(ip - base); -if (offset_2 > maxRep) - savedOffset = offset_2, offset_2 =0 ; -if (offset_1 > maxRep) - savedOffset = offset_1, offset_1 =0 ; +if (offset_2 > maxRep) { + savedOffset = offset_2; + offset_2 =0 ; + } +if (offset_1 > maxRep) { + savedOffset = offset_1; + offset_1 =0 ; + } }/* Match Loop */
lib/zstd/compress.c +5
-2@@ -1940,8 +1958,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src { size_t offsetFound = 99999999; size_t const ml2 = searchMax(ctx, ip, iend, &offsetFound, maxSearches, mls); -if (ml2 > matchLength) - matchLength = ml2, start = ip, offset = offsetFound; +if (ml2 > matchLength) { + matchLength = ml2; + start = ip; + offset = offsetFound; + } }if (matchLength <
EQUAL_READ32) {lib/zstd/compress.c +5
-2@@ -1957,8 +1978,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src size_t const mlRep = ZSTD_count(ip + EQUAL_READ32, ip + EQUAL_READ32 - offset_1, iend) + EQUAL_READ32; int const gain2 = (int)(mlRep * 3); int const gain1 = (int)(matchLength * 3 - ZSTD_highbit32((U32)offset + 1) + 1); -if ((mlRep >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = mlRep, offset =0 , start = ip; +if ((mlRep >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = mlRep; + offset =0 ; + start = ip; + } } { size_t offset2 = 99999999;@@ -1966,7 +1990,7 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcint const gain2 = (int)(ml2 * 4 -
ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ int const gain1 = (int)(matchLength * 4 -ZSTD_highbit32((U32)offset + 1)+ 4); if ((ml2 >=EQUAL_READ32) && (gain2 > gain1)) {lib/zstd/compress.c +1
-1- matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue; /* search a better one */ }
}lib/zstd/compress.c +5
-2@@ -1978,8 +2002,11 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t src size_t const ml2 = ZSTD_count(ip + EQUAL_READ32, ip + EQUAL_READ32 - offset_1, iend) + EQUAL_READ32; int const gain2 = (int)(ml2 * 4); int const gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 1); -if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = ml2, offset =0 , start = ip; +if ((ml2 >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = ml2; + offset =0 ; + start = ip; + } } { size_t offset2 = 99999999;@@ -1987,7 +2014,7 @@ void ZSTD_compressBlock_lazy_generic(ZSTD_CCtx *ctx, const void *src, size_t srcint const gain2 = (int)(ml2 * 4 -
ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ int const gain1 = (int)(matchLength * 4 -ZSTD_highbit32((U32)offset + 1)+ 7); if ((ml2 >=EQUAL_READ32) && (gain2 > gain1)) {lib/zstd/compress.c +1
-1- matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue; }
}lib/zstd/compress.c +5
-2@@ -2110,8 +2137,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, si { size_t offsetFound = 99999999; size_t const ml2 = searchMax(ctx, ip, iend, &offsetFound, maxSearches, mls); -if (ml2 > matchLength) - matchLength = ml2, start = ip, offset = offsetFound; +if (ml2 > matchLength) { + matchLength = ml2; + start = ip; + offset = offsetFound; + } }if (matchLength <
EQUAL_READ32) {lib/zstd/compress.c +5
-2@@ -2138,8 +2168,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, si EQUAL_READ32; int const gain2 = (int)(repLength * 3); int const gain1 = (int)(matchLength * 3 - ZSTD_highbit32((U32)offset + 1) + 1); -if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = repLength, offset =0 , start = ip; +if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = repLength; + offset =0 ; + start = ip; + } } }lib/zstd/compress.c +0
-0@@ -2150,7 +2183,7 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siint const gain2 = (int)(ml2 * 4 -
ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ int const gain1 = (int)(matchLength * 4 -ZSTD_highbit32((U32)offset + 1)+ 4); if ((ml2 >=EQUAL_READ32) && (gain2 > gain1)) {lib/zstd/compress.c +1
-1- matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue; /* search a better one */ }
}lib/zstd/compress.c +5
-2@@ -2173,8 +2206,11 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, si EQUAL_READ32; int gain2 = (int)(repLength * 4); int gain1 = (int)(matchLength * 4 - ZSTD_highbit32((U32)offset + 1) + 1); -if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) - matchLength = repLength, offset =0 , start = ip; +if ((repLength >=EQUAL_READ32 ) && (gain2 > gain1)) { + matchLength = repLength; + offset =0 ; + start = ip; + } } }lib/zstd/compress.c +0
-0@@ -2185,7 +2221,7 @@ void ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx *ctx, const void *src, siint const gain2 = (int)(ml2 * 4 -
ZSTD_highbit32((U32)offset2 + 1)); /* raw approx */ int const gain1 = (int)(matchLength * 4 -ZSTD_highbit32((U32)offset + 1)+ 7); if ((ml2 >=EQUAL_READ32) && (gain2 > gain1)) {lib/zstd/compress.c +1
-1- matchLength = ml2, offset = offset2, start = ip; + matchLength = ml2, offset = offset2; start = ip;continue; }
}lib/zstd/compress.c +1
-1@@ -3159,10 +3195,12 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t * size_t cSize; size_t const iSize = zcs->inBuffPos - zcs->inToCompress; size_t oSize = oend - op; -if (oSize >=ZSTD_compressBound (iSize)) +if (oSize >=ZSTD_compressBound (iSize)) {cDst = op; /* compress directly into output buffer (avoid flush stage) */
lib/zstd/compress.c +4
-2-else - cDst = zcs->outBuff, oSize = zcs->outBuffSize; + }else { + cDst = zcs->outBuff; + oSize = zcs->outBuffSize; + }cSize = (flush ==
zsf_end) ?ZSTD_compressEnd(zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompress, iSize):ZSTD_compressContinue(zcs->cctx, cDst, oSize, zcs->inBuff + zcs->inToCompress, iSize); if (ZSTD_isError(cSize))lib/zstd/compress.c +4
-2@@ -3171,8 +3209,10 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t * zcs->frameEnded = 1; /* prepare next block */ zcs->inBuffTarget = zcs->inBuffPos + zcs->blockSize; -if (zcs->inBuffTarget > zcs->inBuffSize) - zcs->inBuffPos =0 , zcs->inBuffTarget = zcs->blockSize;/* note : inBuffSize >= blockSize */ +if (zcs->inBuffTarget > zcs->inBuffSize) { + zcs->inBuffPos =0 ; + zcs->inBuffTarget = zcs->blockSize; + }/* note : inBuffSize >= blockSize */ zcs->inToCompress = zcs->inBuffPos; if (cDst == op) { op += cSize;lib/zstd/fse_compress.c +4
-2@@ -271,8 +271,10 @@ static size_t FSE_writeNCount_generic(void *header, size_t headerBufferSize, con previous0 = (count == 1); if (remaining < 1) return ERROR(GENERIC); -while (remaining < threshold) - nbBits--, threshold >>=1 ; +while (remaining < threshold) { + nbBits--; + threshold >>=1 ; + } } if (bitCount > 16) { if ((!writeIsSafe) && (out > oend - 2))@@ -569,8 +571,10 @@ static size_t FSE_normalizeM2(short *norm, U32 tableLog, const unsigned *count,find max, then give all remaining points to max */ U32 maxV = 0, maxC = 0;
for (s = 0; s <= maxSymbolValue; s++)lib/zstd/fse_compress.c +4
-2-if (count[s] > maxC) - maxV = s, maxC = count[s]; +if (count[s] > maxC) { + maxV = s; + maxC = count[s]; + }norm[maxV] += (short)ToDistribute; return 0;
}lib/zstd/fse_compress.c +4
-2@@ -578,8 +582,10 @@ static size_t FSE_normalizeM2(short *norm, U32 tableLog, const unsigned *count, if (total == 0) { /* all of the symbols were low enough for the lowOne or lowThreshold */ for (s = 0; ToDistribute > 0; s = (s + 1) % (maxSymbolValue + 1)) -if (norm[s] >0 ) - ToDistribute--, norm[s]++; +if (norm[s] >0 ) { + ToDistribute--; + norm[s]++; + } return 0; }lib/zstd/fse_compress.c +4
-2@@ -644,8 +650,10 @@ size_t FSE_normalizeCount(short *normalizedCounter, unsigned tableLog, const uns U64 restToBeat = vStep * rtbTable[proba]; proba += (count[s] * step) - ((U64)proba << scale) > restToBeat; } -if (proba > largestP) - largestP = proba, largest = s; +if (proba > largestP) { + largestP = proba; + largest = s; + } normalizedCounter[s] = proba; stillToDistribute -= proba; }lib/zstd/huf_compress.c +4
-2@@ -404,8 +404,10 @@ static void HUF_sort(nodeElt *huffNode, const U32 *count, U32 maxSymbolValue) U32 const c = count[n]; U32 const r = BIT_highbit32(c + 1) + 1; U32 pos = rank[r].curr++; -while ((pos > rank[r].base) && (c > huffNode[pos -1 ].count)) - huffNode[pos] = huffNode[pos -1 ], pos--; +while ((pos > rank[r].base) && (c > huffNode[pos -1 ].count)) { + huffNode[pos] = huffNode[pos -1 ]; + pos--; + } huffNode[pos].count = c; huffNode[pos].byte = (BYTE)n; }
PATCH 27/29 ipv6: fib6: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- net/ipv6/ip6_fib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv6/ip6_fib.c +8 -4
@@ -1812,10 +1812,14 @@ static struct fib6_node *fib6_repair_tree(struct net *net, children =0 ; child =NULL ; -if (fn_r) - child = fn_r, children |=1 ; -if (fn_l) - child = fn_l, children |=2 ; +if (fn_r) { + child = fn_r; + children |=1 ; + } +if (fn_l) { + child = fn_l; + children |=2 ; + } if (children == 3 || FIB6_SUBTREE(fn)#ifdef CONFIG_IPV6_SUBTREES
Signature · 1 line
2.26.0
Re: [PATCH 27/29] ipv6: fib6: Avoid comma separated statements
From: Joe Perches <[email protected]>
Date: Mon, 24 Aug 2020 21:56:24 -0700
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 28/29 sunrpc: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- net/sunrpc/sysctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/sunrpc/sysctl.c +4 -2
@@ -108,8 +108,10 @@ proc_dodebug(struct ctl_table *table, int write, void *buffer, size_t *lenp, left -= (s - tmpbuf);if (left && !isspace (*s))return -EINVAL ; -while (left &&isspace (*s)) - left--, s++; +while (left &&isspace (*s)) { + left--; + s++; + } }else left =0 ; *(unsigned int *) table->data = value;
Signature · 1 line
2.26.0
Re: [PATCH 28/29] sunrpc: Avoid comma separated statements
From: Joe Perches <[email protected]>
Date: Mon, 24 Aug 2020 21:56:25 -0700
Quoted 3 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>
Applied.
PATCH 29/29 tools: Avoid comma separated statements
In reply to Joe PerchesUse semicolons and braces.
--- 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 +++++++++++++-------- 4 files changed, 210 insertions(+), 128 deletions(-)
tools/lib/subcmd/help.c +6 -4
@@ -65,12 +65,14 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) ci = cj = ei =0 ;while (ci < cmds->cnt && ei < excludes->cnt) { cmp =strcmp (cmds->names[ci]->name, excludes->names[ei]->name); -if (cmp <0 ) +if (cmp <0 ) { cmds->names[cj++] = cmds->names[ci++]; -else if (cmp ==0 ) - ci++, ei++; -else if (cmp >0 ) + }else if (cmp ==0 ) { + ci++; ei++; + }else if (cmp >0 ) { + ei++; + } }while (ci < cmds->cnt)
tools/power/cpupower/utils/cpufreq-set.c +9 -5
@@ -99,13 +99,17 @@ static unsigned long string_to_frequency(const char *str)continue ;if (str[cp] =='.' ) { -while (power >-1 &&isdigit (str[cp+1 ])) - cp++, power--; +while (power >-1 &&isdigit (str[cp+1 ])) { + cp++; + power--; + } } -if (power >=-1 )/* not enough => pad */ +if (power >=-1 ) {/* not enough => pad */ pad = power +1 ; -else /* to much => strip */ - pad =0 , cp += power +1 ; + }else {/* too much => strip */ + pad =0 ; + cp += power +1 ; + }/* check bounds */ if (cp <=0 || cp + pad >NORM_FREQ_LEN -1 )return 0 ;
tools/testing/selftests/vm/gup_benchmark.c +12 -6
@@ -105,12 +105,16 @@ int main(int argc, char **argv) gup.flags |=FOLL_WRITE ; fd =open ("/sys/kernel/debug/gup_benchmark" ,O_RDWR ); -if (fd ==-1 ) -perror ("open" ),exit (1 ); +if (fd ==-1 ) { +perror ("open" ); +exit (1 ); + } p =mmap (NULL , size,PROT_READ |PROT_WRITE , flags, filed,0 ); -if (p ==MAP_FAILED ) -perror ("mmap" ),exit (1 ); +if (p ==MAP_FAILED ) { +perror ("mmap" ); +exit (1 ); + } gup.addr = (unsigned long )p;if (thp ==1 )
@@ -123,8 +127,10 @@ int main(int argc, char **argv)for (i =0 ; i < repeats; i++) { gup.size = size; -if (ioctl (fd, cmd, &gup)) -perror ("ioctl" ),exit (1 ); +if (ioctl (fd, cmd, &gup)) { +perror ("ioctl" ); +exit (1 ); + }printf ("Time: get:%lld put:%lld us" , gup.get_delta_usec, gup.put_delta_usec);
tools/testing/selftests/vm/userfaultfd.c +183 -113
532 lines not on this page · raw message
Signature · 1 line
2.26.0
Thomas Renninger
maintainerRe: [PATCH 29/29] tools: Avoid comma separated statements
Hi,
getting rid of lines with multiple instructions, separated by comma is certainly a good idea.
One nit pick, though:
Am Dienstag, 25. August 2020, 06:56:26 CEST schrieb Joe Perches:
Quoted 21 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>--- 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 +++++++++++++-------- 4 files changed, 210 insertions(+), 128 deletions(-)tools/lib/subcmd/help.c +1
-1@@ -65,12 +65,14 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) ci = cj = ei = 0;while (ci < cmds->cnt && ei < excludes->cnt) { cmp =strcmp (cmds->names[ci]->name, excludes->names[ei]->name); -if (cmp <0 ) +if (cmp <0 ) { cmds->names[cj++] = cmds->names[ci++];
tools/lib/subcmd/help.c void exclude_cmds(struct cmdnames *cmds, struct cmdnames · line 76
Quoted 10 lines
tools/lib/subcmd/help.c +5
-3-else if (cmp ==0 ) - ci++, ei++; -else if (cmp >0 ) + }else if (cmp ==0 ) { + ci++; ei++; + }else if (cmp >0 ) { + ei++; + } }
I can remember patches being rejected with one line statements in a condition, surounded by braces.
I just read up Documentation/process/coding-style.rst, to be sure this still is up-to-date. It's not a must, but line 180 says:
"Do not unnecessarily use braces where a single statement will do."
So if this is about coding style cleanup, IMO you should remove braces from single line statements.
I haven't reviewed every line, but I expect you only split up comma separated instructions into separate lines and added braces?
Afaik there isn't a specific tag, but having:
cleanup only: No functional change
in the changelog would be nice for people looking for fixes to backport.
Otherwise, I think this is a worthful cleanup.
Thomas
Re: [PATCH 29/29] tools: Avoid comma separated statements
Quoted 11 lines · Thomas Renninger
Hi,
getting rid of lines with multiple instructions, separated by comma is certainly a good idea.
One nit pick, though:Am Dienstag, 25. August 2020, 06:56:26 CEST schrieb Joe Perches:
Quoted 4 lines
Use semicolons and braces.
Signed-off-by Joe Perches <[email protected]>---
[]
Quoted 5 lines
I can remember patches being rejected with one line statements in a condition, surounded by braces.
I just read upDocumentation/process/coding-style.rst, to be sure this still is up-to-date. It's not a must, but line 180 says:
"Do not unnecessarily use braces where a single statement will do."
Read the block immediately below that too:
"This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:"
Quoted 2 lines
I haven't reviewed every line, but I expect you only split up comma separated instructions into separate lines and added braces?
I do not.
While there was a defect using this style though in another patch, this is a style only change.
Quoted 4 lines
Afaik there isn't a specific tag, but having:
cleanup only: No functional changein the changelog would be nice for people looking for fixes to backport.
This is not a fix, so it's not for backporting.
Thomas Renninger
maintainerRe: [PATCH 29/29] tools: Avoid comma separated statements
Am Mittwoch, 26. August 2020, 16:45:24 CEST schrieb Joe Perches:
Quoted 8 lines · Thomas Renninger
Quoted 2 lines
Hi,
Read the block immediately below that too:
"This does not apply if only one branch of a conditional statement is a single statement; in the latter case use braces in both branches:"
Then +1 from here.
Quoted 6 lines
Quoted 4 lines
Afaik there isn't a specific tag, but having:
cleanup only: No functional changein the changelog would be nice for people looking for fixes to backport.
This is not a fix, so it's not for backporting.
Mentioning that in the changelog explicitly or even in the title - cleanup only
is nice imho, but should definitely not be the reason for re-posting.
Thanks for doing this,
Thomas
Martin K. Petersen
AppliedQuoted 10 lines · Joe Perches
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)
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering