struct hdq_data {
struct device *dev;
void __iomem *hdq_base;
- struct semaphore hdq_semlock;
+ struct mutex hdq_mutex;
int hdq_usecount;
struct clk *hdq_ick;
struct clk *hdq_fck;
u8 tmp_status;
unsigned long irqflags;
- ret = down_interruptible(&hdq_data->hdq_semlock);
+ ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0)
return -EINTR;
if (!hdq_data->hdq_usecount) {
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -EINVAL;
}
hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT);
if (ret < 0) {
dev_dbg(hdq_data->dev, "wait interrupted");
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -EINTR;
}
if (!(tmp_status & OMAP_HDQ_INT_STATUS_TIMEOUT)) {
dev_dbg(hdq_data->dev, "timeout waiting for TIMEOUT, %x",
tmp_status);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -ETIMEDOUT;
}
/*
dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits"
"return to zero, %x", tmp_status);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return ret;
}
u8 status;
unsigned long irqflags;
- ret = down_interruptible(&hdq_data->hdq_semlock);
+ ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0)
return -EINTR;
if (!hdq_data->hdq_usecount) {
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -EINVAL;
}
if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
dev_dbg(hdq_data->dev, "timeout waiting for"
"RXCOMPLETE, %x", status);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -ETIMEDOUT;
}
}
/* the data is ready. Read it in! */
*val = hdq_reg_in(hdq_data, OMAP_HDQ_RX_DATA);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return 0;
{
int ret = 0;
- ret = down_interruptible(&hdq_data->hdq_semlock);
+ ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0)
return -EINTR;
if (OMAP_HDQ_MAX_USER == hdq_data->hdq_usecount) {
dev_dbg(hdq_data->dev, "attempt to exceed the max use count");
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
ret = -EINVAL;
} else {
hdq_data->hdq_usecount++;
dev_dbg(hdq_data->dev, "Can not enable ick\n");
clk_put(hdq_data->hdq_ick);
clk_put(hdq_data->hdq_fck);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -ENODEV;
}
if (clk_enable(hdq_data->hdq_fck)) {
dev_dbg(hdq_data->dev, "Can not enable fck\n");
clk_put(hdq_data->hdq_ick);
clk_put(hdq_data->hdq_fck);
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return -ENODEV;
}
}
}
}
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return ret;
}
{
int ret = 0;
- ret = down_interruptible(&hdq_data->hdq_semlock);
+ ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0)
return -EINTR;
clk_disable(hdq_data->hdq_fck);
}
}
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return ret;
}
}
hdq_data->hdq_usecount = 0;
- sema_init(&hdq_data->hdq_semlock, 1);
+ mutex_init(&hdq_data->hdq_mutex);
if (clk_enable(hdq_data->hdq_ick)) {
dev_dbg(&pdev->dev, "Can not enable ick\n");
{
struct hdq_data *hdq_data = platform_get_drvdata(pdev);
- down_interruptible(&hdq_data->hdq_semlock);
+ mutex_lock(&hdq_data->hdq_mutex);
+
if (0 != hdq_data->hdq_usecount) {
dev_dbg(&pdev->dev, "removed when use count is not zero\n");
return -EBUSY;
}
- up(&hdq_data->hdq_semlock);
+
+ mutex_unlock(&hdq_data->hdq_mutex);
/* remove module dependency */
clk_put(hdq_data->hdq_ick);