[LV-kern-commit] CVS: kernel-2.4/drivers/isdn/isdnloop isdnloop.c,1.1.1.1,1.2 isdnloop.h,1.1.1.2,1.2
From: Andy P. <at...@us...> - 2002-04-10 18:31:05
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop In directory usw-pr-cvs1:/tmp/cvs-serv1502/isdn/isdnloop Modified Files: isdnloop.c isdnloop.h Log Message: synch 2.4.15 commit 49 Index: isdnloop.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop/isdnloop.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- isdnloop.c 14 Jan 2001 18:43:13 -0000 1.1.1.1 +++ isdnloop.c 10 Apr 2002 15:32:26 -0000 1.2 @@ -1,30 +1,27 @@ /* $Id$ - + * * ISDN low-level module implementing a dummy loop driver. * * Copyright 1997 by Fritz Elfert (fr...@is...) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * */ #include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> #include "isdnloop.h" -static char -*revision = "$Revision$"; +static char *revision = "$Revision$"; +static char *isdnloop_id; + +MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); +MODULE_AUTHOR("Fritz Elfert"); +MODULE_LICENSE("GPL"); +MODULE_PARM(isdnloop_id, "s"); +MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); static int isdnloop_addcard(char *); @@ -39,10 +36,8 @@ isdnloop_free_queue(isdnloop_card * card, int channel) { struct sk_buff_head *queue = &card->bqueue[channel]; - struct sk_buff *skb; - while ((skb = skb_dequeue(queue))) - dev_kfree_skb(skb); + skb_queue_purge(queue); card->sndcount[channel] = 0; } @@ -323,7 +318,7 @@ int left; u_char c; int ch; - int flags; + unsigned long flags; u_char *p; isdn_ctrl cmd; @@ -975,7 +970,7 @@ * user = flag: 1 = called form userlevel, 0 called from kernel. * card = pointer to card struct. * Return: - * number of bytes transfered (currently always equals len). + * number of bytes transferred (currently always equals len). */ static int isdnloop_writecmd(const u_char * buf, int len, int user, isdnloop_card * card) @@ -985,10 +980,12 @@ isdn_ctrl cmd; while (len) { - int count = MIN(255, len); + int count = len; u_char *p; u_char msg[0x100]; + if (count > 255) + count = 255; if (user) copy_from_user(msg, buf, count); else @@ -1518,38 +1515,18 @@ static int isdnloop_addcard(char *id1) { - ulong flags; isdnloop_card *card; - save_flags(flags); - cli(); if (!(card = isdnloop_initcard(id1))) { - restore_flags(flags); return -EIO; } - restore_flags(flags); printk(KERN_INFO "isdnloop: (%s) virtual card added\n", card->interface.id); return 0; } -#ifdef MODULE -#define isdnloop_init init_module -#else -void -isdnloop_setup(char *str, int *ints) -{ - static char sid[20]; - - if (strlen(str)) { - strcpy(sid, str); - isdnloop_id = sid; - } -} -#endif - -int +static int __init isdnloop_init(void) { char *p; @@ -1565,12 +1542,15 @@ } else strcpy(rev, " ??? "); printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev); - return (isdnloop_addcard(isdnloop_id)); + + if (isdnloop_id) + return (isdnloop_addcard(isdnloop_id)); + + return 0; } -#ifdef MODULE -void -cleanup_module(void) +static void __exit +isdnloop_exit(void) { isdn_ctrl cmd; isdnloop_card *card = cards; @@ -1588,14 +1568,13 @@ } card = cards; while (card) { - struct sk_buff *skb; - last = card; - while ((skb = skb_dequeue(&card->dqueue))) - dev_kfree_skb(skb); + skb_queue_purge(&card->dqueue); card = card->next; kfree(last); } printk(KERN_NOTICE "isdnloop-ISDN-driver unloaded\n"); } -#endif + +module_init(isdnloop_init); +module_exit(isdnloop_exit); Index: isdnloop.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop/isdnloop.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- isdnloop.h 25 Feb 2001 23:15:10 -0000 1.1.1.2 +++ isdnloop.h 10 Apr 2002 15:32:26 -0000 1.2 @@ -1,22 +1,11 @@ /* $Id$ - + * * Loopback lowlevel module for testing of linklevel. * * Copyright 1997 by Fritz Elfert (fr...@is...) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * */ @@ -44,7 +33,6 @@ #ifdef __KERNEL__ /* Kernel includes */ -#include <linux/module.h> #include <linux/version.h> #include <linux/errno.h> #include <linux/fs.h> @@ -115,21 +103,11 @@ */ #ifdef __KERNEL__ static isdnloop_card *cards = (isdnloop_card *) 0; -static char *isdnloop_id = "\0"; - -#ifdef MODULE -MODULE_AUTHOR("Fritz Elfert"); -MODULE_PARM(isdnloop_id, "s"); -MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); -#endif - #endif /* __KERNEL__ */ /* Utility-Macros */ #define CID (card->interface.id) -#define MIN(a,b) ((a<b)?a:b) -#define MAX(a,b) ((a>b)?a:b) #endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */ #endif /* isdnloop_h */ |