Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 18227
b: refs/heads/master
c: 0043170
h: refs/heads/master
i:
  18225: 1ca0ac1
  18223: 20396a4
v: v3
  • Loading branch information
Arjan van de Ven authored and Russell King committed Jan 12, 2006
1 parent e817185 commit d4b0bee
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 59 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4619025a51747a3788fd1bb6bdc46e368a889a7
refs/heads/master: 00431707be0cc1236ee08459367872b57da5be29
15 changes: 8 additions & 7 deletions trunk/arch/arm/common/rtctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/miscdevice.h>
#include <linux/spinlock.h>
#include <linux/device.h>
#include <linux/mutex.h>

#include <asm/rtc.h>
#include <asm/semaphore.h>
Expand All @@ -34,7 +35,7 @@ static unsigned long rtc_irq_data;
/*
* rtc_sem protects rtc_inuse and rtc_ops
*/
static DECLARE_MUTEX(rtc_sem);
static DEFINE_MUTEX(rtc_mutex);
static unsigned long rtc_inuse;
static struct rtc_ops *rtc_ops;

Expand Down Expand Up @@ -355,7 +356,7 @@ static int rtc_open(struct inode *inode, struct file *file)
{
int ret;

down(&rtc_sem);
mutex_lock(&rtc_mutex);

if (rtc_inuse) {
ret = -EBUSY;
Expand All @@ -373,7 +374,7 @@ static int rtc_open(struct inode *inode, struct file *file)
rtc_inuse = 1;
}
}
up(&rtc_sem);
mutex_unlock(&rtc_mutex);

return ret;
}
Expand Down Expand Up @@ -479,7 +480,7 @@ int register_rtc(struct rtc_ops *ops)
{
int ret = -EBUSY;

down(&rtc_sem);
mutex_lock(&rtc_mutex);
if (rtc_ops == NULL) {
rtc_ops = ops;

Expand All @@ -488,20 +489,20 @@ int register_rtc(struct rtc_ops *ops)
create_proc_read_entry("driver/rtc", 0, NULL,
rtc_read_proc, ops);
}
up(&rtc_sem);
mutex_unlock(&rtc_mutex);

return ret;
}
EXPORT_SYMBOL(register_rtc);

void unregister_rtc(struct rtc_ops *rtc)
{
down(&rtc_sem);
mutex_lock(&rtc_mutex);
if (rtc == rtc_ops) {
remove_proc_entry("driver/rtc", NULL);
misc_deregister(&rtc_miscdev);
rtc_ops = NULL;
}
up(&rtc_sem);
mutex_unlock(&rtc_mutex);
}
EXPORT_SYMBOL(unregister_rtc);
7 changes: 4 additions & 3 deletions trunk/arch/arm/kernel/ecard.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <linux/proc_fs.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/mutex.h>

#include <asm/dma.h>
#include <asm/ecard.h>
Expand Down Expand Up @@ -206,7 +207,7 @@ static void ecard_task_readbytes(struct ecard_request *req)

static DECLARE_WAIT_QUEUE_HEAD(ecard_wait);
static struct ecard_request *ecard_req;
static DECLARE_MUTEX(ecard_sem);
static DEFINE_MUTEX(ecard_mutex);

/*
* Set up the expansion card daemon's page tables.
Expand Down Expand Up @@ -299,15 +300,15 @@ static void ecard_call(struct ecard_request *req)

req->complete = &completion;

down(&ecard_sem);
mutex_lock(&ecard_mutex);
ecard_req = req;
wake_up(&ecard_wait);

/*
* Now wait for kecardd to run.
*/
wait_for_completion(&completion);
up(&ecard_sem);
mutex_unlock(&ecard_mutex);
}

/* ======================= Mid-level card control ===================== */
Expand Down
15 changes: 8 additions & 7 deletions trunk/arch/arm/mach-aaec2000/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,27 @@
#include <linux/err.h>
#include <linux/string.h>
#include <linux/clk.h>
#include <linux/mutex.h>

#include <asm/semaphore.h>

#include "clock.h"

static LIST_HEAD(clocks);
static DECLARE_MUTEX(clocks_sem);
static DEFINE_MUTEX(clocks_mutex);

struct clk *clk_get(struct device *dev, const char *id)
{
struct clk *p, *clk = ERR_PTR(-ENOENT);

down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) {
if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
clk = p;
break;
}
}
up(&clocks_sem);
mutex_unlock(&clocks_mutex);

return clk;
}
Expand Down Expand Up @@ -78,18 +79,18 @@ EXPORT_SYMBOL(clk_set_rate);

int clk_register(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_add(&clk->node, &clocks);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
return 0;
}
EXPORT_SYMBOL(clk_register);

void clk_unregister(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_del(&clk->node);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
}
EXPORT_SYMBOL(clk_unregister);

Expand Down
15 changes: 8 additions & 7 deletions trunk/arch/arm/mach-integrator/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@
#include <linux/err.h>
#include <linux/string.h>
#include <linux/clk.h>
#include <linux/mutex.h>

