*Patches should also be test merged against the <tt>upstream-sfr.git</tt> repository on branch <tt>mips-linux-next</tt>.

+

*Finally, if any of your patches touch files outside the <tt>arch/mips</tt> directory, do a kernel build of any x86 architecture to make sure nothing gets broke from your patches.

== Subject ==

== Subject ==

−

+

Each patch should have a subject that concisely describes the patch which the email contains.

−

* The email's Subject: should concisely describe the patch which that email contains. The Subject: should not be a filename. Do not use the same Subject: for every patch in a whole patch series.<p>Bear in mind that the Subject: of your email becomes a globally-unique identifier for that patch. It propagates all the way into BitKeeper. The Subject: may later be used in developer discussions which refer to the patch. People will want to google for the patch's Subject: to read discussion regarding that patch.

+

*It should not contain any filenames.

−

* When sending a series of patches, the patches should be sequence-numbered in the Subject:

+

*Do not use the same subject for every patch in a patch series. Bear in mind that the subject of your email becomes a globally-unique identifier for that patch. It will propagate all the way into Linus' git tree. The subject may later be used in developer discussions which refer to the patch and people will want the ability to Google for the patch's subject.

−

* It is nice if the Subject: includes mention of the subsystem which it affects. See example below.

+

*When sending a series of patches, the patches should be sequence numbered in the subject. Using <tt>git format-patch -X --cover-letter -o patches</tt>, where <tt>-X</tt> is the number of patches from HEAD or other commit identifier and <tt>-o</tt> specifies the output directory, will do all of this automatically. A cover letter file with subject of <tt>PATCH [0/X]</tt> where <tt>X</tt> is the total number of patches in the series, will be generated. You can then edit this file with a general top-level subject and give a detailed explanation of the patch series.

*It is nice if the subject includes mention of the subsystem which it affects like the following:<p><code>[PATCH 2/5] ext2: improve scalability of bitmap searching</code></p>

−

* Note that various people's patch receiving scripts will strip away Subject: text which is inside brackets []. So you should place information which has no long-term relevance to the patch inside brackets. This includes the word "patch" and any sequence numbering. The subsystem identifier ("ext2:") should hence be outside brackets.

+

*Various patch scripts used by developers will strip away any text inside brackets []. You should place information which has no long-term relevance to the patch inside them. This includes the word <code>PATCH</code> and any sequence numbering. The subsystem identifier <code>ext2</code> should hence be outside brackets.

== Changelog ==

== Changelog ==

+

Bear in mind that the changelog will also propagate all the way to Linus' tree. The changelog must describe the patch fully.

+

*Here are some guidelines for changelog content:

+

**Why the kernel needed patching.

+

**What the overall design approach in the patch was.

+

**Implementation details.

+

**Any testing results.

+

*There is no point in mentioning what version of the kernel the patch applies to. This is not interesting information as once the patch is in git, it will probably be merged into a later kernel version than the one which you wrote it for anyway.

+

*Do not refer to earlier patches in the changelog of a new version of a patch. It is not very useful to have a git changelog which says "OK, this fixes the things you mentioned yesterday". Each iteration of the patch should contain a standalone changelog.

+

*Add a Signed-off-by: line with your name and email address. If you are the person responsible for submitting patches for your group or company, you may have multiple Signed-off-by lines.

−

* Bear in mind that the Subject: and changelog which you provide will propagate all the way into the permanent kernel record. Other developers will want to read and understand your patch and changelog years in the future. So the changelog should describe the patch fully:

+

== Patch ==

−

:* why the kernel needed patching

+

All patches should be generated using the <code>git format-patch</code> command. No exceptions.

−

:* the overall design approach in the patch

+

−

:* implementation details

+

−

:* testing results

+

−

* Don't bother mentioning what version of the kernel the patch applies to ("applies to 2.6.8-rc1"). This is not interesting information - once the patch is in bitkeeper, of _course_ it applied, and it'll probably be merged into a later kernel than the one which you wrote it for.

+

−

* Do not refer to earlier patches when changelogging a new version of a patch. It's not very useful to have a bitkeeper changelog which says "OK, this fixes the things you mentioned yesterday". Each iteration of the patch should contain a standalone changelog. This implies that you need a patch management system which maintains changelogs. See below.

+

−

* Add a Signed-off-by: line.

+

−

* Most people's patch receiving scripts will treat a ^--- string as the separator between the changelog and the patch itself. You can use this to ensure that any diffstat information is discarded when the patch is applied:

+

−

<pre>

+

== Sending ==

−

Another few #if/#ifdef cleanups, this time for the PPC architecture.

+

Patches are submitted via email only. Please read [[Mailing-patches]] for instructions once you have completed formatting your patches with git.

−

Signed-off-by: <valdis.kletnieks@vt.edu>

+

== Credits ==

−

Signed-off-by: Andrew Morton <akpm@osdl.org>

+

