mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Loic Pefferkorn <loic@loicp.eu>
Cc: gregkh@linuxfoundation.org, alan@linux.intel.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] staging: goldfish: document spinlock usage
Date: Wed, 3 Sep 2014 13:13:19 +0100	[thread overview]
Message-ID: <20140903131319.79095a43@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1409742827-6048-4-git-send-email-loic@loicp.eu>

On Wed,  3 Sep 2014 13:13:44 +0200
Loic Pefferkorn <loic@loicp.eu> wrote:

> Coding style: document spinlock usage
> 
> Signed-off-by: Loic Pefferkorn <loic@loicp.eu>
> ---
>  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"



  reply	other threads:[~2014-09-03 12:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 11:13 [PATCH 0/6] staging: goldfish: fix coding style warnings Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 1/6] staging: goldfish: suppress consecutive blank lines Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 2/6] staging: goldfish: remove useless space after a cast Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 3/6] staging: goldfish: document spinlock usage Loic Pefferkorn
2014-09-03 12:13   ` One Thousand Gnomes [this message]
2014-09-03 16:25     ` Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 4/6] staging: goldfish: fix alignment to match open parenthesis Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 5/6] staging: goldfish: document mutex usage Loic Pefferkorn
2014-09-03 11:13 ` [PATCH 6/6] staging: goldfish: avoid multiple assignments Loic Pefferkorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140903131319.79095a43@alan.etchedpixels.co.uk \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic@loicp.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®