#include <asm/semaphore.h>
#include <asm/hardware/icst525.h>

#include "clock.h"

static LIST_HEAD(clocks);
static DECLARE_MUTEX(clocks_sem);
static DEFINE_MUTEX(clocks_mutex);

struct clk *clk_get(struct device *dev, const char *id)
{
struct clk *p, *clk = ERR_PTR(-ENOENT);

down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) {
if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
clk = p;
break;
}
}
up(&clocks_sem);
mutex_unlock(&clocks_mutex);

return clk;
}
Expand Down Expand Up @@ -107,18 +108,18 @@ static struct clk uart_clk = {

int clk_register(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_add(&clk->node, &clocks);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
return 0;
}
EXPORT_SYMBOL(clk_register);

void clk_unregister(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_del(&clk->node);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
}
EXPORT_SYMBOL(clk_unregister);

Expand Down
17 changes: 9 additions & 8 deletions trunk/arch/arm/mach-pxa/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/hardware.h>
Expand Down Expand Up @@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = {
#endif
};

static DECLARE_MUTEX(sem);
static DEFINE_MUTEX(mutex);
static int use_count[PXA_SSP_PORTS] = {0, 0, 0};

static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
Expand Down Expand Up @@ -239,16 +240,16 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
if (port > PXA_SSP_PORTS || port == 0)
return -ENODEV;

down(&sem);
mutex_lock(&mutex);
if (use_count[port - 1]) {
up(&sem);
mutex_unlock(&mutex);
return -EBUSY;
}
use_count[port - 1]++;

if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) {
use_count[port - 1]--;
up(&sem);
mutex_unlock(&mutex);
return -EBUSY;
}
dev->port = port;
Expand All @@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)

/* turn on SSP port clock */
pxa_set_cken(ssp_info[port-1].clock, 1);
up(&sem);
mutex_unlock(&mutex);
return 0;

out_region:
release_mem_region(__PREG(SSCR0_P(port)), 0x2c);
use_count[port - 1]--;
up(&sem);
mutex_unlock(&mutex);
return ret;
}

Expand All @@ -282,7 +283,7 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
*/
void ssp_exit(struct ssp_dev *dev)
{
down(&sem);
mutex_lock(&mutex);
SSCR0_P(dev->port) &= ~SSCR0_SSE;

if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
Expand All @@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev)
free_irq(dev->irq, dev);
release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c);
use_count[dev->port - 1]--;
up(&sem);
mutex_unlock(&mutex);
}

EXPORT_SYMBOL(ssp_write_word);
Expand Down
15 changes: 8 additions & 7 deletions trunk/arch/arm/mach-realview/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,28 @@
#include <linux/errno.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/mutex.h>

#include <asm/semaphore.h>
#include <asm/hardware/icst307.h>

#include "clock.h"

static LIST_HEAD(clocks);
static DECLARE_MUTEX(clocks_sem);
static DEFINE_MUTEX(clocks_mutex);

struct clk *clk_get(struct device *dev, const char *id)
{
struct clk *p, *clk = ERR_PTR(-ENOENT);

down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) {
if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
clk = p;
break;
}
}
up(&clocks_sem);
mutex_unlock(&clocks_mutex);

return clk;
}
Expand Down Expand Up @@ -109,18 +110,18 @@ static struct clk mmci_clk = {

int clk_register(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_add(&clk->node, &clocks);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
return 0;
}
EXPORT_SYMBOL(clk_register);

void clk_unregister(struct clk *clk)
{
down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_del(&clk->node);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);
}
EXPORT_SYMBOL(clk_unregister);

Expand Down
11 changes: 6 additions & 5 deletions trunk/arch/arm/mach-s3c2410/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/clk.h>
#include <linux/mutex.h>

#include <asm/hardware.h>
#include <asm/atomic.h>
Expand All @@ -51,7 +52,7 @@
/* clock information */

static LIST_HEAD(clocks);
static DECLARE_MUTEX(clocks_sem);
static DEFINE_MUTEX(clocks_mutex);

/* old functions */

Expand Down Expand Up @@ -102,7 +103,7 @@ struct clk *clk_get(struct device *dev, const char *id)
else
idno = to_platform_device(dev)->id;

down(&clocks_sem);
mutex_lock(&clocks_mutex);

list_for_each_entry(p, &clocks, list) {
if (p->id == idno &&
Expand All @@ -126,7 +127,7 @@ struct clk *clk_get(struct device *dev, const char *id)
}
}

up(&clocks_sem);
mutex_unlock(&clocks_mutex);
return clk;
}

Expand Down Expand Up @@ -362,9 +363,9 @@ int s3c24xx_register_clock(struct clk *clk)

/* add to the list of available clocks */

down(&clocks_sem);
mutex_lock(&clocks_mutex);
list_add(&clk->list, &clocks);
up(&clocks_sem);
mutex_unlock(&clocks_mutex);

return 0;
}
Expand Down
Loading

0 comments on commit d4b0bee

Please sign in to comment.