[Letux-kernel] two accelerometers + iio_bridge considered harmful

Andreas Kemnade andreas at kemnade.info
Wed Aug 1 16:38:43 CEST 2018

On Wed, 1 Aug 2018 09:14:58 +0200
"H. Nikolaus Schaller" <hns at goldelico.com> wrote:

> Hi,
> > Am 01.08.2018 um 08:22 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> >   
> >> 
> >> 
> >> So first question is it really worth to make it thread-safe  
> > 
> > Well, a simple mutex would help.
> > 
> > But where could we initialize it before the first channel is registered?
> > And make sure that it is initialized only once (without another mutex)?  
> Ah, it is easy. DEFINE_MUTEX is a static initializer :)
> Attached is a new patch which does not break my devices (except rmmod, see
> below - this might be if channels[0].data is no longer valid) and may help
> in your setup. Please let me know your results.
Ok, tried it partly, I did a patch -p1 directly on top of my current source
including the additional debug outputs to not accidentially hide problems.
Only the channel mutex stuff applied. I moved the channel_mutex declaration behind the input_work declaration so channels[3] will still point to the input_work if the
compiler is not in a mood to reorder things.

I do not see the race on my two affected filesystems,
neither on stretch nor on jessie. But it is still strange why
you do not see the race at all.
And something in probing must have changed in 4.18.

Someone must have smuggled a if (latitiude > 50) into the gnss code ;-)

Another thing to analyze is whether we might get
X from accel 1, X from accel 2 and Y from accel 1.
I have not tested that yet.

I think we should clearly have one input device per iio accelerometer device,
that might probably save us some trouble.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180801/9ab8c69f/attachment.asc>

More information about the Letux-kernel mailing list