2 min read
Contributing to the Linux Kernel

Together with Raffael Raiél I contributed to refactoring IIO tree code by replacing old style mutex lock and unlock with the newer guard() macro.

We started by searching a suitable file for improvement. Using ripgrep we found that the file drivers/iio/light/vcnl4000.c had several uses of mutex lock and unlock. Moreover, it was a good fit for us since we were already used to working with the iio tree.

The initial modification work was swift. We had no issues in making the refactoring, and sent our first patch for correction on 16th April. After some back and forth with style details (Patch v2, simplifying return paths and attributions and Patch v3 fixing indentation) we got a LGTM from Andy Shevchenko on 20th April.

Accepted patch
LGTM from Andy Shevchenko

However, before merging, Jonathan Cameron noted that we could expand our patch to also deal with issues on other code. We then expanded the code with Patch v4. Again, the code needed some small refinements, which led to Patch v5 (simplifying return commands) and finally Patch v6 (Removing unnecessary conditionals).

With Patch v6, we finally got accepted! 🥳🎉🎊

Accepted patch
Approval message from Jonathan Cameron

At first, it was weird to contribute through mail lists instead of a tool like Github, but kw and git made things a little easier. The culture specificities around sending patches, versioning, etc was also new to me. In the beginning, it all felt a little weird, but with time it all clicked, and the patches got easier and easier to make.


Our complete commit history and feedback received can be find in this lore link.