KernelNewbies:

The Experimentation tasks are for you to get familiar with the IIO subsystem. You do not need to claim these via the Outreachy tasks page.

Please post all questions to outreachy-kernel@googlegroups.com. IIO mentors and other applicants will respond on the list and it will serve as a troubleshooting resource for all applicants.

You can also join #linux-iio IRC channel (server irc.oftc.net) to ask questions of the IIO community.

Please email your solutions to amsfield22 at gmail dot com and daniel.baluta at gmail dot com. Your email should have the subject Task XX: Short task description

Experimenting with IIO subsystem

For this we will use two kernel modules found in drivers/iio/dummy:

Dummy modules compilation

You need to select the following config options:

Use the following commands for modules compilation:

Use the following commands for module loading:

Use the following command to create your dummy device under the configfs filesystem:

Task 01:

Task 02:

IIO event monitor

IIO event monitor is an user space example application which reads events from IIO layer and pretty prints the results. Implementation can be found in iio_event_monitor.c under tools/iio/. BR

Task 03:

Compile iio_event_monitor:

Task 04:

Read events using iio_event_monitor

Generic buffer

Task 05:

Create triggers using configfs interface.

Task 06:

Read samples from buffer generated by the iio_dummy module.

Coding Tasks

Note for all IIO Coding Tasks:

Coding Task 1:

Clean-up idea: IIO Headers: This was previously posted to the outreachy-kernel@googlegroups.com

See description and follow-ups here: https://groups.google.com/forum/#!topic/outreachy-kernel/LtI90_SwjHE

I believe this task is completed or close to being completed. If you find a driver which you think applies here, be sure to search for it in the outreachy group mailing list to see if it has already been done or disregarded.

Coding Task 2:

Coding Task 2: Replace driver usages of mlock with a private lock

Background:

The locking scheme in the IIO subsystem includes a lock in the iio_dev structure called mlock. The usage of iio_dev->mlock is being redefined as protecting operating mode changes - as in changes between BUFFER* and DIRECT modes.

Notice how the struct iio_dev fields are labelled [INTERN] or [DRIVER]. The mlock will revert to an [INTERN] field once all the non-conforming usages are removed from drivers. The IIO core functions in (drivers/iio/industrialio-*.c) will be the only users of mlock. Drivers will use helper functions to control operating mode changes.

That's a bunch of background that you don't need to totally grasp to do this task, but it's nice to see the bigger picture.

The piece of the migration this task focuses on is removing the usages of mlock that don't meet the new model. I suspect we'll find that these drivers were using mlock as it was previously defined: "to protect simultaneous device *state* changes." Typically this means they are changing some configuration bits in the hardware. Those changes are important to protect, just do it with a driver private lock, not mlock.

PATCH Example:

Review this recently submitted patch: staging: iio: ad9832: replace mlock with driver private lock https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?h=testing&id=388c8f18ff29fe95dbf72cb0a1bd8fbcd6f52f8f

This is probably the simplest case patch for this task. I want to emphasize simple, because I did pass over a few others on my way to creating an example patch. I saved the more interesting drivers for you ;)

You may uncover issues with the usage or placement of locks in general.

Your reviewer may notice other things that need tidying up. If they're not immediately required for this patch, save it for a follow up patch.

The Directions:

Your mission is to remove the usage of mlock from the IIO drivers in staging. A simple 'git grep mlock' finds the drivers and I've posted that list on the Outreachy tasks page.

Please sign up for one driver at a time, take it all the way through ACK, before selecting another one. Be sure to follow along as these are posted and learn from others patches.

PATCHES need to be sent to all of:

outreachy-kernel@googlegroups.com,

the IIO Maintainer, IIO Reviewers, and IIO Mailing List,

Jonathan Cameron <jic23@kernel.org> (maintainer:IIO SUBSYSTEM AND DRIVERS) Hartmut Knaack <knaack.h@gmx.de> (reviewer:IIO SUBSYSTEM AND DRIVERS) Lars-Peter Clausen <lars@metafoo.de> (reviewer:IIO SUBSYSTEM AND DRIVERS) Peter Meerwald <pmeerw@pmeerw.net> (reviewer:IIO SUBSYSTEM AND DRIVERS) linux-iio@vger.kernel.org (open list:IIO SUBSYSTEM AND DRIVERS)

and, for good measure, Jonathan likes to make sure the original Author(s) are directly copied on all patches. So, grab the MODULE_AUTHOR found at the tail end of the driver source.

Post questions to outreachy-kernel@googlegroups.com or the #linux-iio IRC channel (server irc.oftc.net).

KernelNewbies: IIO_tasks (last edited 2017-03-12 15:47:59 by or-67-232-66-135)