This article is derived from Andrew Morton's article at http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt.

−

---

+

−

+

−

25-akpm/arch/ppc/kernel/process.c | 2 +-

+

−

25-akpm/arch/ppc/platforms/85xx/mpc85xx_cds_common.c | 2 +-

+

−

25-akpm/arch/ppc/syslib/ppc85xx_setup.c | 4 ++--

+

−

3 files changed, 4 insertions(+), 4 deletions(-)

+

−

+

−

--- 25/arch/ppc/kernel/process.c

+

−

+++ 25/arch/ppc/kernel/process.c

+

−

@@ -667,7 +667,7 @@ void show_stack(struct task_struct *tsk,

+

−

</pre>

+

−

+

−

== The diff ==

+

−

+

−

* Patches should be in `patch -p1' form:

+

−

--- a/kernel/sched.c

+

−

+++ b/kernel/sched.c

+

−

* Make sure that your patches apply to the latest version of the kernel tree. Either straight from bitkeeper or from ftp://ftp.kernel.org/pub/linux/kernel/v2.6/snapshots/

+

−

*When raising patches for -mm it's generally best to base them on the latest Linus tree. I'll work out any rejects/incompatibilities. There are of course exceptions to this.

+

−

*Ensure that your patch does not add new trailing whitespace. The below script will fix up your patch by stripping off such whitespace.

+

−

<pre>

+

−

#!/bin/sh

+

−

+

−

strip1()

+

−

{

+

−

TMP=$(mktemp /tmp/XXXXXX)

+

−

cp $1 $TMP

+

−

sed -e '/^+/s/[ ]*$//' < $TMP > $1

+

−

rm $TMP

+

−

}

+

−

+

−

for i in $*

+

−

do

+

−

strip1 $i

+

−

done</pre>

+

−

+

−

== Overall ==

+

−

+

−

# Avoid MIME and attachements if possible. Make sure that your email client does not wordwrap your patch. Make sure that your email client does not replace tabs with spaces.

+

−

# Mail yourself a decent-sized patch and check that it still applies.

+

−

+

−

The patch management scripts at http://www.zip.com.au/~akpm/linux/patches/ implement all of the above.

+

−

The patch management tools at https://savannah.nongnu.org/projects/quilt/ also implement all of the above.

+

== Tools ==

+

* The patch management scripts at http://www.zip.com.au/~akpm/linux/patches/ implement all of the above.

+

* The patch management tools at https://savannah.nongnu.org/projects/quilt/ also implement all of the above.

Latest revision as of 19:36, 6 September 2012

This article is meant to help people to describe how to create, maintain and send patches that are easy to handle for the kernel maintainers.

Patches should also be test merged against the upstream-sfr.git repository on branch mips-linux-next.

Finally, if any of your patches touch files outside the arch/mips directory, do a kernel build of any x86 architecture to make sure nothing gets broke from your patches.

Subject

Each patch should have a subject that concisely describes the patch which the email contains.

It should not contain any filenames.

Do not use the same subject for every patch in a patch series. Bear in mind that the subject of your email becomes a globally-unique identifier for that patch. It will propagate all the way into Linus' git tree. The subject may later be used in developer discussions which refer to the patch and people will want the ability to Google for the patch's subject.

When sending a series of patches, the patches should be sequence numbered in the subject. Using git format-patch -X --cover-letter -o patches, where -X is the number of patches from HEAD or other commit identifier and -o specifies the output directory, will do all of this automatically. A cover letter file with subject of PATCH [0/X] where X is the total number of patches in the series, will be generated. You can then edit this file with a general top-level subject and give a detailed explanation of the patch series.

It is nice if the subject includes mention of the subsystem which it affects like the following:

[PATCH 2/5] ext2: improve scalability of bitmap searching

Various patch scripts used by developers will strip away any text inside brackets []. You should place information which has no long-term relevance to the patch inside them. This includes the word PATCH and any sequence numbering. The subsystem identifier ext2 should hence be outside brackets.

Changelog

Bear in mind that the changelog will also propagate all the way to Linus' tree. The changelog must describe the patch fully.

Here are some guidelines for changelog content:

Why the kernel needed patching.

What the overall design approach in the patch was.

Implementation details.

Any testing results.

There is no point in mentioning what version of the kernel the patch applies to. This is not interesting information as once the patch is in git, it will probably be merged into a later kernel version than the one which you wrote it for anyway.

Do not refer to earlier patches in the changelog of a new version of a patch. It is not very useful to have a git changelog which says "OK, this fixes the things you mentioned yesterday". Each iteration of the patch should contain a standalone changelog.

Add a Signed-off-by: line with your name and email address. If you are the person responsible for submitting patches for your group or company, you may have multiple Signed-off-by lines.

Patch

All patches should be generated using the git format-patch command. No exceptions.

Sending

Patches are submitted via email only. Please read Mailing-patches for instructions once you have completed formatting your patches with git.