[PATCH 00/30] fix typos in comments

Julia Lawall posted 30 patches 2 years, 6 months ago
drivers/base/devres.c                               |    4 ++--
drivers/clk/qcom/gcc-sm6125.c                       |    2 +-
drivers/clk/ti/clkctrl.c                            |    2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c              |    4 ++--
drivers/gpu/drm/amd/display/dc/bios/command_table.c |    6 +++---
drivers/gpu/drm/amd/pm/amdgpu_pm.c                  |    2 +-
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c  |    4 ++--
drivers/gpu/drm/sti/sti_gdp.c                       |    2 +-
drivers/infiniband/hw/qib/qib_iba7220.c             |    4 ++--
drivers/leds/leds-pca963x.c                         |    2 +-
drivers/media/i2c/ov5695.c                          |    2 +-
drivers/mfd/rohm-bd9576.c                           |    2 +-
drivers/mtd/ubi/block.c                             |    2 +-
drivers/net/can/usb/ucan.c                          |    4 ++--
drivers/net/ethernet/packetengines/yellowfin.c      |    2 +-
drivers/net/wireless/ath/ath6kl/htc_mbox.c          |    2 +-
drivers/net/wireless/cisco/airo.c                   |    2 +-
drivers/net/wireless/mediatek/mt76/mt7915/init.c    |    2 +-
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c |    6 +++---
drivers/platform/x86/uv_sysfs.c                     |    2 +-
drivers/s390/crypto/pkey_api.c                      |    2 +-
drivers/scsi/aic7xxx/aicasm/aicasm.c                |    2 +-
drivers/scsi/elx/libefc_sli/sli4.c                  |    2 +-
drivers/scsi/lpfc/lpfc_mbox.c                       |    2 +-
drivers/scsi/qla2xxx/qla_gs.c                       |    2 +-
drivers/spi/spi-sun4i.c                             |    2 +-
drivers/staging/rtl8723bs/core/rtw_mlme.c           |    2 +-
drivers/usb/gadget/udc/snps_udc_core.c              |    2 +-
fs/kernfs/file.c                                    |    2 +-
kernel/events/core.c                                |    2 +-
30 files changed, 39 insertions(+), 39 deletions(-)
[PATCH 00/30] fix typos in comments
Posted by Julia Lawall 2 years, 6 months ago
Various spelling mistakes in comments.
Detected with the help of Coccinelle.

---

 drivers/base/devres.c                               |    4 ++--
 drivers/clk/qcom/gcc-sm6125.c                       |    2 +-
 drivers/clk/ti/clkctrl.c                            |    2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c              |    4 ++--
 drivers/gpu/drm/amd/display/dc/bios/command_table.c |    6 +++---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c                  |    2 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c  |    4 ++--
 drivers/gpu/drm/sti/sti_gdp.c                       |    2 +-
 drivers/infiniband/hw/qib/qib_iba7220.c             |    4 ++--
 drivers/leds/leds-pca963x.c                         |    2 +-
 drivers/media/i2c/ov5695.c                          |    2 +-
 drivers/mfd/rohm-bd9576.c                           |    2 +-
 drivers/mtd/ubi/block.c                             |    2 +-
 drivers/net/can/usb/ucan.c                          |    4 ++--
 drivers/net/ethernet/packetengines/yellowfin.c      |    2 +-
 drivers/net/wireless/ath/ath6kl/htc_mbox.c          |    2 +-
 drivers/net/wireless/cisco/airo.c                   |    2 +-
 drivers/net/wireless/mediatek/mt76/mt7915/init.c    |    2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c |    6 +++---
 drivers/platform/x86/uv_sysfs.c                     |    2 +-
 drivers/s390/crypto/pkey_api.c                      |    2 +-
 drivers/scsi/aic7xxx/aicasm/aicasm.c                |    2 +-
 drivers/scsi/elx/libefc_sli/sli4.c                  |    2 +-
 drivers/scsi/lpfc/lpfc_mbox.c                       |    2 +-
 drivers/scsi/qla2xxx/qla_gs.c                       |    2 +-
 drivers/spi/spi-sun4i.c                             |    2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme.c           |    2 +-
 drivers/usb/gadget/udc/snps_udc_core.c              |    2 +-
 fs/kernfs/file.c                                    |    2 +-
 kernel/events/core.c                                |    2 +-
 30 files changed, 39 insertions(+), 39 deletions(-)
Re: [PATCH 00/30] fix typos in comments
Posted by patchwork-bot+netdevbpf@kernel.org 2 years, 6 months ago
Hello:

