mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Ferenc Wagner <wferi@niif.hu>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: RocketPort Linux driver errors on module reload
Date: Mon, 15 Oct 2007 07:25:12 -0400	[thread overview]
Message-ID: <bububu786234897832@pripojeni.net> (raw)
In-Reply-To: <87abqk1z3t.fsf@tac.ki.iif.hu>

> -------------------- Start of forwarded message --------------------
> From: Ferenc Wagner <wferi@niif.hu>
> To: support@comtrol.co.uk
> Subject: RocketPort Linux driver errors on module reload
> Date: Fri, 12 Oct 2007 00:22:17 +0200
> Message-ID: <87fy0hwaue.fsf@tac.ki.iif.hu>
> 
> Hi,
> 
> I hope I send this message to the right address...
> 
> I experience the following with the 2.09 version of the driver, as
> included in vanilla Linux 2.6.23.  If I insert the module, I got some
> pretty normal messages, like:
> 
> RocketPort device driver module, version 2.09, 12-June-2003
> ACPI: PCI Interrupt 0000:01:08.0[A] -> GSI 20 (level, low) -> IRQ 21
> Comtrol PCI controller #0 ID 0x802 found in bus:slot:fn 0000:01:08.0 at address d800, 1 AIOP(s) (RocketPort UPCI 8 port w/external I/F)
> Installing RocketPort UPCI 8 port w/external I/F, creating /dev/ttyR0 - 7
> ACPI: PCI Interrupt 0000:02:06.0[A] -> GSI 24 (level, low) -> IRQ 22
> Comtrol PCI controller #1 ID 0x802 found in bus:slot:fn 0000:02:06.0 at address c800, 1 AIOP(s) (RocketPort UPCI 8 port w/external I/F)
> Installing RocketPort UPCI 8 port w/external I/F, creating /dev/ttyR8 - 15
> 
> However, if I remove the module from the kernel, and then insert it
> again, lots of error messages result:
> 
> RocketPort device driver module, version 2.09, 12-June-2003
> Comtrol PCI controller #0 ID 0x802 found in bus:slot:fn 0000:01:08.0 at address d800, 1 AIOP(s) (RocketPort UPCI 8 port w/external I/F)
> Installing RocketPort UPCI 8 port w/external I/F, creating /dev/ttyR0 - 7
> kobject_add failed for ttyR0 with -EEXIST, don't try to register things with the same name in the same directory.
>  [<c01ccdb4>] kobject_shadow_add+0x156/0x188
>  [<c01cd095>] kobject_set_name+0x2b/0x92
>  [<c022d022>] device_add+0x87/0x50f
>  [<c01cce24>] kobject_init+0x2f/0x3f
>  [<c022da2c>] device_create+0x77/0x97
>  [<c02154cb>] tty_register_device+0xb5/0xbd
>  [<f8a130d3>] init_r_port+0x5f1/0x623 [rocket]
>  [<c02409a9>] pci_read+0x29/0x2e
>  [<f8b74ff7>] rp_init+0xff7/0x111a [rocket]
>  [<c013fd38>] __link_module+0x0/0x1f
>  [<c01421de>] sys_init_module+0x1470/0x15a9
>  [<c01296a7>] __request_region+0x0/0x80
>  [<c0103e12>] sysenter_past_esp+0x6b/0xa1
>  =======================
> And so on for each device.
> 
> However, the card seems to operate all right.  Still, the messages
> suggest something isn't quite right and could use some fixing.  Hope
> you can find the problem.

Could you try the attached patch below?

--

diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index 56cbba7..94bb3d0 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -699,8 +699,8 @@ static void init_r_port(int board, int aiop, int chan, struct pci_dev *pci_dev)
 	spin_lock_init(&info->slock);
 	mutex_init(&info->write_mtx);
 	rp_table[line] = info;
-	if (pci_dev)
-		tty_register_device(rocket_driver, line, &pci_dev->dev);
+	tty_register_device(rocket_driver, line, pci_dev ? &pci_dev->dev :
+			NULL);
 }
 
 /*
@@ -2434,7 +2434,7 @@ static int __init rp_init(void)
 	rocket_driver->init_termios.c_ispeed = 9600;
 	rocket_driver->init_termios.c_ospeed = 9600;
 #ifdef ROCKET_SOFT_FLOW
-	rocket_driver->flags |= TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
+	rocket_driver->flags |= TTY_DRIVER_REAL_RAW;
 #endif
 	tty_set_operations(rocket_driver, &rocket_ops);
 
@@ -2491,10 +2491,14 @@ static void rp_cleanup_module(void)
 	if (retval)
 		printk(KERN_INFO "Error %d while trying to unregister "
 		       "rocketport driver\n", -retval);
-	put_tty_driver(rocket_driver);
 
 	for (i = 0; i < MAX_RP_PORTS; i++)
-		kfree(rp_table[i]);
+		if (rp_table[i]) {
+			tty_unregister_device(rocket_driver, i);
+			kfree(rp_table[i]);
+		}
+
+	put_tty_driver(rocket_driver);
 
 	for (i = 0; i < NUM_BOARDS; i++) {
 		if (rcktpt_io_addr[i] <= 0 || is_PCI[i])

  reply	other threads:[~2007-10-15 11:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-15  9:55 Ferenc Wagner
2007-10-15 11:25 ` Jiri Slaby [this message]
2007-10-15 12:57   ` Ferenc Wagner
2007-10-15 19:09     ` Jiri Slaby
2007-10-16  7:47       ` Wagner Ferenc
2007-10-16 21:19         ` Jiri Slaby
2007-10-18 21:53           ` Ferenc Wagner
2007-10-18 22:08             ` Jiri Slaby
2007-10-18 22:48               ` Ferenc Wagner
2007-10-17 17:06 Nick Thompson
2007-10-17 19:35 ` Jiri Slaby
2007-10-17 19:48   ` Nick Thompson
2007-10-18 22:08     ` Jiri Slaby
2007-10-18 23:02       ` Nick Thompson
2007-12-08 10:00         ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bububu786234897832@pripojeni.net \
    --to=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wferi@niif.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome