[PATCH] documentation: add kernel-dot.emacs.txt

2016-02-16 Thread Geyslan G. Bem
This patch adds kernel-dot-emacs.txt (elisp) which deliver best
indentation, comments and white space highlighting functionalities.

This also changes the CodingStyle and 00-INDEX files by referencing
the new kernel-dot-emacs.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
Reviewed-by: Tiago Natel de Moura <tiago4or...@gmail.com>
---

Notes:
This patch was done by suggestion of Jonathan Corbet:
http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309

v2: fix c-cleanup-list scope

 Documentation/00-INDEX |   2 +
 Documentation/CodingStyle  |  38 +
 Documentation/kernel-dot-emacs.txt | 285 +
 3 files changed, 291 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/kernel-dot-emacs.txt

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index cd077ca..d4c48f5 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
- mini HowTo on generation and location of kernel documentation files.
 kernel-docs.txt
- listing of various WWW + books that document kernel internals.
+kernel-dot-emacs.txt
+   - emacs dot file for kernel coding style.
 kernel-parameters.txt
- summary listing of command line / boot prompt args for the kernel.
 kernel-per-CPU-kthreads.txt
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..4d64b58 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
emacs would never
 make a good program).
 
 So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
- (column (c-langelem-2nd-pos c-syntactic-element))
- (offset (- (1+ column) anchor))
- (steps (floor offset c-basic-offset)))
-(* (max steps 1)
-   c-basic-offset)))
-
-(add-hook 'c-mode-common-hook
-  (lambda ()
-;; Add kernel style
-(c-add-style
- "linux-tabs-only"
- '("linux" (c-offsets-alist
-(arglist-cont-nonempty
- c-lineup-gcc-asm-reg
- c-lineup-arglist-tabs-only))
-
-(add-hook 'c-mode-hook
-  (lambda ()
-(let ((filename (buffer-file-name)))
-  ;; Enable kernel mode for the appropriate files
-  (when (and filename
- (string-match (expand-file-name "~/src/linux-trees")
-   filename))
-(setq indent-tabs-mode t)
-(setq show-trailing-whitespace t)
-(c-set-style "linux-tabs-only")
-
-This will make emacs go better with the kernel coding style for C
-files below ~/src/linux-trees.
+values. To do the latter, you can stick the elisp code from
+Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
+emacs go better with the kernel coding style for C files below
+~/src/linux-trees.
 
 But even if you fail in getting emacs to do sane formatting, not
 everything is lost: use "indent".
diff --git a/Documentation/kernel-dot-emacs.txt 
b/Documentation/kernel-dot-emacs.txt
new file mode 100644
index 000..55b3090
--- /dev/null
+++ b/Documentation/kernel-dot-emacs.txt
@@ -0,0 +1,285 @@
+;; Kernel dot emacs
+;; Based on the prior elisp from Documentantion/CodingStyle
+;;
+;; January, 2016
+;; Geyslan G. Bem <geys...@gmail.com>
+
+;; This elisp does use of emacs functionalities which deliver to the
+;; user indentation, comments and white space highlighting.
+;;
+;; As known tabs are the higher law and the prior elisp code enforces
+;; that law for any lineup indentation.
+;;
+;; However some trees have specific rules about line continuation
+;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining up
+;; under the open paren) for lineup the sequential lines.
+;;
+;; In addition to allowing the automatic setup by tree, this elisp can easily
+;; be modified for new configurations. Eg.
+;;
+;; (when (or (string-match (concat source-path "/net") filename)
+;;   (string-match (concat source-path "/drivers/net") 
filename))
+;;   (setup-kernel-style 'extra-bottom-line t nil))
+;;
+;; The above model can be used for a new tree just changing the tree path
+;; and parameters of setup-kernel-style function.
+;;
+;; setup-kernel-style function sets the kernel-comment-style,
+;; kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
+;; are used by the functions kernel-comment-dwim and kernel-lineup-arglist.
+;;
+;; The ker

[PATCH] documentation: add kernel-dot.emacs.txt

2016-02-16 Thread Geyslan G. Bem
This patch adds kernel-dot-emacs.txt (elisp) which deliver best
indentation, comments and white space highlighting functionalities.

This also changes the CodingStyle and 00-INDEX files by referencing
the new kernel-dot-emacs.

Signed-off-by: Geyslan G. Bem 
Reviewed-by: Tiago Natel de Moura 
---

Notes:
This patch was done by suggestion of Jonathan Corbet:
http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309

v2: fix c-cleanup-list scope

 Documentation/00-INDEX |   2 +
 Documentation/CodingStyle  |  38 +
 Documentation/kernel-dot-emacs.txt | 285 +
 3 files changed, 291 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/kernel-dot-emacs.txt

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index cd077ca..d4c48f5 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
- mini HowTo on generation and location of kernel documentation files.
 kernel-docs.txt
- listing of various WWW + books that document kernel internals.
+kernel-dot-emacs.txt
+   - emacs dot file for kernel coding style.
 kernel-parameters.txt
- summary listing of command line / boot prompt args for the kernel.
 kernel-per-CPU-kthreads.txt
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..4d64b58 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
emacs would never
 make a good program).
 
 So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
- (column (c-langelem-2nd-pos c-syntactic-element))
- (offset (- (1+ column) anchor))
- (steps (floor offset c-basic-offset)))
-(* (max steps 1)
-   c-basic-offset)))
-
-(add-hook 'c-mode-common-hook
-  (lambda ()
-;; Add kernel style
-(c-add-style
- "linux-tabs-only"
- '("linux" (c-offsets-alist
-(arglist-cont-nonempty
- c-lineup-gcc-asm-reg
- c-lineup-arglist-tabs-only))
-
-(add-hook 'c-mode-hook
-  (lambda ()
-(let ((filename (buffer-file-name)))
-  ;; Enable kernel mode for the appropriate files
-  (when (and filename
- (string-match (expand-file-name "~/src/linux-trees")
-   filename))
-(setq indent-tabs-mode t)
-(setq show-trailing-whitespace t)
-(c-set-style "linux-tabs-only")
-
-This will make emacs go better with the kernel coding style for C
-files below ~/src/linux-trees.
+values. To do the latter, you can stick the elisp code from
+Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
+emacs go better with the kernel coding style for C files below
+~/src/linux-trees.
 
 But even if you fail in getting emacs to do sane formatting, not
 everything is lost: use "indent".
diff --git a/Documentation/kernel-dot-emacs.txt 
b/Documentation/kernel-dot-emacs.txt
new file mode 100644
index 000..55b3090
--- /dev/null
+++ b/Documentation/kernel-dot-emacs.txt
@@ -0,0 +1,285 @@
+;; Kernel dot emacs
+;; Based on the prior elisp from Documentantion/CodingStyle
+;;
+;; January, 2016
+;; Geyslan G. Bem 
+
+;; This elisp does use of emacs functionalities which deliver to the
+;; user indentation, comments and white space highlighting.
+;;
+;; As known tabs are the higher law and the prior elisp code enforces
+;; that law for any lineup indentation.
+;;
+;; However some trees have specific rules about line continuation
+;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining up
+;; under the open paren) for lineup the sequential lines.
+;;
+;; In addition to allowing the automatic setup by tree, this elisp can easily
+;; be modified for new configurations. Eg.
+;;
+;; (when (or (string-match (concat source-path "/net") filename)
+;;   (string-match (concat source-path "/drivers/net") 
filename))
+;;   (setup-kernel-style 'extra-bottom-line t nil))
+;;
+;; The above model can be used for a new tree just changing the tree path
+;; and parameters of setup-kernel-style function.
+;;
+;; setup-kernel-style function sets the kernel-comment-style,
+;; kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
+;; are used by the functions kernel-comment-dwim and kernel-lineup-arglist.
+;;
+;; The kernel-lineup-arglist function detects the maximum tabs allowed to
+;; lineu

Re: [PATCH] documentation: add kernel-dot.emacs.txt

2016-02-16 Thread Geyslan G. Bem
Hello,

2016-02-16 15:10 GMT-03:00 Tiago Natel de Moura <tiago4or...@gmail.com>:
> Hello folks,
>
> The patch have some problem with the c-mode-hook setup, in the usage of
> c-cleanup-list. On my emacs24 it throw the following error:
>
> "Invalid indentation setting for symbol c-cleanup-list"
>
> After talk with Geyslan, he found the problem and pointed out a solution,
> then everything worked as expected.

Thank you Natel, I'm sending a v2 for this with your review.

>
>
> Thanks!
>
> This patch adds kernel-dot-emacs.txt (elisp) which deliver best
> indentation, comments and white space highlighting functionalities.
>
> This also changes the CodingStyle and 00-INDEX files by referencing
> the new kernel-dot-emacs.
>
> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
> ---
>
> Notes:
> This patch was done by suggestion of Jonathan Corbet:
> http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309
>
>  Documentation/00-INDEX |   2 +
>  Documentation/CodingStyle  |  38 +
>  Documentation/kernel-dot-emacs.txt | 285 
> +
>  3 files changed, 291 insertions(+), 34 deletions(-)
>  create mode 100644 Documentation/kernel-dot-emacs.txt
>
> diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
> index cd077ca..d4c48f5 100644
> --- a/Documentation/00-INDEX
> +++ b/Documentation/00-INDEX
> @@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
> - mini HowTo on generation and location of kernel documentation files.
>  kernel-docs.txt
> - listing of various WWW + books that document kernel internals.
> +kernel-dot-emacs.txt
> +   - emacs dot file for kernel coding style.
>  kernel-parameters.txt
> - summary listing of command line / boot prompt args for the kernel.
>  kernel-per-CPU-kthreads.txt
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index c06f817..4d64b58 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
> emacs would never
>  make a good program).
>
>  So, you can either get rid of GNU emacs, or change it to use saner
> -values.  To do the latter, you can stick the following in your .emacs file:
> -
> -(defun c-lineup-arglist-tabs-only (ignored)
> -  "Line up argument lists by tabs, not spaces"
> -  (let* ((anchor (c-langelem-pos c-syntactic-element))
> - (column (c-langelem-2nd-pos c-syntactic-element))
> - (offset (- (1+ column) anchor))
> - (steps (floor offset c-basic-offset)))
> -(* (max steps 1)
> -   c-basic-offset)))
> -
> -(add-hook 'c-mode-common-hook
> -  (lambda ()
> -;; Add kernel style
> -(c-add-style
> - "linux-tabs-only"
> - '("linux" (c-offsets-alist
> -(arglist-cont-nonempty
> - c-lineup-gcc-asm-reg
> - c-lineup-arglist-tabs-only))
> -
> -(add-hook 'c-mode-hook
> -  (lambda ()
> -(let ((filename (buffer-file-name)))
> -  ;; Enable kernel mode for the appropriate files
> -  (when (and filename
> - (string-match (expand-file-name "~/src/linux-trees")
> -   filename))
> -(setq indent-tabs-mode t)
> -(setq show-trailing-whitespace t)
> -(c-set-style "linux-tabs-only")
> -
> -This will make emacs go better with the kernel coding style for C
> -files below ~/src/linux-trees.
> +values. To do the latter, you can stick the elisp code from
> +Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
> +emacs go better with the kernel coding style for C files below
> +~/src/linux-trees.
>
>  But even if you fail in getting emacs to do sane formatting, not
>  everything is lost: use "indent".
> diff --git a/Documentation/kernel-dot-emacs.txt 
> b/Documentation/kernel-dot-emacs.txt
> new file mode 100644
> index 000..b6d6816
> --- /dev/null
> +++ b/Documentation/kernel-dot-emacs.txt
> @@ -0,0 +1,285 @@
> +;; Kernel dot emacs
> +;; Based on the prior elisp from Documentantion/CodingStyle
> +;;
> +;; January, 2016
> +;; Geyslan G. Bem <geys...@gmail.com>
> +
> +;; This elisp does use of emacs functionalities which deliver to the
> +;; user indentation, comments and white space highlighting.
> +;;
> +;; As known tabs are the higher law and the prior elisp code enforces
> +;; that law for any lineup indentation.
>

Re: [PATCH] documentation: add kernel-dot.emacs.txt

2016-02-16 Thread Geyslan G. Bem
Hello,

2016-02-16 15:10 GMT-03:00 Tiago Natel de Moura :
> Hello folks,
>
> The patch have some problem with the c-mode-hook setup, in the usage of
> c-cleanup-list. On my emacs24 it throw the following error:
>
> "Invalid indentation setting for symbol c-cleanup-list"
>
> After talk with Geyslan, he found the problem and pointed out a solution,
> then everything worked as expected.

Thank you Natel, I'm sending a v2 for this with your review.

>
>
> Thanks!
>
> This patch adds kernel-dot-emacs.txt (elisp) which deliver best
> indentation, comments and white space highlighting functionalities.
>
> This also changes the CodingStyle and 00-INDEX files by referencing
> the new kernel-dot-emacs.
>
> Signed-off-by: Geyslan G. Bem 
> ---
>
> Notes:
> This patch was done by suggestion of Jonathan Corbet:
> http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309
>
>  Documentation/00-INDEX |   2 +
>  Documentation/CodingStyle  |  38 +
>  Documentation/kernel-dot-emacs.txt | 285 
> +
>  3 files changed, 291 insertions(+), 34 deletions(-)
>  create mode 100644 Documentation/kernel-dot-emacs.txt
>
> diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
> index cd077ca..d4c48f5 100644
> --- a/Documentation/00-INDEX
> +++ b/Documentation/00-INDEX
> @@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
> - mini HowTo on generation and location of kernel documentation files.
>  kernel-docs.txt
> - listing of various WWW + books that document kernel internals.
> +kernel-dot-emacs.txt
> +   - emacs dot file for kernel coding style.
>  kernel-parameters.txt
> - summary listing of command line / boot prompt args for the kernel.
>  kernel-per-CPU-kthreads.txt
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index c06f817..4d64b58 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
> emacs would never
>  make a good program).
>
>  So, you can either get rid of GNU emacs, or change it to use saner
> -values.  To do the latter, you can stick the following in your .emacs file:
> -
> -(defun c-lineup-arglist-tabs-only (ignored)
> -  "Line up argument lists by tabs, not spaces"
> -  (let* ((anchor (c-langelem-pos c-syntactic-element))
> - (column (c-langelem-2nd-pos c-syntactic-element))
> - (offset (- (1+ column) anchor))
> - (steps (floor offset c-basic-offset)))
> -(* (max steps 1)
> -   c-basic-offset)))
> -
> -(add-hook 'c-mode-common-hook
> -  (lambda ()
> -;; Add kernel style
> -(c-add-style
> - "linux-tabs-only"
> - '("linux" (c-offsets-alist
> -(arglist-cont-nonempty
> - c-lineup-gcc-asm-reg
> - c-lineup-arglist-tabs-only))
> -
> -(add-hook 'c-mode-hook
> -  (lambda ()
> -(let ((filename (buffer-file-name)))
> -  ;; Enable kernel mode for the appropriate files
> -  (when (and filename
> - (string-match (expand-file-name "~/src/linux-trees")
> -   filename))
> -(setq indent-tabs-mode t)
> -(setq show-trailing-whitespace t)
> -(c-set-style "linux-tabs-only")
> -
> -This will make emacs go better with the kernel coding style for C
> -files below ~/src/linux-trees.
> +values. To do the latter, you can stick the elisp code from
> +Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
> +emacs go better with the kernel coding style for C files below
> +~/src/linux-trees.
>
>  But even if you fail in getting emacs to do sane formatting, not
>  everything is lost: use "indent".
> diff --git a/Documentation/kernel-dot-emacs.txt 
> b/Documentation/kernel-dot-emacs.txt
> new file mode 100644
> index 000..b6d6816
> --- /dev/null
> +++ b/Documentation/kernel-dot-emacs.txt
> @@ -0,0 +1,285 @@
> +;; Kernel dot emacs
> +;; Based on the prior elisp from Documentantion/CodingStyle
> +;;
> +;; January, 2016
> +;; Geyslan G. Bem 
> +
> +;; This elisp does use of emacs functionalities which deliver to the
> +;; user indentation, comments and white space highlighting.
> +;;
> +;; As known tabs are the higher law and the prior elisp code enforces
> +;; that law for any lineup indentation.
> +;;
> +;; However some trees have specific rules about line continuation

Re: [PATCH] documentation: add kernel-dot.emacs.txt

2016-02-11 Thread Geyslan G. Bem
Hello, ping...

2016-01-27 19:51 GMT-03:00 Geyslan G. Bem :
> This patch adds kernel-dot-emacs.txt (elisp) which deliver best
> indentation, comments and white space highlighting functionalities.
>
> This also changes the CodingStyle and 00-INDEX files by referencing
> the new kernel-dot-emacs.
>
> Signed-off-by: Geyslan G. Bem 
> ---
>
> Notes:
> This patch was done by suggestion of Jonathan Corbet:
> http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309
>
>  Documentation/00-INDEX |   2 +
>  Documentation/CodingStyle  |  38 +
>  Documentation/kernel-dot-emacs.txt | 285 
> +
>  3 files changed, 291 insertions(+), 34 deletions(-)
>  create mode 100644 Documentation/kernel-dot-emacs.txt
>
> diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
> index cd077ca..d4c48f5 100644
> --- a/Documentation/00-INDEX
> +++ b/Documentation/00-INDEX
> @@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
> - mini HowTo on generation and location of kernel documentation files.
>  kernel-docs.txt
> - listing of various WWW + books that document kernel internals.
> +kernel-dot-emacs.txt
> +   - emacs dot file for kernel coding style.
>  kernel-parameters.txt
> - summary listing of command line / boot prompt args for the kernel.
>  kernel-per-CPU-kthreads.txt
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index c06f817..4d64b58 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
> emacs would never
>  make a good program).
>
>  So, you can either get rid of GNU emacs, or change it to use saner
> -values.  To do the latter, you can stick the following in your .emacs file:
> -
> -(defun c-lineup-arglist-tabs-only (ignored)
> -  "Line up argument lists by tabs, not spaces"
> -  (let* ((anchor (c-langelem-pos c-syntactic-element))
> - (column (c-langelem-2nd-pos c-syntactic-element))
> - (offset (- (1+ column) anchor))
> - (steps (floor offset c-basic-offset)))
> -(* (max steps 1)
> -   c-basic-offset)))
> -
> -(add-hook 'c-mode-common-hook
> -  (lambda ()
> -;; Add kernel style
> -(c-add-style
> - "linux-tabs-only"
> - '("linux" (c-offsets-alist
> -(arglist-cont-nonempty
> - c-lineup-gcc-asm-reg
> - c-lineup-arglist-tabs-only))
> -
> -(add-hook 'c-mode-hook
> -  (lambda ()
> -(let ((filename (buffer-file-name)))
> -  ;; Enable kernel mode for the appropriate files
> -  (when (and filename
> - (string-match (expand-file-name "~/src/linux-trees")
> -   filename))
> -(setq indent-tabs-mode t)
> -(setq show-trailing-whitespace t)
> -(c-set-style "linux-tabs-only")
> -
> -This will make emacs go better with the kernel coding style for C
> -files below ~/src/linux-trees.
> +values. To do the latter, you can stick the elisp code from
> +Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
> +emacs go better with the kernel coding style for C files below
> +~/src/linux-trees.
>
>  But even if you fail in getting emacs to do sane formatting, not
>  everything is lost: use "indent".
> diff --git a/Documentation/kernel-dot-emacs.txt 
> b/Documentation/kernel-dot-emacs.txt
> new file mode 100644
> index 000..b6d6816
> --- /dev/null
> +++ b/Documentation/kernel-dot-emacs.txt
> @@ -0,0 +1,285 @@
> +;; Kernel dot emacs
> +;; Based on the prior elisp from Documentantion/CodingStyle
> +;;
> +;; January, 2016
> +;; Geyslan G. Bem 
> +
> +;; This elisp does use of emacs functionalities which deliver to the
> +;; user indentation, comments and white space highlighting.
> +;;
> +;; As known tabs are the higher law and the prior elisp code enforces
> +;; that law for any lineup indentation.
> +;;
> +;; However some trees have specific rules about line continuation
> +;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining 
> up
> +;; under the open paren) for lineup the sequential lines.
> +;;
> +;; In addition to allowing the automatic setup by tree, this elisp can easily
> +;; be modified for new configurations. Eg.
> +;;
> +;; (when (or (string-match (concat source-path "/net") filename)
> +;;   (string-match (concat source-path &q

Re: [PATCH] documentation: add kernel-dot.emacs.txt

2016-02-11 Thread Geyslan G. Bem
Hello, ping...

2016-01-27 19:51 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> This patch adds kernel-dot-emacs.txt (elisp) which deliver best
> indentation, comments and white space highlighting functionalities.
>
> This also changes the CodingStyle and 00-INDEX files by referencing
> the new kernel-dot-emacs.
>
> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
> ---
>
> Notes:
> This patch was done by suggestion of Jonathan Corbet:
> http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309
>
>  Documentation/00-INDEX |   2 +
>  Documentation/CodingStyle  |  38 +
>  Documentation/kernel-dot-emacs.txt | 285 
> +
>  3 files changed, 291 insertions(+), 34 deletions(-)
>  create mode 100644 Documentation/kernel-dot-emacs.txt
>
> diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
> index cd077ca..d4c48f5 100644
> --- a/Documentation/00-INDEX
> +++ b/Documentation/00-INDEX
> @@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
> - mini HowTo on generation and location of kernel documentation files.
>  kernel-docs.txt
> - listing of various WWW + books that document kernel internals.
> +kernel-dot-emacs.txt
> +   - emacs dot file for kernel coding style.
>  kernel-parameters.txt
> - summary listing of command line / boot prompt args for the kernel.
>  kernel-per-CPU-kthreads.txt
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index c06f817..4d64b58 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
> emacs would never
>  make a good program).
>
>  So, you can either get rid of GNU emacs, or change it to use saner
> -values.  To do the latter, you can stick the following in your .emacs file:
> -
> -(defun c-lineup-arglist-tabs-only (ignored)
> -  "Line up argument lists by tabs, not spaces"
> -  (let* ((anchor (c-langelem-pos c-syntactic-element))
> - (column (c-langelem-2nd-pos c-syntactic-element))
> - (offset (- (1+ column) anchor))
> - (steps (floor offset c-basic-offset)))
> -(* (max steps 1)
> -   c-basic-offset)))
> -
> -(add-hook 'c-mode-common-hook
> -  (lambda ()
> -;; Add kernel style
> -(c-add-style
> - "linux-tabs-only"
> - '("linux" (c-offsets-alist
> -(arglist-cont-nonempty
> - c-lineup-gcc-asm-reg
> - c-lineup-arglist-tabs-only))
> -
> -(add-hook 'c-mode-hook
> -  (lambda ()
> -(let ((filename (buffer-file-name)))
> -  ;; Enable kernel mode for the appropriate files
> -  (when (and filename
> - (string-match (expand-file-name "~/src/linux-trees")
> -   filename))
> -(setq indent-tabs-mode t)
> -(setq show-trailing-whitespace t)
> -(c-set-style "linux-tabs-only")
> -
> -This will make emacs go better with the kernel coding style for C
> -files below ~/src/linux-trees.
> +values. To do the latter, you can stick the elisp code from
> +Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
> +emacs go better with the kernel coding style for C files below
> +~/src/linux-trees.
>
>  But even if you fail in getting emacs to do sane formatting, not
>  everything is lost: use "indent".
> diff --git a/Documentation/kernel-dot-emacs.txt 
> b/Documentation/kernel-dot-emacs.txt
> new file mode 100644
> index 000..b6d6816
> --- /dev/null
> +++ b/Documentation/kernel-dot-emacs.txt
> @@ -0,0 +1,285 @@
> +;; Kernel dot emacs
> +;; Based on the prior elisp from Documentantion/CodingStyle
> +;;
> +;; January, 2016
> +;; Geyslan G. Bem <geys...@gmail.com>
> +
> +;; This elisp does use of emacs functionalities which deliver to the
> +;; user indentation, comments and white space highlighting.
> +;;
> +;; As known tabs are the higher law and the prior elisp code enforces
> +;; that law for any lineup indentation.
> +;;
> +;; However some trees have specific rules about line continuation
> +;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining 
> up
> +;; under the open paren) for lineup the sequential lines.
> +;;
> +;; In addition to allowing the automatic setup by tree, this elisp can easily
> +;; be modified for new configurations. Eg.
> +;;
> +;; (when (or (string-match (concat source-path "/net&q

[PATCH] documentation: add kernel-dot.emacs.txt

2016-01-27 Thread Geyslan G. Bem
This patch adds kernel-dot-emacs.txt (elisp) which deliver best
indentation, comments and white space highlighting functionalities.

This also changes the CodingStyle and 00-INDEX files by referencing
the new kernel-dot-emacs.

Signed-off-by: Geyslan G. Bem 
---

Notes:
This patch was done by suggestion of Jonathan Corbet:
http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309

 Documentation/00-INDEX |   2 +
 Documentation/CodingStyle  |  38 +
 Documentation/kernel-dot-emacs.txt | 285 +
 3 files changed, 291 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/kernel-dot-emacs.txt

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index cd077ca..d4c48f5 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
- mini HowTo on generation and location of kernel documentation files.
 kernel-docs.txt
- listing of various WWW + books that document kernel internals.
+kernel-dot-emacs.txt
+   - emacs dot file for kernel coding style.
 kernel-parameters.txt
- summary listing of command line / boot prompt args for the kernel.
 kernel-per-CPU-kthreads.txt
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..4d64b58 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
emacs would never
 make a good program).
 
 So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
- (column (c-langelem-2nd-pos c-syntactic-element))
- (offset (- (1+ column) anchor))
- (steps (floor offset c-basic-offset)))
-(* (max steps 1)
-   c-basic-offset)))
-
-(add-hook 'c-mode-common-hook
-  (lambda ()
-;; Add kernel style
-(c-add-style
- "linux-tabs-only"
- '("linux" (c-offsets-alist
-(arglist-cont-nonempty
- c-lineup-gcc-asm-reg
- c-lineup-arglist-tabs-only))
-
-(add-hook 'c-mode-hook
-  (lambda ()
-(let ((filename (buffer-file-name)))
-  ;; Enable kernel mode for the appropriate files
-  (when (and filename
- (string-match (expand-file-name "~/src/linux-trees")
-   filename))
-(setq indent-tabs-mode t)
-(setq show-trailing-whitespace t)
-(c-set-style "linux-tabs-only")
-
-This will make emacs go better with the kernel coding style for C
-files below ~/src/linux-trees.
+values. To do the latter, you can stick the elisp code from
+Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
+emacs go better with the kernel coding style for C files below
+~/src/linux-trees.
 
 But even if you fail in getting emacs to do sane formatting, not
 everything is lost: use "indent".
diff --git a/Documentation/kernel-dot-emacs.txt 
b/Documentation/kernel-dot-emacs.txt
new file mode 100644
index 000..b6d6816
--- /dev/null
+++ b/Documentation/kernel-dot-emacs.txt
@@ -0,0 +1,285 @@
+;; Kernel dot emacs
+;; Based on the prior elisp from Documentantion/CodingStyle
+;;
+;; January, 2016
+;; Geyslan G. Bem 
+
+;; This elisp does use of emacs functionalities which deliver to the
+;; user indentation, comments and white space highlighting.
+;;
+;; As known tabs are the higher law and the prior elisp code enforces
+;; that law for any lineup indentation.
+;;
+;; However some trees have specific rules about line continuation
+;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining up
+;; under the open paren) for lineup the sequential lines.
+;;
+;; In addition to allowing the automatic setup by tree, this elisp can easily
+;; be modified for new configurations. Eg.
+;;
+;; (when (or (string-match (concat source-path "/net") filename)
+;;   (string-match (concat source-path "/drivers/net") 
filename))
+;;   (setup-kernel-style 'extra-bottom-line t nil))
+;;
+;; The above model can be used for a new tree just changing the tree path
+;; and parameters of setup-kernel-style function.
+;;
+;; setup-kernel-style function sets the kernel-comment-style,
+;; kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
+;; are used by the functions kernel-comment-dwim and kernel-lineup-arglist.
+;;
+;; The kernel-lineup-arglist function detects the maximum tabs allowed to
+;; lineup and if it must use tabs and spaces instead of only tabs.
+;;
+;; 

[PATCH] documentation: add kernel-dot.emacs.txt

2016-01-27 Thread Geyslan G. Bem
This patch adds kernel-dot-emacs.txt (elisp) which deliver best
indentation, comments and white space highlighting functionalities.

This also changes the CodingStyle and 00-INDEX files by referencing
the new kernel-dot-emacs.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
This patch was done by suggestion of Jonathan Corbet:
http://thread.gmane.org/gmane.linux.documentation/35265/focus=35309

 Documentation/00-INDEX |   2 +
 Documentation/CodingStyle  |  38 +
 Documentation/kernel-dot-emacs.txt | 285 +
 3 files changed, 291 insertions(+), 34 deletions(-)
 create mode 100644 Documentation/kernel-dot-emacs.txt

diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index cd077ca..d4c48f5 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -259,6 +259,8 @@ kernel-doc-nano-HOWTO.txt
- mini HowTo on generation and location of kernel documentation files.
 kernel-docs.txt
- listing of various WWW + books that document kernel internals.
+kernel-dot-emacs.txt
+   - emacs dot file for kernel coding style.
 kernel-parameters.txt
- summary listing of command line / boot prompt args for the kernel.
 kernel-per-CPU-kthreads.txt
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..4d64b58 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -501,40 +501,10 @@ typing - an infinite number of monkeys typing into GNU 
emacs would never
 make a good program).
 
 So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
- (column (c-langelem-2nd-pos c-syntactic-element))
- (offset (- (1+ column) anchor))
- (steps (floor offset c-basic-offset)))
-(* (max steps 1)
-   c-basic-offset)))
-
-(add-hook 'c-mode-common-hook
-  (lambda ()
-;; Add kernel style
-(c-add-style
- "linux-tabs-only"
- '("linux" (c-offsets-alist
-(arglist-cont-nonempty
- c-lineup-gcc-asm-reg
- c-lineup-arglist-tabs-only))
-
-(add-hook 'c-mode-hook
-  (lambda ()
-(let ((filename (buffer-file-name)))
-  ;; Enable kernel mode for the appropriate files
-  (when (and filename
- (string-match (expand-file-name "~/src/linux-trees")
-   filename))
-(setq indent-tabs-mode t)
-(setq show-trailing-whitespace t)
-(c-set-style "linux-tabs-only")
-
-This will make emacs go better with the kernel coding style for C
-files below ~/src/linux-trees.
+values. To do the latter, you can stick the elisp code from
+Documentation/kernel-dot-emacs.txt in your emacs init file. This will make
+emacs go better with the kernel coding style for C files below
+~/src/linux-trees.
 
 But even if you fail in getting emacs to do sane formatting, not
 everything is lost: use "indent".
diff --git a/Documentation/kernel-dot-emacs.txt 
b/Documentation/kernel-dot-emacs.txt
new file mode 100644
index 000..b6d6816
--- /dev/null
+++ b/Documentation/kernel-dot-emacs.txt
@@ -0,0 +1,285 @@
+;; Kernel dot emacs
+;; Based on the prior elisp from Documentantion/CodingStyle
+;;
+;; January, 2016
+;; Geyslan G. Bem <geys...@gmail.com>
+
+;; This elisp does use of emacs functionalities which deliver to the
+;; user indentation, comments and white space highlighting.
+;;
+;; As known tabs are the higher law and the prior elisp code enforces
+;; that law for any lineup indentation.
+;;
+;; However some trees have specific rules about line continuation
+;; indentation. Even scripts/checkpatch.pl suggests the TABS+SPACES (lining up
+;; under the open paren) for lineup the sequential lines.
+;;
+;; In addition to allowing the automatic setup by tree, this elisp can easily
+;; be modified for new configurations. Eg.
+;;
+;; (when (or (string-match (concat source-path "/net") filename)
+;;   (string-match (concat source-path "/drivers/net") 
filename))
+;;   (setup-kernel-style 'extra-bottom-line t nil))
+;;
+;; The above model can be used for a new tree just changing the tree path
+;; and parameters of setup-kernel-style function.
+;;
+;; setup-kernel-style function sets the kernel-comment-style,
+;; kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
+;; are used by the functions kernel-comment-dwim and kernel-lineup-arglist.
+;;
+;; The kernel-lineup-arglist function detects the maximum tabs allowed to
+;; lineup and if it must use tabs

Re: [PATCH] checkpatch: fix left brace warning

2016-01-26 Thread Geyslan G. Bem
Hello,

2015-12-30 12:49 GMT-03:00 Geyslan G. Bem :
> This patch escapes a regex that uses left brace.
>
> Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped
> left brace in regex is deprecated, passed through in regex;"
>
> Comment from regcomp.c in Perl source: "Currently we don't warn when the
> lbrace is at the start of a construct. This catches it in the middle of
> a literal string, or when it's the first thing after something like
> "\b"."
>
> This works as a complement to 4e5d56bd.
>
> Signed-off-by: Geyslan G. Bem 
> Suggested-by: Peter Senna Tschudin 
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d4960f7..3e11a30 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4108,7 +4108,7 @@ sub process {
>  ## }
>
>  #need space before brace following if, while, etc
> -   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
> $line =~ /do\{/) {
> if (ERROR("SPACING",
>           "space required before the open brace 
> '{'\n" . $herecurr) &&
> --
> 2.6.4
>

This was acked?


-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH] checkpatch: fix left brace warning

2016-01-26 Thread Geyslan G. Bem
Hello,

2015-12-30 12:49 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> This patch escapes a regex that uses left brace.
>
> Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped
> left brace in regex is deprecated, passed through in regex;"
>
> Comment from regcomp.c in Perl source: "Currently we don't warn when the
> lbrace is at the start of a construct. This catches it in the middle of
> a literal string, or when it's the first thing after something like
> "\b"."
>
> This works as a complement to 4e5d56bd.
>
> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
> Suggested-by: Peter Senna Tschudin <peter.se...@gmail.com>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index d4960f7..3e11a30 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4108,7 +4108,7 @@ sub process {
>  ## }
>
>  #need space before brace following if, while, etc
> -   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
> $line =~ /do\{/) {
> if (ERROR("SPACING",
>   "space required before the open brace 
> '{'\n" . $herecurr) &&
> --
> 2.6.4
>

This was acked?


-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 19:18 GMT-03:00 Geyslan G. Bem :
> 2016-01-25 17:40 GMT-03:00 Alan Stern :
>> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>>
>>> 2016-01-25 17:08 GMT-03:00 Alan Stern :
>>> > On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>>> >
>>> >> Ok Greg, there was three patchset versions for this file that would
>>> >> count over 40+ emails. This is v3. I didn't find any answer with ack
>>> >> for it.
>>> >> About sending, there's no problem, I'm here trying to help :-) but in
>>> >> order to not increase the noise that I have created I would like to
>>> >> wait Alan's answer.
>>> >>
>>> >> Alan, could you please analyze this?
>>> >
>>> > How was v3 different from v2?
>>>
>>> Just an undo: 
>>> http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376
>>>
>>> I'm sorry for not put it in the cover letter.
>>
>> Ah yes, now I remember.  For the whole v3 series:
>>
>> Acked-by: Alan Stern 
>
> Thank you, I'll merge my branches to resend _everything_ as a single
> patchset the way Greg asked:
>
> [PATCH resend 0/9] usb: host: ehci.h cleanup
> [PATCH v3 00/16] usb: host: ehci-dbg: cleanup and refactoring
> [PATCH] usb: ehci: remove old stub_debug_files definition
> [PATCH v3 00/10] usb: host: ehci-sched: cleanup (THIS)
>
> I think that it's all.

Hello,

Done: [PATCH 00/36] usb: host: ehci: cleanup and refactoring

>
>>
>> Alan Stern
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [RFC PATCH] codingstyle: improve elisp for a better experience

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:01 GMT-03:00 Jonathan Corbet :
> On Thu, 21 Jan 2016 22:18:30 -0300
> "Geyslan G. Bem"  wrote:
>
>> This patch does use of more emacs functionalities which deliver to the
>> user indentation, commenting and white space highlighting.
>
> So perhaps it's just me, but that's an awful lot of elisp code for readers
> to wade through; many of those readers will not be all that interested in
> it.
>
> Can I suggest an alternative?  Make a kernel-dot-emacs.txt in a form that
> interested people can pull it (nearly) directly into their .emacs files,
> then add a reference to the CodingStyle document.  That makes the stuff
> available for interested developers without rubbing everybody's noses in
> it.  Make sense?

Yes, you have a point. I could make the kernel-dot-emacs.txt. Thank
you Jonathan.

About the elisp, the emacs users have any suggestions?
>
> Thanks,
>
> jon



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:40 GMT-03:00 Alan Stern :
> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>
>> 2016-01-25 17:08 GMT-03:00 Alan Stern :
>> > On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>> >
>> >> Ok Greg, there was three patchset versions for this file that would
>> >> count over 40+ emails. This is v3. I didn't find any answer with ack
>> >> for it.
>> >> About sending, there's no problem, I'm here trying to help :-) but in
>> >> order to not increase the noise that I have created I would like to
>> >> wait Alan's answer.
>> >>
>> >> Alan, could you please analyze this?
>> >
>> > How was v3 different from v2?
>>
>> Just an undo: 
>> http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376
>>
>> I'm sorry for not put it in the cover letter.
>
> Ah yes, now I remember.  For the whole v3 series:
>
> Acked-by: Alan Stern 

Thank you, I'll merge my branches to resend _everything_ as a single
patchset the way Greg asked:

[PATCH resend 0/9] usb: host: ehci.h cleanup
[PATCH v3 00/16] usb: host: ehci-dbg: cleanup and refactoring
[PATCH] usb: ehci: remove old stub_debug_files definition
[PATCH v3 00/10] usb: host: ehci-sched: cleanup (THIS)

I think that it's all.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:08 GMT-03:00 Alan Stern :
> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>
>> Ok Greg, there was three patchset versions for this file that would
>> count over 40+ emails. This is v3. I didn't find any answer with ack
>> for it.
>> About sending, there's no problem, I'm here trying to help :-) but in
>> order to not increase the noise that I have created I would like to
>> wait Alan's answer.
>>
>> Alan, could you please analyze this?
>
> How was v3 different from v2?

Just an undo: http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376

I'm sorry for not put it in the cover letter.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 16:56 GMT-03:00 Greg Kroah-Hartman :
> On Mon, Jan 25, 2016 at 04:52:52PM -0300, Geyslan G. Bem wrote:
>> 2016-01-25 0:30 GMT-03:00 Greg Kroah-Hartman :
>> > On Thu, Dec 24, 2015 at 01:03:39PM -0300, Geyslan G. Bem wrote:
>> >> 2015-12-13 13:59 GMT-03:00 Geyslan G. Bem :
>> >> >
>> >> > Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>> >> >
>> >> > Geyslan G. Bem (10):
>> >> >   usb: host: ehci-sched: refactor scan_isoc function
>> >> >   usb: host: ehci-sched: move constants to right
>> >> >   usb: host: ehci-sched: remove useless initializations
>> >> >   usb: host: ehci-sched: add spaces around operators
>> >> >   usb: host: ehci-sched: remove prohibited spaces
>> >> >   usb: host: ehci-sched: remove useless else branch
>> >> >   usb: host: ehci-sched: use C89-style comments
>> >> >   usb: host: ehci-sched: add line after declarations
>> >> >   usb: host: ehci-sched: use sizeof operator with parens
>> >> >   usb: host: ehci-sched: remove unnecessary braces
>> >> >
>> >> >  drivers/usb/host/ehci-sched.c | 522 
>> >> > +-
>> >> >  1 file changed, 261 insertions(+), 261 deletions(-)
>> >> >
>> >> > --
>> >> > 2.6.3
>> >> >
>> >>
>> >> Hello,
>> >>
>> >> Disturbing eggnogs... :-)
>> >>
>> >> This bunch will be applied?
>> >
>> > Ok, I tried to dig through all of these, but I have over 50+ emails from
>> > you, and it's not quite obvious which ones should be applied, and which
>> > are superseaded by a new series.  So can you just send me all of your
>> > outstanding patches, in one series, with all of the accumulated (if any)
>> > acks you have gotten for them, so that I can queue them up?  That will
>> > make my life much easier.
>>
>> Ok Greg, there was three patchset versions for this file that would
>> count over 40+ emails. This is v3. I didn't find any answer with ack
>> for it.
>
> But you had sent other series as well, please resend _everything_.
Oh, I see.

>
>> About sending, there's no problem, I'm here trying to help :-) but in
>> order to not increase the noise that I have created I would like to
>> wait Alan's answer.
>>
>> Alan, could you please analyze this?
>
> Don't wait for someone, you can just resend it all, that's fine.
All right.

>
> thanks,
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 0:30 GMT-03:00 Greg Kroah-Hartman :
> On Thu, Dec 24, 2015 at 01:03:39PM -0300, Geyslan G. Bem wrote:
>> 2015-12-13 13:59 GMT-03:00 Geyslan G. Bem :
>> >
>> > Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>> >
>> > Geyslan G. Bem (10):
>> >   usb: host: ehci-sched: refactor scan_isoc function
>> >   usb: host: ehci-sched: move constants to right
>> >   usb: host: ehci-sched: remove useless initializations
>> >   usb: host: ehci-sched: add spaces around operators
>> >   usb: host: ehci-sched: remove prohibited spaces
>> >   usb: host: ehci-sched: remove useless else branch
>> >   usb: host: ehci-sched: use C89-style comments
>> >   usb: host: ehci-sched: add line after declarations
>> >   usb: host: ehci-sched: use sizeof operator with parens
>> >   usb: host: ehci-sched: remove unnecessary braces
>> >
>> >  drivers/usb/host/ehci-sched.c | 522 
>> > +-
>> >  1 file changed, 261 insertions(+), 261 deletions(-)
>> >
>> > --
>> > 2.6.3
>> >
>>
>> Hello,
>>
>> Disturbing eggnogs... :-)
>>
>> This bunch will be applied?
>
> Ok, I tried to dig through all of these, but I have over 50+ emails from
> you, and it's not quite obvious which ones should be applied, and which
> are superseaded by a new series.  So can you just send me all of your
> outstanding patches, in one series, with all of the accumulated (if any)
> acks you have gotten for them, so that I can queue them up?  That will
> make my life much easier.

Ok Greg, there was three patchset versions for this file that would
count over 40+ emails. This is v3. I didn't find any answer with ack
for it.
About sending, there's no problem, I'm here trying to help :-) but in
order to not increase the noise that I have created I would like to
wait Alan's answer.

Alan, could you please analyze this?

Thank you.

>
> thanks,
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 16:56 GMT-03:00 Greg Kroah-Hartman <gre...@linuxfoundation.org>:
> On Mon, Jan 25, 2016 at 04:52:52PM -0300, Geyslan G. Bem wrote:
>> 2016-01-25 0:30 GMT-03:00 Greg Kroah-Hartman <gre...@linuxfoundation.org>:
>> > On Thu, Dec 24, 2015 at 01:03:39PM -0300, Geyslan G. Bem wrote:
>> >> 2015-12-13 13:59 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>> >> >
>> >> > Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>> >> >
>> >> > Geyslan G. Bem (10):
>> >> >   usb: host: ehci-sched: refactor scan_isoc function
>> >> >   usb: host: ehci-sched: move constants to right
>> >> >   usb: host: ehci-sched: remove useless initializations
>> >> >   usb: host: ehci-sched: add spaces around operators
>> >> >   usb: host: ehci-sched: remove prohibited spaces
>> >> >   usb: host: ehci-sched: remove useless else branch
>> >> >   usb: host: ehci-sched: use C89-style comments
>> >> >   usb: host: ehci-sched: add line after declarations
>> >> >   usb: host: ehci-sched: use sizeof operator with parens
>> >> >   usb: host: ehci-sched: remove unnecessary braces
>> >> >
>> >> >  drivers/usb/host/ehci-sched.c | 522 
>> >> > +-
>> >> >  1 file changed, 261 insertions(+), 261 deletions(-)
>> >> >
>> >> > --
>> >> > 2.6.3
>> >> >
>> >>
>> >> Hello,
>> >>
>> >> Disturbing eggnogs... :-)
>> >>
>> >> This bunch will be applied?
>> >
>> > Ok, I tried to dig through all of these, but I have over 50+ emails from
>> > you, and it's not quite obvious which ones should be applied, and which
>> > are superseaded by a new series.  So can you just send me all of your
>> > outstanding patches, in one series, with all of the accumulated (if any)
>> > acks you have gotten for them, so that I can queue them up?  That will
>> > make my life much easier.
>>
>> Ok Greg, there was three patchset versions for this file that would
>> count over 40+ emails. This is v3. I didn't find any answer with ack
>> for it.
>
> But you had sent other series as well, please resend _everything_.
Oh, I see.

>
>> About sending, there's no problem, I'm here trying to help :-) but in
>> order to not increase the noise that I have created I would like to
>> wait Alan's answer.
>>
>> Alan, could you please analyze this?
>
> Don't wait for someone, you can just resend it all, that's fine.
All right.

>
> thanks,
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:08 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>
>> Ok Greg, there was three patchset versions for this file that would
>> count over 40+ emails. This is v3. I didn't find any answer with ack
>> for it.
>> About sending, there's no problem, I'm here trying to help :-) but in
>> order to not increase the noise that I have created I would like to
>> wait Alan's answer.
>>
>> Alan, could you please analyze this?
>
> How was v3 different from v2?

Just an undo: http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376

I'm sorry for not put it in the cover letter.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 0:30 GMT-03:00 Greg Kroah-Hartman <gre...@linuxfoundation.org>:
> On Thu, Dec 24, 2015 at 01:03:39PM -0300, Geyslan G. Bem wrote:
>> 2015-12-13 13:59 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>> >
>> > Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>> >
>> > Geyslan G. Bem (10):
>> >   usb: host: ehci-sched: refactor scan_isoc function
>> >   usb: host: ehci-sched: move constants to right
>> >   usb: host: ehci-sched: remove useless initializations
>> >   usb: host: ehci-sched: add spaces around operators
>> >   usb: host: ehci-sched: remove prohibited spaces
>> >   usb: host: ehci-sched: remove useless else branch
>> >   usb: host: ehci-sched: use C89-style comments
>> >   usb: host: ehci-sched: add line after declarations
>> >   usb: host: ehci-sched: use sizeof operator with parens
>> >   usb: host: ehci-sched: remove unnecessary braces
>> >
>> >  drivers/usb/host/ehci-sched.c | 522 
>> > +-
>> >  1 file changed, 261 insertions(+), 261 deletions(-)
>> >
>> > --
>> > 2.6.3
>> >
>>
>> Hello,
>>
>> Disturbing eggnogs... :-)
>>
>> This bunch will be applied?
>
> Ok, I tried to dig through all of these, but I have over 50+ emails from
> you, and it's not quite obvious which ones should be applied, and which
> are superseaded by a new series.  So can you just send me all of your
> outstanding patches, in one series, with all of the accumulated (if any)
> acks you have gotten for them, so that I can queue them up?  That will
> make my life much easier.

Ok Greg, there was three patchset versions for this file that would
count over 40+ emails. This is v3. I didn't find any answer with ack
for it.
About sending, there's no problem, I'm here trying to help :-) but in
order to not increase the noise that I have created I would like to
wait Alan's answer.

Alan, could you please analyze this?

Thank you.

>
> thanks,
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:40 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>
>> 2016-01-25 17:08 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
>> > On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>> >
>> >> Ok Greg, there was three patchset versions for this file that would
>> >> count over 40+ emails. This is v3. I didn't find any answer with ack
>> >> for it.
>> >> About sending, there's no problem, I'm here trying to help :-) but in
>> >> order to not increase the noise that I have created I would like to
>> >> wait Alan's answer.
>> >>
>> >> Alan, could you please analyze this?
>> >
>> > How was v3 different from v2?
>>
>> Just an undo: 
>> http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376
>>
>> I'm sorry for not put it in the cover letter.
>
> Ah yes, now I remember.  For the whole v3 series:
>
> Acked-by: Alan Stern <st...@rowland.harvard.edu>

Thank you, I'll merge my branches to resend _everything_ as a single
patchset the way Greg asked:

[PATCH resend 0/9] usb: host: ehci.h cleanup
[PATCH v3 00/16] usb: host: ehci-dbg: cleanup and refactoring
[PATCH] usb: ehci: remove old stub_debug_files definition
[PATCH v3 00/10] usb: host: ehci-sched: cleanup (THIS)

I think that it's all.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [RFC PATCH] codingstyle: improve elisp for a better experience

2016-01-25 Thread Geyslan G. Bem
2016-01-25 17:01 GMT-03:00 Jonathan Corbet <cor...@lwn.net>:
> On Thu, 21 Jan 2016 22:18:30 -0300
> "Geyslan G. Bem" <geys...@gmail.com> wrote:
>
>> This patch does use of more emacs functionalities which deliver to the
>> user indentation, commenting and white space highlighting.
>
> So perhaps it's just me, but that's an awful lot of elisp code for readers
> to wade through; many of those readers will not be all that interested in
> it.
>
> Can I suggest an alternative?  Make a kernel-dot-emacs.txt in a form that
> interested people can pull it (nearly) directly into their .emacs files,
> then add a reference to the CodingStyle document.  That makes the stuff
> available for interested developers without rubbing everybody's noses in
> it.  Make sense?

Yes, you have a point. I could make the kernel-dot-emacs.txt. Thank
you Jonathan.

About the elisp, the emacs users have any suggestions?
>
> Thanks,
>
> jon



-- 
Regards,

Geyslan G. Bem
hackingbits.com


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2016-01-25 Thread Geyslan G. Bem
2016-01-25 19:18 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> 2016-01-25 17:40 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
>> On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>>
>>> 2016-01-25 17:08 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
>>> > On Mon, 25 Jan 2016, Geyslan G. Bem wrote:
>>> >
>>> >> Ok Greg, there was three patchset versions for this file that would
>>> >> count over 40+ emails. This is v3. I didn't find any answer with ack
>>> >> for it.
>>> >> About sending, there's no problem, I'm here trying to help :-) but in
>>> >> order to not increase the noise that I have created I would like to
>>> >> wait Alan's answer.
>>> >>
>>> >> Alan, could you please analyze this?
>>> >
>>> > How was v3 different from v2?
>>>
>>> Just an undo: 
>>> http://thread.gmane.org/gmane.linux.kernel/2107373/focus=2107376
>>>
>>> I'm sorry for not put it in the cover letter.
>>
>> Ah yes, now I remember.  For the whole v3 series:
>>
>> Acked-by: Alan Stern <st...@rowland.harvard.edu>
>
> Thank you, I'll merge my branches to resend _everything_ as a single
> patchset the way Greg asked:
>
> [PATCH resend 0/9] usb: host: ehci.h cleanup
> [PATCH v3 00/16] usb: host: ehci-dbg: cleanup and refactoring
> [PATCH] usb: ehci: remove old stub_debug_files definition
> [PATCH v3 00/10] usb: host: ehci-sched: cleanup (THIS)
>
> I think that it's all.

Hello,

Done: [PATCH 00/36] usb: host: ehci: cleanup and refactoring

>
>>
>> Alan Stern
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com


[RFC PATCH] codingstyle: improve elisp for a better experience

2016-01-21 Thread Geyslan G. Bem
This patch does use of more emacs functionalities which deliver to the
user indentation, commenting and white space highlighting.

As known tabs are the higher law and the prior elisp code enforces
that law for any lineup indentation.

However some trees have specific rules about line continuation
indentation. Even checkpatch.pl suggests the TABS+SPACES (lining up
under the open paren) for lineup the sequential lines.

This new elisp, in addition to allowing the automatic setup by tree,
can easily be modified for new configurations. Eg.

(when (or (string-match (concat source-path "/net") filename)
  (string-match (concat source-path "/drivers/net") filename))
  (setup-kernel-style 'extra-bottom-line t nil))

The above model can be used for a new tree just changing the tree path
and parameters of setup-kernel-style function.

setup-kernel-style function sets the kernel-comment-style,
kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
are used by the functions kernel-comment-dwim and kernel-lineup-arglist.

The kernel-lineup-arglist function replaces the prior
c-lineup-arglist-tabs-only. Now it detects the maximum tabs allowed to
lineup and if it must use tabs and spaces instead of only tabs.

There are two cleanups for else and else if braces enabled when
auto-newline is on. These are comfortable and avoid wrong coding
style. For instance

void spam(int i)
{
if (i == 7) {
dosomething();
...
}
else
{
appears like this after the last open brace is typed:

void spam(int i)
{
if (i == 7) {
dosomething();
...
} else {

The same happens for else if opening braces.

This elisp adds the function kernel-align-to-equals. It makes the
aligning of variable initializations/assignments easier.

int x = 10;
char *str = "text";
x = 100;

After marked the region and pressed C-c a =

int x   = 10;
char *str   = "text";
x   = 100;

Concerning to comments kernel-comment-dwim is an improved version of
comment-dwim. It comment/uncomment lines, regions or adds a new
indented comment after the code using the same key binding. Eg.

void f(int x, int y);

M-; in any position on the line

void f(int x, int y);   /*  */

M-; again

/* void f(int x, int y); */

M-; and again

void f(int x, int y);

For multi-line comments the result is

/*
 * void f1(int x, int y);
 * void f2(int x, int y);
 */

Emacs doesn't provide yet a 'net' comment style by default. This code
also does the magic when kernel-comment-style is set as 'extra-bottom-line.

/* void f1(int x, int y);
 * void f2(int x, int y);
 */

Until now the comment-region doesn't tabify the comment, generating
spaces before the " * " comment-continue variable (this issue was
reported and patched in the to be released emacs-25) however this code
correctly tabify the commented result.

kernel-comment-dwim also removes trailing white spaces created by the
comment-region.

Finally the white space highlighting is a must to alert about long
lines, leading or trailing spaces and top or bottom empty lines.

Signed-off-by: Geyslan G. Bem 
---

Notes:
I will gladly receive criticism about the code and the topic.

 Documentation/CodingStyle | 192 --
 1 file changed, 167 insertions(+), 25 deletions(-)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..2030b98 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -500,41 +500,183 @@ uses are less than desirable (in fact, they are worse 
than random
 typing - an infinite number of monkeys typing into GNU emacs would never
 make a good program).
 
-So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
+So, you can either get rid of GNU emacs, or change it to use saner values.
+To do the latter, you can stick the following in your emacs init file:
+
+(defconst kernel-column-limit 80
+  "It is only 80, get over it.")
+
+(defvar kernel-source-path "~/src/linux-trees"
+  "The kernel source path.")
+
+(defvar kernel-comment-style 'extra-lines
+  "Default style is 'extra-lines.
+The another option is 'extra-bottom-line")
+(make-variable-buffer-local 'kernel-comment-style)
+
+(defvar kernel-lineup-tabs-only nil
+  "If it is non-nil the kernel lineup indentation will make use of tabs only.
+When nil lineup indentation will use TABS + SPACES.")
+(make-variable-buffer-local 'kernel-lineup-tabs-only)
+
+(defvar kernel-lineup-maximum-tabs nil
+  "If it is non-nil its val

[RFC PATCH] codingstyle: improve elisp for a better experience

2016-01-21 Thread Geyslan G. Bem
This patch does use of more emacs functionalities which deliver to the
user indentation, commenting and white space highlighting.

As known tabs are the higher law and the prior elisp code enforces
that law for any lineup indentation.

However some trees have specific rules about line continuation
indentation. Even checkpatch.pl suggests the TABS+SPACES (lining up
under the open paren) for lineup the sequential lines.

This new elisp, in addition to allowing the automatic setup by tree,
can easily be modified for new configurations. Eg.

(when (or (string-match (concat source-path "/net") filename)
  (string-match (concat source-path "/drivers/net") filename))
  (setup-kernel-style 'extra-bottom-line t nil))

The above model can be used for a new tree just changing the tree path
and parameters of setup-kernel-style function.

setup-kernel-style function sets the kernel-comment-style,
kernel-lineup-tabs-only and kernel-lineup-maximum-tabs variables. They
are used by the functions kernel-comment-dwim and kernel-lineup-arglist.

The kernel-lineup-arglist function replaces the prior
c-lineup-arglist-tabs-only. Now it detects the maximum tabs allowed to
lineup and if it must use tabs and spaces instead of only tabs.

There are two cleanups for else and else if braces enabled when
auto-newline is on. These are comfortable and avoid wrong coding
style. For instance

void spam(int i)
{
if (i == 7) {
dosomething();
...
}
else
{
appears like this after the last open brace is typed:

void spam(int i)
{
if (i == 7) {
dosomething();
...
} else {

The same happens for else if opening braces.

This elisp adds the function kernel-align-to-equals. It makes the
aligning of variable initializations/assignments easier.

int x = 10;
char *str = "text";
x = 100;

After marked the region and pressed C-c a =

int x   = 10;
char *str   = "text";
x   = 100;

Concerning to comments kernel-comment-dwim is an improved version of
comment-dwim. It comment/uncomment lines, regions or adds a new
indented comment after the code using the same key binding. Eg.

void f(int x, int y);

M-; in any position on the line

void f(int x, int y);   /*  */

M-; again

/* void f(int x, int y); */

M-; and again

void f(int x, int y);

For multi-line comments the result is

/*
 * void f1(int x, int y);
 * void f2(int x, int y);
 */

Emacs doesn't provide yet a 'net' comment style by default. This code
also does the magic when kernel-comment-style is set as 'extra-bottom-line.

/* void f1(int x, int y);
 * void f2(int x, int y);
 */

Until now the comment-region doesn't tabify the comment, generating
spaces before the " * " comment-continue variable (this issue was
reported and patched in the to be released emacs-25) however this code
correctly tabify the commented result.

kernel-comment-dwim also removes trailing white spaces created by the
comment-region.

Finally the white space highlighting is a must to alert about long
lines, leading or trailing spaces and top or bottom empty lines.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
I will gladly receive criticism about the code and the topic.

 Documentation/CodingStyle | 192 --
 1 file changed, 167 insertions(+), 25 deletions(-)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c06f817..2030b98 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -500,41 +500,183 @@ uses are less than desirable (in fact, they are worse 
than random
 typing - an infinite number of monkeys typing into GNU emacs would never
 make a good program).
 
-So, you can either get rid of GNU emacs, or change it to use saner
-values.  To do the latter, you can stick the following in your .emacs file:
-
-(defun c-lineup-arglist-tabs-only (ignored)
-  "Line up argument lists by tabs, not spaces"
-  (let* ((anchor (c-langelem-pos c-syntactic-element))
+So, you can either get rid of GNU emacs, or change it to use saner values.
+To do the latter, you can stick the following in your emacs init file:
+
+(defconst kernel-column-limit 80
+  "It is only 80, get over it.")
+
+(defvar kernel-source-path "~/src/linux-trees"
+  "The kernel source path.")
+
+(defvar kernel-comment-style 'extra-lines
+  "Default style is 'extra-lines.
+The another option is 'extra-bottom-line")
+(make-variable-buffer-local 'kernel-comment-style)
+
+(defvar kernel-lineup-tabs-only nil
+  "If it is non-nil the kernel lineup indentation will make use of tabs only.
+When nil lineup indentation will use TABS + SPACES.")
+(make-variable-buffer-local 'kernel-lineup-tabs-only)
+
+(defvar kernel-lineup-max

Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 13:29 GMT-03:00 Alan Stern :
> On Tue, 5 Jan 2016, Joe Perches wrote:
>
>> On Tue, 2016-01-05 at 11:06 -0500, Alan Stern wrote:
>> > Trying to come up with hard-and-fast rules for this sort of thing is
>> > pretty hopeless.  Even "Maximize readability" doesn't work too well,
>> > because different people find different things most readable.
>>
>> Readability is mostly habituation.
>
> Indeed.

Ditto.

>
>> Align to open parenthesis is relatively easy to implement,
>> but it can get out of hand too with long naming.

It's easy and it's consistent (the place of sequential lines).

>
> That's why I dislike it.  Plus the fact that it results in
> continuations of different lines being indented by different amounts.

The different amounts is the price to pay for that indentation, but it
will mostly make the style consistent and easy as Joe stated. I'm not
claiming for that changing, just debating. :-D
But IMHO standardization could make things easier.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
2016-01-05 11:10 GMT-03:00 Geyslan G. Bem :
> 2016-01-05 10:02 GMT-03:00 Julia Lawall :
>>> *** Error in `/usr/lib/coccinelle/spatch': corrupted double-linked
>>> list (not small): 0x01c523d0 ***
>>> === Backtrace: =
>>
>> Wow...  I've never seen an error from OCaml like that.
>>
>> What version of ocaml and Coccinelle are you using?
> $ ocaml -version
> The OCaml toplevel, version 4.02.3
>
> $ spatch --version
> spatch version 1.0.4 with Python support and with PCRE support
Please let me know anything about this issue. I would like to help.

>
>>
>> julia
>>
>>> /usr/lib/libc.so.6(+0x72055)[0x7fb3ec683055]
>>> /usr/lib/libc.so.6(+0x779a6)[0x7fb3ec6889a6]
>>> /usr/lib/libc.so.6(+0x7a2d3)[0x7fb3ec68b2d3]
>>> /usr/lib/libc.so.6(__libc_malloc+0x54)[0x7fb3ec68c3d4]
>>> /usr/lib/coccinelle/spatch(caml_stat_alloc+0x9)[0x42dd14]
>>> /usr/lib/coccinelle/spatch(caml_open_descriptor_in+0x12)[0x432fe2]
>>> /usr/lib/coccinelle/spatch(caml_ml_open_descriptor_in+0xc)[0x43368f]
>>> /usr/lib/coccinelle/spatch(caml_interprete+0x14ba)[0x43e9e1]
>>> /usr/lib/coccinelle/spatch(caml_main+0x371)[0x42b327]
>>> /usr/lib/coccinelle/spatch(main+0xc)[0x43d513]
>>> /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7fb3ec631610]
>>> /usr/lib/coccinelle/spatch(_start+0x29)[0x417609]
>>> === Memory map: 
>>> 0040-00452000 r-xp  08:03 1318169
>>>   /usr/lib/coccinelle/spatch
>>> 00651000-00656000 rw-p 00051000 08:03 1318169
>>>   /usr/lib/coccinelle/spatch
>>> 00656000-00664000 rw-p  00:00 0
>>> 019ea000-0c642000 rw-p  00:00 0  
>>> [heap]
>>> 7fb3e400-7fb3e4021000 rw-p  00:00 0
>>> 7fb3e4021000-7fb3e800 ---p  00:00 0
>>> 7fb3ea931000-7fb3eab32000 rw-p  00:00 0
>>> 7fb3eae36000-7fb3eaef6000 rw-p  00:00 0
>>> 7fb3eaef6000-7fb3eaef8000 r-xp  08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eaef8000-7fb3eb0f7000 ---p 2000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0f7000-7fb3eb0f8000 r--p 1000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0f8000-7fb3eb0fa000 rw-p 2000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0fa000-7fb3eb13a000 rw-p  00:00 0
>>> 7fb3eb787000-7fb3ebb31000 r--p  08:03 2119451
>>>   /usr/lib/locale/locale-archive
>>> 7fb3ebb31000-7fb3ebe4a000 rw-p  00:00 0
>>> 7fb3ebfbe000-7fb3ebfd4000 r-xp  08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ebfd4000-7fb3ec1d3000 ---p 00016000 08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ec1d3000-7fb3ec1d4000 rw-p 00015000 08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ec20c000-7fb3ec40e000 rw-p  00:00 0
>>> 7fb3ec40e000-7fb3ec41 r-xp  08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec41-7fb3ec60f000 ---p 2000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec60f000-7fb3ec61 r--p 1000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec61-7fb3ec611000 rw-p 2000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec611000-7fb3ec7ac000 r-xp  08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec7ac000-7fb3ec9ab000 ---p 0019b000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9ab000-7fb3ec9af000 r--p 0019a000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9af000-7fb3ec9b1000 rw-p 0019e000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9b1000-7fb3ec9b5000 rw-p  00:00 0
>>> 7fb3ec9b5000-7fb3ec9cd000 r-xp  08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ec9cd000-7fb3ecbcc000 ---p 00018000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbcc000-7fb3ecbcd000 r--p 00017000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbcd000-7fb3ecbce000 rw-p 00018000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbce000-7fb3ecbd2000 rw-p  00:00 0
>>> 7fb3ecbd2000-7fb3ecc39000 r-xp  08:03 2100758
>>>   /usr/lib/libncursesw.so.6.0
>>> 7fb3ecc39000-7fb3ece39000 ---p 00067000 08:03 2100758
>>>   /usr/lib/libncursesw.so.6.0
>>> 7

Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:15 GMT-03:00 Alan Stern :
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> 2016-01-04 18:01 GMT-03:00 Alan Stern :
>> > On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>> >
>> >> This patch fixes a coding style issue reported by checkpatch related to
>> >> many leading tabs, removing a 'do while' loop and making use of goto tag 
>> >> instead.
>> >
>> > This is highly questionable.  It's a big amount of code churn, nearly
>> > impossible to verify visually, just to remove one level of indentation.
>> > It also introduces an unnecessary backwards "goto", which seems like a
>> > bad idea.
>> After hear you I agree. I saw that others drivers uses similar
>> structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
>> would be the case in this file of moving code to a new function? If
>> not, please disregard this patch.
>
> Moving code into a new sub-function would be okay.
Ok.

>
> BTW, you don't need to post these patches to both linux-usb and LKML.
> linux-usb alone is good enough.  Nothing about the patches would be
> especially interesting to a general Linux kernel programmer, so there's
> no point in bringing them to everybody's attention.
You're right. I used git send-email
--cc-cmd="scripts/get_maintainer.pl -i". Next patchset will not be
sent to LKML.
Tks.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:27 GMT-03:00 Geyslan G. Bem :
> 2016-01-05 12:23 GMT-03:00 Joe Perches :
>> On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
>>> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>>>
>>> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd 
>>> > >> *ehci, __hc32 token)
>>> > >>   return '/';
>>> > >>  }
>>> > >>
>>> > >> -static void qh_lines(
>>> > >> - struct ehci_hcd *ehci,
>>> > >> - struct ehci_qh *qh,
>>> > >> - char **nextp,
>>> > >> - unsigned *sizep
>>> > >> -)
>>> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>>> > >> + char **nextp, unsigned *sizep)
>>> > >>  {
>>> > >>   u32 scratch;
>>> > >>   u32 hw_curr;
>>> > >>
>>> > >
>>> > And about that style? Should be done?
>>>
>>> You mean squeezing the function parameters into two lines?  That's
>>> okay.
> Yes. I'll change this patch to do only that squeezing.
>
>>>
>>> However, the style in this file is to indent continuation lines by two
>>> extra tab stops, not to line things up with an open paren on the first
>>> line.
> I see. I used 3 tabs, reducing to 2.
>
>>
>> It's not consistent.
>> It's a bit of a mix of 1 and 2 tabs, and some others.
> I noticed it. Maybe to avoid the 80th column there are 1 tab indentations.

Others:

946
static struct debug_buffer *alloc_buffer(struct usb_bus *bus,
ssize_t (*fill_func)(struct debug_buffer *))

has 4 tabs on the second line.

986
static ssize_t debug_output(struct file *file, char __user *user_buf,
size_t len, loff_t *offset)

has 3 tabs and 4 spaces on the second line (aligned to open paren).

I think we should reduce them too to make the file consistent.

>
>>
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:23 GMT-03:00 Joe Perches :
> On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
>> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>>
>> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd 
>> > >> *ehci, __hc32 token)
>> > >>   return '/';
>> > >>  }
>> > >>
>> > >> -static void qh_lines(
>> > >> - struct ehci_hcd *ehci,
>> > >> - struct ehci_qh *qh,
>> > >> - char **nextp,
>> > >> - unsigned *sizep
>> > >> -)
>> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>> > >> + char **nextp, unsigned *sizep)
>> > >>  {
>> > >>   u32 scratch;
>> > >>   u32 hw_curr;
>> > >>
>> > >
>> > And about that style? Should be done?
>>
>> You mean squeezing the function parameters into two lines?  That's
>> okay.
Yes. I'll change this patch to do only that squeezing.

>>
>> However, the style in this file is to indent continuation lines by two
>> extra tab stops, not to line things up with an open paren on the first
>> line.
I see. I used 3 tabs, reducing to 2.

>
> It's not consistent.
> It's a bit of a mix of 1 and 2 tabs, and some others.
I noticed it. Maybe to avoid the 80th column there are 1 tab indentations.

>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-05 Thread Geyslan G. Bem
2016-01-04 23:40 GMT-03:00 Joe Perches :
> On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
>> 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
>> > > > > > This patch fixes coding style issues reported by checkpatch 
>> > > > > > concerning
>> > > > > > to unnecessary space after a cast.
>> > > > > This is a case where checkpatch is wrong, IMO.  Casts should always 
>> > > > > be
>> > > > > followed by a space.  I will not accept this patch.
>
> Your choice, but most kernel code disagrees with you.
>
> measuring only kernel casts to a pointer, (because there are
> too many false positives otherwise) casts without a space
> are preferred ~3:1 over casts followed by a space.
>
> (without space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)\w+" * 
> | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 36612
>
> (with space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)[ 
> \t]\w+" * | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 13233

FWIW I really don't have a side here since it's not defined in Coding
Style. Please disregard this patch.

-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
2016-01-05 10:49 GMT-03:00 Andrzej Hajda :
> On 01/05/2016 01:59 PM, Geyslan G. Bem wrote:
>> Hello,
>>
>> 2016-01-04 4:45 GMT-03:00 Andrzej Hajda :
>>> Unsigned expressions cannot be lesser than zero. Presence of comparisons
>>> 'unsigned (<|<=|>|>=) 0' often indicates a bug, usually wrong type of 
>>> variable.
>>> The patch beside finding such comparisons tries to eliminate false 
>>> positives,
>>> mainly by bypassing range checks.
>>>
>>> gcc can detect such comparisons also using -Wtype-limits switch, but it 
>>> warns
>>> also in correct cases, making too much noise.
>>>
>>> Signed-off-by: Andrzej Hajda 
>>> ---
>>> v6: improved range check detection (according to Julia suggestion)
>>> v5: improved range check detection
>>> v4: added range check detection, added full check in case value holds a 
>>> result
>>> of signed function
>>> v3: added bool type
>>> v2: added --all-includes option
>>> ---
>>>  .../tests/unsigned_lesser_than_zero.cocci  | 76 
>>> ++
>>>  1 file changed, 76 insertions(+)
>>>  create mode 100644 scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>>
>>> diff --git a/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci 
>>> b/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>> new file mode 100644
>>> index 000..b9c7ed8
>>> --- /dev/null
>>> +++ b/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>> @@ -0,0 +1,76 @@
>>> +/// Unsigned expressions cannot be lesser than zero. Presence of
>>> +/// comparisons 'unsigned (<|<=|>|>=) 0' often indicates a bug,
>>> +/// usually wrong type of variable.
>>> +///
>>> +/// To reduce number of false positives following tests have been added:
>>> +/// - parts of range checks are skipped, eg. "if (u < 0 || u > 15) ...",
>>> +///   developers prefer to keep such code,
>>> +/// - comparisons "<= 0" and "> 0" are performed only on results of
>>> +///   signed functions/macros,
>> Why common unsigned comparisons with <= 0 are not being detected? I
>> think that it misleads the code reading and induces further bugs.
>> Just reading "var <= 0" infers that var can receive signed value. The
>> be clear the comparison should be against zero only "var == 0" or
>> depending of the context "!var".
>>
>
> Many developers prefer to use "unsigned <= 0" comparison, as more
> descriptive
> and less fragile. See for example for the last phrase of Linus email[1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2054063

I got it. Tks.

>
> Regards
> Andrzej
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
6/include/uapi -I arch/x86/include/generated/uapi
>> -I ./include/uapi -I include/generated/uapi --include
>> ./include/linux/kconfig.h --max 8 --index 7
>> ./drivers/cpufreq/cpufreq-dt.c:87:20-28: WARNING: Unsigned expression
>> compared with zero: volt_old > 0
>> ./drivers/cpufreq/scpi-cpufreq.c:36:5-11: WARNING: Unsigned expression
>> compared with zero: domain < 0
>> ./drivers/hsi/controllers/omap_ssi.c:327:5-12: WARNING: Unsigned
>> expression compared with zero: ssi -> id < 0
>> ./drivers/clk/clk-vt8500.c:462:16-20: WARNING: Unsigned expression
>> compared with zero: div1 >= 0
>> ./drivers/clk/clk-vt8500.c:506:16-20: WARNING: Unsigned expression
>> compared with zero: div1 >= 0
>> ./drivers/clk/clk-vt8500.c:395:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ./drivers/clk/clk-vt8500.c:463:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ./drivers/clk/clk-vt8500.c:507:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ^CMakefile:1488: recipe for target 'coccicheck' failed
>> make: *** [coccicheck] Error 1
>>
>>
>> --
>> Regards,
>>
>> Geyslan G. Bem
>> hackingbits.com
>>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
2.22.so
7fb3ed33f000-7fb3ed34 r--p 000fc000 08:03 2100404
  /usr/lib/libm-2.22.so
7fb3ed34-7fb3ed341000 rw-p 000fd000 08:03 2100404
  /usr/lib/libm-2.22.so
7fb3ed341000-7fb3ed578000 r-xp  08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed578000-7fb3ed778000 ---p 00237000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed778000-7fb3ed77a000 r--p 00237000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed77a000-7fb3ed7df000 rw-p 00239000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed7df000-7fb3ed80f000 rw-p  00:00 0
7fb3ed80f000-7fb3ed87e000 r-xp  08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3ed87e000-7fb3eda7d000 ---p 0006f000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7d000-7fb3eda7e000 r--p 0006e000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7e000-7fb3eda7f000 rw-p 0006f000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7f000-7fb3edaa1000 r-xp  08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edaa2000-7fb3edc68000 rw-p  00:00 0
7fb3edc9f000-7fb3edca rw-p  00:00 0
7fb3edca-7fb3edca1000 r--p 00021000 08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edca1000-7fb3edca2000 rw-p 00022000 08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edca2000-7fb3edca3000 rw-p  00:00 0
7ffdc875-7ffdc8773000 rw-p  00:00 0  [stack]
7ffdc8796000-7ffdc8798000 r--p  00:00 0  [vvar]
7ffdc8798000-7ffdc879a000 r-xp  00:00 0  [vdso]
ff60-ff601000 r-xp  00:00 0
  [vsyscall]
./scripts/coccicheck: line 97: 18682 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 0
./scripts/coccicheck: line 97: 18684 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 2
./scripts/coccicheck: line 97: 18685 Aborted (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 3
./scripts/coccicheck: line 97: 18686 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 4
./scripts/coccicheck: line 97: 18689 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 7
./drivers/cpufreq/cpufreq-dt.c:87:20-28: WARNING: Unsigned expression
compared with zero: volt_old > 0
./drivers/cpufreq/scpi-cpufreq.c:36:5-11: WARNING: Unsigned expression
compared with zero: domain < 0
./drivers/hsi/controllers/omap_ssi.c:327:5-12: WARNING: Unsigned
expression compared with zero: ssi -> id < 0
./drivers/clk/clk-vt8500.c:462:16-20: WARNING: Unsigned expression
compared with zero: div1 >= 0
./drivers/clk/clk-vt8500.c:506:16-20: WARNING: Unsigned expression
compared with zero: div1 >= 0
./drivers/clk/clk-vt8500.c:395:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
./drivers/clk/clk-vt8500.c:463:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
./drivers/clk/clk-vt8500.c:507:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
^CMakefile:1488: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 1


-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
ated -I
>> include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
>> -I ./include/uapi -I include/generated/uapi --include
>> ./include/linux/kconfig.h --max 8 --index 7
>> ./drivers/cpufreq/cpufreq-dt.c:87:20-28: WARNING: Unsigned expression
>> compared with zero: volt_old > 0
>> ./drivers/cpufreq/scpi-cpufreq.c:36:5-11: WARNING: Unsigned expression
>> compared with zero: domain < 0
>> ./drivers/hsi/controllers/omap_ssi.c:327:5-12: WARNING: Unsigned
>> expression compared with zero: ssi -> id < 0
>> ./drivers/clk/clk-vt8500.c:462:16-20: WARNING: Unsigned expression
>> compared with zero: div1 >= 0
>> ./drivers/clk/clk-vt8500.c:506:16-20: WARNING: Unsigned expression
>> compared with zero: div1 >= 0
>> ./drivers/clk/clk-vt8500.c:395:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ./drivers/clk/clk-vt8500.c:463:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ./drivers/clk/clk-vt8500.c:507:17-21: WARNING: Unsigned expression
>> compared with zero: div2 >= 0
>> ^CMakefile:1488: recipe for target 'coccicheck' failed
>> make: *** [coccicheck] Error 1
>>
>>
>> --
>> Regards,
>>
>> Geyslan G. Bem
>> hackingbits.com
>>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 13:29 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Tue, 5 Jan 2016, Joe Perches wrote:
>
>> On Tue, 2016-01-05 at 11:06 -0500, Alan Stern wrote:
>> > Trying to come up with hard-and-fast rules for this sort of thing is
>> > pretty hopeless.  Even "Maximize readability" doesn't work too well,
>> > because different people find different things most readable.
>>
>> Readability is mostly habituation.
>
> Indeed.

Ditto.

>
>> Align to open parenthesis is relatively easy to implement,
>> but it can get out of hand too with long naming.

It's easy and it's consistent (the place of sequential lines).

>
> That's why I dislike it.  Plus the fact that it results in
> continuations of different lines being indented by different amounts.

The different amounts is the price to pay for that indentation, but it
will mostly make the style consistent and easy as Joe stated. I'm not
claiming for that changing, just debating. :-D
But IMHO standardization could make things easier.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
2016-01-05 11:10 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> 2016-01-05 10:02 GMT-03:00 Julia Lawall <julia.law...@lip6.fr>:
>>> *** Error in `/usr/lib/coccinelle/spatch': corrupted double-linked
>>> list (not small): 0x01c523d0 ***
>>> === Backtrace: =
>>
>> Wow...  I've never seen an error from OCaml like that.
>>
>> What version of ocaml and Coccinelle are you using?
> $ ocaml -version
> The OCaml toplevel, version 4.02.3
>
> $ spatch --version
> spatch version 1.0.4 with Python support and with PCRE support
Please let me know anything about this issue. I would like to help.

>
>>
>> julia
>>
>>> /usr/lib/libc.so.6(+0x72055)[0x7fb3ec683055]
>>> /usr/lib/libc.so.6(+0x779a6)[0x7fb3ec6889a6]
>>> /usr/lib/libc.so.6(+0x7a2d3)[0x7fb3ec68b2d3]
>>> /usr/lib/libc.so.6(__libc_malloc+0x54)[0x7fb3ec68c3d4]
>>> /usr/lib/coccinelle/spatch(caml_stat_alloc+0x9)[0x42dd14]
>>> /usr/lib/coccinelle/spatch(caml_open_descriptor_in+0x12)[0x432fe2]
>>> /usr/lib/coccinelle/spatch(caml_ml_open_descriptor_in+0xc)[0x43368f]
>>> /usr/lib/coccinelle/spatch(caml_interprete+0x14ba)[0x43e9e1]
>>> /usr/lib/coccinelle/spatch(caml_main+0x371)[0x42b327]
>>> /usr/lib/coccinelle/spatch(main+0xc)[0x43d513]
>>> /usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7fb3ec631610]
>>> /usr/lib/coccinelle/spatch(_start+0x29)[0x417609]
>>> === Memory map: 
>>> 0040-00452000 r-xp  08:03 1318169
>>>   /usr/lib/coccinelle/spatch
>>> 00651000-00656000 rw-p 00051000 08:03 1318169
>>>   /usr/lib/coccinelle/spatch
>>> 00656000-00664000 rw-p  00:00 0
>>> 019ea000-0c642000 rw-p  00:00 0  
>>> [heap]
>>> 7fb3e400-7fb3e4021000 rw-p  00:00 0
>>> 7fb3e4021000-7fb3e800 ---p  00:00 0
>>> 7fb3ea931000-7fb3eab32000 rw-p  00:00 0
>>> 7fb3eae36000-7fb3eaef6000 rw-p  00:00 0
>>> 7fb3eaef6000-7fb3eaef8000 r-xp  08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eaef8000-7fb3eb0f7000 ---p 2000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0f7000-7fb3eb0f8000 r--p 1000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0f8000-7fb3eb0fa000 rw-p 2000 08:03 2365929
>>>   /usr/lib/python3.5/lib-dynload/_heapq.cpython-35m-x86_64-linux-gnu.so
>>> 7fb3eb0fa000-7fb3eb13a000 rw-p  00:00 0
>>> 7fb3eb787000-7fb3ebb31000 r--p  08:03 2119451
>>>   /usr/lib/locale/locale-archive
>>> 7fb3ebb31000-7fb3ebe4a000 rw-p  00:00 0
>>> 7fb3ebfbe000-7fb3ebfd4000 r-xp  08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ebfd4000-7fb3ec1d3000 ---p 00016000 08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ec1d3000-7fb3ec1d4000 rw-p 00015000 08:03 2100676
>>>   /usr/lib/libgcc_s.so.1
>>> 7fb3ec20c000-7fb3ec40e000 rw-p  00:00 0
>>> 7fb3ec40e000-7fb3ec41 r-xp  08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec41-7fb3ec60f000 ---p 2000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec60f000-7fb3ec61 r--p 1000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec61-7fb3ec611000 rw-p 2000 08:03 2100408
>>>   /usr/lib/libutil-2.22.so
>>> 7fb3ec611000-7fb3ec7ac000 r-xp  08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec7ac000-7fb3ec9ab000 ---p 0019b000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9ab000-7fb3ec9af000 r--p 0019a000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9af000-7fb3ec9b1000 rw-p 0019e000 08:03 2100354
>>>   /usr/lib/libc-2.22.so
>>> 7fb3ec9b1000-7fb3ec9b5000 rw-p  00:00 0
>>> 7fb3ec9b5000-7fb3ec9cd000 r-xp  08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ec9cd000-7fb3ecbcc000 ---p 00018000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbcc000-7fb3ecbcd000 r--p 00017000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbcd000-7fb3ecbce000 rw-p 00018000 08:03 2100335
>>>   /usr/lib/libpthread-2.22.so
>>> 7fb3ecbce000-7fb3ecbd2000 rw-p  00:00 0
>>> 7fb3ecbd2000-7fb3ecc39000 r-xp  08:03 2100758
>>>   /usr/lib/libncursesw.so.6.0
>>> 7fb3ecc39000-7fb3ece39000 ---p 00067000 08:03 2100758
>

Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-05 Thread Geyslan G. Bem
2016-01-04 23:40 GMT-03:00 Joe Perches <j...@perches.com>:
> On Mon, 2016-01-04 at 19:07 -0300, Geyslan G. Bem wrote:
>> 2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
>> > > > > > This patch fixes coding style issues reported by checkpatch 
>> > > > > > concerning
>> > > > > > to unnecessary space after a cast.
>> > > > > This is a case where checkpatch is wrong, IMO.  Casts should always 
>> > > > > be
>> > > > > followed by a space.  I will not accept this patch.
>
> Your choice, but most kernel code disagrees with you.
>
> measuring only kernel casts to a pointer, (because there are
> too many false positives otherwise) casts without a space
> are preferred ~3:1 over casts followed by a space.
>
> (without space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)\w+" * 
> | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 36612
>
> (with space)
> $ grep -rP --include=*.[ch] -oh "\(\s*(\w{3,}\s+){0,2}\w{3,}\s*\*+\s*\)[ 
> \t]\w+" * | \
>   sort|cut -f1 -d")"| sed 's/$/)/' | wc -l
> 13233

FWIW I really don't have a side here since it's not defined in Coding
Style. Please disregard this patch.

-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:15 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> 2016-01-04 18:01 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
>> > On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>> >
>> >> This patch fixes a coding style issue reported by checkpatch related to
>> >> many leading tabs, removing a 'do while' loop and making use of goto tag 
>> >> instead.
>> >
>> > This is highly questionable.  It's a big amount of code churn, nearly
>> > impossible to verify visually, just to remove one level of indentation.
>> > It also introduces an unnecessary backwards "goto", which seems like a
>> > bad idea.
>> After hear you I agree. I saw that others drivers uses similar
>> structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
>> would be the case in this file of moving code to a new function? If
>> not, please disregard this patch.
>
> Moving code into a new sub-function would be okay.
Ok.

>
> BTW, you don't need to post these patches to both linux-usb and LKML.
> linux-usb alone is good enough.  Nothing about the patches would be
> especially interesting to a general Linux kernel programmer, so there's
> no point in bringing them to everybody's attention.
You're right. I used git send-email
--cc-cmd="scripts/get_maintainer.pl -i". Next patchset will not be
sent to LKML.
Tks.

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:27 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> 2016-01-05 12:23 GMT-03:00 Joe Perches <j...@perches.com>:
>> On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
>>> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>>>
>>> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd 
>>> > >> *ehci, __hc32 token)
>>> > >>   return '/';
>>> > >>  }
>>> > >>
>>> > >> -static void qh_lines(
>>> > >> - struct ehci_hcd *ehci,
>>> > >> - struct ehci_qh *qh,
>>> > >> - char **nextp,
>>> > >> - unsigned *sizep
>>> > >> -)
>>> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>>> > >> + char **nextp, unsigned *sizep)
>>> > >>  {
>>> > >>   u32 scratch;
>>> > >>   u32 hw_curr;
>>> > >>
>>> > >
>>> > And about that style? Should be done?
>>>
>>> You mean squeezing the function parameters into two lines?  That's
>>> okay.
> Yes. I'll change this patch to do only that squeezing.
>
>>>
>>> However, the style in this file is to indent continuation lines by two
>>> extra tab stops, not to line things up with an open paren on the first
>>> line.
> I see. I used 3 tabs, reducing to 2.
>
>>
>> It's not consistent.
>> It's a bit of a mix of 1 and 2 tabs, and some others.
> I noticed it. Maybe to avoid the 80th column there are 1 tab indentations.

Others:

946
static struct debug_buffer *alloc_buffer(struct usb_bus *bus,
ssize_t (*fill_func)(struct debug_buffer *))

has 4 tabs on the second line.

986
static ssize_t debug_output(struct file *file, char __user *user_buf,
size_t len, loff_t *offset)

has 3 tabs and 4 spaces on the second line (aligned to open paren).

I think we should reduce them too to make the file consistent.

>
>>
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-05 Thread Geyslan G. Bem
2016-01-05 12:23 GMT-03:00 Joe Perches <j...@perches.com>:
> On Tue, 2016-01-05 at 10:12 -0500, Alan Stern wrote:
>> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>>
>> > >> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd 
>> > >> *ehci, __hc32 token)
>> > >>   return '/';
>> > >>  }
>> > >>
>> > >> -static void qh_lines(
>> > >> - struct ehci_hcd *ehci,
>> > >> - struct ehci_qh *qh,
>> > >> - char **nextp,
>> > >> - unsigned *sizep
>> > >> -)
>> > >> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>> > >> + char **nextp, unsigned *sizep)
>> > >>  {
>> > >>   u32 scratch;
>> > >>   u32 hw_curr;
>> > >>
>> > >
>> > And about that style? Should be done?
>>
>> You mean squeezing the function parameters into two lines?  That's
>> okay.
Yes. I'll change this patch to do only that squeezing.

>>
>> However, the style in this file is to indent continuation lines by two
>> extra tab stops, not to line things up with an open paren on the first
>> line.
I see. I used 3 tabs, reducing to 2.

>
> It's not consistent.
> It's a bit of a mix of 1 and 2 tabs, and some others.
I noticed it. Maybe to avoid the 80th column there are 1 tab indentations.

>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
2016-01-05 10:49 GMT-03:00 Andrzej Hajda <a.ha...@samsung.com>:
> On 01/05/2016 01:59 PM, Geyslan G. Bem wrote:
>> Hello,
>>
>> 2016-01-04 4:45 GMT-03:00 Andrzej Hajda <a.ha...@samsung.com>:
>>> Unsigned expressions cannot be lesser than zero. Presence of comparisons
>>> 'unsigned (<|<=|>|>=) 0' often indicates a bug, usually wrong type of 
>>> variable.
>>> The patch beside finding such comparisons tries to eliminate false 
>>> positives,
>>> mainly by bypassing range checks.
>>>
>>> gcc can detect such comparisons also using -Wtype-limits switch, but it 
>>> warns
>>> also in correct cases, making too much noise.
>>>
>>> Signed-off-by: Andrzej Hajda <a.ha...@samsung.com>
>>> ---
>>> v6: improved range check detection (according to Julia suggestion)
>>> v5: improved range check detection
>>> v4: added range check detection, added full check in case value holds a 
>>> result
>>> of signed function
>>> v3: added bool type
>>> v2: added --all-includes option
>>> ---
>>>  .../tests/unsigned_lesser_than_zero.cocci  | 76 
>>> ++
>>>  1 file changed, 76 insertions(+)
>>>  create mode 100644 scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>>
>>> diff --git a/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci 
>>> b/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>> new file mode 100644
>>> index 000..b9c7ed8
>>> --- /dev/null
>>> +++ b/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>>> @@ -0,0 +1,76 @@
>>> +/// Unsigned expressions cannot be lesser than zero. Presence of
>>> +/// comparisons 'unsigned (<|<=|>|>=) 0' often indicates a bug,
>>> +/// usually wrong type of variable.
>>> +///
>>> +/// To reduce number of false positives following tests have been added:
>>> +/// - parts of range checks are skipped, eg. "if (u < 0 || u > 15) ...",
>>> +///   developers prefer to keep such code,
>>> +/// - comparisons "<= 0" and "> 0" are performed only on results of
>>> +///   signed functions/macros,
>> Why common unsigned comparisons with <= 0 are not being detected? I
>> think that it misleads the code reading and induces further bugs.
>> Just reading "var <= 0" infers that var can receive signed value. The
>> be clear the comparison should be against zero only "var == 0" or
>> depending of the context "!var".
>>
>
> Many developers prefer to use "unsigned <= 0" comparison, as more
> descriptive
> and less fragile. See for example for the last phrase of Linus email[1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2054063

I got it. Tks.

>
> Regards
> Andrzej
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6] coccinelle: tests: unsigned value cannot be lesser than zero

2016-01-05 Thread Geyslan G. Bem
b3ed33f000 ---p 000fd000 08:03 2100404
  /usr/lib/libm-2.22.so
7fb3ed33f000-7fb3ed34 r--p 000fc000 08:03 2100404
  /usr/lib/libm-2.22.so
7fb3ed34-7fb3ed341000 rw-p 000fd000 08:03 2100404
  /usr/lib/libm-2.22.so
7fb3ed341000-7fb3ed578000 r-xp  08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed578000-7fb3ed778000 ---p 00237000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed778000-7fb3ed77a000 r--p 00237000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed77a000-7fb3ed7df000 rw-p 00239000 08:03 2128110
  /usr/lib/libpython3.5m.so.1.0
7fb3ed7df000-7fb3ed80f000 rw-p  00:00 0
7fb3ed80f000-7fb3ed87e000 r-xp  08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3ed87e000-7fb3eda7d000 ---p 0006f000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7d000-7fb3eda7e000 r--p 0006e000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7e000-7fb3eda7f000 rw-p 0006f000 08:03 2108758
  /usr/lib/libpcre.so.1.2.6
7fb3eda7f000-7fb3edaa1000 r-xp  08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edaa2000-7fb3edc68000 rw-p  00:00 0
7fb3edc9f000-7fb3edca rw-p  00:00 0
7fb3edca-7fb3edca1000 r--p 00021000 08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edca1000-7fb3edca2000 rw-p 00022000 08:03 2100353
  /usr/lib/ld-2.22.so
7fb3edca2000-7fb3edca3000 rw-p  00:00 0
7ffdc875-7ffdc8773000 rw-p  00:00 0  [stack]
7ffdc8796000-7ffdc8798000 r--p  00:00 0  [vvar]
7ffdc8798000-7ffdc879a000 r-xp  00:00 0  [vdso]
ff60-ff601000 r-xp  00:00 0
  [vsyscall]
./scripts/coccicheck: line 97: 18682 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 0
./scripts/coccicheck: line 97: 18684 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 2
./scripts/coccicheck: line 97: 18685 Aborted (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 3
./scripts/coccicheck: line 97: 18686 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 4
./scripts/coccicheck: line 97: 18689 Segmentation fault  (core
dumped) /usr/bin/spatch -D report --very-quiet --no-show-diff
--cocci-file 
/home/geyslan/Projects/linuxtest/scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
--all-includes --dir . -I ./arch/x86/include -I
arch/x86/include/generated/uapi -I arch/x86/include/generated -I
include -I ./arch/x86/include/uapi -I arch/x86/include/generated/uapi
-I ./include/uapi -I include/generated/uapi --include
./include/linux/kconfig.h --max 8 --index 7
./drivers/cpufreq/cpufreq-dt.c:87:20-28: WARNING: Unsigned expression
compared with zero: volt_old > 0
./drivers/cpufreq/scpi-cpufreq.c:36:5-11: WARNING: Unsigned expression
compared with zero: domain < 0
./drivers/hsi/controllers/omap_ssi.c:327:5-12: WARNING: Unsigned
expression compared with zero: ssi -> id < 0
./drivers/clk/clk-vt8500.c:462:16-20: WARNING: Unsigned expression
compared with zero: div1 >= 0
./drivers/clk/clk-vt8500.c:506:16-20: WARNING: Unsigned expression
compared with zero: div1 >= 0
./drivers/clk/clk-vt8500.c:395:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
./drivers/clk/clk-vt8500.c:463:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
./drivers/clk/clk-vt8500.c:507:17-21: WARNING: Unsigned expression
compared with zero: div2 >= 0
^CMakefile:1488: recipe for target 'coccicheck' failed
make: *** [coccicheck] Error 1


-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:01 GMT-03:00 Alan Stern :
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes a coding style issue reported by checkpatch related to
>> many leading tabs, removing a 'do while' loop and making use of goto tag 
>> instead.
>
> This is highly questionable.  It's a big amount of code churn, nearly
> impossible to verify visually, just to remove one level of indentation.
> It also introduces an unnecessary backwards "goto", which seems like a
> bad idea.
After hear you I agree. I saw that others drivers uses similar
structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
would be the case in this file of moving code to a new function? If
not, please disregard this patch.

>
> Alan Stern
>
>> Others changes in this patch are:
>>  - Some multiline statements are reduced (718, 729, 780, 786, 790).
>>  - A constant is moved to right on line 770.
>>
>> Signed-off-by: Geyslan G. Bem 
>> ---
>>
>> Notes:
>> Tested by compilation only.
>>
>>  drivers/usb/host/ehci-dbg.c | 180 
>> ++--
>>  1 file changed, 88 insertions(+), 92 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 2268756..278333d 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
>> *buf)
>>*/
>>   spin_lock_irqsave(>lock, flags);
>>   for (i = 0; i < ehci->periodic_size; i++) {
>> + struct ehci_qh_hw *hw;
>> +
>>   p = ehci->pshadow[i];
>>   if (likely(!p.ptr))
>>   continue;
>> @@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct 
>> debug_buffer *buf)
>>   size -= temp;
>>   next += temp;
>>
>> - do {
>> - struct ehci_qh_hw *hw;
>> -
>> - switch (hc32_to_cpu(ehci, tag)) {
>> - case Q_TYPE_QH:
>> - hw = p.qh->hw;
>> - temp = scnprintf(next, size, " qh%d-%04x/%p",
>> - p.qh->ps.period,
>> - hc32_to_cpup(ehci,
>> - >hw_info2)
>> - /* uframe masks */
>> - & (QH_CMASK | 
>> QH_SMASK),
>> - p.qh);
>> - size -= temp;
>> - next += temp;
>> - /* don't repeat what follows this qh */
>> - for (temp = 0; temp < seen_count; temp++) {
>> - if (seen[temp].ptr != p.ptr)
>> +do_loop:
>> + switch (hc32_to_cpu(ehci, tag)) {
>> + case Q_TYPE_QH:
>> + hw = p.qh->hw;
>> + temp = scnprintf(next, size, " qh%d-%04x/%p",
>> + p.qh->ps.period,
>> + hc32_to_cpup(ehci, >hw_info2)
>> + /* uframe masks */
>> + & (QH_CMASK | QH_SMASK),
>> + p.qh);
>> + size -= temp;
>> + next += temp;
>> + /* don't repeat what follows this qh */
>> + for (temp = 0; temp < seen_count; temp++) {
>> + if (seen[temp].ptr != p.ptr)
>> + continue;
>> + if (p.qh->qh_next.ptr) {
>> + temp = scnprintf(next, size, " ...");
>> + size -= temp;
>> + next += temp;
>> + }
>> + break;
>> + }
>> + /* show more info the first time around */
>> + if (temp == seen_count) {
>> + u32 scratch = hc32_to_cpup(ehci,
>> + >hw_info1);
>> + struct eh

Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:00 GMT-03:00 Alan Stern :
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> Functions must have the opening brace at the beginning of the next line
>> and body conforming indentation.
>
> This isn't necessary if the function is an empty static inline void
> routine.
Ok. It's more related to style. Let's forget it.

>
> Alan Stern
>
>> This patch also reduces qh_lines() header definition to two lines.
>>
>> Signed-off-by: Geyslan G. Bem 
>> ---
>>  drivers/usb/host/ehci-dbg.c | 44 
>> +---
>>  1 file changed, 29 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index edae79e..a365d9d 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -54,7 +54,9 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char 
>> *label)
>>  }
>>  #else
>>
>> -static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
>> +static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
>> +{
>> +}
>>
>>  #endif
>>
>> @@ -94,7 +96,9 @@ static void dbg_hcc_params(struct ehci_hcd *ehci, char 
>> *label)
>>  }
>>  #else
>>
>> -static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
>> +static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
>> +{
>> +}
>>
>>  #endif
>>
>> @@ -284,23 +288,32 @@ dbg_port_buf(char *buf, unsigned len, const char 
>> *label, int port, u32 status)
>>  #else
>>  static inline void __maybe_unused
>>  dbg_qh(char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
>> -{}
>> +{
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 
>> status)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  #endif   /* CONFIG_DYNAMIC_DEBUG */
>>
>> @@ -327,8 +340,13 @@ dbg_port_buf(char *buf, unsigned len, const char 
>> *label, int port, u32 status)
>>
>>  #ifdef STUB_DEBUG_FILES
>>
>> -static inline void create_debug_files(struct ehci_hcd *bus) { }
>> -static inline void remove_debug_files(struct ehci_hcd *bus) { }
>> +static inline void create_debug_files(struct ehci_hcd *bus)
>> +{
>> +}
>> +
>> +static inline void remove_debug_files(struct ehci_hcd *bus)
>> +{
>> +}
>>
>>  #else
>>
>> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd *ehci, 
>> __hc32 token)
>>   return '/';
>>  }
>>
>> -static void qh_lines(
>> - struct ehci_hcd *ehci,
>> - struct ehci_qh *qh,
>> - char **nextp,
>> - unsigned *sizep
>> -)
>> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>> + char **nextp, unsigned *sizep)
>>  {
>>   u32 scratch;
>>   u32 hw_curr;
>>
>
And about that style? Should be done?



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:52 GMT-03:00 Sergei Shtylyov :
> Hello.
>
> On 01/05/2016 12:49 AM, Greg Kroah-Hartman wrote:
>
>>>>> This patch fixes coding style issues reported by checkpatch concerning
>>>>> to unnecessary space after a cast.
>>>>
>>>>
>>>> This is a case where checkpatch is wrong, IMO.  Casts should always be
>>>> followed by a space.  I will not accept this patch.
>>>
>>> Ok. I understand.
>>>
>>>>
>>>> This must be something recently added to checkpatch.  It never used to
>>>> complain about casts, whether they were followed by a space or not.
>>>
>>> I'm using the checkpatch --strict option.
>>
>>
>> Please never use that on existing kernel code, except for
>> drivers/staging/ stuff, otherwise your patches will start to very
>> quickly be ignored.
Good to know. Tks.

>
>
>Just wanted to remind everybody that this option is forced when checking
> the networking code...
Ditto.

>
>> thanks,
>>
>> greg k-h
>
>
> MBR, Sergei
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
2016-01-04 17:58 GMT-03:00 Alan Stern :
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes coding style issues reported by checkpatch concerning
>> to unnecessary space after a cast.
>
> This is a case where checkpatch is wrong, IMO.  Casts should always be
> followed by a space.  I will not accept this patch.
Ok. I understand.

>
> This must be something recently added to checkpatch.  It never used to
> complain about casts, whether they were followed by a space or not.
I'm using the checkpatch --strict option.

>
> Alan Stern
>
>> Signed-off-by: Geyslan G. Bem 
>> ---
>>  drivers/usb/host/ehci-dbg.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 1645120..edae79e 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct 
>> ehci_qh *qh)
>>
>>   ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
>>   qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
>> - dbg_qtd("overlay", ehci, (struct ehci_qtd *) >hw_qtd_next);
>> + dbg_qtd("overlay", ehci, (struct ehci_qtd *)>hw_qtd_next);
>>  }
>>
>>  static void __maybe_unused
>> @@ -491,7 +491,7 @@ static void qh_lines(
>>   (scratch >> 16) & 0x7fff,
>>   scratch,
>>   td->urb,
>> -             (u32) td->qtd_dma,
>> + (u32)td->qtd_dma,
>>   hc32_to_cpup(ehci, >hw_buf[0]));
>>   if (size < temp)
>>   temp = size;
>>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 07/17] usb: host: ehci-dbg: fix unsigned comparison

2016-01-04 Thread Geyslan G. Bem
2016-01-04 17:50 GMT-03:00 Alan Stern :
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes an unsigned comparison to less than 0.
>
> No, it doesn't.  It changes an unsigned comparison for less than or
> equal to 0, which is very different from less than 0.
You're right. The statemant is incomplete.

>
>> Signed-off-by: Geyslan G. Bem 
>> ---
>>
>> Notes:
>> I'm not sure about that comparison because in qh_lines() temp receives
>> the snprintf() return and thereafter occurs this comparison:
>>
>> if (size < temp)
>>  temp = size;
>>
>> Is it a test of string truncation right? That possibility is being
>> treated. But if after some snprintf returns the temp is exactly size
>> minus 1 (trailing null)? Could this scenario happen? If yes, I think
>> size could be not counting correctly. Let me know more about it.
>
> I think the two weird code sequences in qh_lines() were written before
> scnprintf existed.  They should be changed to use scnprintf instead of
> snprintf; then the "if (size < temp) temp = size;" things can be
> removed.
I see. I can do another patch for that if you allow me.

>
>>  drivers/usb/host/ehci-dbg.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 980ca55..1645120 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -542,7 +542,7 @@ static ssize_t fill_async_buffer(struct debug_buffer 
>> *buf)
>>   next += temp;
>>
>>   list_for_each_entry(qh, >async_unlink, unlink_node) {
>> - if (size <= 0)
>> + if (size == 0)
>>   break;
>>   qh_lines(ehci, qh, , );
>>   }
>
> The new line does exactly the same thing as the old line.  There's no
> reason to make this change.
I think that the original and new logic will be the same because the
size variable has no sign. If in some previous subtraction the
subtracted value is greater than size value, this will spin (rotate),
probably, to a great positive value.

The compiled code will not change indeed. That change was only focused
on the improvement of the code reading. So if you allow me I could
change the commit message. If not let's forget it. :-)

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to unnecessary space after a cast.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 1645120..edae79e 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct 
ehci_qh *qh)
 
ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
-   dbg_qtd("overlay", ehci, (struct ehci_qtd *) >hw_qtd_next);
+   dbg_qtd("overlay", ehci, (struct ehci_qtd *)>hw_qtd_next);
 }
 
 static void __maybe_unused
@@ -491,7 +491,7 @@ static void qh_lines(
(scratch >> 16) & 0x7fff,
scratch,
td->urb,
-   (u32) td->qtd_dma,
+   (u32)td->qtd_dma,
hc32_to_cpup(ehci, >hw_buf[0]));
if (size < temp)
temp = size;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/17] usb: host: ehci-dbg: remove space before open square bracket

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch. The only
change in this patch that isn't just removing spaces before opening
square brackets is at line 213 where the initialization of fls_strings[]
is placed in same line.

Signed-off-by: Geyslan G. Bem 
---

Notes:
Before this patch there are 20 warnings about spaces before open square
bracket. After there are still 3. These lines concern to macros that
will be modified to inline functions in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index fcbbdfa..52bf3fe 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -42,7 +42,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
if (HCS_PORTROUTED(params)) {
int i;
-   char buf [46], tmp [7], byte;
+   char buf[46], tmp[7], byte;
 
buf[0] = 0;
for (i = 0; i < HCS_N_PORTS(params); i++) {
@@ -109,8 +109,8 @@ dbg_qtd(const char *label, struct ehci_hcd *ehci, struct 
ehci_qtd *qtd)
hc32_to_cpup(ehci, >hw_next),
hc32_to_cpup(ehci, >hw_alt_next),
hc32_to_cpup(ehci, >hw_token),
-   hc32_to_cpup(ehci, >hw_buf [0]));
-   if (qtd->hw_buf [1])
+   hc32_to_cpup(ehci, >hw_buf[0]));
+   if (qtd->hw_buf[1])
ehci_dbg(ehci, "  p1=%08x p2=%08x p3=%08x p4=%08x\n",
hc32_to_cpup(ehci, >hw_buf[1]),
hc32_to_cpup(ehci, >hw_buf[2]),
@@ -179,7 +179,7 @@ dbg_status_buf(char *buf, unsigned len, const char *label, 
u32 status)
 {
return scnprintf(buf, len,
"%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s%s",
-   label, label [0] ? " " : "", status,
+   label, label[0] ? " " : "", status,
(status & STS_PPCE_MASK) ? " PPCE" : "",
(status & STS_ASS) ? " Async" : "",
(status & STS_PSS) ? " Periodic" : "",
@@ -199,7 +199,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
 {
return scnprintf(buf, len,
"%s%sintrenable %02x%s%s%s%s%s%s%s",
-   label, label [0] ? " " : "", enable,
+   label, label[0] ? " " : "", enable,
(enable & STS_PPCE_MASK) ? " PPCE" : "",
(enable & STS_IAA) ? " IAA" : "",
(enable & STS_FATAL) ? " FATAL" : "",
@@ -210,8 +210,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
);
 }
 
-static const char *const fls_strings [] =
-{ "1024", "512", "256", "??" };
+static const char *const fls_strings[] = { "1024", "512", "256", "??" };
 
 static int
 dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
@@ -219,7 +218,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
return scnprintf(buf, len,
"%s%scommand %07x %s%s%s%s%s%s=%d ithresh=%d%s%s%s%s "
"period=%s%s %s",
-   label, label [0] ? " " : "", command,
+   label, label[0] ? " " : "", command,
(command & CMD_HIRD) ? " HIRD" : "",
(command & CMD_PPCEE) ? " PPCEE" : "",
(command & CMD_FSP) ? " FSP" : "",
@@ -232,7 +231,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
(command & CMD_IAAD) ? " IAAD" : "",
(command & CMD_ASE) ? " Async" : "",
(command & CMD_PSE) ? " Periodic" : "",
-   fls_strings [(command >> 2) & 0x3],
+   fls_strings[(command >> 2) & 0x3],
(command & CMD_RESET) ? " Reset" : "",
(command & CMD_RUN) ? "RUN" : "HALT"
);
@@ -254,7 +253,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
return scnprintf(buf, len,
"%s%sport:%d status %06x %d %s%s%s%s%s%s "
"sig=%s%s%s%s%s%s%s%s%s%s%s",
-   label, label [0] ? " " : "", port, status,
+

[PATCH 03/17] usb: host: ehci-dbg: use C89-style comments

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch.

Coding style demands usage of C89-style comments and a specific format
when it's multiline.

This also removes the Free Software Foundation address because FSF can
change it again.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 52bf3fe..df9f598 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -11,16 +11,14 @@
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /* this file is part of ehci-hcd.c */
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
-/* check the values in the HCSPARAMS register
+/*
+ * check the values in the HCSPARAMS register
  * (host controller _Structural_ parameters)
  * see EHCI spec, Table 2-4 for each value
  */
@@ -46,7 +44,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 
buf[0] = 0;
for (i = 0; i < HCS_N_PORTS(params); i++) {
-   // FIXME MIPS won't readb() ...
+   /* FIXME MIPS won't readb() ... */
byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
@@ -63,10 +61,11 @@ static inline void dbg_hcs_params(struct ehci_hcd *ehci, 
char *label) {}
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
-/* check the values in the HCCPARAMS register
+/*
+ * check the values in the HCCPARAMS register
  * (host controller _Capability_ parameters)
  * see EHCI Spec, Table 2-5 for each value
- * */
+ */
 static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcc_params);
@@ -515,7 +514,8 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
 
*next = 0;
 
-   /* dumps a snapshot of the async schedule.
+   /*
+* dumps a snapshot of the async schedule.
 * usually empty except for long-term bulk reads, or head.
 * one QH per line, and TDs we know about
 */
@@ -647,7 +647,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
size -= temp;
next += temp;
 
-   /* dump a snapshot of the periodic schedule.
+   /*
+* dump a snapshot of the periodic schedule.
 * iso changes, interrupt usually doesn't.
 */
spin_lock_irqsave(>lock, flags);
@@ -861,7 +862,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer 
*buf)
}
 #endif
 
-   // FIXME interpret both types of params
+   /* FIXME interpret both types of params */
i = ehci_readl(ehci, >caps->hcs_params);
temp = scnprintf(next, size, "structural params 0x%08x\n", i);
size -= temp;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/17] usb: host: ehci-dbg: put spaces around operators

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing spaces around operators.

There is an additional change on line 49 that removes unnecessary
parenthesis around ternary operands.

Signed-off-by: Geyslan G. Bem 
---

Notes:
Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 3b423e1..980ca55 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -46,7 +46,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
/* FIXME MIPS won't readb() ... */
byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
-   ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
+   (i & 0x1) ? byte & 0xf : (byte >> 4) & 0xf);
strcat(buf, tmp);
}
ehci_dbg(ehci, "%s portroute %s\n", label, buf);
@@ -257,14 +257,14 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
"%s%sport:%d status %06x %d %s%s%s%s%s%s "
"sig=%s%s%s%s%s%s%s%s%s%s%s",
label, label[0] ? " " : "", port, status,
-   status>>25,/*device address */
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_ACK ?
+   status >> 25, /*device address */
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ACK ?
" ACK" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_NYET ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_NYET ?
" NYET" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_STALL ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_STALL ?
" STALL" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_ERR ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ERR ?
" ERR" : "",
(status & PORT_POWER) ? " POWER" : "",
(status & PORT_OWNER) ? " OWNER" : "",
@@ -846,7 +846,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer 
*buf)
if (dev_is_pci(hcd->self.controller)) {
struct pci_dev  *pdev;
u32 offset, cap, cap2;
-   unsignedcount = 256/4;
+   unsignedcount = 256 / 4;
 
pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
offset = HCC_EXT_CAPS(ehci_readl(ehci,
@@ -1058,7 +1058,7 @@ static int debug_periodic_open(struct inode *inode, 
struct file *file)
if (!buf)
return -ENOMEM;
 
-   buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8)*PAGE_SIZE;
+   buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8) * PAGE_SIZE;
file->private_data = buf;
return 0;
 }
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 07/17] usb: host: ehci-dbg: fix unsigned comparison

2016-01-04 Thread Geyslan G. Bem
This patch fixes an unsigned comparison to less than 0.

Signed-off-by: Geyslan G. Bem 
---

Notes:
I'm not sure about that comparison because in qh_lines() temp receives
the snprintf() return and thereafter occurs this comparison:

if (size < temp)
   temp = size;

Is it a test of string truncation right? That possibility is being
treated. But if after some snprintf returns the temp is exactly size
minus 1 (trailing null)? Could this scenario happen? If yes, I think
size could be not counting correctly. Let me know more about it.

 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 980ca55..1645120 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -542,7 +542,7 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
next += temp;
 
list_for_each_entry(qh, >async_unlink, unlink_node) {
-   if (size <= 0)
+   if (size == 0)
break;
qh_lines(ehci, qh, , );
}
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/17] usb: host: ehci-dbg: fix up closing parenthesis

2016-01-04 Thread Geyslan G. Bem
This patch puts the closing parenthesis at the statement end removing
unnecessary "new line".

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index c409e4f..3b423e1 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -35,8 +35,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
HCS_N_PCC(params),
HCS_PORTROUTED(params) ? "" : " ordered",
HCS_PPC(params) ? "" : " !ppc",
-   HCS_N_PORTS(params)
-   );
+   HCS_N_PORTS(params));
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
if (HCS_PORTROUTED(params)) {
int i;
@@ -189,8 +188,7 @@ dbg_status_buf(char *buf, unsigned len, const char *label, 
u32 status)
(status & STS_FLR) ? " FLR" : "",
(status & STS_PCD) ? " PCD" : "",
(status & STS_ERR) ? " ERR" : "",
-   (status & STS_INT) ? " INT" : ""
-   );
+   (status & STS_INT) ? " INT" : "");
 }
 
 static int __maybe_unused
@@ -205,8 +203,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
(enable & STS_FLR) ? " FLR" : "",
(enable & STS_PCD) ? " PCD" : "",
(enable & STS_ERR) ? " ERR" : "",
-   (enable & STS_INT) ? " INT" : ""
-   );
+   (enable & STS_INT) ? " INT" : "");
 }
 
 static const char *const fls_strings[] = { "1024", "512", "256", "??" };
@@ -232,8 +229,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
(command & CMD_PSE) ? " Periodic" : "",
fls_strings[(command >> 2) & 0x3],
(command & CMD_RESET) ? " Reset" : "",
-   (command & CMD_RUN) ? "RUN" : "HALT"
-   );
+   (command & CMD_RUN) ? "RUN" : "HALT");
 }
 
 static int
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/17] usb: host: ehci-dbg: remove space before open parenthesis

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch. The vast
majority of changes in this patch are removing spaces before opening
parenthesis, but in some cases, a few additional changes are made to fix
other coding style issues.

These additional changes are:

 - Spaces around >> on line 50.
 - On line 55 a call to ehci_dbg reduced to a single line.
 - sizeof operands surrounded with parenthesis on lines 877, 883, 889
   and 901.

Signed-off-by: Geyslan G. Bem 
---

Notes:
Before this patch there are 105 warnings about spaces before opening
parenthesis. After there are still 6. These lines concern to macros that
will be modified to inline functions in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 199 ++--
 1 file changed, 99 insertions(+), 100 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b7d623f..fcbbdfa 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -24,41 +24,40 @@
  * (host controller _Structural_ parameters)
  * see EHCI spec, Table 2-4 for each value
  */
-static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
+static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcs_params);
 
-   ehci_dbg (ehci,
+   ehci_dbg(ehci,
"%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n",
label, params,
-   HCS_DEBUG_PORT (params),
-   HCS_INDICATOR (params) ? " ind" : "",
-   HCS_N_CC (params),
-   HCS_N_PCC (params),
-   HCS_PORTROUTED (params) ? "" : " ordered",
-   HCS_PPC (params) ? "" : " !ppc",
-   HCS_N_PORTS (params)
+   HCS_DEBUG_PORT(params),
+   HCS_INDICATOR(params) ? " ind" : "",
+   HCS_N_CC(params),
+   HCS_N_PCC(params),
+   HCS_PORTROUTED(params) ? "" : " ordered",
+   HCS_PPC(params) ? "" : " !ppc",
+   HCS_N_PORTS(params)
);
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
-   if (HCS_PORTROUTED (params)) {
+   if (HCS_PORTROUTED(params)) {
int i;
char buf [46], tmp [7], byte;
 
buf[0] = 0;
-   for (i = 0; i < HCS_N_PORTS (params); i++) {
+   for (i = 0; i < HCS_N_PORTS(params); i++) {
// FIXME MIPS won't readb() ...
-   byte = readb (>caps->portroute[(i>>1)]);
+   byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
strcat(buf, tmp);
}
-   ehci_dbg (ehci, "%s portroute %s\n",
-   label, buf);
+   ehci_dbg(ehci, "%s portroute %s\n", label, buf);
}
 }
 #else
 
-static inline void dbg_hcs_params (struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
 
 #endif
 
@@ -68,19 +67,19 @@ static inline void dbg_hcs_params (struct ehci_hcd *ehci, 
char *label) {}
  * (host controller _Capability_ parameters)
  * see EHCI Spec, Table 2-5 for each value
  * */
-static void dbg_hcc_params (struct ehci_hcd *ehci, char *label)
+static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcc_params);
 
-   if (HCC_ISOC_CACHE (params)) {
-   ehci_dbg (ehci,
+   if (HCC_ISOC_CACHE(params)) {
+   ehci_dbg(ehci,
"%s hcc_params %04x caching frame %s%s%s\n",
label, params,
HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024",
HCC_CANPARK(params) ? " park" : "",
HCC_64BIT_ADDR(params) ? " 64 bit addr" : "");
} else {
-   ehci_dbg (ehci,
+   ehci_dbg(ehci,
"%s hcc_params %04x thresh %d uframes %s%s%s%s%s%s%s\n",
label,
params,
@@ -97,14 +96,14 @@ static void dbg_hcc_params (struct ehci_hcd *ehci, char 
*label)
 }
 #else
 
-static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
 
 #endif
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
 static void __maybe_unused
-dbg_qtd (const char *label, struct ehci_hcd *ehci, struct ehci_qtd *qtd)
+db

[PATCH 13/17] usb: host: ehci-dbg: remove blank line before close brace

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issue reported by checkpatch concerning to
an unnecessary line before close brace.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index a42b05b..b9bbac7 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1052,7 +1052,6 @@ static ssize_t debug_output(struct file *file, char 
__user *user_buf,
 
 out:
return ret;
-
 }
 
 static int debug_close(struct inode *inode, struct file *file)
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/17] usb: host: ehci-dbg: convert macro to inline function

2016-01-04 Thread Geyslan G. Bem
This patch converts macros into inline functions since the usage of
second is encouraged by Coding Style instead of the first.

Macros converted to functions:
 - dbg_status
 - dbg_cmd
 - dbg_port
 - speed_char

The size after changes remains the same.

Before:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

After:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

Signed-off-by: Geyslan G. Bem 
---

Notes:
The comment

/* functions have the "wrong" filename when they're output... */

was removed because after changes the file remained the same size and
the symbols of the new inline functions were not created, so they were
properly inlined.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 54 -
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 4ba577d..db28992 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -317,23 +317,31 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
 #endif /* CONFIG_DYNAMIC_DEBUG */
 
-/* functions have the "wrong" filename when they're output... */
-#define dbg_status(ehci, label, status) { \
-   char _buf [80]; \
-   dbg_status_buf (_buf, sizeof _buf, label, status); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_status(struct ehci_hcd *ehci, const char *label, u32 status)
+{
+   char buf[80];
+
+   dbg_status_buf(buf, sizeof(buf), label, status);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
-#define dbg_cmd(ehci, label, command) { \
-   char _buf [80]; \
-   dbg_command_buf (_buf, sizeof _buf, label, command); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_cmd(struct ehci_hcd *ehci, const char *label, u32 command)
+{
+   char buf[80];
+
+   dbg_command_buf(buf, sizeof(buf), label, command);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
-#define dbg_port(ehci, label, port, status) { \
-   char _buf [80]; \
-   dbg_port_buf (_buf, sizeof _buf, label, port, status); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_port(struct ehci_hcd *ehci, const char *label, int port, u32 status)
+{
+   char buf[80];
+
+   dbg_port_buf(buf, sizeof(buf), label, port, status);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
 /*-*/
@@ -403,13 +411,19 @@ struct debug_buffer {
size_t alloc_size;
 };
 
-#define speed_char(info1) ({ char tmp; \
-   switch (info1 & (3 << 12)) { \
-   case QH_FULL_SPEED: tmp = 'f'; break; \
-   case QH_LOW_SPEED:  tmp = 'l'; break; \
-   case QH_HIGH_SPEED: tmp = 'h'; break; \
-   default: tmp = '?'; break; \
-   } tmp; })
+static inline char speed_char(u32 info1)
+{
+   switch (info1 & (3 << 12)) {
+   case QH_FULL_SPEED:
+   return 'f';
+   case QH_LOW_SPEED:
+   return 'l';
+   case QH_HIGH_SPEED:
+   return 'h';
+   default:
+   return '?';
+   }
+}
 
 static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
 {
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/17] usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch related to
kmalloc_array usage.

On same line the sizeof operand was enclosed by parenthesis.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 7f8ad18..2268756 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -678,7 +678,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
unsignedi;
__hc32  tag;
 
-   seen = kmalloc(DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC);
+   seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
if (!seen)
return 0;
seen_count = 0;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/17] usb: host: ehci-dbg: add blank line after declarations

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing line after variable declarations.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index db28992..a42b05b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1085,6 +1085,7 @@ static int debug_bandwidth_open(struct inode *inode, 
struct file *file)
 static int debug_periodic_open(struct inode *inode, struct file *file)
 {
struct debug_buffer *buf;
+
buf = alloc_buffer(inode->i_private, fill_periodic_buffer);
if (!buf)
return -ENOMEM;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/17] usb: host: ehci-dbg: enclose conditional blocks with braces

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to conditional blocks without braces.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index bf3ec19..7f8ad18 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -491,11 +491,11 @@ static void qh_lines(struct ehci_hcd *ehci, struct 
ehci_qh *qh,
td = list_entry(entry, struct ehci_qtd, qtd_list);
scratch = hc32_to_cpup(ehci, >hw_token);
mark = ' ';
-   if (hw_curr == td->qtd_dma)
+   if (hw_curr == td->qtd_dma) {
mark = '*';
-   else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma))
+   } else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma)) {
mark = '+';
-   else if (QTD_LENGTH(scratch)) {
+   } else if (QTD_LENGTH(scratch)) {
if (td->hw_alt_next == ehci->async->hw->hw_alt_next)
mark = '#';
else if (td->hw_alt_next != list_end)
@@ -772,8 +772,9 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
 
if (seen_count < DBG_SCHED_LIMIT)
seen[seen_count++].qh = p.qh;
-   } else
+   } else {
temp = 0;
+   }
tag = Q_NEXT_TYPE(ehci, hw->hw_next);
p = p.qh->qh_next;
break;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/17] usb: host: ehci-dbg: replace sizeof operand

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch concerning
to usage of sizeof operand as a variable instead the type.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b9bbac7..bf3ec19 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -996,7 +996,7 @@ static struct debug_buffer *alloc_buffer(struct usb_bus 
*bus,
 {
struct debug_buffer *buf;
 
-   buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
+   buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 
if (buf) {
buf->bus = bus;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch related to
many leading tabs, removing a 'do while' loop and making use of goto tag 
instead.

Others changes in this patch are:
 - Some multiline statements are reduced (718, 729, 780, 786, 790).
 - A constant is moved to right on line 770.

Signed-off-by: Geyslan G. Bem 
---

Notes:
Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 180 ++--
 1 file changed, 88 insertions(+), 92 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 2268756..278333d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
 */
spin_lock_irqsave(>lock, flags);
for (i = 0; i < ehci->periodic_size; i++) {
+   struct ehci_qh_hw *hw;
+
p = ehci->pshadow[i];
if (likely(!p.ptr))
continue;
@@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
size -= temp;
next += temp;
 
-   do {
-   struct ehci_qh_hw *hw;
-
-   switch (hc32_to_cpu(ehci, tag)) {
-   case Q_TYPE_QH:
-   hw = p.qh->hw;
-   temp = scnprintf(next, size, " qh%d-%04x/%p",
-   p.qh->ps.period,
-   hc32_to_cpup(ehci,
-   >hw_info2)
-   /* uframe masks */
-   & (QH_CMASK | QH_SMASK),
-   p.qh);
-   size -= temp;
-   next += temp;
-   /* don't repeat what follows this qh */
-   for (temp = 0; temp < seen_count; temp++) {
-   if (seen[temp].ptr != p.ptr)
+do_loop:
+   switch (hc32_to_cpu(ehci, tag)) {
+   case Q_TYPE_QH:
+   hw = p.qh->hw;
+   temp = scnprintf(next, size, " qh%d-%04x/%p",
+   p.qh->ps.period,
+   hc32_to_cpup(ehci, >hw_info2)
+   /* uframe masks */
+   & (QH_CMASK | QH_SMASK),
+   p.qh);
+   size -= temp;
+   next += temp;
+   /* don't repeat what follows this qh */
+   for (temp = 0; temp < seen_count; temp++) {
+   if (seen[temp].ptr != p.ptr)
+   continue;
+   if (p.qh->qh_next.ptr) {
+   temp = scnprintf(next, size, " ...");
+   size -= temp;
+   next += temp;
+   }
+   break;
+   }
+   /* show more info the first time around */
+   if (temp == seen_count) {
+   u32 scratch = hc32_to_cpup(ehci,
+   >hw_info1);
+   struct ehci_qtd *qtd;
+   char*type = "";
+
+   /* count tds, get ep direction */
+   temp = 0;
+   list_for_each_entry(qtd,
+   >qtd_list,
+   qtd_list) {
+   temp++;
+   switch ((hc32_to_cpu(ehci,
+   qtd->hw_token) >> 8)
+   & 0x03) {
+   case 0:
+   type = "out";
+   continue;
+   case 1:
+   type = "in";
continue;
-   if (p.qh->qh_next.ptr) {
-   temp = scnprintf(next, size,
-   &q

[PATCH 10/17] usb: host: ehci-dbg: use a blank line after struct declarations

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing line after struct declarations.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index a365d9d..4ba577d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -367,6 +367,7 @@ static const struct file_operations debug_async_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_bandwidth_fops = {
.owner  = THIS_MODULE,
.open   = debug_bandwidth_open,
@@ -374,6 +375,7 @@ static const struct file_operations debug_bandwidth_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_periodic_fops = {
.owner  = THIS_MODULE,
.open   = debug_periodic_open,
@@ -381,6 +383,7 @@ static const struct file_operations debug_periodic_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_registers_fops = {
.owner  = THIS_MODULE,
.open   = debug_registers_open,
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-04 Thread Geyslan G. Bem
Functions must have the opening brace at the beginning of the next line
and body conforming indentation.

This patch also reduces qh_lines() header definition to two lines.

Signed-off-by: Geyslan G. Bem 
---
 drivers/usb/host/ehci-dbg.c | 44 +---
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index edae79e..a365d9d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -54,7 +54,9 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 }
 #else
 
-static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
+{
+}
 
 #endif
 
@@ -94,7 +96,9 @@ static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 }
 #else
 
-static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
+{
+}
 
 #endif
 
@@ -284,23 +288,32 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 #else
 static inline void __maybe_unused
 dbg_qh(char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
-{}
+{
+}
 
 static inline int __maybe_unused
 dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
-{ return 0; }
+{
+   return 0;
+}
 
 #endif /* CONFIG_DYNAMIC_DEBUG */
 
@@ -327,8 +340,13 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
 #ifdef STUB_DEBUG_FILES
 
-static inline void create_debug_files(struct ehci_hcd *bus) { }
-static inline void remove_debug_files(struct ehci_hcd *bus) { }
+static inline void create_debug_files(struct ehci_hcd *bus)
+{
+}
+
+static inline void remove_debug_files(struct ehci_hcd *bus)
+{
+}
 
 #else
 
@@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd *ehci, 
__hc32 token)
return '/';
 }
 
-static void qh_lines(
-   struct ehci_hcd *ehci,
-   struct ehci_qh *qh,
-   char **nextp,
-   unsigned *sizep
-)
+static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
+   char **nextp, unsigned *sizep)
 {
u32 scratch;
u32 hw_curr;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring

2016-01-04 Thread Geyslan G. Bem
This patchset removes all errors reported by checkpatch in addition to
some refactoring.

Geyslan G. Bem (17):
  usb: host: ehci-dbg: remove space before open parenthesis
  usb: host: ehci-dbg: remove space before open square bracket
  usb: host: ehci-dbg: use C89-style comments
  usb: host: ehci-dbg: move trailing statements to next line
  usb: host: ehci-dbg: fix up closing parenthesis
  usb: host: ehci-dbg: put spaces around operators
  usb: host: ehci-dbg: fix unsigned comparison
  usb: host: ehci-dbg: remove unnecessary space after cast
  usb: host: ehci-dbg: fix up function definitions
  usb: host: ehci-dbg: use a blank line after struct declarations
  usb: host: ehci-dbg: convert macro to inline function
  usb: host: ehci-dbg: add blank line after declarations
  usb: host: ehci-dbg: remove blank line before close brace
  usb: host: ehci-dbg: replace sizeof operand
  usb: host: ehci-dbg: enclose conditional blocks with braces
  usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size
  usb: host: ehci-dbg: refactor fill_periodic_buffer function

 drivers/usb/host/ehci-dbg.c | 585 
 1 file changed, 315 insertions(+), 270 deletions(-)

-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/17] usb: host: ehci-dbg: move trailing statements to next line

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to switch case statements. There are few additional changes made to fix
other coding styles issues.

These additional changes are:

 - The compound statement "({...})" on line 474 is pulled out from
   snprintf parameters.

 - On line 723 the constant "0x03" is moved to right.

Signed-off-by: Geyslan G. Bem 
---

Notes:
Before this patch there are 14 warnings about trailing statements that
should be on next line. After there are still 4. These lines concern to
a macro that will be modified to inline function in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 54 +++--
 1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index df9f598..c409e4f 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -243,10 +243,18 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
/* signaling state */
switch (status & (3 << 10)) {
-   case 0 << 10: sig = "se0"; break;
-   case 1 << 10: sig = "k"; break; /* low speed */
-   case 2 << 10: sig = "j"; break;
-   default: sig = "?"; break;
+   case 0 << 10:
+   sig = "se0";
+   break;
+   case 1 << 10: /* low speed */
+   sig = "k";
+   break;
+   case 2 << 10:
+   sig = "j";
+   break;
+   default:
+   sig = "?";
+   break;
}
 
return scnprintf(buf, len,
@@ -451,6 +459,8 @@ static void qh_lines(
 
/* hc may be modifying the list as we read it ... */
list_for_each(entry, >qtd_list) {
+   char *type;
+
td = list_entry(entry, struct ehci_qtd, qtd_list);
scratch = hc32_to_cpup(ehci, >hw_token);
mark = ' ';
@@ -464,16 +474,24 @@ static void qh_lines(
else if (td->hw_alt_next != list_end)
mark = '/';
}
+   switch ((scratch >> 8) & 0x03) {
+   case 0:
+   type = "out";
+   break;
+   case 1:
+   type = "in";
+   break;
+   case 2:
+   type = "setup";
+   break;
+   default:
+   type = "?";
+   break;
+   }
temp = snprintf(next, size,
"\n\t%p%c%s len=%d %08x urb %p"
" [td %08x buf[0] %08x]",
-   td, mark, ({ char *tmp;
-switch ((scratch>>8)&0x03) {
-case 0: tmp = "out"; break;
-case 1: tmp = "in"; break;
-case 2: tmp = "setup"; break;
-default: tmp = "?"; break;
-} tmp;}),
+   td, mark, type,
(scratch >> 16) & 0x7fff,
scratch,
td->urb,
@@ -702,11 +720,15 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
>qtd_list,
qtd_list) {
temp++;
-   switch (0x03 & (hc32_to_cpu(
-   ehci,
-   qtd->hw_token) >> 8)) {
-   case 0: type = "out"; continue;
-   case 1: type = "in"; continue;
+   switch ((hc32_to_cpu(ehci,
+   qtd->hw_token) >> 8)
+   & 0x03) {
+   case 0:
+   type = "out";
+   continue;
+   case 1:
+   type = "in";
+   continue;
}
}
 
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 01/17] usb: host: ehci-dbg: remove space before open parenthesis

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch. The vast
majority of changes in this patch are removing spaces before opening
parenthesis, but in some cases, a few additional changes are made to fix
other coding style issues.

These additional changes are:

 - Spaces around >> on line 50.
 - On line 55 a call to ehci_dbg reduced to a single line.
 - sizeof operands surrounded with parenthesis on lines 877, 883, 889
   and 901.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
Before this patch there are 105 warnings about spaces before opening
parenthesis. After there are still 6. These lines concern to macros that
will be modified to inline functions in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 199 ++--
 1 file changed, 99 insertions(+), 100 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b7d623f..fcbbdfa 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -24,41 +24,40 @@
  * (host controller _Structural_ parameters)
  * see EHCI spec, Table 2-4 for each value
  */
-static void dbg_hcs_params (struct ehci_hcd *ehci, char *label)
+static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcs_params);
 
-   ehci_dbg (ehci,
+   ehci_dbg(ehci,
"%s hcs_params 0x%x dbg=%d%s cc=%d pcc=%d%s%s ports=%d\n",
label, params,
-   HCS_DEBUG_PORT (params),
-   HCS_INDICATOR (params) ? " ind" : "",
-   HCS_N_CC (params),
-   HCS_N_PCC (params),
-   HCS_PORTROUTED (params) ? "" : " ordered",
-   HCS_PPC (params) ? "" : " !ppc",
-   HCS_N_PORTS (params)
+   HCS_DEBUG_PORT(params),
+   HCS_INDICATOR(params) ? " ind" : "",
+   HCS_N_CC(params),
+   HCS_N_PCC(params),
+   HCS_PORTROUTED(params) ? "" : " ordered",
+   HCS_PPC(params) ? "" : " !ppc",
+   HCS_N_PORTS(params)
);
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
-   if (HCS_PORTROUTED (params)) {
+   if (HCS_PORTROUTED(params)) {
int i;
char buf [46], tmp [7], byte;
 
buf[0] = 0;
-   for (i = 0; i < HCS_N_PORTS (params); i++) {
+   for (i = 0; i < HCS_N_PORTS(params); i++) {
// FIXME MIPS won't readb() ...
-   byte = readb (>caps->portroute[(i>>1)]);
+   byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
strcat(buf, tmp);
}
-   ehci_dbg (ehci, "%s portroute %s\n",
-   label, buf);
+   ehci_dbg(ehci, "%s portroute %s\n", label, buf);
}
 }
 #else
 
-static inline void dbg_hcs_params (struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
 
 #endif
 
@@ -68,19 +67,19 @@ static inline void dbg_hcs_params (struct ehci_hcd *ehci, 
char *label) {}
  * (host controller _Capability_ parameters)
  * see EHCI Spec, Table 2-5 for each value
  * */
-static void dbg_hcc_params (struct ehci_hcd *ehci, char *label)
+static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcc_params);
 
-   if (HCC_ISOC_CACHE (params)) {
-   ehci_dbg (ehci,
+   if (HCC_ISOC_CACHE(params)) {
+   ehci_dbg(ehci,
"%s hcc_params %04x caching frame %s%s%s\n",
label, params,
HCC_PGM_FRAMELISTLEN(params) ? "256/512/1024" : "1024",
HCC_CANPARK(params) ? " park" : "",
HCC_64BIT_ADDR(params) ? " 64 bit addr" : "");
} else {
-   ehci_dbg (ehci,
+   ehci_dbg(ehci,
"%s hcc_params %04x thresh %d uframes %s%s%s%s%s%s%s\n",
label,
params,
@@ -97,14 +96,14 @@ static void dbg_hcc_params (struct ehci_hcd *ehci, char 
*label)
 }
 #else
 
-static inline void dbg_hcc_params (struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
 
 #endif
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
 static void __maybe_unused
-dbg_qtd (const char *label, struct ehci_hcd *ehci, 

[PATCH 07/17] usb: host: ehci-dbg: fix unsigned comparison

2016-01-04 Thread Geyslan G. Bem
This patch fixes an unsigned comparison to less than 0.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
I'm not sure about that comparison because in qh_lines() temp receives
the snprintf() return and thereafter occurs this comparison:

if (size < temp)
   temp = size;

Is it a test of string truncation right? That possibility is being
treated. But if after some snprintf returns the temp is exactly size
minus 1 (trailing null)? Could this scenario happen? If yes, I think
size could be not counting correctly. Let me know more about it.

 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 980ca55..1645120 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -542,7 +542,7 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
next += temp;
 
list_for_each_entry(qh, >async_unlink, unlink_node) {
-   if (size <= 0)
+   if (size == 0)
break;
qh_lines(ehci, qh, , );
}
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 05/17] usb: host: ehci-dbg: fix up closing parenthesis

2016-01-04 Thread Geyslan G. Bem
This patch puts the closing parenthesis at the statement end removing
unnecessary "new line".

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index c409e4f..3b423e1 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -35,8 +35,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
HCS_N_PCC(params),
HCS_PORTROUTED(params) ? "" : " ordered",
HCS_PPC(params) ? "" : " !ppc",
-   HCS_N_PORTS(params)
-   );
+   HCS_N_PORTS(params));
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
if (HCS_PORTROUTED(params)) {
int i;
@@ -189,8 +188,7 @@ dbg_status_buf(char *buf, unsigned len, const char *label, 
u32 status)
(status & STS_FLR) ? " FLR" : "",
(status & STS_PCD) ? " PCD" : "",
(status & STS_ERR) ? " ERR" : "",
-   (status & STS_INT) ? " INT" : ""
-   );
+   (status & STS_INT) ? " INT" : "");
 }
 
 static int __maybe_unused
@@ -205,8 +203,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
(enable & STS_FLR) ? " FLR" : "",
(enable & STS_PCD) ? " PCD" : "",
(enable & STS_ERR) ? " ERR" : "",
-   (enable & STS_INT) ? " INT" : ""
-   );
+   (enable & STS_INT) ? " INT" : "");
 }
 
 static const char *const fls_strings[] = { "1024", "512", "256", "??" };
@@ -232,8 +229,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
(command & CMD_PSE) ? " Periodic" : "",
fls_strings[(command >> 2) & 0x3],
(command & CMD_RESET) ? " Reset" : "",
-   (command & CMD_RUN) ? "RUN" : "HALT"
-   );
+   (command & CMD_RUN) ? "RUN" : "HALT");
 }
 
 static int
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/17] usb: host: ehci-dbg: use C89-style comments

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch.

Coding style demands usage of C89-style comments and a specific format
when it's multiline.

This also removes the Free Software Foundation address because FSF can
change it again.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 52bf3fe..df9f598 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -11,16 +11,14 @@
  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 /* this file is part of ehci-hcd.c */
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
-/* check the values in the HCSPARAMS register
+/*
+ * check the values in the HCSPARAMS register
  * (host controller _Structural_ parameters)
  * see EHCI spec, Table 2-4 for each value
  */
@@ -46,7 +44,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 
buf[0] = 0;
for (i = 0; i < HCS_N_PORTS(params); i++) {
-   // FIXME MIPS won't readb() ...
+   /* FIXME MIPS won't readb() ... */
byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
@@ -63,10 +61,11 @@ static inline void dbg_hcs_params(struct ehci_hcd *ehci, 
char *label) {}
 
 #ifdef CONFIG_DYNAMIC_DEBUG
 
-/* check the values in the HCCPARAMS register
+/*
+ * check the values in the HCCPARAMS register
  * (host controller _Capability_ parameters)
  * see EHCI Spec, Table 2-5 for each value
- * */
+ */
 static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 {
u32 params = ehci_readl(ehci, >caps->hcc_params);
@@ -515,7 +514,8 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
 
*next = 0;
 
-   /* dumps a snapshot of the async schedule.
+   /*
+* dumps a snapshot of the async schedule.
 * usually empty except for long-term bulk reads, or head.
 * one QH per line, and TDs we know about
 */
@@ -647,7 +647,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
size -= temp;
next += temp;
 
-   /* dump a snapshot of the periodic schedule.
+   /*
+* dump a snapshot of the periodic schedule.
 * iso changes, interrupt usually doesn't.
 */
spin_lock_irqsave(>lock, flags);
@@ -861,7 +862,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer 
*buf)
}
 #endif
 
-   // FIXME interpret both types of params
+   /* FIXME interpret both types of params */
i = ehci_readl(ehci, >caps->hcs_params);
temp = scnprintf(next, size, "structural params 0x%08x\n", i);
size -= temp;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 06/17] usb: host: ehci-dbg: put spaces around operators

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing spaces around operators.

There is an additional change on line 49 that removes unnecessary
parenthesis around ternary operands.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 3b423e1..980ca55 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -46,7 +46,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
/* FIXME MIPS won't readb() ... */
byte = readb(>caps->portroute[(i >> 1)]);
sprintf(tmp, "%d ",
-   ((i & 0x1) ? ((byte)&0xf) : ((byte>>4)&0xf)));
+   (i & 0x1) ? byte & 0xf : (byte >> 4) & 0xf);
strcat(buf, tmp);
}
ehci_dbg(ehci, "%s portroute %s\n", label, buf);
@@ -257,14 +257,14 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
"%s%sport:%d status %06x %d %s%s%s%s%s%s "
"sig=%s%s%s%s%s%s%s%s%s%s%s",
label, label[0] ? " " : "", port, status,
-   status>>25,/*device address */
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_ACK ?
+   status >> 25, /*device address */
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ACK ?
" ACK" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_NYET ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_NYET ?
" NYET" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_STALL ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_STALL ?
" STALL" : "",
-   (status & PORT_SSTS)>>23 == PORTSC_SUSPEND_STS_ERR ?
+   (status & PORT_SSTS) >> 23 == PORTSC_SUSPEND_STS_ERR ?
" ERR" : "",
(status & PORT_POWER) ? " POWER" : "",
(status & PORT_OWNER) ? " OWNER" : "",
@@ -846,7 +846,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer 
*buf)
if (dev_is_pci(hcd->self.controller)) {
struct pci_dev  *pdev;
u32 offset, cap, cap2;
-   unsignedcount = 256/4;
+   unsignedcount = 256 / 4;
 
pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
offset = HCC_EXT_CAPS(ehci_readl(ehci,
@@ -1058,7 +1058,7 @@ static int debug_periodic_open(struct inode *inode, 
struct file *file)
if (!buf)
return -ENOMEM;
 
-   buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8)*PAGE_SIZE;
+   buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8) * PAGE_SIZE;
file->private_data = buf;
return 0;
 }
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/17] usb: host: ehci-dbg: remove space before open square bracket

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch. The only
change in this patch that isn't just removing spaces before opening
square brackets is at line 213 where the initialization of fls_strings[]
is placed in same line.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
Before this patch there are 20 warnings about spaces before open square
bracket. After there are still 3. These lines concern to macros that
will be modified to inline functions in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 33 -
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index fcbbdfa..52bf3fe 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -42,7 +42,7 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
/* Port routing, per EHCI 0.95 Spec, Section 2.2.5 */
if (HCS_PORTROUTED(params)) {
int i;
-   char buf [46], tmp [7], byte;
+   char buf[46], tmp[7], byte;
 
buf[0] = 0;
for (i = 0; i < HCS_N_PORTS(params); i++) {
@@ -109,8 +109,8 @@ dbg_qtd(const char *label, struct ehci_hcd *ehci, struct 
ehci_qtd *qtd)
hc32_to_cpup(ehci, >hw_next),
hc32_to_cpup(ehci, >hw_alt_next),
hc32_to_cpup(ehci, >hw_token),
-   hc32_to_cpup(ehci, >hw_buf [0]));
-   if (qtd->hw_buf [1])
+   hc32_to_cpup(ehci, >hw_buf[0]));
+   if (qtd->hw_buf[1])
ehci_dbg(ehci, "  p1=%08x p2=%08x p3=%08x p4=%08x\n",
hc32_to_cpup(ehci, >hw_buf[1]),
hc32_to_cpup(ehci, >hw_buf[2]),
@@ -179,7 +179,7 @@ dbg_status_buf(char *buf, unsigned len, const char *label, 
u32 status)
 {
return scnprintf(buf, len,
"%s%sstatus %04x%s%s%s%s%s%s%s%s%s%s%s",
-   label, label [0] ? " " : "", status,
+   label, label[0] ? " " : "", status,
(status & STS_PPCE_MASK) ? " PPCE" : "",
(status & STS_ASS) ? " Async" : "",
(status & STS_PSS) ? " Periodic" : "",
@@ -199,7 +199,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
 {
return scnprintf(buf, len,
"%s%sintrenable %02x%s%s%s%s%s%s%s",
-   label, label [0] ? " " : "", enable,
+   label, label[0] ? " " : "", enable,
(enable & STS_PPCE_MASK) ? " PPCE" : "",
(enable & STS_IAA) ? " IAA" : "",
(enable & STS_FATAL) ? " FATAL" : "",
@@ -210,8 +210,7 @@ dbg_intr_buf(char *buf, unsigned len, const char *label, 
u32 enable)
);
 }
 
-static const char *const fls_strings [] =
-{ "1024", "512", "256", "??" };
+static const char *const fls_strings[] = { "1024", "512", "256", "??" };
 
 static int
 dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
@@ -219,7 +218,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
return scnprintf(buf, len,
"%s%scommand %07x %s%s%s%s%s%s=%d ithresh=%d%s%s%s%s "
"period=%s%s %s",
-   label, label [0] ? " " : "", command,
+   label, label[0] ? " " : "", command,
(command & CMD_HIRD) ? " HIRD" : "",
(command & CMD_PPCEE) ? " PPCEE" : "",
(command & CMD_FSP) ? " FSP" : "",
@@ -232,7 +231,7 @@ dbg_command_buf(char *buf, unsigned len, const char *label, 
u32 command)
(command & CMD_IAAD) ? " IAAD" : "",
(command & CMD_ASE) ? " Async" : "",
(command & CMD_PSE) ? " Periodic" : "",
-   fls_strings [(command >> 2) & 0x3],
+   fls_strings[(command >> 2) & 0x3],
(command & CMD_RESET) ? " Reset" : "",
(command & CMD_RUN) ? "RUN" : "HALT"
);
@@ -254,7 +253,7 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
return scnprintf(buf, len,
"%s%sport:%d status %06x %d %s%s%s%s%s%s "
"sig=%s%s%s%s%s%s%s%s%s%s%s",
-   label, label [0] ? " " 

[PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-04 Thread Geyslan G. Bem
Functions must have the opening brace at the beginning of the next line
and body conforming indentation.

This patch also reduces qh_lines() header definition to two lines.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 44 +---
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index edae79e..a365d9d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -54,7 +54,9 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
 }
 #else
 
-static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
+{
+}
 
 #endif
 
@@ -94,7 +96,9 @@ static void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
 }
 #else
 
-static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
+static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
+{
+}
 
 #endif
 
@@ -284,23 +288,32 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 #else
 static inline void __maybe_unused
 dbg_qh(char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
-{}
+{
+}
 
 static inline int __maybe_unused
 dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
-{ return 0; }
+{
+   return 0;
+}
 
 static inline int __maybe_unused
 dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 status)
-{ return 0; }
+{
+   return 0;
+}
 
 #endif /* CONFIG_DYNAMIC_DEBUG */
 
@@ -327,8 +340,13 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
 #ifdef STUB_DEBUG_FILES
 
-static inline void create_debug_files(struct ehci_hcd *bus) { }
-static inline void remove_debug_files(struct ehci_hcd *bus) { }
+static inline void create_debug_files(struct ehci_hcd *bus)
+{
+}
+
+static inline void remove_debug_files(struct ehci_hcd *bus)
+{
+}
 
 #else
 
@@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd *ehci, 
__hc32 token)
return '/';
 }
 
-static void qh_lines(
-   struct ehci_hcd *ehci,
-   struct ehci_qh *qh,
-   char **nextp,
-   unsigned *sizep
-)
+static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
+   char **nextp, unsigned *sizep)
 {
u32 scratch;
u32 hw_curr;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 00/17] usb: host: ehci-dbg: cleanup and refactoring

2016-01-04 Thread Geyslan G. Bem
This patchset removes all errors reported by checkpatch in addition to
some refactoring.

Geyslan G. Bem (17):
  usb: host: ehci-dbg: remove space before open parenthesis
  usb: host: ehci-dbg: remove space before open square bracket
  usb: host: ehci-dbg: use C89-style comments
  usb: host: ehci-dbg: move trailing statements to next line
  usb: host: ehci-dbg: fix up closing parenthesis
  usb: host: ehci-dbg: put spaces around operators
  usb: host: ehci-dbg: fix unsigned comparison
  usb: host: ehci-dbg: remove unnecessary space after cast
  usb: host: ehci-dbg: fix up function definitions
  usb: host: ehci-dbg: use a blank line after struct declarations
  usb: host: ehci-dbg: convert macro to inline function
  usb: host: ehci-dbg: add blank line after declarations
  usb: host: ehci-dbg: remove blank line before close brace
  usb: host: ehci-dbg: replace sizeof operand
  usb: host: ehci-dbg: enclose conditional blocks with braces
  usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size
  usb: host: ehci-dbg: refactor fill_periodic_buffer function

 drivers/usb/host/ehci-dbg.c | 585 
 1 file changed, 315 insertions(+), 270 deletions(-)

-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/17] usb: host: ehci-dbg: move trailing statements to next line

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to switch case statements. There are few additional changes made to fix
other coding styles issues.

These additional changes are:

 - The compound statement "({...})" on line 474 is pulled out from
   snprintf parameters.

 - On line 723 the constant "0x03" is moved to right.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
Before this patch there are 14 warnings about trailing statements that
should be on next line. After there are still 4. These lines concern to
a macro that will be modified to inline function in sequential patches.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 54 +++--
 1 file changed, 38 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index df9f598..c409e4f 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -243,10 +243,18 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
/* signaling state */
switch (status & (3 << 10)) {
-   case 0 << 10: sig = "se0"; break;
-   case 1 << 10: sig = "k"; break; /* low speed */
-   case 2 << 10: sig = "j"; break;
-   default: sig = "?"; break;
+   case 0 << 10:
+   sig = "se0";
+   break;
+   case 1 << 10: /* low speed */
+   sig = "k";
+   break;
+   case 2 << 10:
+   sig = "j";
+   break;
+   default:
+   sig = "?";
+   break;
}
 
return scnprintf(buf, len,
@@ -451,6 +459,8 @@ static void qh_lines(
 
/* hc may be modifying the list as we read it ... */
list_for_each(entry, >qtd_list) {
+   char *type;
+
td = list_entry(entry, struct ehci_qtd, qtd_list);
scratch = hc32_to_cpup(ehci, >hw_token);
mark = ' ';
@@ -464,16 +474,24 @@ static void qh_lines(
else if (td->hw_alt_next != list_end)
mark = '/';
}
+   switch ((scratch >> 8) & 0x03) {
+   case 0:
+   type = "out";
+   break;
+   case 1:
+   type = "in";
+   break;
+   case 2:
+   type = "setup";
+   break;
+   default:
+   type = "?";
+   break;
+   }
temp = snprintf(next, size,
"\n\t%p%c%s len=%d %08x urb %p"
" [td %08x buf[0] %08x]",
-   td, mark, ({ char *tmp;
-switch ((scratch>>8)&0x03) {
-case 0: tmp = "out"; break;
-case 1: tmp = "in"; break;
-case 2: tmp = "setup"; break;
-default: tmp = "?"; break;
-} tmp;}),
+   td, mark, type,
(scratch >> 16) & 0x7fff,
scratch,
td->urb,
@@ -702,11 +720,15 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
>qtd_list,
qtd_list) {
temp++;
-   switch (0x03 & (hc32_to_cpu(
-   ehci,
-   qtd->hw_token) >> 8)) {
-   case 0: type = "out"; continue;
-   case 1: type = "in"; continue;
+   switch ((hc32_to_cpu(ehci,
+   qtd->hw_token) >> 8)
+   & 0x03) {
+   case 0:
+   type = "out";
+   continue;
+   case 1:
+   type = "in";
+   continue;
}
}
 
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/17] usb: host: ehci-dbg: remove blank line before close brace

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issue reported by checkpatch concerning to
an unnecessary line before close brace.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index a42b05b..b9bbac7 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1052,7 +1052,6 @@ static ssize_t debug_output(struct file *file, char 
__user *user_buf,
 
 out:
return ret;
-
 }
 
 static int debug_close(struct inode *inode, struct file *file)
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 11/17] usb: host: ehci-dbg: convert macro to inline function

2016-01-04 Thread Geyslan G. Bem
This patch converts macros into inline functions since the usage of
second is encouraged by Coding Style instead of the first.

Macros converted to functions:
 - dbg_status
 - dbg_cmd
 - dbg_port
 - speed_char

The size after changes remains the same.

Before:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

After:
text  data bss dec   hex  filename
36920 81   12  37013 9095 drivers/usb/host/ehci-hcd.o

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
The comment

/* functions have the "wrong" filename when they're output... */

was removed because after changes the file remained the same size and
the symbols of the new inline functions were not created, so they were
properly inlined.

Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 54 -
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 4ba577d..db28992 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -317,23 +317,31 @@ dbg_port_buf(char *buf, unsigned len, const char *label, 
int port, u32 status)
 
 #endif /* CONFIG_DYNAMIC_DEBUG */
 
-/* functions have the "wrong" filename when they're output... */
-#define dbg_status(ehci, label, status) { \
-   char _buf [80]; \
-   dbg_status_buf (_buf, sizeof _buf, label, status); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_status(struct ehci_hcd *ehci, const char *label, u32 status)
+{
+   char buf[80];
+
+   dbg_status_buf(buf, sizeof(buf), label, status);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
-#define dbg_cmd(ehci, label, command) { \
-   char _buf [80]; \
-   dbg_command_buf (_buf, sizeof _buf, label, command); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_cmd(struct ehci_hcd *ehci, const char *label, u32 command)
+{
+   char buf[80];
+
+   dbg_command_buf(buf, sizeof(buf), label, command);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
-#define dbg_port(ehci, label, port, status) { \
-   char _buf [80]; \
-   dbg_port_buf (_buf, sizeof _buf, label, port, status); \
-   ehci_dbg (ehci, "%s\n", _buf); \
+static inline void
+dbg_port(struct ehci_hcd *ehci, const char *label, int port, u32 status)
+{
+   char buf[80];
+
+   dbg_port_buf(buf, sizeof(buf), label, port, status);
+   ehci_dbg(ehci, "%s\n", buf);
 }
 
 /*-*/
@@ -403,13 +411,19 @@ struct debug_buffer {
size_t alloc_size;
 };
 
-#define speed_char(info1) ({ char tmp; \
-   switch (info1 & (3 << 12)) { \
-   case QH_FULL_SPEED: tmp = 'f'; break; \
-   case QH_LOW_SPEED:  tmp = 'l'; break; \
-   case QH_HIGH_SPEED: tmp = 'h'; break; \
-   default: tmp = '?'; break; \
-   } tmp; })
+static inline char speed_char(u32 info1)
+{
+   switch (info1 & (3 << 12)) {
+   case QH_FULL_SPEED:
+   return 'f';
+   case QH_LOW_SPEED:
+   return 'l';
+   case QH_HIGH_SPEED:
+   return 'h';
+   default:
+   return '?';
+   }
+}
 
 static inline char token_mark(struct ehci_hcd *ehci, __hc32 token)
 {
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 16/17] usb: host: ehci-dbg: prefer kmalloc_array over kmalloc times size

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch related to
kmalloc_array usage.

On same line the sizeof operand was enclosed by parenthesis.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 7f8ad18..2268756 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -678,7 +678,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
unsignedi;
__hc32  tag;
 
-   seen = kmalloc(DBG_SCHED_LIMIT * sizeof *seen, GFP_ATOMIC);
+   seen = kmalloc_array(DBG_SCHED_LIMIT, sizeof(*seen), GFP_ATOMIC);
if (!seen)
return 0;
seen_count = 0;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/17] usb: host: ehci-dbg: add blank line after declarations

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing line after variable declarations.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index db28992..a42b05b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1085,6 +1085,7 @@ static int debug_bandwidth_open(struct inode *inode, 
struct file *file)
 static int debug_periodic_open(struct inode *inode, struct file *file)
 {
struct debug_buffer *buf;
+
buf = alloc_buffer(inode->i_private, fill_periodic_buffer);
if (!buf)
return -ENOMEM;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to unnecessary space after a cast.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 1645120..edae79e 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct 
ehci_qh *qh)
 
ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
-   dbg_qtd("overlay", ehci, (struct ehci_qtd *) >hw_qtd_next);
+   dbg_qtd("overlay", ehci, (struct ehci_qtd *)>hw_qtd_next);
 }
 
 static void __maybe_unused
@@ -491,7 +491,7 @@ static void qh_lines(
(scratch >> 16) & 0x7fff,
scratch,
td->urb,
-   (u32) td->qtd_dma,
+   (u32)td->qtd_dma,
hc32_to_cpup(ehci, >hw_buf[0]));
if (size < temp)
temp = size;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch related to
many leading tabs, removing a 'do while' loop and making use of goto tag 
instead.

Others changes in this patch are:
 - Some multiline statements are reduced (718, 729, 780, 786, 790).
 - A constant is moved to right on line 770.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---

Notes:
Tested by compilation only.

 drivers/usb/host/ehci-dbg.c | 180 ++--
 1 file changed, 88 insertions(+), 92 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 2268756..278333d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
 */
spin_lock_irqsave(>lock, flags);
for (i = 0; i < ehci->periodic_size; i++) {
+   struct ehci_qh_hw *hw;
+
p = ehci->pshadow[i];
if (likely(!p.ptr))
continue;
@@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
size -= temp;
next += temp;
 
-   do {
-   struct ehci_qh_hw *hw;
-
-   switch (hc32_to_cpu(ehci, tag)) {
-   case Q_TYPE_QH:
-   hw = p.qh->hw;
-   temp = scnprintf(next, size, " qh%d-%04x/%p",
-   p.qh->ps.period,
-   hc32_to_cpup(ehci,
-   >hw_info2)
-   /* uframe masks */
-   & (QH_CMASK | QH_SMASK),
-   p.qh);
-   size -= temp;
-   next += temp;
-   /* don't repeat what follows this qh */
-   for (temp = 0; temp < seen_count; temp++) {
-   if (seen[temp].ptr != p.ptr)
+do_loop:
+   switch (hc32_to_cpu(ehci, tag)) {
+   case Q_TYPE_QH:
+   hw = p.qh->hw;
+   temp = scnprintf(next, size, " qh%d-%04x/%p",
+   p.qh->ps.period,
+   hc32_to_cpup(ehci, >hw_info2)
+   /* uframe masks */
+   & (QH_CMASK | QH_SMASK),
+   p.qh);
+   size -= temp;
+   next += temp;
+   /* don't repeat what follows this qh */
+   for (temp = 0; temp < seen_count; temp++) {
+   if (seen[temp].ptr != p.ptr)
+   continue;
+   if (p.qh->qh_next.ptr) {
+   temp = scnprintf(next, size, " ...");
+   size -= temp;
+   next += temp;
+   }
+   break;
+   }
+   /* show more info the first time around */
+   if (temp == seen_count) {
+   u32 scratch = hc32_to_cpup(ehci,
+   >hw_info1);
+   struct ehci_qtd *qtd;
+   char*type = "";
+
+   /* count tds, get ep direction */
+   temp = 0;
+   list_for_each_entry(qtd,
+   >qtd_list,
+   qtd_list) {
+   temp++;
+   switch ((hc32_to_cpu(ehci,
+   qtd->hw_token) >> 8)
+   & 0x03) {
+   case 0:
+   type = "out";
+   continue;
+   case 1:
+   type = "in";
continue;
-   if (p.qh->qh_next.ptr) {
-   temp = scnprintf(next, size,
-   

[PATCH 10/17] usb: host: ehci-dbg: use a blank line after struct declarations

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to missing line after struct declarations.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index a365d9d..4ba577d 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -367,6 +367,7 @@ static const struct file_operations debug_async_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_bandwidth_fops = {
.owner  = THIS_MODULE,
.open   = debug_bandwidth_open,
@@ -374,6 +375,7 @@ static const struct file_operations debug_bandwidth_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_periodic_fops = {
.owner  = THIS_MODULE,
.open   = debug_periodic_open,
@@ -381,6 +383,7 @@ static const struct file_operations debug_periodic_fops = {
.release= debug_close,
.llseek = default_llseek,
 };
+
 static const struct file_operations debug_registers_fops = {
.owner  = THIS_MODULE,
.open   = debug_registers_open,
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/17] usb: host: ehci-dbg: enclose conditional blocks with braces

2016-01-04 Thread Geyslan G. Bem
This patch fixes coding style issues reported by checkpatch concerning
to conditional blocks without braces.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index bf3ec19..7f8ad18 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -491,11 +491,11 @@ static void qh_lines(struct ehci_hcd *ehci, struct 
ehci_qh *qh,
td = list_entry(entry, struct ehci_qtd, qtd_list);
scratch = hc32_to_cpup(ehci, >hw_token);
mark = ' ';
-   if (hw_curr == td->qtd_dma)
+   if (hw_curr == td->qtd_dma) {
mark = '*';
-   else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma))
+   } else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma)) {
mark = '+';
-   else if (QTD_LENGTH(scratch)) {
+   } else if (QTD_LENGTH(scratch)) {
if (td->hw_alt_next == ehci->async->hw->hw_alt_next)
mark = '#';
else if (td->hw_alt_next != list_end)
@@ -772,8 +772,9 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
*buf)
 
if (seen_count < DBG_SCHED_LIMIT)
seen[seen_count++].qh = p.qh;
-   } else
+   } else {
temp = 0;
+   }
tag = Q_NEXT_TYPE(ehci, hw->hw_next);
p = p.qh->qh_next;
break;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 14/17] usb: host: ehci-dbg: replace sizeof operand

2016-01-04 Thread Geyslan G. Bem
This patch fixes a coding style issue reported by checkpatch concerning
to usage of sizeof operand as a variable instead the type.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
---
 drivers/usb/host/ehci-dbg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b9bbac7..bf3ec19 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -996,7 +996,7 @@ static struct debug_buffer *alloc_buffer(struct usb_bus 
*bus,
 {
struct debug_buffer *buf;
 
-   buf = kzalloc(sizeof(struct debug_buffer), GFP_KERNEL);
+   buf = kzalloc(sizeof(*buf), GFP_KERNEL);
 
if (buf) {
buf->bus = bus;
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 09/17] usb: host: ehci-dbg: fix up function definitions

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:00 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> Functions must have the opening brace at the beginning of the next line
>> and body conforming indentation.
>
> This isn't necessary if the function is an empty static inline void
> routine.
Ok. It's more related to style. Let's forget it.

>
> Alan Stern
>
>> This patch also reduces qh_lines() header definition to two lines.
>>
>> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
>> ---
>>  drivers/usb/host/ehci-dbg.c | 44 
>> +---
>>  1 file changed, 29 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index edae79e..a365d9d 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -54,7 +54,9 @@ static void dbg_hcs_params(struct ehci_hcd *ehci, char 
>> *label)
>>  }
>>  #else
>>
>> -static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label) {}
>> +static inline void dbg_hcs_params(struct ehci_hcd *ehci, char *label)
>> +{
>> +}
>>
>>  #endif
>>
>> @@ -94,7 +96,9 @@ static void dbg_hcc_params(struct ehci_hcd *ehci, char 
>> *label)
>>  }
>>  #else
>>
>> -static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label) {}
>> +static inline void dbg_hcc_params(struct ehci_hcd *ehci, char *label)
>> +{
>> +}
>>
>>  #endif
>>
>> @@ -284,23 +288,32 @@ dbg_port_buf(char *buf, unsigned len, const char 
>> *label, int port, u32 status)
>>  #else
>>  static inline void __maybe_unused
>>  dbg_qh(char *label, struct ehci_hcd *ehci, struct ehci_qh *qh)
>> -{}
>> +{
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_status_buf(char *buf, unsigned len, const char *label, u32 status)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_command_buf(char *buf, unsigned len, const char *label, u32 command)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_intr_buf(char *buf, unsigned len, const char *label, u32 enable)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  static inline int __maybe_unused
>>  dbg_port_buf(char *buf, unsigned len, const char *label, int port, u32 
>> status)
>> -{ return 0; }
>> +{
>> + return 0;
>> +}
>>
>>  #endif   /* CONFIG_DYNAMIC_DEBUG */
>>
>> @@ -327,8 +340,13 @@ dbg_port_buf(char *buf, unsigned len, const char 
>> *label, int port, u32 status)
>>
>>  #ifdef STUB_DEBUG_FILES
>>
>> -static inline void create_debug_files(struct ehci_hcd *bus) { }
>> -static inline void remove_debug_files(struct ehci_hcd *bus) { }
>> +static inline void create_debug_files(struct ehci_hcd *bus)
>> +{
>> +}
>> +
>> +static inline void remove_debug_files(struct ehci_hcd *bus)
>> +{
>> +}
>>
>>  #else
>>
>> @@ -404,12 +422,8 @@ static inline char token_mark(struct ehci_hcd *ehci, 
>> __hc32 token)
>>   return '/';
>>  }
>>
>> -static void qh_lines(
>> - struct ehci_hcd *ehci,
>> - struct ehci_qh *qh,
>> - char **nextp,
>> - unsigned *sizep
>> -)
>> +static void qh_lines(struct ehci_hcd *ehci, struct ehci_qh *qh,
>> + char **nextp, unsigned *sizep)
>>  {
>>   u32 scratch;
>>   u32 hw_curr;
>>
>
And about that style? Should be done?



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:52 GMT-03:00 Sergei Shtylyov <sergei.shtyl...@cogentembedded.com>:
> Hello.
>
> On 01/05/2016 12:49 AM, Greg Kroah-Hartman wrote:
>
>>>>> This patch fixes coding style issues reported by checkpatch concerning
>>>>> to unnecessary space after a cast.
>>>>
>>>>
>>>> This is a case where checkpatch is wrong, IMO.  Casts should always be
>>>> followed by a space.  I will not accept this patch.
>>>
>>> Ok. I understand.
>>>
>>>>
>>>> This must be something recently added to checkpatch.  It never used to
>>>> complain about casts, whether they were followed by a space or not.
>>>
>>> I'm using the checkpatch --strict option.
>>
>>
>> Please never use that on existing kernel code, except for
>> drivers/staging/ stuff, otherwise your patches will start to very
>> quickly be ignored.
Good to know. Tks.

>
>
>Just wanted to remind everybody that this option is forced when checking
> the networking code...
Ditto.

>
>> thanks,
>>
>> greg k-h
>
>
> MBR, Sergei
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 08/17] usb: host: ehci-dbg: remove unnecessary space after cast

2016-01-04 Thread Geyslan G. Bem
2016-01-04 17:58 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes coding style issues reported by checkpatch concerning
>> to unnecessary space after a cast.
>
> This is a case where checkpatch is wrong, IMO.  Casts should always be
> followed by a space.  I will not accept this patch.
Ok. I understand.

>
> This must be something recently added to checkpatch.  It never used to
> complain about casts, whether they were followed by a space or not.
I'm using the checkpatch --strict option.

>
> Alan Stern
>
>> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
>> ---
>>  drivers/usb/host/ehci-dbg.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 1645120..edae79e 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -123,7 +123,7 @@ dbg_qh(const char *label, struct ehci_hcd *ehci, struct 
>> ehci_qh *qh)
>>
>>   ehci_dbg(ehci, "%s qh %p n%08x info %x %x qtd %x\n", label,
>>   qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current);
>> - dbg_qtd("overlay", ehci, (struct ehci_qtd *) >hw_qtd_next);
>> + dbg_qtd("overlay", ehci, (struct ehci_qtd *)>hw_qtd_next);
>>  }
>>
>>  static void __maybe_unused
>> @@ -491,7 +491,7 @@ static void qh_lines(
>>   (scratch >> 16) & 0x7fff,
>>   scratch,
>>   td->urb,
>> -         (u32) td->qtd_dma,
>> + (u32)td->qtd_dma,
>>   hc32_to_cpup(ehci, >hw_buf[0]));
>>   if (size < temp)
>>   temp = size;
>>
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 07/17] usb: host: ehci-dbg: fix unsigned comparison

2016-01-04 Thread Geyslan G. Bem
2016-01-04 17:50 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes an unsigned comparison to less than 0.
>
> No, it doesn't.  It changes an unsigned comparison for less than or
> equal to 0, which is very different from less than 0.
You're right. The statemant is incomplete.

>
>> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
>> ---
>>
>> Notes:
>> I'm not sure about that comparison because in qh_lines() temp receives
>> the snprintf() return and thereafter occurs this comparison:
>>
>> if (size < temp)
>>  temp = size;
>>
>> Is it a test of string truncation right? That possibility is being
>> treated. But if after some snprintf returns the temp is exactly size
>> minus 1 (trailing null)? Could this scenario happen? If yes, I think
>> size could be not counting correctly. Let me know more about it.
>
> I think the two weird code sequences in qh_lines() were written before
> scnprintf existed.  They should be changed to use scnprintf instead of
> snprintf; then the "if (size < temp) temp = size;" things can be
> removed.
I see. I can do another patch for that if you allow me.

>
>>  drivers/usb/host/ehci-dbg.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 980ca55..1645120 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -542,7 +542,7 @@ static ssize_t fill_async_buffer(struct debug_buffer 
>> *buf)
>>   next += temp;
>>
>>   list_for_each_entry(qh, >async_unlink, unlink_node) {
>> - if (size <= 0)
>> + if (size == 0)
>>   break;
>>   qh_lines(ehci, qh, , );
>>   }
>
> The new line does exactly the same thing as the old line.  There's no
> reason to make this change.
I think that the original and new logic will be the same because the
size variable has no sign. If in some previous subtraction the
subtracted value is greater than size value, this will spin (rotate),
probably, to a great positive value.

The compiled code will not change indeed. That change was only focused
on the improvement of the code reading. So if you allow me I could
change the commit message. If not let's forget it. :-)

>
> Alan Stern
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 17/17] usb: host: ehci-dbg: refactor fill_periodic_buffer function

2016-01-04 Thread Geyslan G. Bem
2016-01-04 18:01 GMT-03:00 Alan Stern <st...@rowland.harvard.edu>:
> On Mon, 4 Jan 2016, Geyslan G. Bem wrote:
>
>> This patch fixes a coding style issue reported by checkpatch related to
>> many leading tabs, removing a 'do while' loop and making use of goto tag 
>> instead.
>
> This is highly questionable.  It's a big amount of code churn, nearly
> impossible to verify visually, just to remove one level of indentation.
> It also introduces an unnecessary backwards "goto", which seems like a
> bad idea.
After hear you I agree. I saw that others drivers uses similar
structure (fotg210-hcd.c and ohci-dbg.c), but they have less code. It
would be the case in this file of moving code to a new function? If
not, please disregard this patch.

>
> Alan Stern
>
>> Others changes in this patch are:
>>  - Some multiline statements are reduced (718, 729, 780, 786, 790).
>>  - A constant is moved to right on line 770.
>>
>> Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
>> ---
>>
>> Notes:
>> Tested by compilation only.
>>
>>  drivers/usb/host/ehci-dbg.c | 180 
>> ++--
>>  1 file changed, 88 insertions(+), 92 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
>> index 2268756..278333d 100644
>> --- a/drivers/usb/host/ehci-dbg.c
>> +++ b/drivers/usb/host/ehci-dbg.c
>> @@ -698,6 +698,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer 
>> *buf)
>>*/
>>   spin_lock_irqsave(>lock, flags);
>>   for (i = 0; i < ehci->periodic_size; i++) {
>> + struct ehci_qh_hw *hw;
>> +
>>   p = ehci->pshadow[i];
>>   if (likely(!p.ptr))
>>   continue;
>> @@ -707,104 +709,98 @@ static ssize_t fill_periodic_buffer(struct 
>> debug_buffer *buf)
>>   size -= temp;
>>   next += temp;
>>
>> - do {
>> - struct ehci_qh_hw *hw;
>> -
>> - switch (hc32_to_cpu(ehci, tag)) {
>> - case Q_TYPE_QH:
>> - hw = p.qh->hw;
>> - temp = scnprintf(next, size, " qh%d-%04x/%p",
>> - p.qh->ps.period,
>> - hc32_to_cpup(ehci,
>> - >hw_info2)
>> - /* uframe masks */
>> - & (QH_CMASK | 
>> QH_SMASK),
>> - p.qh);
>> - size -= temp;
>> - next += temp;
>> - /* don't repeat what follows this qh */
>> - for (temp = 0; temp < seen_count; temp++) {
>> - if (seen[temp].ptr != p.ptr)
>> +do_loop:
>> + switch (hc32_to_cpu(ehci, tag)) {
>> + case Q_TYPE_QH:
>> + hw = p.qh->hw;
>> + temp = scnprintf(next, size, " qh%d-%04x/%p",
>> + p.qh->ps.period,
>> + hc32_to_cpup(ehci, >hw_info2)
>> + /* uframe masks */
>> + & (QH_CMASK | QH_SMASK),
>> + p.qh);
>> + size -= temp;
>> + next += temp;
>> + /* don't repeat what follows this qh */
>> + for (temp = 0; temp < seen_count; temp++) {
>> + if (seen[temp].ptr != p.ptr)
>> + continue;
>> + if (p.qh->qh_next.ptr) {
>> + temp = scnprintf(next, size, " ...");
>> + size -= temp;
>> + next += temp;
>> + }
>> + break;
>> + }
>> + /* show more info the first time around */
>> + if (temp == seen_count) {
>> + u32 scratch = hc32_to_cpup(ehci,
>> +   

Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-30 Thread Geyslan G. Bem
2015-12-16 8:21 GMT-03:00 Geyslan G. Bem :
> 2015-12-15 21:13 GMT-03:00 Joe Perches :
>> On Tue, 2015-12-15 at 20:58 -0300, Geyslan G. Bem wrote:
>>> 2015-12-10 8:24 GMT-03:00 Geyslan G. Bem :
>>> > Suggested-by: Peter Senna Tschudin 
>>> > Reported-by: Geyslan G. Bem 
>>> >
>>>
>>> Joe, do you applied this patch? If not, would I send it?
>>
>> You can resend, but I believe there are a few more instances
>> of this that might need fixing too.
Only one regex from that list triggered the warning. Patch sent.

>>
>> I don't have perl 5.22 so it's difficult for me to test.
>>
>> Here's a grep with some possible false positives
>> and maybe missing some too.
> Ok, I'll try to trigger them before make the patch.
>
>>
>> $ git grep -n "=[\!~].*{" scripts/checkpatch.pl|grep -vw qr|grep -vP 
>> '{$|{\s*#|\${|\\{|{[\d$]'
>> scripts/checkpatch.pl:1143: $remainder =~ 
>> /^(else)(?:\s|{)/ &&
>> scripts/checkpatch.pl:1233: $stmt =~ s/^\s*{//;
>> scripts/checkpatch.pl:2458: if ($file =~ 
>> m{^(.*?)(?::\d+)+:?$} &&
>> scripts/checkpatch.pl:2802: if ($line =~ 
>> /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
>> scripts/checkpatch.pl:3015: $s =~ s/{.*$//s;
>> scripts/checkpatch.pl:3168: $s =~ s/^\s*{//;
>> scripts/checkpatch.pl:3274: if ($line =~ /^.\s*{/ &&
>> scripts/checkpatch.pl:3282: $fixedline =~ 
>> s/\s*=\s*$/ = {/;
>> scripts/checkpatch.pl:3285: $fixedline =~ 
>> s/^(.\s*){\s*/$1/;
>> scripts/checkpatch.pl:3606: if 
>> (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>> scripts/checkpatch.pl:3613: $fixed_line =~ 
>> /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
>> scripts/checkpatch.pl:3625: if ($line =~ /^.\s*{/ &&
>> scripts/checkpatch.pl:3635: $fixedline =~ 
>> s/^(.\s*){\s*/$1\t/;
>> scripts/checkpatch.pl:4104:##       if ($line =~ 
>> /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
>> scripts/checkpatch.pl:4124: $fixed[$fixlinenr] 
>> =~ s/^(\+.*(?:do|\))){/$1 {/;
>> scripts/checkpatch.pl:4734: $seen++ if 
>> ($block =~ /^\s*{/);
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] checkpatch: fix left brace warning

2015-12-30 Thread Geyslan G. Bem
This patch escapes a regex that uses left brace.

Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped
left brace in regex is deprecated, passed through in regex;"

Comment from regcomp.c in Perl source: "Currently we don't warn when the
lbrace is at the start of a construct. This catches it in the middle of
a literal string, or when it's the first thing after something like
"\b"."

This works as a complement to 4e5d56bd.

Signed-off-by: Geyslan G. Bem 
Suggested-by: Peter Senna Tschudin 
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d4960f7..3e11a30 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4108,7 +4108,7 @@ sub process {
 ## }
 
 #need space before brace following if, while, etc
-   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
$line =~ /do\{/) {
if (ERROR("SPACING",
  "space required before the open brace '{'\n" 
. $herecurr) &&
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-30 Thread Geyslan G. Bem
2015-12-16 8:21 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> 2015-12-15 21:13 GMT-03:00 Joe Perches <j...@perches.com>:
>> On Tue, 2015-12-15 at 20:58 -0300, Geyslan G. Bem wrote:
>>> 2015-12-10 8:24 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>>> > Suggested-by: Peter Senna Tschudin <peter.se...@gmail.com>
>>> > Reported-by: Geyslan G. Bem <geys...@gmail.com>
>>> >
>>>
>>> Joe, do you applied this patch? If not, would I send it?
>>
>> You can resend, but I believe there are a few more instances
>> of this that might need fixing too.
Only one regex from that list triggered the warning. Patch sent.

>>
>> I don't have perl 5.22 so it's difficult for me to test.
>>
>> Here's a grep with some possible false positives
>> and maybe missing some too.
> Ok, I'll try to trigger them before make the patch.
>
>>
>> $ git grep -n "=[\!~].*{" scripts/checkpatch.pl|grep -vw qr|grep -vP 
>> '{$|{\s*#|\${|\\{|{[\d$]'
>> scripts/checkpatch.pl:1143: $remainder =~ 
>> /^(else)(?:\s|{)/ &&
>> scripts/checkpatch.pl:1233: $stmt =~ s/^\s*{//;
>> scripts/checkpatch.pl:2458: if ($file =~ 
>> m{^(.*?)(?::\d+)+:?$} &&
>> scripts/checkpatch.pl:2802: if ($line =~ 
>> /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
>> scripts/checkpatch.pl:3015: $s =~ s/{.*$//s;
>> scripts/checkpatch.pl:3168: $s =~ s/^\s*{//;
>> scripts/checkpatch.pl:3274: if ($line =~ /^.\s*{/ &&
>> scripts/checkpatch.pl:3282: $fixedline =~ 
>> s/\s*=\s*$/ = {/;
>> scripts/checkpatch.pl:3285: $fixedline =~ 
>> s/^(.\s*){\s*/$1/;
>> scripts/checkpatch.pl:3606: if 
>> (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>> scripts/checkpatch.pl:3613: $fixed_line =~ 
>> /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
>> scripts/checkpatch.pl:3625: if ($line =~ /^.\s*{/ &&
>> scripts/checkpatch.pl:3635: $fixedline =~ 
>> s/^(.\s*){\s*/$1\t/;
>> scripts/checkpatch.pl:4104:##   if ($line =~ 
>> /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
>> scripts/checkpatch.pl:4124: $fixed[$fixlinenr] 
>> =~ s/^(\+.*(?:do|\))){/$1 {/;
>> scripts/checkpatch.pl:4734: $seen++ if 
>> ($block =~ /^\s*{/);
>>
>
>
>
> --
> Regards,
>
> Geyslan G. Bem
> hackingbits.com



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] checkpatch: fix left brace warning

2015-12-30 Thread Geyslan G. Bem
This patch escapes a regex that uses left brace.

Using checkpatch.pl with Perl 5.22.0 generates the warning: "Unescaped
left brace in regex is deprecated, passed through in regex;"

Comment from regcomp.c in Perl source: "Currently we don't warn when the
lbrace is at the start of a construct. This catches it in the middle of
a literal string, or when it's the first thing after something like
"\b"."

This works as a complement to 4e5d56bd.

Signed-off-by: Geyslan G. Bem <geys...@gmail.com>
Suggested-by: Peter Senna Tschudin <peter.se...@gmail.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d4960f7..3e11a30 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4108,7 +4108,7 @@ sub process {
 ## }
 
 #need space before brace following if, while, etc
-   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
+   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
$line =~ /do\{/) {
if (ERROR("SPACING",
  "space required before the open brace '{'\n" 
. $herecurr) &&
-- 
2.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH resend 0/9] usb: host: ehci.h cleanup

2015-12-24 Thread Geyslan G. Bem
2015-12-24 13:27 GMT-03:00 Greg Kroah-Hartman :
> On Thu, Dec 24, 2015 at 01:01:36PM -0300, Geyslan G. Bem wrote:
>>
>> 2015-12-11 18:24 GMT-03:00 Geyslan G. Bem :
>>
>> This cleanup was done with the help of checkpatch and coccinelle tools.
>>
>> Geyslan G. Bem (9):
>>   usb: host: ehci.h: remove space before comma
>>   usb: host: ehci.h: remove space before function open parenthesis
>>   usb: host: ehci.h: remove space before open square bracket
>>   usb: host: ehci.h: fix single statement macros
>>   usb: host: ehci.h: remove direct use of __attribute__ keyword
>>   usb: host: ehci.h: use space after comma
>>   usb: host: ehci.h: remove macros trailing semicolon
>>   usb: host: ehci.h: move pointer operator to name side
>>   usb: host: ehci.h: move constant to right
>>
>>  drivers/usb/host/ehci.h | 77
>> +
>>  1 file changed, 39 insertions(+), 38 deletions(-)
>>
>> --
>> 2.6.3
>>
>>
>>
>> Hello,
>>
>> Disturbing eggnogs... :-)
>>
>> This bunch will be applied?
>
> It's way at the bottom of my queue, give me a chance, I'm supposed to be
> on vacation...
Oh man, you deserve that vacation. :-)

>
> don't worry, it's not lost.

Tks greg.
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2015-12-24 Thread Geyslan G. Bem
2015-12-13 13:59 GMT-03:00 Geyslan G. Bem :
>
> Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>
> Geyslan G. Bem (10):
>   usb: host: ehci-sched: refactor scan_isoc function
>   usb: host: ehci-sched: move constants to right
>   usb: host: ehci-sched: remove useless initializations
>   usb: host: ehci-sched: add spaces around operators
>   usb: host: ehci-sched: remove prohibited spaces
>   usb: host: ehci-sched: remove useless else branch
>   usb: host: ehci-sched: use C89-style comments
>   usb: host: ehci-sched: add line after declarations
>   usb: host: ehci-sched: use sizeof operator with parens
>   usb: host: ehci-sched: remove unnecessary braces
>
>  drivers/usb/host/ehci-sched.c | 522 
> +-
>  1 file changed, 261 insertions(+), 261 deletions(-)
>
> --
> 2.6.3
>

Hello,

Disturbing eggnogs... :-)

This bunch will be applied?

-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 00/10] usb: host: ehci-sched: cleanup

2015-12-24 Thread Geyslan G. Bem
2015-12-13 13:59 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>
> Cleanup done with the help of coccinelle, checkpatch and cppcheck tools.
>
> Geyslan G. Bem (10):
>   usb: host: ehci-sched: refactor scan_isoc function
>   usb: host: ehci-sched: move constants to right
>   usb: host: ehci-sched: remove useless initializations
>   usb: host: ehci-sched: add spaces around operators
>   usb: host: ehci-sched: remove prohibited spaces
>   usb: host: ehci-sched: remove useless else branch
>   usb: host: ehci-sched: use C89-style comments
>   usb: host: ehci-sched: add line after declarations
>   usb: host: ehci-sched: use sizeof operator with parens
>   usb: host: ehci-sched: remove unnecessary braces
>
>  drivers/usb/host/ehci-sched.c | 522 
> +-
>  1 file changed, 261 insertions(+), 261 deletions(-)
>
> --
> 2.6.3
>

Hello,

Disturbing eggnogs... :-)

This bunch will be applied?

-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH resend 0/9] usb: host: ehci.h cleanup

2015-12-24 Thread Geyslan G. Bem
2015-12-24 13:27 GMT-03:00 Greg Kroah-Hartman <gre...@linuxfoundation.org>:
> On Thu, Dec 24, 2015 at 01:01:36PM -0300, Geyslan G. Bem wrote:
>>
>> 2015-12-11 18:24 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>>
>> This cleanup was done with the help of checkpatch and coccinelle tools.
>>
>> Geyslan G. Bem (9):
>>   usb: host: ehci.h: remove space before comma
>>   usb: host: ehci.h: remove space before function open parenthesis
>>   usb: host: ehci.h: remove space before open square bracket
>>   usb: host: ehci.h: fix single statement macros
>>   usb: host: ehci.h: remove direct use of __attribute__ keyword
>>   usb: host: ehci.h: use space after comma
>>   usb: host: ehci.h: remove macros trailing semicolon
>>   usb: host: ehci.h: move pointer operator to name side
>>   usb: host: ehci.h: move constant to right
>>
>>  drivers/usb/host/ehci.h | 77
>> +
>>  1 file changed, 39 insertions(+), 38 deletions(-)
>>
>> --
>> 2.6.3
>>
>>
>>
>> Hello,
>>
>> Disturbing eggnogs... :-)
>>
>> This bunch will be applied?
>
> It's way at the bottom of my queue, give me a chance, I'm supposed to be
> on vacation...
Oh man, you deserve that vacation. :-)

>
> don't worry, it's not lost.

Tks greg.
>
> greg k-h



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-16 Thread Geyslan G. Bem
2015-12-15 21:13 GMT-03:00 Joe Perches :
> On Tue, 2015-12-15 at 20:58 -0300, Geyslan G. Bem wrote:
>> 2015-12-10 8:24 GMT-03:00 Geyslan G. Bem :
>> > Suggested-by: Peter Senna Tschudin 
>> > Reported-by: Geyslan G. Bem 
>> >
>>
>> Joe, do you applied this patch? If not, would I send it?
>
> You can resend, but I believe there are a few more instances
> of this that might need fixing too.
>
> I don't have perl 5.22 so it's difficult for me to test.
>
> Here's a grep with some possible false positives
> and maybe missing some too.
Ok, I'll try to trigger them before make the patch.

>
> $ git grep -n "=[\!~].*{" scripts/checkpatch.pl|grep -vw qr|grep -vP 
> '{$|{\s*#|\${|\\{|{[\d$]'
> scripts/checkpatch.pl:1143: $remainder =~ 
> /^(else)(?:\s|{)/ &&
> scripts/checkpatch.pl:1233: $stmt =~ s/^\s*{//;
> scripts/checkpatch.pl:2458: if ($file =~ 
> m{^(.*?)(?::\d+)+:?$} &&
> scripts/checkpatch.pl:2802: if ($line =~ 
> /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
> scripts/checkpatch.pl:3015: $s =~ s/{.*$//s;
> scripts/checkpatch.pl:3168: $s =~ s/^\s*{//;
> scripts/checkpatch.pl:3274: if ($line =~ /^.\s*{/ &&
> scripts/checkpatch.pl:3282: $fixedline =~ 
> s/\s*=\s*$/ = {/;
> scripts/checkpatch.pl:3285: $fixedline =~ 
> s/^(.\s*){\s*/$1/;
> scripts/checkpatch.pl:3606: if 
> (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
> scripts/checkpatch.pl:3613: $fixed_line =~ 
> /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
> scripts/checkpatch.pl:3625: if ($line =~ /^.\s*{/ &&
> scripts/checkpatch.pl:3635: $fixedline =~ 
> s/^(.\s*){\s*/$1\t/;
> scripts/checkpatch.pl:4104:##   if ($line =~ 
> /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
> scripts/checkpatch.pl:4124:     $fixed[$fixlinenr] =~ 
> s/^(\+.*(?:do|\))){/$1 {/;
> scripts/checkpatch.pl:4734: $seen++ if 
> ($block =~ /^\s*{/);
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-16 Thread Geyslan G. Bem
2015-12-15 21:13 GMT-03:00 Joe Perches <j...@perches.com>:
> On Tue, 2015-12-15 at 20:58 -0300, Geyslan G. Bem wrote:
>> 2015-12-10 8:24 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>> > Suggested-by: Peter Senna Tschudin <peter.se...@gmail.com>
>> > Reported-by: Geyslan G. Bem <geys...@gmail.com>
>> >
>>
>> Joe, do you applied this patch? If not, would I send it?
>
> You can resend, but I believe there are a few more instances
> of this that might need fixing too.
>
> I don't have perl 5.22 so it's difficult for me to test.
>
> Here's a grep with some possible false positives
> and maybe missing some too.
Ok, I'll try to trigger them before make the patch.

>
> $ git grep -n "=[\!~].*{" scripts/checkpatch.pl|grep -vw qr|grep -vP 
> '{$|{\s*#|\${|\\{|{[\d$]'
> scripts/checkpatch.pl:1143: $remainder =~ 
> /^(else)(?:\s|{)/ &&
> scripts/checkpatch.pl:1233: $stmt =~ s/^\s*{//;
> scripts/checkpatch.pl:2458: if ($file =~ 
> m{^(.*?)(?::\d+)+:?$} &&
> scripts/checkpatch.pl:2802: if ($line =~ 
> /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
> scripts/checkpatch.pl:3015: $s =~ s/{.*$//s;
> scripts/checkpatch.pl:3168: $s =~ s/^\s*{//;
> scripts/checkpatch.pl:3274: if ($line =~ /^.\s*{/ &&
> scripts/checkpatch.pl:3282: $fixedline =~ 
> s/\s*=\s*$/ = {/;
> scripts/checkpatch.pl:3285: $fixedline =~ 
> s/^(.\s*){\s*/$1/;
> scripts/checkpatch.pl:3606: if 
> (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
> scripts/checkpatch.pl:3613: $fixed_line =~ 
> /(^..*$Type\s*$Ident\(.*\)\s*){(.*)$/;
> scripts/checkpatch.pl:3625: if ($line =~ /^.\s*{/ &&
> scripts/checkpatch.pl:3635: $fixedline =~ 
> s/^(.\s*){\s*/$1\t/;
> scripts/checkpatch.pl:4104:##   if ($line =~ 
> /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
> scripts/checkpatch.pl:4124: $fixed[$fixlinenr] =~ 
> s/^(\+.*(?:do|\))){/$1 {/;
> scripts/checkpatch.pl:4734: $seen++ if 
> ($block =~ /^\s*{/);
>



-- 
Regards,

Geyslan G. Bem
hackingbits.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-15 Thread Geyslan G. Bem
2015-12-10 8:24 GMT-03:00 Geyslan G. Bem :
> 2015-12-09 19:59 GMT-03:00 Geyslan G. Bem :
>>
>>
>> 2015-12-07 20:36 GMT-03:00 Geyslan G. Bem :
>>>
>>> 2015-12-07 20:06 GMT-03:00 Joe Perches :
>>> > On Mon, 2015-12-07 at 19:53 -0300, Geyslan G. Bem wrote:
>>> >> Hello,
>>> >
>>> > hello.
>>> >
>>> >> Follow checkpatch output using perl 5.22.0.
>>> >>
>>> >> geyslan@hb ~/Projects/linux $ scripts/checkpatch.pl -f
>>> >> drivers/usb/host/ehci-hub.c
>>> >> Unescaped left brace in regex is deprecated, passed through in regex;
>>> >> marked by <-- HERE in m/\((?^x:
>>> >>
>>> >
>>> > No HERE here.  Are you using linux-next?
>>> Yep,
>>>
>>> geyslan@hb ~/Projects/linux $ git branch -a
>>> * (HEAD detached from linux-next/master)
>>> ...
>>>
>>> geyslan@hb ~/Projects/linux $ git remote update
>>> Fetching linux
>>> Fetching linux-next
>>> Fetching linux-staging
>>>
>>> >
>>> > There have been patches applied for this warning already.
>>> >
>>> > see:
>>> >
>>> > commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
>>> > Author: Eddie Kovsky 
>>> > Date:   Wed Sep 9 15:37:52 2015 -0700
>>> >
>>> > checkpatch: fix left brace warning
>>> >
>>> > Using checkpatch.pl with Perl 5.22.0 generates the following
>>> > warning:
>>> >
>>> > Unescaped left brace in regex is deprecated, passed through in
>>> > regex;
>>> >  5.
>>>
>>> Indeed. But here the error continues.
>>>
>>> geyslan@hb ~/Projects/linux $ git log 4e5d56bdf892e -1
>>> commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
>>> Author: Eddie Kovsky 
>>> Date:   Wed Sep 9 15:37:52 2015 -0700
>>>
>>> checkpatch: fix left brace warning
>>>
>>> Using checkpatch.pl with Perl 5.22.0 generates the following warning:
>>> ...
>>>
>>> geyslan@hb ~/Projects/linux $ git blame scripts/checkpatch.pl | grep
>>> 4e5d56b
>>> 3599:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 3599) !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>>> 4111:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4111) if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>>> 4112:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4112) $line =~ /do\{/) {
>>> 4589:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4589) $dstat !~ /^\(\{/ &&# ({...
>>>
>>> It missed some regexes, maybe?
>>
>>
>> Joe, I found the culprit (copy & paste, tabs not preserved):
>>
>> geyslan@hb ~/Projects/linux $ git diff
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index d4960f7..3e11a30 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -4108,7 +4108,7 @@ sub process {
>>  ## }
>>
>>  #need space before brace following if, while, etc
>> -   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
>> $line =~ /do\{/) {
>> if (ERROR("SPACING",
>>   "space required before the open brace
>> '{'\n" . $herecurr) &&
>>
> Suggested-by: Peter Senna Tschudin 
> Reported-by: Geyslan G. Bem 
>

Joe, do you applied this patch? If not, would I send it?

Tks.

>>
>>
>> Do you think that these could be other not treated cases?
>>
>> geyslan@hb ~/Projects/linux $ grep "{/" scripts/checkpatch.pl
>> 1233:$stmt =~ s/^\s*{//;
>> 3109:if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) &&
>> $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
>> 3160:    $s =~ s/^\s*{//;
>> 3266:if ($line =~ /^.\s*{/ &&
>> 3274:$fixedline =~ s/\s*=\s*$/ = {/;
>> 3289:if ($path =~ m{//}) {
>> 3300:if ($line =~ m{//}) {
>> 3412:if ($line =~
>> /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
>> 3598:if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
>> 3599:!($

Re: [BUG] checkpatch: unescaped left brace in regex is deprecated

2015-12-15 Thread Geyslan G. Bem
2015-12-10 8:24 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
> 2015-12-09 19:59 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>>
>>
>> 2015-12-07 20:36 GMT-03:00 Geyslan G. Bem <geys...@gmail.com>:
>>>
>>> 2015-12-07 20:06 GMT-03:00 Joe Perches <j...@perches.com>:
>>> > On Mon, 2015-12-07 at 19:53 -0300, Geyslan G. Bem wrote:
>>> >> Hello,
>>> >
>>> > hello.
>>> >
>>> >> Follow checkpatch output using perl 5.22.0.
>>> >>
>>> >> geyslan@hb ~/Projects/linux $ scripts/checkpatch.pl -f
>>> >> drivers/usb/host/ehci-hub.c
>>> >> Unescaped left brace in regex is deprecated, passed through in regex;
>>> >> marked by <-- HERE in m/\((?^x:
>>> >>
>>> >
>>> > No HERE here.  Are you using linux-next?
>>> Yep,
>>>
>>> geyslan@hb ~/Projects/linux $ git branch -a
>>> * (HEAD detached from linux-next/master)
>>> ...
>>>
>>> geyslan@hb ~/Projects/linux $ git remote update
>>> Fetching linux
>>> Fetching linux-next
>>> Fetching linux-staging
>>>
>>> >
>>> > There have been patches applied for this warning already.
>>> >
>>> > see:
>>> >
>>> > commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
>>> > Author: Eddie Kovsky <e...@edkovsky.org>
>>> > Date:   Wed Sep 9 15:37:52 2015 -0700
>>> >
>>> > checkpatch: fix left brace warning
>>> >
>>> > Using checkpatch.pl with Perl 5.22.0 generates the following
>>> > warning:
>>> >
>>> > Unescaped left brace in regex is deprecated, passed through in
>>> > regex;
>>> >  5.
>>>
>>> Indeed. But here the error continues.
>>>
>>> geyslan@hb ~/Projects/linux $ git log 4e5d56bdf892e -1
>>> commit 4e5d56bdf892e18832a6540b63ebf709966bce2a
>>> Author: Eddie Kovsky <e...@edkovsky.org>
>>> Date:   Wed Sep 9 15:37:52 2015 -0700
>>>
>>> checkpatch: fix left brace warning
>>>
>>> Using checkpatch.pl with Perl 5.22.0 generates the following warning:
>>> ...
>>>
>>> geyslan@hb ~/Projects/linux $ git blame scripts/checkpatch.pl | grep
>>> 4e5d56b
>>> 3599:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 3599) !($line=~/\#\s*define.*do\s\{/) and !($line=~/}/)) {
>>> 4111:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4111) if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>>> 4112:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4112) $line =~ /do\{/) {
>>> 4589:4e5d56bdf89 (Eddie Kovsky  2015-09-09 15:37:52 -0700
>>> 4589) $dstat !~ /^\(\{/ &&# ({...
>>>
>>> It missed some regexes, maybe?
>>
>>
>> Joe, I found the culprit (copy & paste, tabs not preserved):
>>
>> geyslan@hb ~/Projects/linux $ git diff
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index d4960f7..3e11a30 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -4108,7 +4108,7 @@ sub process {
>>  ## }
>>
>>  #need space before brace following if, while, etc
>> -   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\){/) ||
>> +   if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
>> $line =~ /do\{/) {
>> if (ERROR("SPACING",
>>   "space required before the open brace
>> '{'\n" . $herecurr) &&
>>
> Suggested-by: Peter Senna Tschudin <peter.se...@gmail.com>
> Reported-by: Geyslan G. Bem <geys...@gmail.com>
>

Joe, do you applied this patch? If not, would I send it?

Tks.

>>
>>
>> Do you think that these could be other not treated cases?
>>
>> geyslan@hb ~/Projects/linux $ grep "{/" scripts/checkpatch.pl
>> 1233:$stmt =~ s/^\s*{//;
>> 3109:if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) &&
>> $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
>> 3160:$s =~ s/^\s*{//;
>> 3266:        if ($line =~ /^.\s*{/ &&
>> 3274:            $fixedline =~ s/\s*=\s*$/ = {/;
>> 3289:if ($path =~ m{//}) {
>> 3300:if ($line =~ m{//}) {
>> 3

  1   2   3   4   5   6   >