This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 14 Mar 2022 12:53:24 +0100 you wrote:
> Various spelling mistakes in comments.
> Detected with the help of Coccinelle.
> 
> ---
> 
>  drivers/base/devres.c                               |    4 ++--
>  drivers/clk/qcom/gcc-sm6125.c                       |    2 +-
>  drivers/clk/ti/clkctrl.c                            |    2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c              |    4 ++--
>  drivers/gpu/drm/amd/display/dc/bios/command_table.c |    6 +++---
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c                  |    2 +-
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c  |    4 ++--
>  drivers/gpu/drm/sti/sti_gdp.c                       |    2 +-
>  drivers/infiniband/hw/qib/qib_iba7220.c             |    4 ++--
>  drivers/leds/leds-pca963x.c                         |    2 +-
>  drivers/media/i2c/ov5695.c                          |    2 +-
>  drivers/mfd/rohm-bd9576.c                           |    2 +-
>  drivers/mtd/ubi/block.c                             |    2 +-
>  drivers/net/can/usb/ucan.c                          |    4 ++--
>  drivers/net/ethernet/packetengines/yellowfin.c      |    2 +-
>  drivers/net/wireless/ath/ath6kl/htc_mbox.c          |    2 +-
>  drivers/net/wireless/cisco/airo.c                   |    2 +-
>  drivers/net/wireless/mediatek/mt76/mt7915/init.c    |    2 +-
>  drivers/net/wireless/realtek/rtlwifi/rtl8821ae/dm.c |    6 +++---
>  drivers/platform/x86/uv_sysfs.c                     |    2 +-
>  drivers/s390/crypto/pkey_api.c                      |    2 +-
>  drivers/scsi/aic7xxx/aicasm/aicasm.c                |    2 +-
>  drivers/scsi/elx/libefc_sli/sli4.c                  |    2 +-
>  drivers/scsi/lpfc/lpfc_mbox.c                       |    2 +-
>  drivers/scsi/qla2xxx/qla_gs.c                       |    2 +-
>  drivers/spi/spi-sun4i.c                             |    2 +-
>  drivers/staging/rtl8723bs/core/rtw_mlme.c           |    2 +-
>  drivers/usb/gadget/udc/snps_udc_core.c              |    2 +-
>  fs/kernfs/file.c                                    |    2 +-
>  kernel/events/core.c                                |    2 +-
>  30 files changed, 39 insertions(+), 39 deletions(-)

