LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] arch/cris: Use mutex_unlock rather than spin_unlock
@ 2008-03-06 17:24 Julia Lawall
2008-03-06 18:08 ` Jesper Nilsson
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2008-03-06 17:24 UTC (permalink / raw)
To: starvik, jesper.nilsson, dev-etrax, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
It looks at least odd to apply spin_unlock to a mutex.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@def@
declarer DEFINE_MUTEX;
identifier m;
@@
DEFINE_MUTEX(m);
@@
identifier def.m;
@@
(
- spin_lock(&m)
+ mutex_lock(&m)
|
- spin_unlock(&m)
+ mutex_unlock(&m)
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
arch/cris/arch-v10/drivers/pcf8563.c | 2 +-
arch/cris/arch-v32/drivers/pcf8563.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff -u -p a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
--- a/arch/cris/arch-v10/drivers/pcf8563.c 2008-02-10 22:34:04.000000000 +0100
+++ b/arch/cris/arch-v10/drivers/pcf8563.c 2008-03-05 22:06:18.000000000 +0100
@@ -233,7 +233,7 @@ int pcf8563_ioctl(struct inode *inode, s
if (copy_to_user((struct rtc_time *) arg, &tm,
sizeof tm)) {
- spin_unlock(&rtc_lock);
+ mutex_unlock(&rtc_lock);
return -EFAULT;
}
diff -u -p a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
--- a/arch/cris/arch-v32/drivers/pcf8563.c 2008-02-10 22:34:04.000000000 +0100
+++ b/arch/cris/arch-v32/drivers/pcf8563.c 2008-03-05 22:06:18.000000000 +0100
@@ -229,7 +229,7 @@ int pcf8563_ioctl(struct inode *inode, s
if (copy_to_user((struct rtc_time *) arg, &tm,
sizeof tm)) {
- spin_unlock(&rtc_lock);
+ mutex_unlock(&rtc_lock);
return -EFAULT;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] arch/cris: Use mutex_unlock rather than spin_unlock
2008-03-06 17:24 [PATCH] arch/cris: Use mutex_unlock rather than spin_unlock Julia Lawall
@ 2008-03-06 18:08 ` Jesper Nilsson
0 siblings, 0 replies; 2+ messages in thread
From: Jesper Nilsson @ 2008-03-06 18:08 UTC (permalink / raw)
To: Julia Lawall; +Cc: mikael.starvik, dev-etrax, linux-kernel, kernel-janitors
On Thu, Mar 06, 2008 at 06:24:05PM +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> It looks at least odd to apply spin_unlock to a mutex.
>
> The semantic patch that makes this change is as follows:
> (http://www.emn.fr/x-info/coccinelle/)
>
> // <smpl>
> @def@
> declarer DEFINE_MUTEX;
> identifier m;
> @@
>
> DEFINE_MUTEX(m);
>
> @@
> identifier def.m;
> @@
>
> (
> - spin_lock(&m)
> + mutex_lock(&m)
> |
> - spin_unlock(&m)
> + mutex_unlock(&m)
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>
> ---
> arch/cris/arch-v10/drivers/pcf8563.c | 2 +-
> arch/cris/arch-v32/drivers/pcf8563.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff -u -p a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
> --- a/arch/cris/arch-v10/drivers/pcf8563.c 2008-02-10 22:34:04.000000000 +0100
> +++ b/arch/cris/arch-v10/drivers/pcf8563.c 2008-03-05 22:06:18.000000000 +0100
> @@ -233,7 +233,7 @@ int pcf8563_ioctl(struct inode *inode, s
>
> if (copy_to_user((struct rtc_time *) arg, &tm,
> sizeof tm)) {
> - spin_unlock(&rtc_lock);
> + mutex_unlock(&rtc_lock);
> return -EFAULT;
> }
>
> diff -u -p a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
> --- a/arch/cris/arch-v32/drivers/pcf8563.c 2008-02-10 22:34:04.000000000 +0100
> +++ b/arch/cris/arch-v32/drivers/pcf8563.c 2008-03-05 22:06:18.000000000 +0100
> @@ -229,7 +229,7 @@ int pcf8563_ioctl(struct inode *inode, s
>
> if (copy_to_user((struct rtc_time *) arg, &tm,
> sizeof tm)) {
> - spin_unlock(&rtc_lock);
> + mutex_unlock(&rtc_lock);
> return -EFAULT;
> }
>
Quite correct, I'll add it to my queue.
Thanks,
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-06 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-06 17:24 [PATCH] arch/cris: Use mutex_unlock rather than spin_unlock Julia Lawall
2008-03-06 18:08 ` Jesper Nilsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).