linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
@ 2014-03-02 15:01 Yogesh Chaudhari
  2014-03-02 15:14 ` Joe Perches
  2014-03-02 15:20 ` Levente Kurusa
  0 siblings, 2 replies; 8+ messages in thread
From: Yogesh Chaudhari @ 2014-03-02 15:01 UTC (permalink / raw)
  To: LKML; +Cc: joe, apw

Based on the discussion here:
https://lkml.org/lkml/2014/3/2/17

I would like to propose this patch to improve the warning message in
checkpatch.pl.  Comments/Suggestions on possible improvements are
welcome.


=========================================================

This patch modifies scripts/checkpatch.pl to give more detailed
warning message in case printk is used in any patch.

Signed-off-by: Yogesh Chaudhari <mr.yogesh@gmail.com>
---
 scripts/checkpatch.pl | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 464dcef..526f33aa 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2799,7 +2799,10 @@ sub process {
             my $level2 = $level;
             $level2 = "dbg" if ($level eq "debug");
             WARN("PREFER_PR_LEVEL",
-                 "Prefer netdev_$level2(netdev, ... then
dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
$herecurr);
+                 "Order of preference for printing debug messages:
+                 1. [subsystem]_$level2([subsystem]dev, ... eg
netdev_$level2(netdev, ... for netdevice object
+                 2. dev_$level2(dev, ... for drivers with struct device
+                 3. pr_$level(...  to printk(KERN_$orig ...\n" . $herecurr);
         }

         if ($line =~ /\bpr_warning\s*\(/) {





-- 
DREAM IT, CODE IT

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 15:01 [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch Yogesh Chaudhari
@ 2014-03-02 15:14 ` Joe Perches
  2014-03-02 15:20 ` Levente Kurusa
  1 sibling, 0 replies; 8+ messages in thread
From: Joe Perches @ 2014-03-02 15:14 UTC (permalink / raw)
  To: Yogesh Chaudhari; +Cc: LKML, apw

On Sun, 2014-03-02 at 20:31 +0530, Yogesh Chaudhari wrote:
> Based on the discussion here:
> https://lkml.org/lkml/2014/3/2/17
> 
> I would like to propose this patch to improve the warning message in
> checkpatch.pl.  Comments/Suggestions on possible improvements are
> welcome.

Messages are all single line.

This breaks --terse.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
>              WARN("PREFER_PR_LEVEL",
> -                 "Prefer netdev_$level2(netdev, ... then
> dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
> $herecurr);
> +                 "Order of preference for printing debug messages:
> +                 1. [subsystem]_$level2([subsystem]dev, ... eg
> netdev_$level2(netdev, ... for netdevice object
> +                 2. dev_$level2(dev, ... for drivers with struct device
> +                 3. pr_$level(...  to printk(KERN_$orig ...\n" . $herecurr);
>          }



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 15:01 [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch Yogesh Chaudhari
  2014-03-02 15:14 ` Joe Perches
@ 2014-03-02 15:20 ` Levente Kurusa
       [not found]   ` <CAAOfnZqjVn5_aTU3fQQmOF8MqOb5NqXS5Yg4gb-Sec+Qm_0dEQ@mail.gmail.com>
  2014-03-02 15:40   ` Joe Perches
  1 sibling, 2 replies; 8+ messages in thread
From: Levente Kurusa @ 2014-03-02 15:20 UTC (permalink / raw)
  To: Yogesh Chaudhari, LKML; +Cc: joe, apw

Hi,

On 03/02/2014 04:01 PM, Yogesh Chaudhari wrote:
> Based on the discussion here:
> https://lkml.org/lkml/2014/3/2/17
> 
> I would like to propose this patch to improve the warning message in
> checkpatch.pl.  Comments/Suggestions on possible improvements are
> welcome.
> 
> 
> =========================================================
> 
> This patch modifies scripts/checkpatch.pl to give more detailed
> warning message in case printk is used in any patch.
> 
> Signed-off-by: Yogesh Chaudhari <mr.yogesh@gmail.com>
> ---
>  scripts/checkpatch.pl | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 464dcef..526f33aa 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2799,7 +2799,10 @@ sub process {
>              my $level2 = $level;
>              $level2 = "dbg" if ($level eq "debug");
>              WARN("PREFER_PR_LEVEL",
> -                 "Prefer netdev_$level2(netdev, ... then
> dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
> $herecurr);

Whoops, that's a word-wrap!
Try using git-format-patch+git-send-email to send the patch.

> +                 "Order of preference for printing debug messages:
> +                 1. [subsystem]_$level2([subsystem]dev, ... eg
> netdev_$level2(netdev, ... for netdevice object
> +                 2. dev_$level2(dev, ... for drivers with struct device
> +                 3. pr_$level(...  to printk(KERN_$orig ...\n" . $herecurr);
>          }
> 
>          if ($line =~ /\bpr_warning\s*\(/) {
> 

IMHO, this message is too big. The one we already have is nice and clean.
I would simply do: s/netdev/[subsystem]/ or something among the lines.


-- 
Regards,
Levente Kurusa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
       [not found]   ` <CAAOfnZqjVn5_aTU3fQQmOF8MqOb5NqXS5Yg4gb-Sec+Qm_0dEQ@mail.gmail.com>
@ 2014-03-02 15:34     ` Levente Kurusa
  0 siblings, 0 replies; 8+ messages in thread
From: Levente Kurusa @ 2014-03-02 15:34 UTC (permalink / raw)
  To: Yogesh Chaudhari; +Cc: LKML, Joe Perches

Hi,

[+CC LKML, Joe]
[Leaving full copy for LKML, Joe]

On 03/02/2014 04:29 PM, Yogesh Chaudhari wrote:
> On 2 March 2014 20:50, Levente Kurusa <levex@linux.com> wrote:
>> Hi,
>>
>> On 03/02/2014 04:01 PM, Yogesh Chaudhari wrote:
>>> Based on the discussion here:
>>> https://lkml.org/lkml/2014/3/2/17
>>>
>>> I would like to propose this patch to improve the warning message in
>>> checkpatch.pl.  Comments/Suggestions on possible improvements are
>>> welcome.
>>>
>>>
>>> =========================================================
>>>
>>> This patch modifies scripts/checkpatch.pl to give more detailed
>>> warning message in case printk is used in any patch.
>>>
>>> Signed-off-by: Yogesh Chaudhari <mr.yogesh@gmail.com>
>>> ---
>>>  scripts/checkpatch.pl | 5 ++++-
>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>>> index 464dcef..526f33aa 100755
>>> --- a/scripts/checkpatch.pl
>>> +++ b/scripts/checkpatch.pl
>>> @@ -2799,7 +2799,10 @@ sub process {
>>>              my $level2 = $level;
>>>              $level2 = "dbg" if ($level eq "debug");
>>>              WARN("PREFER_PR_LEVEL",
>>> -                 "Prefer netdev_$level2(netdev, ... then
>>> dev_$level2(dev, ... then pr_$level(...  to printk(KERN_$orig ...\n" .
>>> $herecurr);
>>
>> Whoops, that's a word-wrap!
>> Try using git-format-patch+git-send-email to send the patch.
> Ack, my bad, I will make this change.
> 
>>
>>> +                 "Order of preference for printing debug messages:
>>> +                 1. [subsystem]_$level2([subsystem]dev, ... eg
>>> netdev_$level2(netdev, ... for netdevice object
>>> +                 2. dev_$level2(dev, ... for drivers with struct device
>>> +                 3. pr_$level(...  to printk(KERN_$orig ...\n" . $herecurr);
>>>          }
>>>
>>>          if ($line =~ /\bpr_warning\s*\(/) {
>>>
>>
>> IMHO, this message is too big. The one we already have is nice and clean.
>> I would simply do: s/netdev/[subsystem]/ or something among the lines.
> 
> Seems proper way to go about. I agree that this makes it a bit too
> long, however, I was wondering, if there is a detailed
> documentation/information file about checkpatch (or patching in
> general where a detailed message would be accurate). Particularly,
> where we can make a note of proper way of using such debug calls.

Yes there is. Documentation/CodingStyle#Chapter13 is where you should
do stuff like that.

-- 
Regards,
Levente Kurusa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 15:20 ` Levente Kurusa
       [not found]   ` <CAAOfnZqjVn5_aTU3fQQmOF8MqOb5NqXS5Yg4gb-Sec+Qm_0dEQ@mail.gmail.com>
@ 2014-03-02 15:40   ` Joe Perches
  2014-03-02 15:49     ` Levente Kurusa
  1 sibling, 1 reply; 8+ messages in thread
From: Joe Perches @ 2014-03-02 15:40 UTC (permalink / raw)
  To: Levente Kurusa; +Cc: Yogesh Chaudhari, LKML, apw

On Sun, 2014-03-02 at 16:20 +0100, Levente Kurusa wrote:
> IMHO, this message is too big. The one we already have is nice and clean.
> I would simply do: s/netdev/[subsystem]/ or something among the lines.

maybe:

"Prefer [subsystem eg: netdev]_$level2 then dev_$level2 then pr_$level to printk(KERN_$orig ...\n"

or reference the stackoverflow link


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 15:40   ` Joe Perches
@ 2014-03-02 15:49     ` Levente Kurusa
  2014-03-02 16:21       ` Yogesh Chaudhari
  0 siblings, 1 reply; 8+ messages in thread
From: Levente Kurusa @ 2014-03-02 15:49 UTC (permalink / raw)
  To: Joe Perches; +Cc: Yogesh Chaudhari, LKML, Robo Bot

Hi,

2014-03-02 16:40 GMT+01:00 Joe Perches <joe@perches.com>:
> On Sun, 2014-03-02 at 16:20 +0100, Levente Kurusa wrote:
>> IMHO, this message is too big. The one we already have is nice and clean.
>> I would simply do: s/netdev/[subsystem]/ or something among the lines.
>
> maybe:
>
> "Prefer [subsystem eg: netdev]_$level2 then dev_$level2 then pr_$level to printk(KERN_$orig ...\n"

Excellent, that looks the best and combines the best of two worlds.

>
> or reference the stackoverflow link
>

And what if that disappears? Might as well write this to
Documentation/CodingStyle
as I have previously mentioned. Yogesh, you want to do this or should I?

--
Regards,
Levente Kurusa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 15:49     ` Levente Kurusa
@ 2014-03-02 16:21       ` Yogesh Chaudhari
  2014-03-02 18:54         ` Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Yogesh Chaudhari @ 2014-03-02 16:21 UTC (permalink / raw)
  To: Levente Kurusa; +Cc: Joe Perches, LKML, Robo Bot

On 2 March 2014 21:19, Levente Kurusa <levex@linux.com> wrote:
> Hi,
>
> 2014-03-02 16:40 GMT+01:00 Joe Perches <joe@perches.com>:
>> On Sun, 2014-03-02 at 16:20 +0100, Levente Kurusa wrote:
>>> IMHO, this message is too big. The one we already have is nice and clean.
>>> I would simply do: s/netdev/[subsystem]/ or something among the lines.
>>
>> maybe:
>>
>> "Prefer [subsystem eg: netdev]_$level2 then dev_$level2 then pr_$level to printk(KERN_$orig ...\n"
>
> Excellent, that looks the best and combines the best of two worlds.
>
>>
>> or reference the stackoverflow link
>>
>
> And what if that disappears? Might as well write this to
> Documentation/CodingStyle
> as I have previously mentioned. Yogesh, you want to do this or should I?

I will send in a new patch with both the script file and the
documentation modifications.

>
> --
> Regards,
> Levente Kurusa


Regards
Yogesh

-- 
DREAM IT, CODE IT

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch
  2014-03-02 16:21       ` Yogesh Chaudhari
@ 2014-03-02 18:54         ` Joe Perches
  0 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2014-03-02 18:54 UTC (permalink / raw)
  To: Yogesh Chaudhari; +Cc: Levente Kurusa, LKML, Robo Bot

On Sun, 2014-03-02 at 21:51 +0530, Yogesh Chaudhari wrote:
> I will send in a new patch with both the script file and the
> documentation modifications.

Separate patches please.
Changes to CodingStyle generally bring another
round of comments.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-02 18:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-02 15:01 [PATCH 1/1] scripts/checkpatch.pl: to give more detailed warning message in case printk is used in any patch Yogesh Chaudhari
2014-03-02 15:14 ` Joe Perches
2014-03-02 15:20 ` Levente Kurusa
     [not found]   ` <CAAOfnZqjVn5_aTU3fQQmOF8MqOb5NqXS5Yg4gb-Sec+Qm_0dEQ@mail.gmail.com>
2014-03-02 15:34     ` Levente Kurusa
2014-03-02 15:40   ` Joe Perches
2014-03-02 15:49     ` Levente Kurusa
2014-03-02 16:21       ` Yogesh Chaudhari
2014-03-02 18:54         ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).