Skip to contentSkip to conversation

How to create patch for checkpatch.pl cleanups

DISCUSSION kashyap gada 6 participants 11 messages Feb 5, 2012 – Feb 6, 2012 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hello Linux Newbies, I'm one too.
I was looking out for some clean up work and I ran the checkpatch.pl script. I came across a file with some 400 errors and 200 warnings. Now there were bunch of 80 char per line warning , braces and related things. I don't want to be sending patches for each and every error or warning I fix as it becomes tedious and If i send lots of correction patches in one go the kernel maintainers wont accept it. I want to know Can we correct all similar errors or warnings in one patch? or series of patches?

Kashyap Gada gada.kashyap at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120206/414fe5bb/attachment.html

#3 lore raw

How to use /proc

Hello Guys,

I am CS student trying to write a kernel module as a part of my class assignment. I wanted to know, from within kernel, how do I read and write data to my proc file? I need to store state from last call of my function.

Thanks,
Suren Nihalani.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120205/445fe425/attachment.html

#4 lore raw

How to use /proc

Quoted 6 lines · Surenkumar Nihalani

Hello Guys,

I am CS student trying to write a kernel module as a part of my class assignment. I wanted to know, from within kernel, how do I read and write data to my proc file?
I need to store state from last call of my function.

Hello,

Have you tried searching on the internet? :D [1].

Another approach is to see how an existing proc entry is handled. Look for example at /proc/sched_debug [2].

thanks,
Daniel.

[1] http://www.ibm.com/developerworks/linux/library/l-proc/index.html
[2] http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393

#5 lore raw

How to use /proc

Hey Daniel,

Thanks for the quick reply.

The IBM tutorial helps me writing the function for handling user reads and writes to your corresponding proc file. It doesn't help in terms of opening and writing from the kernel side.
the example you provided just creates a proc entry. It doesn't tell me how to write to it.

Please help.

Thanks,
Suren Nihalani.

----- Original Message -----
From: "Daniel Baluta" <[email protected]>
To: "Surenkumar Nihalani" <[email protected]>
Cc: Kernelnewbies at kernelnewbies.org
Sent: Sunday, February 5, 2012 4:20:28 PM
Subject: Re: How to use /proc

Quoted 6 lines · Surenkumar Nihalani

Hello Guys,

I am CS student trying to write a kernel module as a part of my class assignment. I wanted to know, from within kernel, how do I read and write data to my proc file?
I need to store state from last call of my function.

Hello,

Have you tried searching on the internet? :D [1].

Another approach is to see how an existing proc entry is handled. Look for example at /proc/sched_debug [2].

thanks,
Daniel.

[1] http://www.ibm.com/developerworks/linux/library/l-proc/index.html
[2] http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393

#6 lore raw

How to use /proc

Read LDD, there are plenty of examples on using proc interface.

Quoted 41 lines · Surenkumar Nihalani

Hey Daniel,

Thanks for the quick reply.

The IBM tutorial helps me writing the function for handling user reads and writes to your corresponding proc file. It doesn't help in terms of opening and writing from the kernel side.
the example you provided just creates a proc entry. It doesn't tell me how to write to it.

Please help.

Thanks,
Suren Nihalani.

----- Original Message -----
From: "Daniel Baluta" <[email protected]>
To: "Surenkumar Nihalani" <[email protected]>
Cc: Kernelnewbies at kernelnewbies.org
Sent: Sunday, February 5, 2012 4:20:28 PM
Subject: Re: How to use /proc

Quoted 6 lines · Surenkumar Nihalani

Hello Guys,

I am CS student trying to write a kernel module as a part of my class assignment. I wanted to know, from within kernel, how do I read and write data to my proc file?
I need to store state from last call of my function.

Hello,

Have you tried searching on the internet? :D [1].

Another approach is to see how an existing proc entry is handled. Look for example at /proc/sched_debug [2].

thanks,
Daniel.

Quoted 8 lines

[1] http://www.ibm.com/developerworks/linux/library/l-proc/index.html
[2] http://lxr.linux.no/linux+v3.2.4/kernel/sched_debug.c#L393

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120205/457c07c2/attachment.html

#7 lore raw

How to use /proc

In reply to Surenkumar Nihalani

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 8 lines · Surenkumar Nihalani

Hey Daniel,

Thanks for the quick reply.

