All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] fix 16550A for 2.4
@ 2005-12-18 10:16 Jan Kiszka
  2005-12-18 18:06 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2005-12-18 10:16 UTC (permalink / raw)
  To: xenomai-core


[-- Attachment #1.1: Type: text/plain, Size: 197 bytes --]

Hi,

it takes more to get the serial driver running on 2.4 kernels. The
current trunk version does not let the user set any module parameter
(effectively commented out). This patch fixes it.

Jan


[-- Attachment #1.2: 16550A_module_param.patch --]
[-- Type: text/x-patch, Size: 2849 bytes --]

Index: ksrc/drivers/16550A/16550A.c
===================================================================
--- ksrc/drivers/16550A/16550A.c	(Revision 287)
+++ ksrc/drivers/16550A/16550A.c	(Arbeitskopie)
@@ -114,26 +114,34 @@
 static struct rtdm_device   *device[MAX_DEVICES];
 
 static unsigned long        ioaddr[MAX_DEVICES];
-static int                  ioaddr_c;
 static unsigned int         irq[MAX_DEVICES];
-static int                  irq_c;
 static unsigned int         baud_base[MAX_DEVICES];
-static int                  baud_base_c;
 static int                  tx_fifo[MAX_DEVICES];
-static int                  tx_fifo_c;
 static unsigned int         start_index;
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static int                  ioaddr_c;
+static int                  irq_c;
+static int                  baud_base_c;
+static int                  tx_fifo_c;
+
 module_param_array(ioaddr, ulong, &ioaddr_c, 0400);
+module_param_array(irq, uint, &irq_c, 0400);
+module_param_array(baud_base, uint, &baud_base_c, 0400);
+module_param_array(tx_fifo, int, &tx_fifo_c, 0400);
+#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) */
+MODULE_PARM(ioaddr, "1-" __MODULE_STRING(MAX_DEVICES) "i");
+MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_DEVICES) "i");
+MODULE_PARM(baud_base, "1-" __MODULE_STRING(MAX_DEVICES) "i");
+MODULE_PARM(tx_fifo, "1-" __MODULE_STRING(MAX_DEVICES) "i");
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
+
 MODULE_PARM_DESC(ioaddr, "I/O addresses of the serial devices");
-module_param_array(irq, uint, &irq_c, 0400);
 MODULE_PARM_DESC(irq, "IRQ numbers of the serial devices");
-module_param_array(baud_base, uint, &baud_base_c, 0400);
 MODULE_PARM_DESC(baud_base,
     "Maximum baud rate of the serial device (internal clock rate / 16)");
-module_param_array(tx_fifo, int, &tx_fifo_c, 0400);
 MODULE_PARM_DESC(tx_fifo, "Transmitter FIFO size");
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
+
 module_param(start_index, uint, 0400);
 MODULE_PARM_DESC(start_index, "First device instance number to be used");
 
@@ -1026,7 +1034,7 @@
     device_class:       RTDM_CLASS_SERIAL,
     device_sub_class:   RTDM_SUBCLASS_16550A,
     driver_name:        "xeno_16550A",
-    driver_version:     RTDM_DRIVER_VER(1, 2, 1),
+    driver_version:     RTDM_DRIVER_VER(1, 2, 2),
     peripheral_name:    "UART 16550A",
     provider_name:      "Jan Kiszka",
 };
@@ -1040,10 +1048,15 @@
     int                 i;
 
 
