mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] Char: mxser, fix oops when removing opened
@ 2006-12-22 22:50 Jiri Slaby
  2006-12-22 22:51 ` [PATCH 2/3] Char: mxser_new, mark init functions Jiri Slaby
  2006-12-22 22:51 ` [PATCH 3/3] Char: mxser_new, remove useless spinlock Jiri Slaby
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby @ 2006-12-22 22:50 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, osv

mxser, fix oops when removing opened

tty_driver->owner is not set, so if somebody remove mxser_module, it might
oops (and doesn't tell the user: no way, it's in use). Set the .owner value.

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

---
commit e3a36e41f423af467a95221598fd5754a8fb4032
tree b78cc8a59cb41f27781d115e285c447cf913a889
parent 5df5a993999b94d728cedfa669eba2b0b58e16d7
author Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 22:48:24 +0059
committer Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 22:48:24 +0059

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

diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index c063359..83f604b 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -717,6 +717,7 @@ static int mxser_init(void)
 
 	/* Initialize the tty_driver structure */
 	memset(mxvar_sdriver, 0, sizeof(struct tty_driver));
+	mxvar_sdriver->owner = THIS_MODULE;
 	mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
 	mxvar_sdriver->name = "ttyMI";
 	mxvar_sdriver->major = ttymajor;
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index cd989dc..1bb030b 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -2690,6 +2690,7 @@ static int __init mxser_module_init(void)
 		MXSER_VERSION);
 
 	/* Initialize the tty_driver structure */
+	mxvar_sdriver->owner = THIS_MODULE;
 	mxvar_sdriver->magic = TTY_DRIVER_MAGIC;
 	mxvar_sdriver->name = "ttyMI";
 	mxvar_sdriver->major = ttymajor;

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

* [PATCH 2/3] Char: mxser_new, mark init functions
  2006-12-22 22:50 [PATCH 1/3] Char: mxser, fix oops when removing opened Jiri Slaby
@ 2006-12-22 22:51 ` Jiri Slaby
  2006-12-22 22:51 ` [PATCH 3/3] Char: mxser_new, remove useless spinlock Jiri Slaby
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2006-12-22 22:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

mxser_new, mark init functions

Mark some funcions with __init and __devinit.

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

---
commit 04a4dbf03a9fdc4c53282ab7e1db146389140c3b
tree 916cdef3d0f3acb58de8b96db6e83c11c3f0613c
parent e3a36e41f423af467a95221598fd5754a8fb4032
author Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 22:56:33 +0059
committer Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 22:56:33 +0059

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

diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 1bb030b..2f173e9 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -316,7 +316,7 @@ static int mxser_set_baud_method[MXSER_PORTS + 1];
 static spinlock_t gm_lock;
 
 #ifdef CONFIG_PCI
-static int CheckIsMoxaMust(int io)
+static int __devinit CheckIsMoxaMust(int io)
 {
 	u8 oldmcr, hwid;
 	int i;
@@ -1373,7 +1373,7 @@ static int mxser_tiocmset(struct tty_struct *tty, struct file *file,
 	return 0;
 }
 
-static int mxser_program_mode(int port)
+static int __init mxser_program_mode(int port)
 {
 	int id, i, j, n;
 
@@ -1410,7 +1410,7 @@ static int mxser_program_mode(int port)
 	return id;
 }
 
-static void mxser_normal_mode(int port)
+static void __init mxser_normal_mode(int port)
 {
 	int i, n;
 
@@ -1443,7 +1443,7 @@ static void mxser_normal_mode(int port)
 #define EN0_PORT	0x010	/* Rcv missed frame error counter RD */
 #define ENC_PAGE0	0x000	/* Select page 0 of chip registers   */
 #define ENC_PAGE3	0x0C0	/* Select page 3 of chip registers   */
-static int mxser_read_register(int port, unsigned short *regs)
+static int __init mxser_read_register(int port, unsigned short *regs)
 {
 	int i, k, value, id;
 	unsigned int j;

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

* [PATCH 3/3] Char: mxser_new, remove useless spinlock
  2006-12-22 22:50 [PATCH 1/3] Char: mxser, fix oops when removing opened Jiri Slaby
  2006-12-22 22:51 ` [PATCH 2/3] Char: mxser_new, mark init functions Jiri Slaby
@ 2006-12-22 22:51 ` Jiri Slaby
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2006-12-22 22:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

mxser_new, remove useless spinlock

gm_lock is useless, since ISA is configured at init time and there it's
serialized.

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

---
commit 5f93193574c932263132e3262853be671e9d1642
tree 94693e221836fd7234e290b9911757357889a580
parent 04a4dbf03a9fdc4c53282ab7e1db146389140c3b
author Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 23:04:17 +0059
committer Jiri Slaby <jirislaby@gmail.com> Fri, 22 Dec 2006 23:04:17 +0059

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

diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c
index 2f173e9..103f0b5 100644
--- a/drivers/char/mxser_new.c
+++ b/drivers/char/mxser_new.c
@@ -313,7 +313,6 @@ static int mxvar_diagflag;
 static unsigned char mxser_msr[MXSER_PORTS + 1];
 static struct mxser_mon_ext mon_data_ext;
 static int mxser_set_baud_method[MXSER_PORTS + 1];
-static spinlock_t gm_lock;
 
 #ifdef CONFIG_PCI
 static int __devinit CheckIsMoxaMust(int io)
@@ -1377,7 +1376,6 @@ static int __init mxser_program_mode(int port)
 {
 	int id, i, j, n;
 
-	spin_lock(&gm_lock);
 	outb(0, port);
 	outb(0, port);
 	outb(0, port);
@@ -1385,7 +1383,6 @@ static int __init mxser_program_mode(int port)
 	(void)inb(port);
 	outb(0, port);
 	(void)inb(port);
-	spin_unlock(&gm_lock);
 
 	id = inb(port + 1) & 0x1F;
 	if ((id != C168_ASIC_ID) &&
@@ -2684,7 +2681,6 @@ static int __init mxser_module_init(void)
 	mxvar_sdriver = alloc_tty_driver(MXSER_PORTS + 1);
 	if (!mxvar_sdriver)
 		return -ENOMEM;
-	spin_lock_init(&gm_lock);
 
 	printk(KERN_INFO "MOXA Smartio/Industio family driver version %s\n",
 		MXSER_VERSION);

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

end of thread, other threads:[~2006-12-22 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-22 22:50 [PATCH 1/3] Char: mxser, fix oops when removing opened Jiri Slaby
2006-12-22 22:51 ` [PATCH 2/3] Char: mxser_new, mark init functions Jiri Slaby
2006-12-22 22:51 ` [PATCH 3/3] Char: mxser_new, remove useless spinlock Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®