Re: Change to serial_core.c .... causing my serial driver problem Help Request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 17 Apr 2008, vcgandhi1@xxxxxxx wrote:

> My driver does the same as jsm_init_module. I would be very surprised if jsm
> actually worked with your change. You need to test it under suspend and resume
> condition.
> 
> My driver does the same uart_register_driver/tty_register_driver, but it looks
> like tty_register_driver sets the major address for the tty structure, but
> that does not get set back in the uart_driver structure. So uart_driver
> structure is still at zero.

Indeed, you're right. One possible solution would be to pull the just 
obtained numbers into struct uart_driver in the specific serial driver 
like

diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index 6767ee3..3afebab 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -225,6 +225,8 @@ static int __init jsm_init_module(void)
 
 	rc = uart_register_driver(&jsm_uart_driver);
 	if (!rc) {
+		jsm_uart_driver.major = jsm_uart_driver.tty_driver->major;
+		jsm_uart_driver.minor = jsm_uart_driver.tty_driver->minor_start;
 		rc = pci_register_driver(&jsm_driver);
 		if (rc)
 			uart_unregister_driver(&jsm_uart_driver);

You could do the same in your driver and see if this fixes your problem. 
However, maybe it is really better to fix it once for all drivers like

diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 0f5a179..11e96bc 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2274,6 +2274,11 @@ int uart_register_driver(struct uart_driver *drv)
 	if (retval < 0) {
 		put_tty_driver(normal);
 		kfree(drv->state);
+	} else if (!drv->major) {
+		/* Driver uses dynamic major and minor numbers,
+		 * propagate the numbers, we just obtained, back */
+		drv->major = normal->major;
+		drv->minor = normal->minor_start;
 	}
 	return retval;
 }

Could you test this one too, please (without the previous one, of course)?

Thanks
Guennadi
---
Guennadi Liakhovetski
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux