ChangeSet 1.2231.1.124, 2005/03/28 19:51:02-08:00, [EMAIL PROTECTED]

        [PATCH] Stallion driver module clean up
        
        These two patches continue the work that Wayne Meissner started and are
        against the current bk tree.
        
        These patches allow the stallion driver to be built-in and loaded at 
boot
        time, the current #ifdef MODULE only allows the init code to be 
included if
        compiled as a module.
        
        Tested for compile, boot and running on our console server as module and
        built-in.
        
        Signed-off-by Darren Williams <[EMAIL PROTECTED]>
        
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 stallion.c |   29 +++++++----------------------
 1 files changed, 7 insertions(+), 22 deletions(-)


diff -Nru a/drivers/char/stallion.c b/drivers/char/stallion.c
--- a/drivers/char/stallion.c   2005-03-28 21:33:55 -08:00
+++ b/drivers/char/stallion.c   2005-03-28 21:33:55 -08:00
@@ -232,13 +232,12 @@
 
 /*****************************************************************************/
 
-#ifdef MODULE
 /*
  *     Define some string labels for arguments passed from the module
  *     load line. These allow for easy board definitions, and easy
  *     modification of the io, memory and irq resoucres.
  */
-
+static int     stl_nargs = 0;
 static char    *board0[4];
 static char    *board1[4];
 static char    *board2[4];
@@ -299,17 +298,15 @@
 MODULE_DESCRIPTION("Stallion Multiport Serial Driver");
 MODULE_LICENSE("GPL");
 
-MODULE_PARM(board0, "1-4s");
+module_param_array(board0, charp, &stl_nargs, 0);
 MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,ioaddr2][,irq]]");
-MODULE_PARM(board1, "1-4s");
+module_param_array(board1, charp, &stl_nargs, 0);
 MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,ioaddr2][,irq]]");
-MODULE_PARM(board2, "1-4s");
+module_param_array(board2, charp, &stl_nargs, 0);
 MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,ioaddr2][,irq]]");
-MODULE_PARM(board3, "1-4s");
+module_param_array(board3, charp, &stl_nargs, 0);
 MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,ioaddr2][,irq]]");
 
-#endif
-
 /*****************************************************************************/
 
 /*
@@ -464,12 +461,10 @@
  *     Declare all those functions in this driver!
  */
 
-#ifdef MODULE
 static void    stl_argbrds(void);
 static int     stl_parsebrd(stlconf_t *confp, char **argp);
 
 static unsigned long stl_atol(char *str);
-#endif
 
 int            stl_init(void);
 static int     stl_open(struct tty_struct *tty, struct file *filp);
@@ -726,8 +721,6 @@
 
 static struct class_simple *stallion_class;
 
-#ifdef MODULE
-
 /*
  *     Loadable module initialization stuff.
  */
@@ -842,15 +835,13 @@
 {
        stlconf_t       conf;
        stlbrd_t        *brdp;
-       int             nrargs, i;
+       int             i;
 
 #ifdef DEBUG
        printk("stl_argbrds()\n");
 #endif
 
-       nrargs = sizeof(stl_brdsp) / sizeof(char **);
-
-       for (i = stl_nrbrds; (i < nrargs); i++) {
+       for (i = stl_nrbrds; (i < stl_nargs); i++) {
                memset(&conf, 0, sizeof(conf));
                if (stl_parsebrd(&conf, stl_brdsp[i]) == 0)
                        continue;
@@ -950,8 +941,6 @@
        return(1);
 }
 
-#endif
-
 /*****************************************************************************/
 
 /*
@@ -2787,9 +2776,7 @@
  */
        for (i = 0; (i < stl_nrbrds); i++) {
                confp = &stl_brdconf[i];
-#ifdef MODULE
                stl_parsebrd(confp, stl_brdsp[i]);
-#endif
                if ((brdp = stl_allocbrd()) == (stlbrd_t *) NULL)
                        return(-ENOMEM);
                brdp->brdnr = i;
@@ -2805,9 +2792,7 @@
  *     Find any dynamically supported boards. That is via module load
  *     line options or auto-detected on the PCI bus.
  */
-#ifdef MODULE
        stl_argbrds();
-#endif
 #ifdef CONFIG_PCI
        stl_findpcibrds();
 #endif
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to