From: Matthias Kaehlcke Date: Tue, 17 Jul 2007 11:04:16 +0000 (-0700) Subject: use mutex instead of semaphore in SPI core/init code X-Git-Tag: v2.6.23-rc1~686 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=940408289842677cfe9e053a6c423bf3fb922560;p=linux-2.6 use mutex instead of semaphore in SPI core/init code The SPI core/init code uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke Acked-by: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 4831edbae2..018884d7a5 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -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); } /*-------------------------------------------------------------------------*/