LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/3] Char: mxser_new, do not null driver_data
@ 2007-01-23 14:42 Jiri Slaby
  2007-01-23 14:42 ` [PATCH 2/3] Char: mxser_new, lock count and flags Jiri Slaby
  2007-01-23 14:42 ` [PATCH 3/3] Char: mxser_new, fix sparse warning Jiri Slaby
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2007-01-23 14:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, osv

mxser_new, do not null driver_data

driver_data are initialzed to NULL from tty layer, no need to do it in the
driver. In this case it cases oops, since driver_data may be NULL for a
short while for another closing process.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <osv@javad.com>

---
commit f49b6914c3113f930a31ff7b8f811744f2d8f339
tree d4f8355eb12a89f779dc4b85e7a908b9e80e88d3
parent 2826e3a35f34046890c84a77bc2784a184f9bf6a
author Jiri Slaby <jirislaby@gmail.com> Sat, 20 Jan 2007 17:00:12 +0059
committer Jiri Slaby <jirislaby@gmail.com> Sat, 20 Jan 2007 17:00:12 +0059

 drivers/char/mxser_new.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 4c80549..1c8e00c 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -927,9 +927,6 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
 	struct mxser_port *info;
 	int retval, line;
 
-	/* initialize driver_data in case something fails */
-	tty->driver_data = NULL;
-
 	line = tty->index;
 	if (line == MXSER_PORTS)
 		return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/3] Char: mxser_new, lock count and flags
  2007-01-23 14:42 [PATCH 1/3] Char: mxser_new, do not null driver_data Jiri Slaby
@ 2007-01-23 14:42 ` Jiri Slaby
  2007-01-23 14:42 ` [PATCH 3/3] Char: mxser_new, fix sparse warning Jiri Slaby
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2007-01-23 14:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, osv

mxser_new, lock count and flags

Both open count and INITIALIZED flag should be changed under lock.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <osv@javad.com>

---
commit 76b3ee2d5737395df62553cec1b8193252476147
tree dfc50c164ddde6b73a954f694dfdcb98ed921629
parent f49b6914c3113f930a31ff7b8f811744f2d8f339
author Jiri Slaby <jirislaby@gmail.com> Sat, 20 Jan 2007 17:18:24 +0059
committer Jiri Slaby <jirislaby@gmail.com> Sat, 20 Jan 2007 17:18:24 +0059

 drivers/char/mxser_new.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 1c8e00c..d52ecff 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -853,9 +853,9 @@ static int mxser_startup(struct mxser_port *info)
 	 * and set the speed of the serial port
 	 */
 	mxser_change_speed(info, NULL);
+	info->flags |= ASYNC_INITIALIZED;
 	spin_unlock_irqrestore(&info->slock, flags);
 
-	info->flags |= ASYNC_INITIALIZED;
 	return 0;
 }
 
@@ -925,6 +925,7 @@ static void mxser_shutdown(struct mxser_port *info)
 static int mxser_open(struct tty_struct *tty, struct file *filp)
 {
 	struct mxser_port *info;
+	unsigned long flags;
 	int retval, line;
 
 	line = tty->index;
@@ -941,7 +942,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
 	/*
 	 * Start up serial port
 	 */
+	spin_lock_irqsave(&info->slock, flags);
 	info->count++;
+	spin_unlock_irqrestore(&info->slock, flags);
 	retval = mxser_startup(info);
 	if (retval)
 		return retval;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 3/3] Char: mxser_new, fix sparse warning
  2007-01-23 14:42 [PATCH 1/3] Char: mxser_new, do not null driver_data Jiri Slaby
  2007-01-23 14:42 ` [PATCH 2/3] Char: mxser_new, lock count and flags Jiri Slaby
@ 2007-01-23 14:42 ` Jiri Slaby
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2007-01-23 14:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, osv

mxser_new, fix sparse warning

Feed NULL instead of 0 where pointer is expected.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <osv@javad.com>

---
commit e87e9f65c3ac51d447cfe435217032a07f7a56e0
tree fbb8597542ed5919d3fae6b9ab45865e0659e922
parent 76b3ee2d5737395df62553cec1b8193252476147
author Jiri Slaby <jirislaby@gmail.com> Tue, 23 Jan 2007 01:43:13 +0059
committer Jiri Slaby <jirislaby@gmail.com> Tue, 23 Jan 2007 01:43:13 +0059

 drivers/char/mxser_new.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index d52ecff..9af07e4 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -1708,7 +1708,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
 
 		info->speed = speed;
 		spin_lock_irqsave(&info->slock, flags);
-		mxser_change_speed(info, 0);
+		mxser_change_speed(info, NULL);
 		spin_unlock_irqrestore(&info->slock, flags);
 
 		return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-01-23 14:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 14:42 [PATCH 1/3] Char: mxser_new, do not null driver_data Jiri Slaby
2007-01-23 14:42 ` [PATCH 2/3] Char: mxser_new, lock count and flags Jiri Slaby
2007-01-23 14:42 ` [PATCH 3/3] Char: mxser_new, fix sparse warning Jiri Slaby

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).