[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180323180027.GM31333@gavran.carpriv.carnet.hr>
Date: Fri, 23 Mar 2018 19:00:27 +0100
From: Valentin Vidic <Valentin.Vidic@...Net.hr>
To: Marcus Wolf <marcus.wolf@...rthome-wolf.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Simon Sandström <simon@...anor.nu>,
Marcus Wolf <linux@...f-Entwicklungen.de>,
Luca Söthe <luca@...l.me>,
Marcin Ciupak <marcin.s.ciupak@...il.com>,
Michael Panzlaff <michael.panzlaff@....de>,
Derek Robson <robsonde@...il.com>, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: pi433: add descriptions for mutex locks
On Fri, Mar 23, 2018 at 04:38:50PM +0100, Marcus Wolf wrote:
> I had no time to work on the code for monthes now and the memorisation
> of my thoughts when I was programming that (approx. one year ago) is
> quite pale.
>
> As far as I remember, I read something, that the fifo has an integrated
> protection, so no external protection is needed. But absolutely unsure.
>
> If I will find some time within the next days, I'll have a look at the
> code and try to recall.
>
> But the most important thing already took place: We started thinking
> about it :-)
You are right, here is what kfifo.h says:
/*
* Note about locking : There is no locking required until only * one reader
* and one writer is using the fifo and no kfifo_reset() will be * called
* kfifo_reset_out() can be safely used, until it will be only called
* in the reader thread.
* For multiple writer and one reader there is only a need to lock the writer.
* And vice versa for only one writer and multiple reader there is only a need
* to lock the reader.
*/
In the case of pi433 there is only one reader (pi433_tx_thread) and
there is no need for a lock there. But the char device (pi433_write)
might have multiple writers so we leave the mutex just in that function?
--
Valentin
Powered by blists - more mailing lists