Hi All,
I am porting USB -to-serial & parallel driver to 2.6.17 &16 , able to load the driver and its working fine but
Couldn't load the driver successfully.
When unloading the driver(usb-to- serial & parallel)
Dmesg log:
: moschip7715_exit: mos7715_exit :entering..........
: moschip7715_exit CHeck1:
: usbcore: deregistering driver moschip7715
: mos7715_shutdown: Entering ...
: mos7715_shutdown: pp is : ca603200
: mos7715_shutdown: priv is : c82836c0
: Before remove port:test2
: BUG: unable to handle kernel paging request at virtual address 723d4edb
: printing eip:
: c02167d7
: *pde = 00000000
: Oops: 0000 [#1]
: Modules linked in: mos7715 usbserial ipv6 autofs4 hidp rfcomm l2cap bluetooth sunrpc usbnet dm_mirror dm_mod video button battery ac parport_pc parport floppy nvram ehci_hcd uhci_hcd snd_via82xx gameport snd_ac97_codec snd_ac97_bus snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq i2c_prosavage i2c_algo_bit snd_pcm_oss snd_mixer_oss snd_pcm via_ircc snd_timer snd_page_alloc snd_mpu401_uart snd_rawmidi snd_seq_device snd soundcore irda crc_ccitt 8139too 8139cp i2c_viapro i2c_core mii sata_via libata sd_mod scsi_mod
: CPU: 0
: EIP: 0060:[<c02167d7>] Not tainted VLI
: EFLAGS: 00010246 (2.6.17.7 #1)
: EIP is at check_tty_count+0x3b/0x83
: eax: 723d4e4f ebx: c80fd000 ecx: c80fd1c0 edx: cdfdfab0
: esi: 00000000 edi: c0324560 ebp: 00000000 esp: cdfdef28
: ds: 007b es: 007b ss: 0068
: Process events/0 (pid: 4, threadinfo=cdfde000 task=cdfdfab0)
: Stack: c80fd188 c80fd000 cdef06a0 c0217a92 00000282 cdef06a0 c80fd188 c80fd18c
: cdef06a0 00000282 c0126b6e c0217a41 c80fd000 cdef06b8 cdef06a0 cdef06c0
: c0126eeb c0126fd7 00000000 00000000 00000000 00000000 00000000 c0352a80
: Call Trace:
: <c0217a92> do_tty_hangup+0x51/0x2c0 <c0126b6e> run_workqueue+0x7a/0xb5
: <c0217a41> do_tty_hangup+0x0/0x2c0 <c0126eeb> worker_thread+0x0/0x11d
: <c0126fd7> worker_thread+0xec/0x11d <c02ee665> _spin_unlock_irq+0x5/0x7
: <c02ed474> schedule+0x49e/0x4fa <c011694d> default_wake_function+0x0/0xc
: <c0129296> kthread+0x91/0xbd <c0129205> kthread+0x0/0xbd
: <c0101005> kernel_thread_helper+0x5/0xb
: Code: 7e 0d 00 8b 8b c0 01 00 00 eb 03 46 89 d1 8b 11 0f 18 02 90 8d 83 c0 01 00 00 39 c1 75 ed b8 4c ae 35 c0 e8 9f 7e 0d 00 8b 43 04 <81> b8 8c 00 00 00 04 00 02 00 75 14 8b 83 dc 00 00 00 85 c0 74
: EIP: [<c02167d7>] check_tty_count+0x3b/0x83 SS:ESP 0068:cdfdef28
: After remove - port :test3
: After put- port: test4
: mos7715_shutdown: FREE, parallel private structure
: mos7715_shutdown CHECK1
: mos7715_shutdown CHECK2
: mos7715_shutdown: FREE, serial private structure
: mos7715_shutdown : end ...
: moschip7715 ttyUSB0: Moschip USB Serial Parallel Driver converter now disconnected from ttyUSB0
: moschip7715 ttyUSB1: Moschip USB Serial Parallel Driver converter now disconnected from ttyUSB1
: moschip7715 4-1:1.0: device disconnected
: moschip7715_exit CHeck2:
: drivers/usb/serial/usb-serial.c: USB Serial deregistering driver Moschip USB Serial Parallel Driver
: moschip7715_exit CHeck3:
: moschip7715_exit: Leaving...
=====================================================
Here are Exit & the Shutdown functions:
void __exit moschip7715_exit (void)
{
DPRINTK("%s \n"," mos7715_exit :entering..........");
printk("%s CHeck1:\n", __FUNCTION__);
usb_deregister (&io_driver);
printk("%s CHeck2:\n" ,__FUNCTION__);
usb_serial_deregister (&moschip7715_2port_device);
printk("%s CHeck3:\n", __FUNCTION__);
DPRINTK("%s\n","Leaving...");
}
static void mos7715_shutdown (struct usb_serial *serial)
{
int i;
struct parport_mos7715_private *priv;
struct parport *pp;
struct moschip_serial *mos7715_serial;
struct moschip_port *mos7715_port; //mahipal
printk("mos7715_shutdown: Entering ...\n");
if(!serial)
{
DPRINTK("%s","Invalid Handler \n");
return;
}
mos7715_serial = get_serial_private(serial);
pp = mos7715_serial->parp;
printk("mos7715_shutdown: pp is : %x\n",(unsigned int)mos7715_serial->parp);
priv = pp->private_data;
printk("mos7715_shutdown: priv is : %x\n",(unsigned int)priv);
if (pp)
{
printk("test1\n");
// priv = pp->private_data;
priv->usbdev = NULL;
printk("Before remove port:test2\n");
pp->modes = 0x0;
parport_remove_port(pp);
printk("After remove - port :test3\n");
parport_put_port(pp);
printk("After put- port: test4\n");
kfree(priv);
DPRINTK("%s\n","FREE, parallel private structure");
}
printk("%s CHECK1\n",__FUNCTION__);
for (i=0; i < serial->num_ports; ++i)
{
mos7715_port = get_port_private(serial->port[i]);
kfree(mos7715_port);
set_port_private(serial->port[i],NULL);
}
printk("%s CHECK2\n",__FUNCTION__);
kfree(get_serial_private(serial)); //free the mos7715_serial context
set_serial_private(serial,NULL);
DPRINTK("%s\n","FREE, serial private structure");
printk("\nmos7715_shutdown : end ...\n");
}
Anybody could give some help on this
Regards,
-Mahipal