DEV Community

moonlitpath
moonlitpath

Posted on

Submitting My First Linux Kernel Patch for GSoC 2026 — The Real, Messy Process

A short introduction about me:
Hey! I'm Anushka. I'm a UG college student, majoring in Information Technology, from India. I absolutely love learning about how systems work under the hood, and contributing to the Linux Kernel is a dream of mine.

This year, I am applying to GSoC, specifically the Project under Device Tree Bindings, which involves converting Device Tree Bindings to DT Schema.
One of the prerequisites is to create a small patch that fixes a trivial issue in drivers/staging. So, in this post, I am documenting my process of doing exactly that.


This patch was about fixing formatting issues given by checkpatch.pl


Steps to find an issue and submit a patch

script to find files have formatting issues within drivers/staging

checkpatch.pl is a super useful script, found within the /scripts folder, that patches or code files for style violations and, in some cases, functional issues.
It categorizes issues into -

  • ERROR (strict, must fix)
  • WARNING (requires review)
  • CHECK (mild/stylistic) levels

script:

find ./drivers/staging/ -name '*.c' | xargs ./scripts/checkpatch.pl -f
Enter fullscreen mode Exit fullscreen mode

script to check formatting within just 1 file

./scripts/checkpatch.pl --strict -f drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
Enter fullscreen mode Exit fullscreen mode

the output i got

