From: Andy P. <at...@us...> - 2002-04-10 18:30:50
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit In directory usw-pr-cvs1:/tmp/cvs-serv1502/isdn/pcbit Modified Files: callbacks.c callbacks.h capi.c capi.h drv.c edss1.c edss1.h layer2.c layer2.h module.c pcbit.h Log Message: synch 2.4.15 commit 49 Index: callbacks.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/callbacks.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- callbacks.c 25 Feb 2001 23:15:09 -0000 1.1.1.2 +++ callbacks.c 10 Apr 2002 15:32:26 -0000 1.2 @@ -1,14 +1,12 @@ /* + * Callbacks for the FSM + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * callbacks for the FSM + * the GNU General Public License, incorporated herein by reference. */ /* @@ -16,11 +14,6 @@ * Port of Nelson Escravana's <nel...@us...> fix to CalledPN * NULL pointer dereference in cb_in_1 (originally fixed in 2.0) */ - - -#define __NO_VERSION__ - -#include <linux/module.h> #include <linux/sched.h> #include <linux/string.h> Index: callbacks.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/callbacks.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- callbacks.h 14 Jan 2001 18:40:02 -0000 1.1.1.1 +++ callbacks.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,15 +1,12 @@ /* + * Callbacks prototypes for FSM + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * Callbacks prototypes for FSM - * + * the GNU General Public License, incorporated herein by reference. */ #ifndef CALLBACKS_H Index: capi.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/capi.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- capi.c 25 Feb 2001 23:15:09 -0000 1.1.1.2 +++ capi.c 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,17 +1,16 @@ /* + * CAPI encoder/decoder for + * Portugal Telecom CAPI 2.0 + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * CAPI encoder/decoder for - * Portugal Telecom CAPI 2.0 + * the GNU General Public License, incorporated herein by reference. + * + * Not compatible with the AVM Gmbh. CAPI 2.0 * - * Not compatible with the AVM Gmbh. CAPI 2.0 */ /* @@ -27,10 +26,6 @@ * for debug purposes mainly * encode our number in CallerPN and ConnectedPN */ - -#define __NO_VERSION__ - -#include <linux/module.h> #include <linux/sched.h> #include <linux/string.h> Index: capi.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/capi.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- capi.h 14 Jan 2001 18:40:04 -0000 1.1.1.1 +++ capi.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,14 +1,12 @@ /* + * CAPI encode/decode prototypes and defines + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * CAPI encode/decode prototypes and defines + * the GNU General Public License, incorporated herein by reference. */ #ifndef CAPI_H Index: drv.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/drv.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- drv.c 25 Feb 2001 23:15:09 -0000 1.1.1.2 +++ drv.c 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,14 +1,12 @@ /* + * PCBIT-D interface with isdn4linux + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D interface with isdn4linux + * the GNU General Public License, incorporated herein by reference. */ /* @@ -412,7 +410,6 @@ return len; } - int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel) { struct pcbit_dev * dev; @@ -436,32 +433,36 @@ if (len > BANK4 + 1) { printk("pcbit_writecmd: invalid length %d\n", len); - return -EFAULT; + return -EINVAL; } if (user) { - u_char cbuf[1024]; + u_char *cbuf = kmalloc(len, GFP_KERNEL); + if (!cbuf) + return -ENOMEM; - copy_from_user(cbuf, buf, len); - for (i=0; i<len; i++) - writeb(cbuf[i], dev->sh_mem + i); + if (copy_from_user(cbuf, buf, len)) { + kfree(cbuf); + return -EFAULT; + } + memcpy_toio(dev->sh_mem, cbuf, len); + kfree(cbuf); } else memcpy_toio(dev->sh_mem, buf, len); return len; - break; case L2_FWMODE: /* this is the hard part */ /* dumb board */ - if (len < 0) - return -EINVAL; - if (user) { /* get it into kernel space */ if ((ptr = kmalloc(len, GFP_KERNEL))==NULL) return -ENOMEM; - copy_from_user(ptr, buf, len); + if (copy_from_user(ptr, buf, len)) { + kfree(ptr); + return -EFAULT; + } loadbuf = ptr; } else @@ -493,12 +494,9 @@ kfree(ptr); return errstat ? errstat : len; - - break; default: return -EBUSY; } - return 0; } /* Index: edss1.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/edss1.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- edss1.c 25 Feb 2001 23:15:09 -0000 1.1.1.2 +++ edss1.c 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,25 +1,19 @@ /* + * DSS.1 Finite State Machine + * base: ITU-T Rec Q.931 + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * DSS.1 Finite State Machine - * base: ITU-T Rec Q.931 + * the GNU General Public License, incorporated herein by reference. */ /* * TODO: complete the FSM * move state/event descriptions to a user space logger */ - -#define __NO_VERSION__ - -#include <linux/module.h> #include <linux/sched.h> #include <linux/string.h> Index: edss1.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/edss1.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- edss1.h 14 Jan 2001 18:40:08 -0000 1.1.1.1 +++ edss1.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,14 +1,12 @@ /* + * DSS.1 module definitions + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * DSS.1 module definitions + * the GNU General Public License, incorporated herein by reference. */ #ifndef EDSS1_H Index: layer2.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/layer2.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- layer2.c 25 Feb 2001 23:15:09 -0000 1.1.1.2 +++ layer2.c 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,10 +1,12 @@ /* + * PCBIT-D low-layer interface + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. + * the GNU General Public License, incorporated herein by reference. */ /* @@ -13,10 +15,6 @@ */ /* - * PCBIT-D low-layer interface - */ - -/* * Based on documentation provided by Inesc: * - "Interface com bus do PC para o PCBIT e PCBIT-D", Inesc, Jan 93 */ @@ -26,16 +24,6 @@ * re-write/remove debug printks */ -#define __NO_VERSION__ - - -#ifdef MODULE -#define INCLUDE_INLINE_FUNCS -#endif - - -#include <linux/module.h> - #include <linux/sched.h> #include <linux/string.h> #include <linux/kernel.h> @@ -176,7 +164,6 @@ struct frame_buf *frame = NULL; unsigned char unacked; int flen; /* fragment frame length including all headers */ - int totlen; /* non-fragmented frame length */ int free; int count, cp_len; @@ -213,11 +200,12 @@ ulong msg; if (frame->skb) - totlen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len; + flen = FRAME_HDR_LEN + PREHDR_LEN + frame->skb->len; else - totlen = FRAME_HDR_LEN + PREHDR_LEN; + flen = FRAME_HDR_LEN + PREHDR_LEN; - flen = MIN(totlen, free); + if (flen > free) + flen = free; msg = frame->msg; @@ -259,9 +247,10 @@ } else { /* Type 1 frame */ - totlen = 2 + (frame->skb->len - frame->copied); + flen = 2 + (frame->skb->len - frame->copied); - flen = MIN(totlen, free); + if (flen > free) + flen = free; /* TT */ tt = ((ushort) (flen - 2)) | 0x8000U; /* Type 1 */ @@ -271,8 +260,9 @@ } if (frame->skb) { - cp_len = MIN(frame->skb->len - frame->copied, - flen - count); + cp_len = frame->skb->len - frame->copied; + if (cp_len > flen - count) + cp_len = flen - count; memcpy_topcbit(dev, frame->skb->data + frame->copied, cp_len); Index: layer2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/layer2.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- layer2.h 14 Jan 2001 18:40:09 -0000 1.1.1.1 +++ layer2.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,10 +1,12 @@ /* + * PCBIT-D low-layer interface definitions + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. + * the GNU General Public License, incorporated herein by reference. */ /* @@ -12,10 +14,6 @@ * Hacked to compile with egcs and run with current version of isdn modules */ -/* - * PCBIT-D low-layer interface definitions - */ - #ifndef LAYER2_H #define LAYER2_H @@ -120,8 +118,6 @@ unsigned int copied; struct frame_buf * next; }; - -#define MIN(a,b) ((a<b)?a:b) extern int pcbit_l2_write(struct pcbit_dev * dev, ulong msg, ushort refnum, struct sk_buff *skb, unsigned short hdr_len); Index: module.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/module.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- module.c 14 Jan 2001 18:40:02 -0000 1.1.1.1 +++ module.c 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,18 +1,16 @@ /* + * PCBIT-D module support + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D module support + * the GNU General Public License, incorporated herein by reference. */ #include <linux/module.h> - +#include <linux/init.h> #include <linux/sched.h> #include <linux/string.h> #include <linux/kernel.h> @@ -22,25 +20,22 @@ #include <linux/isdnif.h> #include "pcbit.h" +MODULE_DESCRIPTION("ISDN4Linux: Driver for PCBIT-T card"); +MODULE_AUTHOR("Pedro Roque Marques"); +MODULE_LICENSE("GPL"); +MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); +MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); + static int mem[MAX_PCBIT_CARDS] = {0, }; static int irq[MAX_PCBIT_CARDS] = {0, }; static int num_boards; -struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS] = {0, 0, 0, 0}; - -int init_module(void); -void cleanup_module(void); +struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS] = {0, }; extern void pcbit_terminate(int board); extern int pcbit_init_dev(int board, int mem_base, int irq); -#ifdef MODULE -MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i"); -#define pcbit_init init_module -#endif - -int pcbit_init(void) +static int __init pcbit_init(void) { int board; @@ -83,15 +78,10 @@ else return -EIO; } - - /* No symbols to export, hide all symbols */ - EXPORT_NO_SYMBOLS; - return 0; } -#ifdef MODULE -void cleanup_module(void) +static void __exit pcbit_exit(void) { int board; @@ -101,9 +91,8 @@ "PCBIT-D module unloaded\n"); } -#else +#ifndef MODULE #define MAX_PARA (MAX_PCBIT_CARDS * 2) -#include <linux/init.h> static int __init pcbit_setup(char *line) { int i, j, argc; @@ -134,5 +123,6 @@ __setup("pcbit=", pcbit_setup); #endif - +module_init(pcbit_init); +module_exit(pcbit_exit); Index: pcbit.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/pcbit/pcbit.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- pcbit.h 14 Jan 2001 18:40:09 -0000 1.1.1.1 +++ pcbit.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,14 +1,12 @@ /* + * PCBIT-D device driver definitions + * * Copyright (C) 1996 Universidade de Lisboa * * Written by Pedro Roque Marques (ro...@di...) * * This software may be used and distributed according to the terms of - * the GNU Public License, incorporated herein by reference. - */ - -/* - * PCBIT-D device driver definitions + * the GNU General Public License, incorporated herein by reference. */ #ifndef PCBIT_H |