Thiago Duvanel
445 words
2 minutes
My first Linux Kernel contribution
2024-04-19

I’ve prepared and sent my first contribution to the Linux Foundation. Together with my friends Otávio and Felipe, we studied some patch recommendations from our professor Paulo Meirelles and the advisor Marcelo Schdmit.

His recommendation was to work with some drivers that act on signal conversion from the IIO (Industrial Input Output). The IIO is very important for interfacing sensors with the kernel, enabling a wide range of applications to work together in signal conversion and automation.

The start of the journey#

The journey began with research about the drivers, what they do and the existing driver codes that were already fixed from the error we were searching for handling the output of negative numbers, which can cause unexpected behavior from the systems that depends on the drivers.

The initial challenge was to understand how each function works, since the kernel uses very low-level libraries, we had to search line by line in existing header files included in our driver and read its documentation.

Change of plans#

The first plan was to work separately: Otávio and Felipe together and me alone with different drivers but the same project idea: fixing important outputs. But we have faced a problem: one of the drivers recommended by Marcelo was too complicated to fix because we couldn’t test them properly, since we didn’t have the proper hardware to do it. So, we brainstormed some ideas and decided to follow together.

Rest of the process#

After this, the process was very fast: we searched for the code necessary for changes, used a function already implemented by the team that keeps the drivers, and fixed its arguments for a nice format and index sensitive information since we were messing with the index of binary numbers.

Then, we sent the patch to our colleagues at MAC0470, who are evaluating it. After all recommendation given by them are followed, we can send the patch to Linux mantenors.

Update#

Me, Felipe and Otávio had some serious problems. After asking for help to decide which patch we would gonna develop for Linux, Jonathan Sebastian, the main mantenor for the IIO Linux tree, answered our patch with an email asking if the driver that we modified was really suffering from the recommended problem to fim: not supporting negative numbers. After some study and discussion with Marcelo Schdmit, who recommended the patch, and studying the driver documentation, we found out that the driver was incomplete, and didn’t support functions that were necessary for negative numbers to appear in the implementation.

As a result of this, our patch wasn’t really necessary at all. So, we decided to not move on with the patch. In the next few days, we will try to contribute in another way to the Linux tree.

My first Linux Kernel contribution
https://th-duvanel.github.io/posts/linux/
Author
Thiago Duvanel Fereira
Published at
2024-04-19