The IBM tutorial helps me writing the function for handling user reads and writes to your corresponding proc file. It doesn't help in terms of opening and writing from the kernel side. the example you provided just creates a proc entry. It doesn't tell me how to write to it.

You do not write/read proc files from within the kernel, that makes no sense. This is a virtual file, just modify the value that the file is showing.

And please, never create new proc files, unless it really is for process information, use debugfs for "playing around" type things, that is what it is there for.

greg k-h

#8 lore raw
In reply to kashyap gada
Quoted 8 lines · kashyap gada

Hello Linux Newbies, I'm one too. I was looking out for some clean up work and I ran the checkpatch.pl script. I came across a file with some 400 errors and 200 warnings. Now there were bunch of 80 char per line warning , braces and related things. I don't want to be sending patches for each and every error or warning I fix as it becomes tedious and If i send lots of correction patches in one go the kernel maintainers wont accept it. I want to know Can we correct all similar errors or warnings in one patch? or series of patches?

Regarding 80 chars per line issues, people are discussing right now on increasing the limit to 100. See [1].

For the other issues, just send a patch with all the changes. It should be fine since you are modifying one single file.

thanks,
Daniel.

[1] https://lkml.org/lkml/2012/2/5/141

#9 lore raw
Quoted 10 lines · Daniel Baluta
Quoted 8 lines · kashyap gada

Hello Linux Newbies, I'm one too. I was looking out for some clean up work and I ran the checkpatch.pl script. I came across a file with some 400 errors and 200 warnings. Now there were bunch of 80 char per line warning , braces and related things. I don't want to be sending patches for each and every error or warning I fix as it becomes tedious and If i send lots of correction patches in one go the kernel maintainers wont accept it. I want to know Can we correct all similar errors or warnings in one patch? or series of patches?

Quoted 5 lines

Regarding 80 chars per line issues, people are discussing right now on increasing the limit to 100. See [1].

For the other issues, just send a patch with all the changes. It should be fine since you are modifying one single file.

No, please break it up into "one thing per patch" to make it easy to review, otherwise it will be ignored and/or rejected.

Also realize that a lot of subsystem maintainers do not like these types of patches, outside of the drivers/staging/ area, so you might want to ask the subsystem developers if they will take this type of work before you do it.

greg k-h

#10 lore raw

By one thing per patch you mean that I can correct say for example all the 80 char per line warnings in a single file as a patch?

Kashyap Gada

________________________________
From: Greg KH <[email protected]>
To: Daniel Baluta <[email protected]>
Cc: kashyap gada <[email protected]>; "kernelnewbies at kernelnewbies.org" <[email protected]>
Sent: Sunday, 5 February 2012 10:51 PM
Subject: Re: How to create patch for checkpatch.pl cleanups

Quoted 10 lines · Daniel Baluta
Quoted 8 lines · kashyap gada

Hello Linux Newbies, I'm one too. I was looking out for some clean up work and I ran the checkpatch.pl script. I came across a file with some 400 errors and 200 warnings. Now there were bunch of 80 char per line warning , braces and related things. I don't want to be sending patches for each and every error or warning I fix as it becomes tedious and If i send lots of correction patches in one go the kernel maintainers wont accept it. I want to know Can we correct all similar errors or warnings in one patch? or series of patches?

Quoted 5 lines

Regarding 80 chars per line issues, people are discussing right now on increasing the limit to 100. See [1].

For the other issues, just send a patch with all the changes. It should be fine since you are modifying one single file.

No, please break it up into "one thing per patch" to make it easy to review, otherwise it will be ignored and/or rejected.

Also realize that a lot of subsystem maintainers do not like these types of patches, outside of the drivers/staging/ area, so you might want to ask the subsystem developers if they will take this type of work before you do it.

greg k-h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120206/cf27f85d/attachment-0001.html

#11 lore raw

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 2 lines · kashyap gada

By one thing per patch you mean that I can correct say for example all the 80 char per line warnings in a single file as a patch?

Yes.

#12 lore raw
In reply to kashyap gada
Quoted 2 lines · kashyap gada

By one thing per patch you mean that I can correct say for example all the 80 char per line warnings in a single file as a patch?

For beginners, don't even try to work on these warnings - it is far more important to keep the source easily readable (even if these rule is broken) than to adhere some formatting rules.

[ Full-quote deleted ]

Bernd

Signature · 2 lines
Bernd Petrovitsch                  Email : bernd at petrovitsch.priv.at
                     LUGA : http://www.luga.at