./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
--------------------------------------------------------------------------
ERROR: open brace '{' following function definitions go on the next line
#48: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:48:
+int
+sh_css_vf_downscale_log2(
+    const struct ia_css_frame_info *out_info,
+    const struct ia_css_frame_info *vf_info,
+    unsigned int *downscale_log2) {

WARNING: please, no spaces at the start of a line
#50: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:50:
+    const struct ia_css_frame_info *out_info,$

WARNING: please, no spaces at the start of a line
#51: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:51:
+    const struct ia_css_frame_info *vf_info,$

WARNING: please, no spaces at the start of a line
#52: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:52:
+    unsigned int *downscale_log2) {$

WARNING: Block comments should align the * on each line
#65: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:65:
+   /* downscale until width smaller than the viewfinder width. We don't
+   * test for the height since the vmem buffers only put restrictions on

ERROR: that open brace { should be on the previous line
#68: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:68:
+   while (out_width >= vf_info->res.width)
+   {

ERROR: open brace '{' following function definitions go on the next line
#83: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:83:
+static int
+configure_kernel(
+    const struct ia_css_binary_info *info,
+    const struct ia_css_frame_info *out_info,
+    const struct ia_css_frame_info *vf_info,
+    unsigned int *downscale_log2,
+    struct ia_css_vf_configuration *config) {

WARNING: please, no spaces at the start of a line
#85: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:85:
+    const struct ia_css_binary_info *info,$

WARNING: please, no spaces at the start of a line
#86: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:86:
+    const struct ia_css_frame_info *out_info,$

WARNING: please, no spaces at the start of a line
#87: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:87:
+    const struct ia_css_frame_info *vf_info,$

WARNING: please, no spaces at the start of a line
#88: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:88:
+    unsigned int *downscale_log2,$

WARNING: please, no spaces at the start of a line
#89: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:89:
+    struct ia_css_vf_configuration *config) {$

WARNING: please, no spaces at the start of a line
#109: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:109:
+    struct ia_css_vf_configuration *config,$

WARNING: please, no spaces at the start of a line
#110: FILE: ./drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c:110:
+    const struct ia_css_frame_info *vf_info)$

total: 3 errors, 11 warnings, 134 lines checked

Enter fullscreen mode Exit fullscreen mode

My Mistake:

I saw multiple types of issues and fixed all of them, which turned out to be my first mistake. Thus, my patch was rejected by my mentor.

The issues I fixed were all of different types as you can see above.

One commit should fix only one type of issue.
Fix either whitespace issue, or braces issue. Don't fix all issues in one file.

I had also mailed my patch as a regular Gmail attachment, which was wrong. The Linux Kernel Community requires patches sent via git send-email, which preserves the patch formatting as raw plain text, regular email clients can corrupt whitespace and formatting
You can configure thunderbird to send mails in plain text, and send patches using git send-mail

So, I fixed only the brace placement issue for functions and while loop this time.

After fixing, you have to stage it

git add drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
Enter fullscreen mode Exit fullscreen mode

Then we commit the file

git commit -s
Enter fullscreen mode Exit fullscreen mode

-s means signed by

inside git commit, write this message

  1. title --- subsystem name and issue fixed
  2. short description of issues fixed
  3. signed off by
    staging: atomisp: vf_1.0: fix open brace placement

    Fix open brace placement on function definitions and control statements to comply with kernel coding style.

    Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>
Enter fullscreen mode Exit fullscreen mode

now we make a patch

$ git format-patch -1

0001-staging-atomisp-vf_1.0-fix-open-brace-placement.patch
Enter fullscreen mode Exit fullscreen mode

check the patch with checkpatch one last time

./scripts/checkpatch.pl --strict 0001-*.patch
Enter fullscreen mode Exit fullscreen mode

after checking the patch, the next step is to mail the patch to the maintainers.

in order to find the maintainers of a file, there is a handy script called get-maintainer.pl

this is how i found maintainers for my file

./scripts/get_maintainer.pl -f drivers/staging/media/atomisp/pci/isp/kernels/vf/vf_1.0/ia_css_vf.host.c
Enter fullscreen mode Exit fullscreen mode

note the name and mail of maintainers

to mail, this is the format:

git send-email --to=email1@gmail.com --cc=email2.gmail.com 0001-your-patch-name.patch
Enter fullscreen mode Exit fullscreen mode

add all maintainers to --cc when you mail them

After I created my new patch that fixed just 1 issue cleanly and sent my patch to be reviewed by my mentors, it was approved by them. So, I sent it to the kernel community


Extra -- aka just me screaming my head off

[23-03-26 15:03:34]
THIS IS MY FIRST EMAIL TO THE COMMUNITY!!!! OMGGGGG

anu@laptop:~/kernel-dev/source/linux$ git send-email 0001-staging-atomisp-vf_1.0-fix-open-brace-placement.patch \
  --to=hansg@kernel.org \
  --to=mchehab@kernel.org \
  --to=gregkh@linuxfoundation.org \
  --cc=andy@kernel.org \
  --cc=sakari.ailus@linux.intel.com \
  --cc=linux-media@vger.kernel.org \
  --cc=linux-staging@lists.linux.dev
0001-staging-atomisp-vf_1.0-fix-open-brace-placement.patch

(mbox) Adding cc: Anushka Badhe <anushkabadhe@gmail.com> from line 'From: Anushka Badhe <anushkabadhe@gmail.com>'
(body) Adding cc: Anushka Badhe <anushkabadhe@gmail.com> from line 'Signed-off-by: Anushka Badhe <anushkabadhe@gmail.com>'

From: Anushka Badhe <anushkabadhe@gmail.com>
To: hansg@kernel.org,
    mchehab@kernel.org,
    gregkh@linuxfoundation.org
Cc: andy@kernel.org,
    sakari.ailus@linux.intel.com,
    linux-media@vger.kernel.org,
    linux-staging@lists.linux.dev,
    Anushka Badhe <anushkabadhe@gmail.com>
Subject: [PATCH] staging: atomisp: vf_1.0: fix open brace placement
Date: Mon, 23 Mar 2026 15:00:24 +0530
Message-ID: <20260323093024.38704-1-anushkabadhe@gmail.com>
X-Mailer: git-send-email 2.43.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

    The Cc list above has been expanded by additional
    addresses found in the patch commit message. By default
    send-email prompts before sending whenever this occurs.
    This behavior is controlled by the sendemail.confirm
    configuration setting.

    For additional information, run 'git send-email --help'.
    To retain the current behavior, but squelch this message,
    run 'git config --global sendemail.confirm auto'.

Send this email? ([y]es|[n]o|[e]dit|[q]uit|[a]ll): y
OK. Log says:
Sendmail: /usr/sbin/sendmail -i hansg@kernel.org mchehab@kernel.org gregkh@linuxfoundation.org andy@kernel.org sakari.ailus@linux.intel.com linux-media@vger.kernel.org linux-staging@lists.linux.dev anushkabadhe@gmail.com
From: Anushka Badhe <anushkabadhe@gmail.com>
To: hansg@kernel.org,
    mchehab@kernel.org,
    gregkh@linuxfoundation.org
Cc: andy@kernel.org,
    sakari.ailus@linux.intel.com,
    linux-media@vger.kernel.org,
    linux-staging@lists.linux.dev,
    Anushka Badhe <anushkabadhe@gmail.com>
Subject: [PATCH] staging: atomisp: vf_1.0: fix open brace placement
Date: Mon, 23 Mar 2026 15:00:24 +0530
Message-ID: <20260323093024.38704-1-anushkabadhe@gmail.com>
X-Mailer: git-send-email 2.43.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

Result: OK
Enter fullscreen mode Exit fullscreen mode

[23-03-26 15:09:10]
AAAAHHHHHHHHHHHH
safj;esfeas;gnaeg;jeagneianaerijgnlk;lnsdpkfpegflefm
I can see my patch on the lkml!!!!
https://lore.kernel.org/linux-media/20260323093024.38704-1-anushkabadhe@gmail.com/T/#Z2e.:..:20260323093024.38704-1-anushkabadhe::40gmail.com:1atomisp:pci:isp:kernels:vf:vf_1.0:ia_css_vf.host.c


[23-03-26 15:31:30]
I GOT A REPLY!!
Dan Carpenter replied to my patch!!
On Mon, Mar 23, 2026 at 03:00:24PM +0530, Anushka Badhe wrote:

Fix open brace placement on function definitions and control statements to comply with kernel coding style.

Line wrap your commit message at 74 characters. Also run your
patches through checkpatch.pl. (Ignore the space character
warning since that was there in the original code).

regards,
dan carpenter

Mistake
My commit message is over 73 characters...
this like was the issue..
Fix open brace placement on function definitions and control statements to comply with kernel coding style.

i have to split message so there are under 73 chars per line

I edited the commit message line and sent it again again
How I did that:

changing commit message:

git commit --amend
Enter fullscreen mode Exit fullscreen mode

edit the commit message so it follows the commit message.

send the mail, replying to the message.
Find the patch in lore.kernel.org, and go to the reply button, you can see

[23-02-26 04:29:52]
OMG! OMGGGGGG! OMGGG!!!!

all mails

he approved it!!!!!!! He actually approved it!!!!!
OMGGGGGGGG!!!!!! AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaAAA!!!!!!!!!!!!

[16:50:20]
I got a reply from Andy Shevchenko

Enter fullscreen mode Exit fullscreen mode

awwh, I feel a bit disappointed, but honestly I'm still very happy seeing my patch was acknowledged by the kernel community! It's such an honor!

After getting the reply, I checked [[lore.kernel.org]] under all categories and searched for my file ia_css_vf

and as Andy said.. there were 3-4 other submission like mine, fixing the exact same issue. -_-

patches fixing the same issue as mine


Lesson Learned: Always check the lkml for similar patches in staging before starting working on that issue.


Ending Note:
Honestly, this experience was very very valuable, and I plan to submit a new patch soon, ofc after checking whether my issue was already fixed by someone else or not.

Top comments (0)