-    if (irq_c < ioaddr_c)
-        return -EINVAL;
+    for (i = 0; i < MAX_DEVICES; i++) {
+        if (!ioaddr[i])
+            continue;
 
-    for (i = 0; i < ioaddr_c; i++) {
+        ret = -EINVAL;
+        if (!irq[i]) {
+            goto cleanup_out;
+        }
+
         dev = kmalloc(sizeof(struct rtdm_device), GFP_KERNEL);
         ret = -ENOMEM;
         if (!dev)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

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

* Re: [Xenomai-core] [PATCH] fix 16550A for 2.4
  2005-12-18 10:16 [Xenomai-core] [PATCH] fix 16550A for 2.4 Jan Kiszka
@ 2005-12-18 18:06 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2005-12-18 18:06 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai-core

Jan Kiszka wrote:
> Hi,
> 
> it takes more to get the serial driver running on 2.4 kernels. The
> current trunk version does not let the user set any module parameter
> (effectively commented out). This patch fixes it.

Applied, thanks.

> 
> Jan
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: ksrc/drivers/16550A/16550A.c
> ===================================================================
> --- ksrc/drivers/16550A/16550A.c	(Revision 287)
> +++ ksrc/drivers/16550A/16550A.c	(Arbeitskopie)
> @@ -114,26 +114,34 @@
>  static struct rtdm_device   *device[MAX_DEVICES];
>  
>  static unsigned long        ioaddr[MAX_DEVICES];
> -static int                  ioaddr_c;
>  static unsigned int         irq[MAX_DEVICES];
> -static int                  irq_c;
>  static unsigned int         baud_base[MAX_DEVICES];
> -static int                  baud_base_c;
>  static int                  tx_fifo[MAX_DEVICES];
> -static int                  tx_fifo_c;
>  static unsigned int         start_index;
>  
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> +static int                  ioaddr_c;
> +static int                  irq_c;
> +static int                  baud_base_c;
> +static int                  tx_fifo_c;
> +
>  module_param_array(ioaddr, ulong, &ioaddr_c, 0400);
> +module_param_array(irq, uint, &irq_c, 0400);
> +module_param_array(baud_base, uint, &baud_base_c, 0400);
> +module_param_array(tx_fifo, int, &tx_fifo_c, 0400);
> +#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) */
> +MODULE_PARM(ioaddr, "1-" __MODULE_STRING(MAX_DEVICES) "i");
> +MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_DEVICES) "i");
> +MODULE_PARM(baud_base, "1-" __MODULE_STRING(MAX_DEVICES) "i");
> +MODULE_PARM(tx_fifo, "1-" __MODULE_STRING(MAX_DEVICES) "i");
> +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
> +
>  MODULE_PARM_DESC(ioaddr, "I/O addresses of the serial devices");
> -module_param_array(irq, uint, &irq_c, 0400);
>  MODULE_PARM_DESC(irq, "IRQ numbers of the serial devices");
> -module_param_array(baud_base, uint, &baud_base_c, 0400);
>  MODULE_PARM_DESC(baud_base,
>      "Maximum baud rate of the serial device (internal clock rate / 16)");
> -module_param_array(tx_fifo, int, &tx_fifo_c, 0400);
>  MODULE_PARM_DESC(tx_fifo, "Transmitter FIFO size");
> -#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) */
> +
>  module_param(start_index, uint, 0400);
>  MODULE_PARM_DESC(start_index, "First device instance number to be used");
>  
> @@ -1026,7 +1034,7 @@
>      device_class:       RTDM_CLASS_SERIAL,
>      device_sub_class:   RTDM_SUBCLASS_16550A,
>      driver_name:        "xeno_16550A",
> -    driver_version:     RTDM_DRIVER_VER(1, 2, 1),
> +    driver_version:     RTDM_DRIVER_VER(1, 2, 2),
>      peripheral_name:    "UART 16550A",
>      provider_name:      "Jan Kiszka",
>  };
> @@ -1040,10 +1048,15 @@
>      int                 i;
>  
>  
> -    if (irq_c < ioaddr_c)
> -        return -EINVAL;
> +    for (i = 0; i < MAX_DEVICES; i++) {
> +        if (!ioaddr[i])
> +            continue;
>  
> -    for (i = 0; i < ioaddr_c; i++) {
> +        ret = -EINVAL;
> +        if (!irq[i]) {
> +            goto cleanup_out;
> +        }
> +
>          dev = kmalloc(sizeof(struct rtdm_device), GFP_KERNEL);
>          ret = -ENOMEM;
>          if (!dev)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core


-- 

Philippe.


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

end of thread, other threads:[~2005-12-18 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-18 10:16 [Xenomai-core] [PATCH] fix 16550A for 2.4 Jan Kiszka
2005-12-18 18:06 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.