貢献できるかな

昔々、スーパーデバッギングマシーンなリングネイムを無理矢理付けられておりましたが、この度、パッチ送付ロボとなるべく、昨晩見つけた以下を確認しつつ修行してみることにしました。

とりあえず諸々について云々しつつログをこちらにも投入の方向にて。

clone しとく

$ mkdir fuga
$ cd fuga
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

なんかえらい時間かかっとるな。clone できたら drivers/staging 配下をナニ。

$ cd linux/drivers/staging
$ $ find -name 'TODO'|xargs grep checkpatch
./asus_oled/TODO:       - checkpatch.pl cleanups
./rtl8187se/TODO:- checkpatch.pl fixes
./panel/TODO:   - checkpatch.pl cleanups
./winbond/TODO: - checkpatch cleanups
./vt6656/TODO:- checkpatch.pl fixes
./rtl8712/TODO:- checkpatch.pl fixes - only a few remain
./tidspbridge/TODO:* checkpatch.pl fixes
./frontier/TODO:        - checkpatch.pl clean
./vt6655/TODO:- checkpatch.pl fixes
./ft1000/TODO:  - checkpatch.pl cleanups
./rts5139/TODO:- checkpatch.pl fixes
./bcm/TODO:     - checkpatch warnings
./comedi/TODO:  - checkpatch.pl cleanups
./olpc_dcon/TODO:       - checkpatch.pl cleanups
./android/TODO: - checkpatch.pl cleanups
./rts_pstor/TODO:- checkpatch.pl fixes
./keucr/TODO:   - checkpatch.pl clean
$

ではいっちゃん上に checkpatch.pl を。

$ ./scripts/checkpatch.pl drivers/staging/asus_oled/asus_oled.c 
ERROR: Does not appear to be a unified-diff format patch

total: 1 errors, 0 warnings, 0 lines checked

drivers/staging/asus_oled/asus_oled.c has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
$

後は自分で間違いを探すのか。

そういえば

わしの .emacs はこうなってるな

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C プログラムの書式
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun my-c-mode-common-hook ()
;   (c-set-style "linux") (setq indent-tabs-mode t) ;linux 式がいいとき
;      /usr/src/linux/Documentation/CodingStyle 参照
;   (c-set-style "k&r") ;k&r式がいいときはこれを有効にする
;   (c-set-style "gnu") ;デフォルトの設定
  (c-set-style "bsd")
  (setq tab-width 4)
  (setq c-basic-offset tab-width)
 )
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

以下にしてみるか。

(defun my-c-mode-common-hook ()
   (c-set-style "linux") (setq indent-tabs-mode t) ;linux 式がいいとき
)

で、branch するか。

$ git checkout -b asus_oled
Switched to a new branch 'asus_oled'
$

しかし修正せねば、な具体的な情報が無いな、と言いつつ --terse とか --file なオプションがある、という事をいまごろ知る。

$ ./scripts/checkpatch.pl drivers/staging/asus_oled/asus_oled.c --file --terse
drivers/staging/asus_oled/asus_oled.c:393: WARNING: quoted string split across lines
drivers/staging/asus_oled/asus_oled.c:785: WARNING: line over 80 characters
drivers/staging/asus_oled/asus_oled.c:785: WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
drivers/staging/asus_oled/asus_oled.c:791: WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
drivers/staging/asus_oled/asus_oled.c:798: WARNING: line over 80 characters
drivers/staging/asus_oled/asus_oled.c:798: WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
total: 0 errors, 6 warnings, 818 lines checked
$

こうして見るに warning なのだな。つうか最初の warning が微妙過ぎるので簡単そうなのを探そう (を

確認してみるに

staging はたしかにク※の山な模様。stating/android というナニを見つけたのでそちらを云々しようかな。ボリューム的にアレなのでちょっと時間かかりそう。つうか warning の数が合わせて 180 か。
いっちゃん微妙なのが_quoted string split across lines_というソレですな。とりあえず branch を新たに作成して中身を確認。

$ find drivers/staging/android/ -name "*.[ch]"|xargs ./scripts/checkpatch.pl --file --terse |less

しかし長い文字列を表示する printk (ではなくて pr_*) てどう直すべきなんだろ。どう考えても作成してる側の問題な気がしてならないのでこれはスルーでコミット作るべきな気がしてきています。
とりあえず warning を減らす、という方針で地味にアレ。