* [PATCH 7/9]HDQ driver:replace semaphore with mutex
@ 2008-09-24 11:31 Madhusudhan Chikkature
2008-09-24 11:50 ` Felipe Balbi
0 siblings, 1 reply; 6+ messages in thread
From: Madhusudhan Chikkature @ 2008-09-24 11:31 UTC (permalink / raw)
To: tony; +Cc: johnpol, felipe.balbi, linux-omap
From: Madhusudhan Chikkature<madhu.cr@ti.com>
This patch replaces the usage of semaphore by mutex.
Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com>
---
drivers/w1/masters/omap_hdq.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
===================================================================
--- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24
11:13:12.000000000 +0530
+++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 11:49:45.000000000
+0530
@@ -55,7 +55,7 @@ static int w1_id;
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;
@@ -308,12 +308,12 @@ omap_hdq_break(struct hdq_data *hdq_data
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;
}
@@ -335,7 +335,7 @@ omap_hdq_break(struct hdq_data *hdq_data
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;
}
@@ -346,7 +346,7 @@ omap_hdq_break(struct hdq_data *hdq_data
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;
}
/*
@@ -361,7 +361,7 @@ omap_hdq_break(struct hdq_data *hdq_data
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;
}
@@ -371,12 +371,12 @@ static int hdq_read_byte(struct hdq_data
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;
}
@@ -407,13 +407,13 @@ static int hdq_read_byte(struct hdq_data
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;
@@ -427,13 +427,13 @@ omap_hdq_get(struct hdq_data *hdq_data)
{
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++;
@@ -443,14 +443,14 @@ omap_hdq_get(struct hdq_data *hdq_data)
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;
}
@@ -472,7 +472,7 @@ omap_hdq_get(struct hdq_data *hdq_data)
}
}
}
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return ret;
}
@@ -484,7 +484,7 @@ omap_hdq_put(struct hdq_data *hdq_data)
{
int ret = 0;
- ret = down_interruptible(&hdq_data->hdq_semlock);
+ ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0)
return -EINTR;
@@ -500,7 +500,7 @@ omap_hdq_put(struct hdq_data *hdq_data)
clk_disable(hdq_data->hdq_fck);
}
}
- up(&hdq_data->hdq_semlock);
+ mutex_unlock(&hdq_data->hdq_mutex);
return ret;
}
@@ -614,7 +614,7 @@ static int __init omap_hdq_probe(struct
}
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");
@@ -689,12 +689,14 @@ static int omap_hdq_remove(struct platfo
{
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);
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex
2008-09-24 11:31 [PATCH 7/9]HDQ driver:replace semaphore with mutex Madhusudhan Chikkature
@ 2008-09-24 11:50 ` Felipe Balbi
2008-09-24 13:00 ` Madhusudhan Chikkature
0 siblings, 1 reply; 6+ messages in thread
From: Felipe Balbi @ 2008-09-24 11:50 UTC (permalink / raw)
To: ext Madhusudhan Chikkature; +Cc: tony, johnpol, felipe.balbi, linux-omap
On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
> From: Madhusudhan Chikkature<madhu.cr@ti.com>
>
> This patch replaces the usage of semaphore by mutex.
>
> Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com>
> ---
> drivers/w1/masters/omap_hdq.c | 42 ++++++++++++++++++++++--------------------
> 1 files changed, 22 insertions(+), 20 deletions(-)
>
> Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
> ===================================================================
> --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24
> 11:13:12.000000000 +0530
> +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 11:49:45.000000000
> +0530
> @@ -55,7 +55,7 @@ static int w1_id;
> 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;
Please, fix these two:
CHECK: struct mutex definition without comment
#58: FILE: w1/masters/omap_hdq.c:58:
+ struct mutex hdq_mutex;
CHECK: spinlock_t definition without comment
#63: FILE: w1/masters/omap_hdq.c:63:
+ spinlock_t hdq_spinlock;
total: 0 errors, 0 warnings, 2 checks, 732 lines checked
--
balbi
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex
2008-09-24 11:50 ` Felipe Balbi
@ 2008-09-24 13:00 ` Madhusudhan Chikkature
2008-09-24 13:05 ` Gadiyar, Anand
0 siblings, 1 reply; 6+ messages in thread
From: Madhusudhan Chikkature @ 2008-09-24 13:00 UTC (permalink / raw)
Cc: tony, johnpol, felipe.balbi, linux-omap
----- Original Message -----
From: "Felipe Balbi" <felipe.balbi@nokia.com>
To: "ext Madhusudhan Chikkature" <madhu.cr@ti.com>
Cc: <tony@atomide.com>; <johnpol@2ka.mipt.ru>; <felipe.balbi@nokia.com>; <linux-omap@vger.kernel.org>
Sent: Wednesday, September 24, 2008 5:20 PM
Subject: Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex
> On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
>> From: Madhusudhan Chikkature<madhu.cr@ti.com>
>>
>> This patch replaces the usage of semaphore by mutex.
>>
>> Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com>
>> ---
>> drivers/w1/masters/omap_hdq.c | 42 ++++++++++++++++++++++--------------------
>> 1 files changed, 22 insertions(+), 20 deletions(-)
>>
>> Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
>> ===================================================================
>> --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24
>> 11:13:12.000000000 +0530
>> +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 11:49:45.000000000
>> +0530
>> @@ -55,7 +55,7 @@ static int w1_id;
>> 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;
>
> Please, fix these two:
>
> CHECK: struct mutex definition without comment
> #58: FILE: w1/masters/omap_hdq.c:58:
> + struct mutex hdq_mutex;
>
> CHECK: spinlock_t definition without comment
> #63: FILE: w1/masters/omap_hdq.c:63:
> + spinlock_t hdq_spinlock;
>
> total: 0 errors, 0 warnings, 2 checks, 732 lines checked
I dont see any such checks reported by checkpatch.pl?
Regards,
Madhu
>
> --
> balbi
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [PATCH 7/9]HDQ driver:replace semaphore with mutex
2008-09-24 13:00 ` Madhusudhan Chikkature
@ 2008-09-24 13:05 ` Gadiyar, Anand
2008-09-24 13:17 ` Madhusudhan Chikkature
2008-09-24 23:01 ` Felipe Balbi
0 siblings, 2 replies; 6+ messages in thread
From: Gadiyar, Anand @ 2008-09-24 13:05 UTC (permalink / raw)
To: Chikkature Rajashekar, Madhusudhan
Cc: tony@atomide.com, johnpol@2ka.mipt.ru, felipe.balbi@nokia.com,
linux-omap@vger.kernel.org
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org On Behalf Of Chikkature Rajashekar, Madhusudhan
> ----- Original Message ----- From: "Felipe Balbi" <felipe.balbi@nokia.com>
>
> > On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
> >> From: Madhusudhan Chikkature<madhu.cr@ti.com>
> >>
> >> This patch replaces the usage of semaphore by mutex.
> >>
> >> Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com>
> >> ---
> >> drivers/w1/masters/omap_hdq.c | 42 ++++++++++++++++++++++--------------------
> >> 1 files changed, 22 insertions(+), 20 deletions(-)
> >>
> >> Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
> >> ===================================================================
> >> --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24 11:13:12.000000000 +0530
> >> +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 11:49:45.000000000 +0530
> >> @@ -55,7 +55,7 @@ static int w1_id;
> >> 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;
> >
> > Please, fix these two:
> >
> > CHECK: struct mutex definition without comment
> > #58: FILE: w1/masters/omap_hdq.c:58:
> > + struct mutex hdq_mutex;
> >
> > CHECK: spinlock_t definition without comment
> > #63: FILE: w1/masters/omap_hdq.c:63:
> > + spinlock_t hdq_spinlock;
> >
> > total: 0 errors, 0 warnings, 2 checks, 732 lines checked
>
> I dont see any such checks reported by checkpatch.pl?
>
Oh, I guess Felipe uses `checkpatch.pl --strict`, right Felipe?
- Anand
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex
2008-09-24 13:05 ` Gadiyar, Anand
@ 2008-09-24 13:17 ` Madhusudhan Chikkature
2008-09-24 23:01 ` Felipe Balbi
1 sibling, 0 replies; 6+ messages in thread
From: Madhusudhan Chikkature @ 2008-09-24 13:17 UTC (permalink / raw)
To: Gadiyar, Anand; +Cc: tony, johnpol, felipe.balbi, linux-omap
----- Original Message -----
From: "Gadiyar, Anand" <gadiyar@ti.com>
To: "Chikkature Rajashekar, Madhusudhan" <madhu.cr@ti.com>; <felipe.balbi@nokia.com>
Cc: <tony@atomide.com>; <johnpol@2ka.mipt.ru>; <felipe.balbi@nokia.com>; <linux-omap@vger.kernel.org>
Sent: Wednesday, September 24, 2008 6:35 PM
Subject: RE: [PATCH 7/9]HDQ driver:replace semaphore with mutex
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org On Behalf Of Chikkature Rajashekar, Madhusudhan
> ----- Original Message ----- From: "Felipe Balbi" <felipe.balbi@nokia.com>
>
> > On Wed, Sep 24, 2008 at 05:01:27PM +0530, ext Madhusudhan Chikkature wrote:
> >> From: Madhusudhan Chikkature<madhu.cr@ti.com>
> >>
> >> This patch replaces the usage of semaphore by mutex.
> >>
> >> Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com>
> >> ---
> >> drivers/w1/masters/omap_hdq.c | 42 ++++++++++++++++++++++--------------------
> >> 1 files changed, 22 insertions(+), 20 deletions(-)
> >>
> >> Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
> >> ===================================================================
> >> --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c 2008-09-24 11:13:12.000000000 +0530
> >> +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c 2008-09-24 11:49:45.000000000 +0530
> >> @@ -55,7 +55,7 @@ static int w1_id;
> >> 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;
> >
> > Please, fix these two:
> >
> > CHECK: struct mutex definition without comment
> > #58: FILE: w1/masters/omap_hdq.c:58:
> > + struct mutex hdq_mutex;
> >
> > CHECK: spinlock_t definition without comment
> > #63: FILE: w1/masters/omap_hdq.c:63:
> > + spinlock_t hdq_spinlock;
> >
> > total: 0 errors, 0 warnings, 2 checks, 732 lines checked
>
> I dont see any such checks reported by checkpatch.pl?
>
Oh, I guess Felipe uses `checkpatch.pl --strict`, right Felipe?
Hi,
Yes. That seems to be the case. I will add a couple of simple comments. I will send a final patch (patch #10)which will fix these minor things which Filipe reported.I do not want to rebase any of my patches again :)
Regards,
Madhu
- Anand
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 7/9]HDQ driver:replace semaphore with mutex
2008-09-24 13:05 ` Gadiyar, Anand
2008-09-24 13:17 ` Madhusudhan Chikkature
@ 2008-09-24 23:01 ` Felipe Balbi
1 sibling, 0 replies; 6+ messages in thread
From: Felipe Balbi @ 2008-09-24 23:01 UTC (permalink / raw)
To: Gadiyar, Anand
Cc: Chikkature Rajashekar, Madhusudhan, felipe.balbi@nokia.com,
tony@atomide.com, johnpol@2ka.mipt.ru, linux-omap@vger.kernel.org
On Wed, Sep 24, 2008 at 06:35:57PM +0530, Gadiyar, Anand wrote:
> Oh, I guess Felipe uses `checkpatch.pl --strict`, right Felipe?
right ;-)
--
balbi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-09-24 23:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-24 11:31 [PATCH 7/9]HDQ driver:replace semaphore with mutex Madhusudhan Chikkature
2008-09-24 11:50 ` Felipe Balbi
2008-09-24 13:00 ` Madhusudhan Chikkature
2008-09-24 13:05 ` Gadiyar, Anand
2008-09-24 13:17 ` Madhusudhan Chikkature
2008-09-24 23:01 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox