On Wed, 3 Sep 2014 13:13:44 +0200 Loic Pefferkorn <loic@xxxxxxxx> wrote: > Coding style: document spinlock usage > > Signed-off-by: Loic Pefferkorn <loic@xxxxxxxx> > --- > drivers/staging/goldfish/goldfish_audio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c > index 23a206d..ab723ab 100644 > --- a/drivers/staging/goldfish/goldfish_audio.c > +++ b/drivers/staging/goldfish/goldfish_audio.c > @@ -36,7 +36,7 @@ MODULE_VERSION("1.0"); > struct goldfish_audio { > char __iomem *reg_base; > int irq; > - spinlock_t lock; > + spinlock_t lock; /* Serialize access to device */ This tells the reader nothing. It's good to document locking models but - you lock data not code (which is a detail a lot of programmers get wrong in th design stage too) - you need to document what objects are protected by the lock So it should tell the reader what the lock must be held to do If you look at the audio code it actually protects the status field and status register of the "hardware" _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel