* [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock
@ 2007-04-11 7:19 Matthias Kaehlcke
2007-04-11 8:19 ` Milind Arun Choudhary
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Matthias Kaehlcke @ 2007-04-11 7:19 UTC (permalink / raw)
To: kernel-janitors
HYSDN cards: use spin_lock_init() for spinlock initialization
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
---
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index f7e83a8..168fd56 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -299,7 +299,8 @@ hysdn_log_close(struct inode *ino, struct file *filep)
hysdn_card *card;
int retval = 0;
unsigned long flags;
- spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
+ spinlock_t hysdn_lock;
+ spin_lock_init(&hysdn_lock);
lock_kernel();
if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) = FMODE_WRITE) {
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
Usually when people are sad, they don't do anything. They just cry over
their condition. But when they get angry, they bring about a change
(Malcolm X)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock
2007-04-11 7:19 [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock Matthias Kaehlcke
@ 2007-04-11 8:19 ` Milind Arun Choudhary
2007-04-11 8:44 ` Matthias Kaehlcke
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Milind Arun Choudhary @ 2007-04-11 8:19 UTC (permalink / raw)
To: kernel-janitors
On 4/11/07, Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> HYSDN cards: use spin_lock_init() for spinlock initialization
>
> Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
> ---
> diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
> index f7e83a8..168fd56 100644
> --- a/drivers/isdn/hysdn/hysdn_proclog.c
> +++ b/drivers/isdn/hysdn/hysdn_proclog.c
> @@ -299,7 +299,8 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> hysdn_card *card;
> int retval = 0;
> unsigned long flags;
> - spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
> + spinlock_t hysdn_lock;
> + spin_lock_init(&hysdn_lock);
use DEFINE_SPINLOCK() instead,for static/compile time initialization
spin_lock_init() is for runtime
--
Milind Arun Choudhary
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock
2007-04-11 7:19 [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock Matthias Kaehlcke
2007-04-11 8:19 ` Milind Arun Choudhary
@ 2007-04-11 8:44 ` Matthias Kaehlcke
2007-04-11 11:23 ` Alexey Dobriyan
2007-04-11 11:44 ` Matthias Kaehlcke
3 siblings, 0 replies; 5+ messages in thread
From: Matthias Kaehlcke @ 2007-04-11 8:44 UTC (permalink / raw)
To: kernel-janitors
El Wed, Apr 11, 2007 at 01:37:50PM +0530 Milind Arun Choudhary ha dit:
> On 4/11/07, Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> >HYSDN cards: use spin_lock_init() for spinlock initialization
> >
> >Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
> >---
> >diff --git a/drivers/isdn/hysdn/hysdn_proclog.c
> >b/drivers/isdn/hysdn/hysdn_proclog.c
> >index f7e83a8..168fd56 100644
> >--- a/drivers/isdn/hysdn/hysdn_proclog.c
> >+++ b/drivers/isdn/hysdn/hysdn_proclog.c
> >@@ -299,7 +299,8 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> > hysdn_card *card;
> > int retval = 0;
> > unsigned long flags;
> >- spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
> >+ spinlock_t hysdn_lock;
> >+ spin_lock_init(&hysdn_lock);
>
> use DEFINE_SPINLOCK() instead,for static/compile time initialization
>
> spin_lock_init() is for runtime
thanks for your comment, i have corrected this
---
HYSDN cards: use DEFINE_SPINLOCK() for spinlock declaration and
initialization instead of declaring the spinlock and assigning it to
SPIN_LOCK_UNLOCKED
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
---
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
index f7e83a8..53e8de6 100644
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -299,7 +299,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
hysdn_card *card;
int retval = 0;
unsigned long flags;
- spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
+ DEFINE_SPINLOCK(hysdn_lock);
lock_kernel();
if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) = FMODE_WRITE) {
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
The salvation of mankind lies only in making everything the concern of all
(Alexander Solzhenitsyn)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock
2007-04-11 7:19 [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock Matthias Kaehlcke
2007-04-11 8:19 ` Milind Arun Choudhary
2007-04-11 8:44 ` Matthias Kaehlcke
@ 2007-04-11 11:23 ` Alexey Dobriyan
2007-04-11 11:44 ` Matthias Kaehlcke
3 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2007-04-11 11:23 UTC (permalink / raw)
To: kernel-janitors
On 4/11/07, Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> HYSDN cards: use spin_lock_init() for spinlock initialization
> --- a/drivers/isdn/hysdn/hysdn_proclog.c
> +++ b/drivers/isdn/hysdn/hysdn_proclog.c
> @@ -299,7 +299,8 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> hysdn_card *card;
> int retval = 0;
> unsigned long flags;
> - spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
> + spinlock_t hysdn_lock;
> + spin_lock_init(&hysdn_lock);
Wow! Second spinlock on stack I've seen.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock
2007-04-11 7:19 [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock Matthias Kaehlcke
` (2 preceding siblings ...)
2007-04-11 11:23 ` Alexey Dobriyan
@ 2007-04-11 11:44 ` Matthias Kaehlcke
3 siblings, 0 replies; 5+ messages in thread
From: Matthias Kaehlcke @ 2007-04-11 11:44 UTC (permalink / raw)
To: kernel-janitors
El Wed, Apr 11, 2007 at 03:23:07PM +0400 Alexey Dobriyan ha dit:
> On 4/11/07, Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> >HYSDN cards: use spin_lock_init() for spinlock initialization
>
> >--- a/drivers/isdn/hysdn/hysdn_proclog.c
> >+++ b/drivers/isdn/hysdn/hysdn_proclog.c
> >@@ -299,7 +299,8 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> > hysdn_card *card;
> > int retval = 0;
> > unsigned long flags;
> >- spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
> >+ spinlock_t hysdn_lock;
> >+ spin_lock_init(&hysdn_lock);
>
> Wow! Second spinlock on stack I've seen.
now that you say it, it really looks odd. the declaration doesn't make
sense and the calls to spin_lock_irqsave() and
spin_unlock_irqrestore() should probably receive card->hysdn_lock as
parameter instead of the spinlock on stack.
--
Matthias Kaehlcke
Linux Application Developer
Barcelona
If you don't know where you are going,
you will probably end up somewhere else
(Laurence J. Peter)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-04-11 11:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-11 7:19 [KJ] [PATCH] HYSDN cards: use spin_lock_init() for spinlock Matthias Kaehlcke
2007-04-11 8:19 ` Milind Arun Choudhary
2007-04-11 8:44 ` Matthias Kaehlcke
2007-04-11 11:23 ` Alexey Dobriyan
2007-04-11 11:44 ` Matthias Kaehlcke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.