Here is the summary with links:
  - [03/30] ath6kl: fix typos in comments
    (no matching commit)
  - [10/30] mt76: mt7915: fix typos in comments
    (no matching commit)
  - [12/30] drivers: net: packetengines: fix typos in comments
    https://git.kernel.org/netdev/net-next/c/ebc0b8b5374e
  - [19/30] rtlwifi: rtl8821ae: fix typos in comments
    (no matching commit)
  - [20/30] airo: fix typos in comments
    (no matching commit)
  - [27/30] can: ucan: fix typos in comments
    (no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Re: [PATCH 00/30] fix typos in comments
Posted by Martin K. Petersen 2 years, 6 months ago
On Mon, 14 Mar 2022 12:53:24 +0100, Julia Lawall wrote:

> Various spelling mistakes in comments.
> Detected with the help of Coccinelle.
> 

Applied to 5.18/scsi-queue, thanks!

[02/30] scsi: lpfc: fix typos in comments
        https://git.kernel.org/mkp/scsi/c/9a866e6aaf4e
[17/30] scsi: elx: libefc_sli: fix typos in comments
        https://git.kernel.org/mkp/scsi/c/8037185d1ad8
[24/30] scsi: qla2xxx: fix typos in comments
        https://git.kernel.org/mkp/scsi/c/5419e0f15622
[25/30] treewide: fix typos in comments
        https://git.kernel.org/mkp/scsi/c/9d05790f5187

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: [PATCH 00/30] fix typos in comments
Posted by Joe Perches 2 years, 6 months ago
Care to describe _how_ coccinelle was helpful in finding
these typos in comments?
Re: [PATCH 00/30] fix typos in comments
Posted by Julia Lawall 2 years, 6 months ago

On Mon, 14 Mar 2022, Joe Perches wrote:

> Care to describe _how_ coccinelle was helpful in finding
> these typos in comments?

First, Coccinelle can bind a metavariable to the comments before, within
and after anohter kind of term.  So I collected the comments before,
within, and after statements and declarations.

Second, I also used Coccinelle to collect all of the identifiers
referenced in the same file, and discarded all of these words from
consideration.

Otherwise, it's the python library enchant for a dictionary, and some
hacks to reduce the number of false positives, including dropping words
that occur multiple times.  The results are still maybe 90% false
positives, though.

The semantic patch is attached.  It gives around 30K results for the
current linux-next.

julia@initialize:ocaml@
@@

let seen = Hashtbl.create 101
let bseen = Hashtbl.create 101
let wseen = Hashtbl.create 101
let ids = Hashtbl.create 101
exception NotOK

let okw = ["aren";"isn";"wasn";"doesn";"didn";"weren";"shouldn";"couldn";"wouldn";"hasn";"haven";"linux";"hotplug";"cpu";"ifdef";"ifndef";"endif";"struct"]

let add i =
  (if not (Hashtbl.mem ids i) then Hashtbl.add ids i ());
  let pieces = Str.split (Str.regexp "_") i in
  List.iter
    (fun i -> if not (Hashtbl.mem ids i) then Hashtbl.add ids i ())
    pieces;
  false

let hasvowel s =
  let vowels = ['a';'e';'i';'o';'u';'y';'A';'E';'I';'O';'U';'Y'] in
  try
    String.iter
      (fun c ->
	if List.mem c vowels
	then raise NotOK)
      s;
    false
  with NotOK -> true

let only_letters s =
  let islower c = 'a' <= c && c <= 'z' in
  let isupper c = 'A' <= c && c <= 'Z' in
  try
    String.iteri
      (fun i c ->
	let ok =
	  if i = 0
	  then islower c || isupper c
	  else islower c in
	if not ok
	then raise NotOK)
      s;
    true
  with NotOK -> false

let check bad loc p c =
  if not(Hashtbl.mem seen c)
  then
  begin
  Hashtbl.add seen c ();
  let pieces = Str.split (Str.regexp "\\b") c in
  List.iter
    (fun word ->
      if String.length word <= 2 || not(only_letters word) || Hashtbl.mem ids word || List.mem word !bad || not(hasvowel word)
      then ()
      else
	let word = String.uncapitalize_ascii word in
	if List.mem word okw
	then ()
	else
	let res =
	  try Hashtbl.find wseen word
	  with Not_found ->
	    let cmd =
	      Printf.sprintf "python spell.py %s" word in
	    let v = Common.cmd_to_list cmd in
	    Hashtbl.add wseen word v;
	    v in
	List.iter
	  (fun wd ->
	    bad := word :: !bad;
	    Common.hashadd bseen word (loc,word,p))
	  res)
    pieces
  end

@script:ocaml@
@@
Hashtbl.clear seen

@identifier@
identifier i : script:ocaml() { add i };
@@
i

@r1@
comments c;
statement S;
position p;
@@

S@c@p

@script:ocaml@
c << r1.c;
p << r1.p;
@@

let bad = ref [] in
List.iter
(function c->
let (cb,ci,ca) = c in
List.iter (check bad "before" p) cb;
List.iter (check bad "within" p) ci;
List.iter (check bad "after" p) ca)
c

@r2@
comments c;
declaration d;
position p;
@@

d@c@p

@script:ocaml@
c << r2.c;
p << r2.p;
@@

let bad = ref [] in
List.iter
(function c->
let (cb,ci,ca) = c in
List.iter (check bad "before" p) cb;
List.iter (check bad "within" p) ci;
List.iter (check bad "after" p) ca)
c

@finalize:ocaml@
bseen << merge.bseen;
@@

List.iter
  (fun bseen ->
    Hashtbl.iter
      (fun word l ->
	match !l with
	  [(loc,word,p)] ->
	    Coccilib.print_main
	      (Printf.sprintf "problem with %s comment word: %s" loc word)
	      p
	| _ -> ())
      bseen)
  bseen
Re: [PATCH 00/30] fix typos in comments
Posted by Martin K. Petersen 2 years, 6 months ago
Julia,

>  drivers/scsi/aic7xxx/aicasm/aicasm.c                |    2 +-
>  drivers/scsi/elx/libefc_sli/sli4.c                  |    2 +-
>  drivers/scsi/lpfc/lpfc_mbox.c                       |    2 +-
>  drivers/scsi/qla2xxx/qla_gs.c                       |    2 +-

Applied patches 2, 17, 24, and 25 to 5.18/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Re: (subset) [PATCH 00/30] fix typos in comments
Posted by Mark Brown 2 years, 6 months ago
On Mon, 14 Mar 2022 12:53:24 +0100, Julia Lawall wrote:
> Various spelling mistakes in comments.
> Detected with the help of Coccinelle.
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[21/30] spi: sun4i: fix typos in comments
        commit: 2002c13243d595e211c0dad6b8e2e87f906f474b

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark