From: David Brownell <david-b@pacbell.net>
To: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: dbrownell@users.sourceforge.net,
spi-devel-general@lists.sourceforge.net,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH 1/5] use mutex instead of semaphore in SPI core/init code
Date: Fri, 13 Jul 2007 12:59:32 -0700 [thread overview]
Message-ID: <200707131259.33011.david-b@pacbell.net> (raw)
In-Reply-To: <20070713192347.GE18159@traven>
On Friday 13 July 2007, Matthias Kaehlcke wrote:
> The SPI core/init code uses a semaphore as mutex. Use the mutex
> API instead of the (binary) semaphore.
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
ACK ... and thanks!
>
> --
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 4831edb..018884d 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -23,6 +23,7 @@
> #include <linux/device.h>
> #include <linux/init.h>
> #include <linux/cache.h>
> +#include <linux/mutex.h>
> #include <linux/spi/spi.h>
>
>
> @@ -185,7 +186,7 @@ struct boardinfo {
> };
>
> static LIST_HEAD(board_list);
> -static DECLARE_MUTEX(board_lock);
> +static DEFINE_MUTEX(board_lock);
>
>
> /**
> @@ -292,9 +293,9 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
> bi->n_board_info = n;
> memcpy(bi->board_info, info, n * sizeof *info);
>
> - down(&board_lock);
> + mutex_lock(&board_lock);
> list_add_tail(&bi->list, &board_list);
> - up(&board_lock);
> + mutex_unlock(&board_lock);
> return 0;
> }
>
> @@ -308,7 +309,7 @@ scan_boardinfo(struct spi_master *master)
> struct boardinfo *bi;
> struct device *dev = master->cdev.dev;
>
> - down(&board_lock);
> + mutex_lock(&board_lock);
> list_for_each_entry(bi, &board_list, list) {
> struct spi_board_info *chip = bi->board_info;
> unsigned n;
> @@ -330,7 +331,7 @@ scan_boardinfo(struct spi_master *master)
> (void) spi_new_device(master, chip);
> }
> }
> - up(&board_lock);
> + mutex_unlock(&board_lock);
> }
>
> /*-------------------------------------------------------------------------*/
>
> --
> Matthias Kaehlcke
> Linux Application Developer
> Barcelona
>
> Ma patrie est où je suis, où personne ne me dérange, où personne
> ne me demande que je suis, d'où je viens et ce que je fais
> (B. Traven)
> .''`.
> using free software / Debian GNU/Linux | http://debian.org : :' :
> `. `'`
> gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
>
next prev parent reply other threads:[~2007-07-13 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-13 19:20 [PATCH 0/5] use mutex instead of semaphore in several drivers Matthias Kaehlcke
2007-07-13 19:23 ` [PATCH 1/5] use mutex instead of semaphore in SPI core/init code Matthias Kaehlcke
2007-07-13 19:59 ` David Brownell [this message]
2007-07-13 19:25 ` [PATCH 2/5] use mutex instead of semaphore in the USB gadget serial driver Matthias Kaehlcke
2007-07-13 20:00 ` David Brownell
2007-07-13 19:26 ` [PATCH 3/5] use mutex instead of semaphore in the ELAN U132 adapter driver Matthias Kaehlcke
2007-07-13 19:28 ` [PATCH 4/5] use mutex instead of semaphore in the Adutux driver Matthias Kaehlcke
2007-07-13 19:29 ` [PATCH 5/5] use mutex instead of semaphore in the FTDI ELAN driver Matthias Kaehlcke
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=200707131259.33011.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=akpm@linux-foundation.org \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.kaehlcke@gmail.com \
--cc=spi-devel-general@lists.sourceforge.net \
/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