Commit 94040828 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Linus Torvalds

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: default avatarMatthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: default avatarDavid Brownell <david-b@pacbell.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2cac67d
......@@ -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);
}
/*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment