---
# System prepended metadata

title: Submitting Patches

---

# Submitting Patches

## Overview

* LF Training
* Configuration
* Signing Commits
* Formatting
* Scripts
* Email (mutt)
* References

## Linux Foundation Training

* free courses
* professional certifications

## Configuration

* no need for .git-credentials
* .gitconfig

The email in `signed-off-by:` tag should match

```bash=
[user]
	name = FirstName LastName
	email = firstname.lastname@mail.com
	signingkey = ABCDEFGHIJKLMNOP 

[format]
	signoff = true
[credential]
	helper = store
```

## Sigining Commits

* `git commit -S -m "commit message..."`
* nice article here from [Github](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits)

## Formatting

* after your change is ready (git add, commit etc.)
* run the command `git format-patch -1`
* you will get something like this `00001-patch-file-name`


sample patch:

```bash=
From c3f2311e4b9e20785f870042ed6ddb3e55d43daf Mon Sep 17 00:00:00 2001
From: FirstName LastName <firstname.lastname@mail.com>
Date: Thu, 15 Apr 2021 15:37:58 +0100
Subject: [PATCH] ACPI: APEI: remove redundant assignment to variable rc

The variable rc is being assigned a value that is never read,
the assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: FirstName LastName <firstname.lastname@mail.com>
---
 drivers/acpi/apei/einj.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 133156759551..328e8aeece6c 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -725,7 +725,6 @@ static int __init einj_init(void)
 		goto err_release;
 	}
 
-	rc = -ENOMEM;
 	einj_param = einj_get_parameter_address();
 	if ((param_extension || acpi5) && einj_param) {
 		debugfs_create_x32("flags", S_IRUSR | S_IWUSR, einj_debug_dir,
-- 
2.31.1
```

## Scripts

* Ok, so before bothering maintainers (they are busy!) let's make sure we are not wasting their time with some built-in tools
* by far the most popular are `scripts/checkpatch.pl` and `scripts/get_maintainer.pl`
* Read through the kernel docs below to become more intimate with the usage

## Email (mutt)

* writing and submitting patches is a bit of an art
* always have a second email to send to for testing
* mutt with [proton](https://account.proton.me/login) is pretty straight forward (below)
* also see python with Titan [here](https://hackmd.io/sCmQtWvYRr2Rs79TYblJrg?view)

.muttrc

```bash=
set ssl_starttls=yes
set ssl_force_tls=yes
set send_charset="us-ascii:utf-8"

set imap_user = "your.email@protonmail.com"
set imap_pass = "proton-bridge-password"

set spoolfile = "imap://localhost:1143/INBOX"
set folder ="imap://localhost:1143/"
set postponed = "imap://localhost:1143/[Protonmail]/Drafts"
set mbox = "imap://localhost:1143/[Protonmail]/All Mail"

set header_cache = "~/.mutt/cache/headers"
set message_cachedir = "~/.mutt/cache/bodies"
set certificate_file = "~/.mutt/certificates"

set smtp_authenticators = "gssapi:login"

# ================  SMTP  ====================
set smtp_url = "smtp://your.user.name@protonmail.com:your-bridge-password@localhost:1025/"

set move = no
set imap_keepalive = 900

# ================  Composition  ====================
set editor = `echo \$EDITOR`
set edit_headers = yes  # See the headers when editing
set charset = UTF-8     # value of $LANG; also fallback for 
send_charset
unset use_domain        # because joe@localhost is just embarrassing
set realname = "Your Name"
set from = "your.user.name@protonmail.com"
set use_from = yes
```

Create the email with `mutt -H 0001-patch-file-name`

Be sure to send it to yourself or a friend to proofread!

Happy patching!

## References

* [Linux Foundation Training](https://training.linuxfoundation.org/training/a-beginners-guide-to-linux-kernel-development-lfd103/)
* [docs](https://docs.kernel.org/index.html)
* [mutt](http://www.mutt.org/)