diff mbox series

[03/18,ARM] pata_icside: use semicolons rather than commas to separate statements

Message ID 1601233948-11629-4-git-send-email-Julia.Lawall@inria.fr
State Not Applicable
Delegated to: David Miller
Headers show
Series use semicolons rather than commas to separate statements | expand

Commit Message

Julia Lawall Sept. 27, 2020, 7:12 p.m. UTC
Replace commas with semicolons.  What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

// <smpl>
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

---
 drivers/ata/pata_icside.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

Comments

Joe Perches Sept. 28, 2020, 4:47 p.m. UTC | #1
On Sun, 2020-09-27 at 21:12 +0200, Julia Lawall wrote:
> Replace commas with semicolons.  What is done is essentially described by
> the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):

Hi Julia.

How did you decide on this patch subject header line?

It's certainly reasonable, but not what I would expect
from any automation.

A somewhat common method of finding the most commonly used
"git log" subject line doesn't easily provide a similar heading.

$ git log --no-merges --format='%s' drivers/ata/pata_icside.c
treewide: Add SPDX license identifier for more missed files
libata: remove ata_sff_data_xfer_noirq()
scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS
Drivers: ata: remove __dev* attributes.
ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
libata-sff: separate out BMDMA irq handler
libata-sff: separate out BMDMA EH
libata-sff: clean up BMDMA initialization
libata-sff: clean up inheritance in several drivers
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
[libata] convert drivers to use ata.h mode mask defines
[ARM] dma: Use sensible DMA parameters for Acorn drivers
[ARM] dma: pata_icside's contiguous sg array is now redundant
libata-sff: Fix oops reported in kerneloops.org for pnp devices with no ctl
libata: rename SFF port ops
libata: rename SFF functions
libata: make reset related methods proper port operations
libata: implement and use ops inheritance
libata: implement and use SHT initializers
libata: implement and use ata_noop_irq_clear()
libata: eliminate the home grown dma padding in favour of
libata: convert to chained sg
Fix pata_icside build for recent libata API changes
libata: implement and use ata_port_desc() to report port configuration
[libata] Remove ->port_disable() hook
[libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()
[ARM] pata_icside: fix the FIXMEs
[libata] PATA drivers: remove ATA_FLAG_SRST
[ARM] pata_icside: fix build errors
[ARM] ecard: add ecardm_iomap() / ecardm_iounmap()
[ARM] ecard: add helper function for setting ecard irq ops
[ARM] Add support for ICSIDE interface on RiscPC

$ git log --no-merges --format='%s' drivers/ata/pata_icside.c | \
  cut -f1 -d":" | sort | uniq -c | sort -rn
     10 libata
      5 libata-sff
      2 [ARM] pata_icside
      2 [ARM] ecard
      2 [ARM] dma
      1 treewide
      1 scsi
      1 [libata] Remove ->port_disable() hook
      1 [libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()
      1 [libata] PATA drivers
      1 [libata] convert drivers to use ata.h mode mask defines
      1 include cleanup
      1 Fix pata_icside build for recent libata API changes
      1 Drivers
      1 ata
      1 [ARM] Add support for ICSIDE interface on RiscPC
Julia Lawall Sept. 28, 2020, 5:11 p.m. UTC | #2
On Mon, 28 Sep 2020, Joe Perches wrote:

> On Sun, 2020-09-27 at 21:12 +0200, Julia Lawall wrote:
> > Replace commas with semicolons.  What is done is essentially described by
> > the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
>
> Hi Julia.
>
> How did you decide on this patch subject header line?
>
> It's certainly reasonable, but not what I would expect
> from any automation.

Most of the patches on this file touch other files as well.  There are
four that only touch this file.  One has no subsystem.  One has dma as the
subsystem.  Two have pata_icside, so that was chosen.

I found that taking the most popular overall could give results that were
too general.

julia

>
> A somewhat common method of finding the most commonly used
> "git log" subject line doesn't easily provide a similar heading.
>
> $ git log --no-merges --format='%s' drivers/ata/pata_icside.c
> treewide: Add SPDX license identifier for more missed files
> libata: remove ata_sff_data_xfer_noirq()
> scsi: rename SCSI_MAX_{SG, SG_CHAIN}_SEGMENTS
> Drivers: ata: remove __dev* attributes.
> ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level>
> libata-sff: separate out BMDMA irq handler
> libata-sff: separate out BMDMA EH
> libata-sff: clean up BMDMA initialization
> libata-sff: clean up inheritance in several drivers
> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
> [libata] convert drivers to use ata.h mode mask defines
> [ARM] dma: Use sensible DMA parameters for Acorn drivers
> [ARM] dma: pata_icside's contiguous sg array is now redundant
> libata-sff: Fix oops reported in kerneloops.org for pnp devices with no ctl
> libata: rename SFF port ops
> libata: rename SFF functions
> libata: make reset related methods proper port operations
> libata: implement and use ops inheritance
> libata: implement and use SHT initializers
> libata: implement and use ata_noop_irq_clear()
> libata: eliminate the home grown dma padding in favour of
> libata: convert to chained sg
> Fix pata_icside build for recent libata API changes
> libata: implement and use ata_port_desc() to report port configuration
> [libata] Remove ->port_disable() hook
> [libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()
> [ARM] pata_icside: fix the FIXMEs
> [libata] PATA drivers: remove ATA_FLAG_SRST
> [ARM] pata_icside: fix build errors
> [ARM] ecard: add ecardm_iomap() / ecardm_iounmap()
> [ARM] ecard: add helper function for setting ecard irq ops
> [ARM] Add support for ICSIDE interface on RiscPC
>
> $ git log --no-merges --format='%s' drivers/ata/pata_icside.c | \
>   cut -f1 -d":" | sort | uniq -c | sort -rn
>      10 libata
>       5 libata-sff
>       2 [ARM] pata_icside
>       2 [ARM] ecard
>       2 [ARM] dma
>       1 treewide
>       1 scsi
>       1 [libata] Remove ->port_disable() hook
>       1 [libata] Remove ->irq_ack() hook, and ata_dummy_irq_on()
>       1 [libata] PATA drivers
>       1 [libata] convert drivers to use ata.h mode mask defines
>       1 include cleanup
>       1 Fix pata_icside build for recent libata API changes
>       1 Drivers
>       1 ata
>       1 [ARM] Add support for ICSIDE interface on RiscPC
>
>
>
Joe Perches Sept. 28, 2020, 5:57 p.m. UTC | #3
On Mon, 2020-09-28 at 19:11 +0200, Julia Lawall wrote:
> 
> On Mon, 28 Sep 2020, Joe Perches wrote:
> 
> > On Sun, 2020-09-27 at 21:12 +0200, Julia Lawall wrote:
> > > Replace commas with semicolons.  What is done is essentially described by
> > > the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
> > 
> > Hi Julia.
> > 
> > How did you decide on this patch subject header line?
> > 
> > It's certainly reasonable, but not what I would expect
> > from any automation.
> 
> Most of the patches on this file touch other files as well.  There are
> four that only touch this file.  One has no subsystem.  One has dma as the
> subsystem.  Two have pata_icside, so that was chosen.

So did you select the patch subject without any automation
or did you create a tool that looks only at commits for
individual files?

> > $ git log --no-merges --format='%s' drivers/ata/pata_icside.c | \
> >   cut -f1 -d":" | sort | uniq -c | sort -rn
> >      10 libata
> >       5 libata-sff
> >       2 [ARM] pata_icside
> >       2 [ARM] ecard
> >       2 [ARM] dma

Yeah...

Something like the script below and some examples of its use?

$ cat find_best_header.sh
#!/bin/bash

# Show possible patch subject prefixes for a file in git

# use commits that modify only the single file argument and
# emit up to the 5 most common commit prefixes

git log --no-merges --format='%h' -- $1 |
    while read commit ; do
	if [[ $(git log --format='%h' --name-only -1 $commit | wc -l) == 3 ]] ; then
	    git log --format='%s' -1 $commit
	fi
    done |
    cut -f1 -d":" | cut -f1-3 -d" " | sort | uniq -c | sort -rn | head -5

$ ./find_best_header.sh drivers/ata/pata_icside.c
      2 [ARM] pata_icside
      1 Fix pata_icside build
      1 [ARM] dma

$ ./find_best_header.sh kernel/fork.c
     36 fork
     14 kernel/fork.c
      6 mm
      4 pidns
      4 [PATCH] unshare system

$ ./find_best_header.sh kernel/sched/core.c
    150 sched
    110 sched/core
     12 sched/uclamp
     12 sched/debug
     10 sched/deadline

$ ./find_best_header.sh drivers/iio/pressure/mpl115.c
      3 iio
diff mbox series

Patch

diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c
index 08543aeb0093..498383cb6e29 100644
--- a/drivers/ata/pata_icside.c
+++ b/drivers/ata/pata_icside.c
@@ -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);