From a1034e54906cf4c5ced40cbc2f12a27b3457016a Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:33:57 -0500 Subject: [PATCH] Import 2.3.99pre6-2 --- Documentation/Configure.help | 22 +- Documentation/DocBook/Makefile | 15 +- Documentation/ioctl-number.txt | 5 +- Documentation/video4linux/README.cpia | 6 +- Makefile | 5 +- arch/arm/kernel/arthur.c | 6 +- arch/i386/defconfig | 1 + arch/mips/kernel/irixelf.c | 12 +- arch/sparc/kernel/sys_solaris.c | 4 +- arch/sparc64/kernel/binfmt_aout32.c | 20 +- arch/sparc64/solaris/misc.c | 9 +- drivers/block/xd.c | 2 +- drivers/block/xd.h | 4 +- drivers/char/misc.c | 2 +- drivers/char/videodev.c | 2 +- drivers/isdn/avmb1/b1dma.c | 7 +- drivers/isdn/avmb1/b1isa.c | 16 +- drivers/isdn/avmb1/b1pci.c | 17 +- drivers/isdn/avmb1/b1pcmcia.c | 17 +- drivers/isdn/avmb1/c4.c | 19 +- drivers/isdn/avmb1/capi.c | 12 +- drivers/isdn/avmb1/capidrv.c | 195 ++++++------ drivers/isdn/avmb1/capifs.c | 18 +- drivers/isdn/avmb1/kcapi.c | 44 ++- drivers/isdn/avmb1/t1isa.c | 17 +- drivers/isdn/avmb1/t1pci.c | 25 +- drivers/isdn/hisax/hisax.h | 6 +- drivers/isdn/hisax/isar.c | 26 +- drivers/isdn/hisax/isdnl2.c | 15 +- drivers/isdn/hisax/isdnl3.c | 13 +- drivers/isdn/hisax/md5sums.asc | 14 +- drivers/isdn/hisax/niccy.c | 21 +- drivers/isdn/isdn_common.c | 13 +- drivers/isdn/isdn_net.c | 21 +- drivers/parport/ChangeLog | 15 +- drivers/parport/parport_pc.c | 10 +- drivers/parport/share.c | 305 ++++++++++--------- drivers/usb/acm.c | 4 - drivers/usb/mousedev.c | 12 +- drivers/usb/serial/ftdi_sio.c | 10 +- drivers/usb/serial/keyspan_pda.c | 198 ++++++------ drivers/usb/serial/usb-serial.h | 20 +- drivers/usb/serial/usbserial.c | 413 +++++++++++++------------- fs/binfmt_aout.c | 26 +- fs/binfmt_elf.c | 15 +- fs/exec.c | 10 + fs/ext2/namei.c | 2 +- fs/nfs/mount_clnt.c | 16 +- include/asm-alpha/elf.h | 3 +- include/asm-arm/proc-armo/elf.h | 3 +- include/asm-arm/proc-armv/elf.h | 3 +- include/asm-i386/elf.h | 3 +- include/asm-ia64/elf.h | 3 +- include/asm-ia64/ia32.h | 3 +- include/asm-m68k/elf.h | 3 +- include/asm-mips/elf.h | 3 +- include/asm-mips64/elf.h | 4 +- include/asm-ppc/elf.h | 3 +- include/asm-sh/elf.h | 3 +- include/asm-sparc/elf.h | 3 +- include/asm-sparc64/elf.h | 4 +- include/linux/binfmts.h | 1 + include/linux/parport.h | 2 +- include/linux/personality.h | 8 +- include/linux/usb.h | 4 +- init/main.c | 2 +- kernel/exec_domain.c | 40 ++- kernel/ksyms.c | 3 +- net/irda/af_irda.c | 6 +- scripts/usb/procusb | 44 --- scripts/usb/usbtree | 90 ------ 71 files changed, 976 insertions(+), 952 deletions(-) delete mode 100644 scripts/usb/procusb delete mode 100644 scripts/usb/usbtree diff --git a/Documentation/Configure.help b/Documentation/Configure.help index f6fe91f36493..fd656f58bcf7 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -533,8 +533,11 @@ CONFIG_BLK_DEV_IDEFLOPPY drives, similar to the SCSI protocol. The LS-120 and the IDE/ATAPI Iomega ZIP drive are also supported by - this driver. (ATAPI PD-CD/CDR drives are not supported by this - driver; support for PD-CD/CDR drives is available if you answer Y to + this driver. For information about jumper settings and the question + of when a ZIP drive uses a partition table, see + http://www.win.tue.nl/~aeb/linux/zip/zip-1.html . + (ATAPI PD-CD/CDR drives are not supported by this driver; support + for PD-CD/CDR drives is available if you answer Y to "SCSI emulation support", below). If you say Y here, the FLOPPY drive will be identified along with @@ -9370,8 +9373,8 @@ CONFIG_USB USB verbose debug messages CONFIG_USB_DEBUG - Say Y here if you want the USB core drivers to produce a bunch of - debug messages to the system log. Select this if you are having a + Say Y here if you want the USB core & hub drivers to produce a bunch + of debug messages to the system log. Select this if you are having a problem with USB support and want to see more of what is going on. UHCI (intel PIIX4, VIA, ...) support? @@ -13494,9 +13497,8 @@ CONFIG_HISAX_EURO Say Y or N according to the D-channel protocol which your local telephone service company provides. - NOTE: If you say Y here and you have only one ISDN card installed, - you cannot say Y to "HiSax Support for German 1TR6", below. And vice - versa. + The call control protocol E-DSS1 is used in most European countries. + If unsure, say yes. Support for german charge info CONFIG_DE_AOC @@ -13527,9 +13529,9 @@ CONFIG_HISAX_1TR6 Say Y or N according to the D-channel protocol which your local telephone service company provides. - NOTE: If you say Y here and you have only one ISDN card installed, - you cannot say Y to "HiSax Support for EURO/DSS1", above. And vice - versa. + 1TR6 is an old call control protocol which was used in Germany + before E-DSS1 was established. Nowadays, all new lines in Germany + use E-DSS1. Teles 16.0/8.0 CONFIG_HISAX_16_0 diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile index 1b1ce265bb1d..2079bae183d8 100644 --- a/Documentation/DocBook/Makefile +++ b/Documentation/DocBook/Makefile @@ -3,13 +3,22 @@ BOOKS := wanbook.sgml z8530book.sgml mcabook.sgml videobook.sgml kernel-api.sgml PS := $(patsubst %.sgml, %.ps, $(BOOKS)) PDF := $(patsubst %.sgml, %.pdf, $(BOOKS)) -books: docproc $(BOOKS) +$(BOOKS): $(TOPDIR)/scripts/docproc + +.PHONY: books ps pdf clean mrproper db2ps db2pdf + +books: $(BOOKS) ps: $(PS) pdf: $(PDF) -docproc: +db2ps db2pdf: + @(which $@ > /dev/null 2>&1) || \ + (echo "*** You need to install DocBook stylesheets ***"; \ + exit 1) + +$(TOPDIR)/scripts/docproc: $(MAKE) -C $(TOPDIR)/scripts docproc wanbook.sgml: wanbook.tmpl @@ -64,7 +73,7 @@ clean: mrproper: clean $(RM) $(PS) $(PDF) -%.ps : %.sgml +%.ps : %.sgml db2ps db2ps $< %.pdf : %.sgml diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt index 29a11c3a84ba..bb8e3ee46206 100644 --- a/Documentation/ioctl-number.txt +++ b/Documentation/ioctl-number.txt @@ -28,8 +28,9 @@ patch to Linus Torvalds. Or you can e-mail me at and I'll register one for you. The second argument to _IO, _IOW, _IOR, or _IOWR is a sequence number -to distinguish ioctls from each other. The third argument is the size -of the structure going into the kernel or coming out of the kernel. +to distinguish ioctls from each other. The third argument to _IOW, +_IOR, or _IOWR is the type of the data going into the kernel or coming +out of the kernel (e.g. 'int' or 'struct foo'). Some devices use their major number as the identifier; this is OK, as long as it is unique. Some devices are irregular and don't follow any diff --git a/Documentation/video4linux/README.cpia b/Documentation/video4linux/README.cpia index 2674d1fd4a32..7ac342ff696a 100644 --- a/Documentation/video4linux/README.cpia +++ b/Documentation/video4linux/README.cpia @@ -51,12 +51,12 @@ CONFIG_VIDEO_DEV=m CONFIG_VIDEO_CPIA=m CONFIG_VIDEO_CPIA_PP=m -For autoloading of all those modules you need to tell kerneld some -stuff. Add the following line to your kerneld config-file +For autoloading of all those modules you need to tell modutils some +stuff. Add the following line to your modutils config-file (e.g. /etc/modules.conf or wherever your distribution does store that stuff): -options parport_pc dma=3 irq=7 +options parport_pc io=0x378 irq=7 dma=3 alias char-major-81 cpia_pp The first line tells the dma/irq channels to use. Those _must_ match diff --git a/Makefile b/Makefile index 542715cb1961..790887c5a5ee 100644 --- a/Makefile +++ b/Makefile @@ -410,14 +410,15 @@ backup: mrproper sync sgmldocs: + chmod 755 $(TOPDIR)/scripts/docgen + chmod 755 $(TOPDIR)/scripts/gen-all-syms + chmod 755 $(TOPDIR)/scripts/kernel-doc $(MAKE) -C $(TOPDIR)/Documentation/DocBook books psdocs: sgmldocs - $(MAKE) -C scripts docproc $(MAKE) -C Documentation/DocBook ps pdfdocs: sgmldocs - $(MAKE) -C scripts docproc $(MAKE) -C Documentation/DocBook pdf sums: diff --git a/arch/arm/kernel/arthur.c b/arch/arm/kernel/arthur.c index 77c7d73969fd..8a8a5510d591 100644 --- a/arch/arm/kernel/arthur.c +++ b/arch/arm/kernel/arthur.c @@ -59,11 +59,7 @@ static struct exec_domain arthur_exec_domain = { PER_RISCOS, PER_RISCOS, arthur_to_linux_signals, linux_to_arthur_signals, -#ifdef MODULE - &__this_module, /* No usage counter. */ -#else - NULL, -#endif + THIS_MODULE, NULL /* Nothing after this in the list. */ }; diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 80f68ec31c13..9fa79dff9934 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -107,6 +107,7 @@ CONFIG_BLK_DEV_FD=y # # CONFIG_BLK_DEV_LOOP is not set # CONFIG_BLK_DEV_NBD is not set +# CONFIG_BLK_DEV_LVM is not set # CONFIG_BLK_DEV_MD is not set # CONFIG_MD_LINEAR is not set # CONFIG_MD_STRIPED is not set diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c index 1d46f424af53..a4f767a68f33 100644 --- a/arch/mips/kernel/irixelf.c +++ b/arch/mips/kernel/irixelf.c @@ -717,16 +717,8 @@ static int load_irix_binary(struct linux_binprm * bprm, struct pt_regs * regs) set_fs(old_fs); kfree(elf_phdata); - current->personality = PER_IRIX32; - - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &irix_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); - + set_personality(PER_IRIX32); + set_binfmt(&irix_format); compute_creds(bprm); current->flags &= ~PF_FORKNOEXEC; bprm->p = (unsigned long) diff --git a/arch/sparc/kernel/sys_solaris.c b/arch/sparc/kernel/sys_solaris.c index eb79c344c65b..d099c4e8acc8 100644 --- a/arch/sparc/kernel/sys_solaris.c +++ b/arch/sparc/kernel/sys_solaris.c @@ -23,9 +23,7 @@ do_solaris_syscall (struct pt_regs *regs) int ret; lock_kernel(); - put_exec_domain(current->exec_domain); - current->personality = PER_SVR4; - current->exec_domain = lookup_exec_domain(PER_SVR4); + set_personality(PER_SVR4); if (current->exec_domain && current->exec_domain->handler){ current->exec_domain->handler (0, regs); diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index b927f499ad4b..9cc240293488 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c @@ -198,7 +198,6 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) { struct exec ex; - int fd; unsigned long error; unsigned long fd_offset; unsigned long rlim; @@ -230,7 +229,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) return retval; /* OK, This is the point of no return */ - current->personality = PER_SUNOS; + set_personality(PER_SUNOS); current->mm->end_code = ex.a_text + (current->mm->start_code = N_TXTADDR(ex)); @@ -270,15 +269,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) error_time = jiffies; } - fd = get_unused_fd(); - if (fd < 0) - return fd; - get_file(bprm->file); - fd_install(fd, bprm->file); - if (!bprm->file->f_op->mmap) { loff_t pos = fd_offset; - sys_close(fd); do_brk(0, ex.a_text+ex.a_data); bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -291,7 +283,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) fd_offset); if (error != N_TXTADDR(ex)) { - sys_close(fd); send_sig(SIGKILL, current, 0); return error; } @@ -300,20 +291,13 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); - sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); return error; } } beyond_if: - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &aout32_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); + set_binfmt(&aout32_format); set_brk(current->mm->start_brk, current->mm->brk); diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index 09b12cbb7b7d..2639d19776b5 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -54,7 +54,8 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o unsigned long retval, ret_type; lock_kernel(); - current->personality = PER_SVR4; + /* Do we need it here? */ + set_personality(PER_SVR4); if (flags & MAP_NORESERVE) { static int cnt = 0; @@ -719,11 +720,7 @@ asmlinkage int do_sol_unimplemented(struct pt_regs *regs) asmlinkage void solaris_register(void) { - lock_kernel(); - current->personality = PER_SVR4; - put_exec_domain(current->exec_domain); - current->exec_domain = lookup_exec_domain(current->personality); - unlock_kernel(); + set_personality(PER_SVR4); } extern long solaris_to_linux_signals[], linux_to_solaris_signals[]; diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 65d87930d858..659e05c1799f 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -1190,7 +1190,7 @@ static int __init xd_manual_geo_init (char *str) { int i, integers[1 + 3*XD_MAXDRIVES]; - get_options (str, ARRAY_SIZE (ints), ints); + get_options (str, ARRAY_SIZE (integers), integers); if (integers[0]%3 != 0) { printk("xd: incorrect number of parameters for xd_geo\n"); return 1; diff --git a/drivers/block/xd.h b/drivers/block/xd.h index b3b9cf4bfd1b..b07de3c346bf 100644 --- a/drivers/block/xd.h +++ b/drivers/block/xd.h @@ -103,9 +103,9 @@ typedef struct { const char *name; } XD_SIGNATURE; -void xd_setup (char *command,int *integers); +int xd_setup (char *); #ifndef MODULE -void xd_manual_geo_init (char *command,int *integers); +int xd_manual_geo_init (char *command); #endif /* MODULE */ static u_char xd_detect (u_char *controller, unsigned int *address); static u_char xd_initdrives (void (*init_drive)(u_char drive)); diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 7e4686e405de..b98f9a21c6e1 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -195,7 +195,7 @@ int misc_register(struct miscdevice * misc) * @misc: device to unregister * * Unregister a miscellaneous device that was previously - * successfully registered with misc_register()F. Success + * successfully registered with misc_register(). Success * is indicated by a zero return, a negative errno code * indicates an error. */ diff --git a/drivers/char/videodev.c b/drivers/char/videodev.c index 244871791d84..364ae8e69525 100644 --- a/drivers/char/videodev.c +++ b/drivers/char/videodev.c @@ -227,7 +227,7 @@ extern struct file_operations video_fops; * * The registration code assigns minor numbers based on the type * requested. -ENFILE is returned in all the device slots for this - * catetory are full. If not then the minor field is set and the + * category are full. If not then the minor field is set and the * driver initialize function is called (if non %NULL). * * Zero is returned on success. diff --git a/drivers/isdn/avmb1/b1dma.c b/drivers/isdn/avmb1/b1dma.c index 1785e1740212..b40fafae9788 100644 --- a/drivers/isdn/avmb1/b1dma.c +++ b/drivers/isdn/avmb1/b1dma.c @@ -1,11 +1,14 @@ /* - * $Id: b1dma.c,v 1.3 2000/02/26 01:00:53 keil Exp $ + * $Id: b1dma.c,v 1.4 2000/04/03 16:38:05 calle Exp $ * * Common module for AVM B1 cards that support dma with AMCC * * (c) Copyright 2000 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: b1dma.c,v $ + * Revision 1.4 2000/04/03 16:38:05 calle + * made suppress_pollack static. + * * Revision 1.3 2000/02/26 01:00:53 keil * changes from 2.3.47 * @@ -34,7 +37,7 @@ #include "capicmd.h" #include "capiutil.h" -static char *revision = "$Revision: 1.3 $"; +static char *revision = "$Revision: 1.4 $"; /* ------------------------------------------------------------- */ diff --git a/drivers/isdn/avmb1/b1isa.c b/drivers/isdn/avmb1/b1isa.c index 590e825b6d82..9c67a0a42342 100644 --- a/drivers/isdn/avmb1/b1isa.c +++ b/drivers/isdn/avmb1/b1isa.c @@ -1,11 +1,15 @@ /* - * $Id: b1isa.c,v 1.7 2000/02/02 18:36:03 calle Exp $ + * $Id: b1isa.c,v 1.8 2000/04/03 13:29:24 calle Exp $ * * Module for AVM B1 ISA-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: b1isa.c,v $ + * Revision 1.8 2000/04/03 13:29:24 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.7 2000/02/02 18:36:03 calle * - Modules are now locked while init_module is running * - fixed problem with memory mapping if address is not aligned @@ -69,7 +73,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.7 $"; +static char *revision = "$Revision: 1.8 $"; /* ------------------------------------------------------------- */ @@ -265,6 +269,9 @@ int b1isa_init(void) { struct capi_driver *driver = &b1isa_driver; char *p; + int retval = 0; + + MOD_INC_USE_COUNT; if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); @@ -279,9 +286,10 @@ int b1isa_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); - return -EIO; + retval = -EIO; } - return 0; + MOD_DEC_USE_COUNT; + return retval; } #ifdef MODULE diff --git a/drivers/isdn/avmb1/b1pci.c b/drivers/isdn/avmb1/b1pci.c index f7affea0d8ec..c82de87172ea 100644 --- a/drivers/isdn/avmb1/b1pci.c +++ b/drivers/isdn/avmb1/b1pci.c @@ -1,11 +1,15 @@ /* - * $Id: b1pci.c,v 1.20 2000/02/02 18:36:03 calle Exp $ + * $Id: b1pci.c,v 1.21 2000/04/03 13:29:24 calle Exp $ * * Module for AVM B1 PCI-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: b1pci.c,v $ + * Revision 1.21 2000/04/03 13:29:24 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.20 2000/02/02 18:36:03 calle * - Modules are now locked while init_module is running * - fixed problem with memory mapping if address is not aligned @@ -75,7 +79,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.20 $"; +static char *revision = "$Revision: 1.21 $"; /* ------------------------------------------------------------- */ @@ -509,6 +513,8 @@ int b1pci_init(void) char *p; int retval; + MOD_INC_USE_COUNT; + if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); p = strchr(driver->revision, '$'); @@ -522,6 +528,7 @@ int b1pci_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; } @@ -534,6 +541,7 @@ int b1pci_init(void) detach_capi_driver(driver); printk(KERN_ERR "%s: failed to attach capi_driver\n", driverv4->name); + MOD_DEC_USE_COUNT; return -EIO; } #endif @@ -545,6 +553,7 @@ int b1pci_init(void) #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4 detach_capi_driver(driverv4); #endif + MOD_DEC_USE_COUNT; return -EIO; } @@ -554,6 +563,7 @@ int b1pci_init(void) #ifdef MODULE cleanup_module(); #endif + MOD_DEC_USE_COUNT; return retval; } ncards++; @@ -561,12 +571,15 @@ int b1pci_init(void) if (ncards) { printk(KERN_INFO "%s: %d B1-PCI card(s) detected\n", driver->name, ncards); + MOD_DEC_USE_COUNT; return 0; } printk(KERN_ERR "%s: NO B1-PCI card detected\n", driver->name); + MOD_DEC_USE_COUNT; return -ESRCH; #else printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; #endif } diff --git a/drivers/isdn/avmb1/b1pcmcia.c b/drivers/isdn/avmb1/b1pcmcia.c index ff90b42c8c92..2c749c69d718 100644 --- a/drivers/isdn/avmb1/b1pcmcia.c +++ b/drivers/isdn/avmb1/b1pcmcia.c @@ -1,11 +1,15 @@ /* - * $Id: b1pcmcia.c,v 1.8 2000/03/06 18:00:23 calle Exp $ + * $Id: b1pcmcia.c,v 1.9 2000/04/03 13:29:24 calle Exp $ * * Module for AVM B1/M1/M2 PCMCIA-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: b1pcmcia.c,v $ + * Revision 1.9 2000/04/03 13:29:24 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.8 2000/03/06 18:00:23 calle * - Middleware extention now working with 2.3.49 (capifs). * - Fixed typos in debug section of capi.c @@ -60,6 +64,7 @@ * */ +#include #include #include #include @@ -75,7 +80,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.8 $"; +static char *revision = "$Revision: 1.9 $"; /* ------------------------------------------------------------- */ @@ -301,6 +306,9 @@ int b1pcmcia_init(void) { struct capi_driver *driver = &b1pcmcia_driver; char *p; + int retval = 0; + + MOD_INC_USE_COUNT; if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); @@ -315,9 +323,10 @@ int b1pcmcia_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); - return -EIO; + retval = -EIO; } - return 0; + MOD_DEC_USE_COUNT; + return retval; } #ifdef MODULE diff --git a/drivers/isdn/avmb1/c4.c b/drivers/isdn/avmb1/c4.c index 8ac5a2d31f1d..e3fcabf9b928 100644 --- a/drivers/isdn/avmb1/c4.c +++ b/drivers/isdn/avmb1/c4.c @@ -1,11 +1,18 @@ /* - * $Id: c4.c,v 1.6 2000/03/17 12:21:08 calle Exp $ + * $Id: c4.c,v 1.8 2000/04/03 16:38:05 calle Exp $ * * Module for AVM C4 card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: c4.c,v $ + * Revision 1.8 2000/04/03 16:38:05 calle + * made suppress_pollack static. + * + * Revision 1.7 2000/04/03 13:29:24 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.6 2000/03/17 12:21:08 calle * send patchvalues now working. * @@ -46,7 +53,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.6 $"; +static char *revision = "$Revision: 1.8 $"; #undef CONFIG_C4_DEBUG #undef CONFIG_C4_POLLDEBUG @@ -1294,6 +1301,8 @@ int c4_init(void) char *p; int retval; + MOD_INC_USE_COUNT; + if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); p = strchr(driver->revision, '$'); @@ -1307,6 +1316,7 @@ int c4_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; } @@ -1314,6 +1324,7 @@ int c4_init(void) if (!pci_present()) { printk(KERN_ERR "%s: no PCI bus present\n", driver->name); detach_capi_driver(driver); + MOD_DEC_USE_COUNT; return -EIO; } @@ -1337,6 +1348,7 @@ int c4_init(void) #ifdef MODULE cleanup_module(); #endif + MOD_DEC_USE_COUNT; return retval; } ncards++; @@ -1344,12 +1356,15 @@ int c4_init(void) if (ncards) { printk(KERN_INFO "%s: %d C4 card(s) detected\n", driver->name, ncards); + MOD_DEC_USE_COUNT; return 0; } printk(KERN_ERR "%s: NO C4 card detected\n", driver->name); + MOD_DEC_USE_COUNT; return -ESRCH; #else printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; #endif } diff --git a/drivers/isdn/avmb1/capi.c b/drivers/isdn/avmb1/capi.c index 3bbc329e16f6..c9b4c54dab88 100644 --- a/drivers/isdn/avmb1/capi.c +++ b/drivers/isdn/avmb1/capi.c @@ -1,11 +1,15 @@ /* - * $Id: capi.c,v 1.30 2000/03/19 12:31:36 calle Exp $ + * $Id: capi.c,v 1.31 2000/04/03 13:29:24 calle Exp $ * * CAPI 2.0 Interface for Linux * * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: capi.c,v $ + * Revision 1.31 2000/04/03 13:29:24 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.30 2000/03/19 12:31:36 calle * PPP over CAPI raw driver disabled for now, ppp_generic has been changed. * @@ -154,7 +158,6 @@ * */ -#include #include #include #include @@ -189,7 +192,7 @@ #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */ #include -static char *revision = "$Revision: 1.30 $"; +static char *revision = "$Revision: 1.31 $"; MODULE_AUTHOR("Carsten Paeth (calle@calle.in-berlin.de)"); @@ -362,12 +365,13 @@ struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci) struct capiminor *mp, **pp; unsigned int minor = 0; + MOD_INC_USE_COUNT; mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC); if (!mp) { + MOD_DEC_USE_COUNT; printk(KERN_ERR "capi: can't alloc capiminor\n"); return 0; } - MOD_INC_USE_COUNT; #ifdef _DEBUG_REFCOUNT printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE)); #endif diff --git a/drivers/isdn/avmb1/capidrv.c b/drivers/isdn/avmb1/capidrv.c index d35c21d77b6b..9521140f1871 100644 --- a/drivers/isdn/avmb1/capidrv.c +++ b/drivers/isdn/avmb1/capidrv.c @@ -1,11 +1,21 @@ /* - * $Id: capidrv.c,v 1.30 2000/03/03 15:50:42 calle Exp $ + * $Id: capidrv.c,v 1.32 2000/04/07 15:19:58 calle Exp $ * * ISDN4Linux Driver, using capi20 interface (kernelcapi) * * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: capidrv.c,v $ + * Revision 1.32 2000/04/07 15:19:58 calle + * remove warnings + * + * Revision 1.31 2000/04/06 15:01:25 calle + * Bugfix: crash in capidrv.c when reseting a capi controller. + * - changed code order on remove of controller. + * - using tq_schedule for notifier in kcapi.c. + * - now using spin_lock_irqsave() and spin_unlock_irqrestore(). + * strange: sometimes even MP hang on unload of isdn.o ... + * * Revision 1.30 2000/03/03 15:50:42 calle * - kernel CAPI: * - Changed parameter "param" in capi_signal from __u32 to void *. @@ -182,8 +192,8 @@ #include "capicmd.h" #include "capidrv.h" -static char *revision = "$Revision: 1.30 $"; -int debugmode = 0; +static char *revision = "$Revision: 1.32 $"; +static int debugmode = 0; MODULE_AUTHOR("Carsten Paeth "); MODULE_PARM(debugmode, "i"); @@ -291,6 +301,7 @@ typedef struct capidrv_bchan capidrv_bchan; /* -------- data definitions ----------------------------------------- */ static capidrv_data global; +static spinlock_t global_lock = SPIN_LOCK_UNLOCKED; static struct capi_interface *capifuncs; static void handle_dtrace_data(capidrv_contr *card, @@ -450,33 +461,27 @@ static inline __u8 cip2si2(__u16 cipval) static inline capidrv_contr *findcontrbydriverid(int driverid) { - capidrv_contr *p = global.contr_list; - long flags; + unsigned long flags; + capidrv_contr *p; - save_flags(flags); - cli(); - while (p) { + spin_lock_irqsave(&global_lock, flags); + for (p = global.contr_list; p; p = p->next) if (p->myid == driverid) break; - p = p->next; - } - restore_flags(flags); + spin_unlock_irqrestore(&global_lock, flags); return p; } static capidrv_contr *findcontrbynumber(__u32 contr) { + unsigned long flags; capidrv_contr *p = global.contr_list; - long flags; - save_flags(flags); - cli(); - while (p) { + spin_lock_irqsave(&global_lock, flags); + for (p = global.contr_list; p; p = p->next) if (p->contrnr == contr) break; - p = p->next; - } - restore_flags(flags); + spin_unlock_irqrestore(&global_lock, flags); return p; } @@ -1564,47 +1569,41 @@ static void capidrv_signal(__u16 applid, void *dummy) static void handle_dtrace_data(capidrv_contr *card, int send, int level2, __u8 *data, __u16 len) { - long flags; - __u8 *p, *end; - isdn_ctrl cmd; + __u8 *p, *end; + isdn_ctrl cmd; - if (!len) { - printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n", + if (!len) { + printk(KERN_DEBUG "capidrv-%d: avmb1_q931_data: len == %d\n", card->contrnr, len); - return; - } + return; + } - save_flags(flags); - cli(); - - if (level2) { - PUTBYTE_TO_STATUS(card, 'D'); - PUTBYTE_TO_STATUS(card, '2'); - PUTBYTE_TO_STATUS(card, send ? '>' : '<'); - PUTBYTE_TO_STATUS(card, ':'); - } else { - PUTBYTE_TO_STATUS(card, 'D'); - PUTBYTE_TO_STATUS(card, '3'); - PUTBYTE_TO_STATUS(card, send ? '>' : '<'); - PUTBYTE_TO_STATUS(card, ':'); - } + if (level2) { + PUTBYTE_TO_STATUS(card, 'D'); + PUTBYTE_TO_STATUS(card, '2'); + PUTBYTE_TO_STATUS(card, send ? '>' : '<'); + PUTBYTE_TO_STATUS(card, ':'); + } else { + PUTBYTE_TO_STATUS(card, 'D'); + PUTBYTE_TO_STATUS(card, '3'); + PUTBYTE_TO_STATUS(card, send ? '>' : '<'); + PUTBYTE_TO_STATUS(card, ':'); + } + + for (p = data, end = data+len; p < end; p++) { + __u8 w; + PUTBYTE_TO_STATUS(card, ' '); + w = (*p >> 4) & 0xf; + PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); + w = *p & 0xf; + PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); + } + PUTBYTE_TO_STATUS(card, '\n'); - for (p = data, end = data+len; p < end; p++) { - __u8 w; - PUTBYTE_TO_STATUS(card, ' '); - w = (*p >> 4) & 0xf; - PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); - w = *p & 0xf; - PUTBYTE_TO_STATUS(card, (w < 10) ? '0'+w : 'A'-10+w); - } - PUTBYTE_TO_STATUS(card, '\n'); - - restore_flags(flags); - - cmd.command = ISDN_STAT_STAVAIL; - cmd.driver = card->myid; - cmd.arg = len*3+5; - card->interface.statcallb(&cmd); + cmd.command = ISDN_STAT_STAVAIL; + cmd.driver = card->myid; + cmd.arg = len*3+5; + card->interface.statcallb(&cmd); } /* ------------------------------------------------------------------- */ @@ -2009,8 +2008,8 @@ static int if_command(isdn_ctrl * c) return capidrv_command(c, card); printk(KERN_ERR - "capidrv-%d: if_command %d called with invalid driverId %d!\n", - card->contrnr, c->command, c->driver); + "capidrv: if_command %d called with invalid driverId %d!\n", + c->command, c->driver); return -ENODEV; } @@ -2297,12 +2296,11 @@ static int capidrv_addcontr(__u16 contr, struct capi_profile *profp) } card->myid = card->interface.channels; - save_flags(flags); - cli(); + spin_lock_irqsave(&global_lock, flags); card->next = global.contr_list; global.contr_list = card; global.ncontr++; - restore_flags(flags); + spin_unlock_irqrestore(&global_lock, flags); memset(card->bchans, 0, sizeof(capidrv_bchan) * card->nbchan); for (i = 0; i < card->nbchan; i++) { @@ -2333,25 +2331,22 @@ static int capidrv_addcontr(__u16 contr, struct capi_profile *profp) static int capidrv_delcontr(__u16 contr) { capidrv_contr **pp, *card; + unsigned long flags; isdn_ctrl cmd; - long flags; - int i; - save_flags(flags); - cli(); - for (pp = &global.contr_list; *pp; pp = &(*pp)->next) { - if ((*pp)->contrnr == contr) + spin_lock_irqsave(&global_lock, flags); + for (card = global.contr_list; card; card = card->next) { + if (card->contrnr == contr) break; } - if (!*pp) { - restore_flags(flags); + if (!card) { + spin_unlock_irqrestore(&global_lock, flags); printk(KERN_ERR "capidrv: delcontr: no contr %u\n", contr); return -1; } - card = *pp; - *pp = (*pp)->next; - global.ncontr--; - restore_flags(flags); + spin_unlock_irqrestore(&global_lock, flags); + + del_timer(&card->listentimer); if (debugmode) printk(KERN_DEBUG "capidrv-%d: id=%d unloading\n", @@ -2361,28 +2356,51 @@ static int capidrv_delcontr(__u16 contr) cmd.driver = card->myid; card->interface.statcallb(&cmd); - for (i = 0; i < card->nbchan; i++) { + while (card->nbchan) { cmd.command = ISDN_STAT_DISCH; cmd.driver = card->myid; - cmd.arg = i; + cmd.arg = card->nbchan-1; cmd.parm.num[0] = 0; + if (debugmode) + printk(KERN_DEBUG "capidrv-%d: id=%d disable chan=%ld\n", + card->contrnr, card->myid, cmd.arg); card->interface.statcallb(&cmd); - if (card->bchans[i].nccip) - free_ncci(card, card->bchans[i].nccip); - if (card->bchans[i].plcip) - free_plci(card, card->bchans[i].plcip); + if (card->bchans[card->nbchan-1].nccip) + free_ncci(card, card->bchans[card->nbchan-1].nccip); + if (card->bchans[card->nbchan-1].plcip) + free_plci(card, card->bchans[card->nbchan-1].plcip); if (card->plci_list) printk(KERN_ERR "capidrv: bug in free_plci()\n"); + card->nbchan--; } kfree(card->bchans); - del_timer(&card->listentimer); + card->bchans = 0; + + if (debugmode) + printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n", + card->contrnr, card->myid); cmd.command = ISDN_STAT_UNLOAD; cmd.driver = card->myid; card->interface.statcallb(&cmd); + if (debugmode) + printk(KERN_DEBUG "capidrv-%d: id=%d remove contr from list\n", + card->contrnr, card->myid); + + spin_lock_irqsave(&global_lock, flags); + for (pp = &global.contr_list; *pp; pp = &(*pp)->next) { + if (*pp == card) { + *pp = (*pp)->next; + card->next = 0; + global.ncontr--; + break; + } + } + spin_unlock_irqrestore(&global_lock, flags); + kfree(card); printk(KERN_INFO "%s: now down.\n", card->name); @@ -2539,12 +2557,10 @@ int capidrv_init(void) #ifdef MODULE void cleanup_module(void) { - capidrv_contr *card, *next; - long flags; char rev[10]; char *p; - if ((p = strchr(revision, ':'))) { + if ((p = strchr(revision, ':')) != 0) { strcpy(rev, p + 1); p = strchr(rev, '$'); *p = 0; @@ -2552,21 +2568,10 @@ void cleanup_module(void) strcpy(rev, " ??? "); } - for (card = global.contr_list; card; card = next) { - next = card->next; - disable_dchannel_trace(card); - } - - save_flags(flags); - cli(); - for (card = global.contr_list; card; card = next) { - next = card->next; - capidrv_delcontr(card->contrnr); - } - restore_flags(flags); - (void) (*capifuncs->capi_release) (global.appid); + detach_capi_interface(&cuser); + proc_exit(); printk(KERN_NOTICE "capidrv: Rev%s: unloaded\n", rev); diff --git a/drivers/isdn/avmb1/capifs.c b/drivers/isdn/avmb1/capifs.c index b869e6b5cea4..97f374fa6529 100644 --- a/drivers/isdn/avmb1/capifs.c +++ b/drivers/isdn/avmb1/capifs.c @@ -1,11 +1,15 @@ /* - * $Id: capifs.c,v 1.5 2000/03/13 17:49:52 calle Exp $ + * $Id: capifs.c,v 1.6 2000/04/03 13:29:25 calle Exp $ * * (c) Copyright 2000 by Carsten Paeth (calle@calle.de) * * Heavily based on devpts filesystem from H. Peter Anvin * * $Log: capifs.c,v $ + * Revision 1.6 2000/04/03 13:29:25 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.5 2000/03/13 17:49:52 calle * make it running with 2.3.51. * @@ -44,19 +48,22 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include #include #include #include MODULE_AUTHOR("Carsten Paeth "); -static char *revision = "$Revision: 1.5 $"; +static char *revision = "$Revision: 1.6 $"; struct capifs_ncci { struct inode *inode; @@ -554,6 +561,8 @@ int __init capifs_init(void) char *p; int err; + MOD_INC_USE_COUNT; + if ((p = strchr(revision, ':'))) { strcpy(rev, p + 1); p = strchr(rev, '$'); @@ -562,13 +571,16 @@ int __init capifs_init(void) strcpy(rev, "1.0"); err = register_filesystem(&capifs_fs_type); - if (err) + if (err) { + MOD_DEC_USE_COUNT; return err; + } #ifdef MODULE printk(KERN_NOTICE "capifs: Rev%s: loaded\n", rev); #else printk(KERN_NOTICE "capifs: Rev%s: started\n", rev); #endif + MOD_DEC_USE_COUNT; return 0; } diff --git a/drivers/isdn/avmb1/kcapi.c b/drivers/isdn/avmb1/kcapi.c index d678a8ad7d3f..98e01bc5554d 100644 --- a/drivers/isdn/avmb1/kcapi.c +++ b/drivers/isdn/avmb1/kcapi.c @@ -1,11 +1,22 @@ /* - * $Id: kcapi.c,v 1.13 2000/03/03 15:50:42 calle Exp $ + * $Id: kcapi.c,v 1.15 2000/04/06 15:01:25 calle Exp $ * * Kernel CAPI 2.0 Module * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: kcapi.c,v $ + * Revision 1.15 2000/04/06 15:01:25 calle + * Bugfix: crash in capidrv.c when reseting a capi controller. + * - changed code order on remove of controller. + * - using tq_schedule for notifier in kcapi.c. + * - now using spin_lock_irqsave() and spin_unlock_irqrestore(). + * strange: sometimes even MP hang on unload of isdn.o ... + * + * Revision 1.14 2000/04/03 13:29:25 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.13 2000/03/03 15:50:42 calle * - kernel CAPI: * - Changed parameter "param" in capi_signal from __u32 to void *. @@ -98,7 +109,7 @@ #include #endif -static char *revision = "$Revision: 1.13 $"; +static char *revision = "$Revision: 1.15 $"; /* ------------------------------------------------------------- */ @@ -541,20 +552,21 @@ static struct capi_notifier_list{ struct capi_notifier *tail; } notifier_list; +static spinlock_t notifier_lock = SPIN_LOCK_UNLOCKED; + static inline void notify_enqueue(struct capi_notifier *np) { struct capi_notifier_list *q = ¬ifier_list; unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(¬ifier_lock, flags); if (q->tail) { q->tail->next = np; q->tail = np; } else { q->head = q->tail = np; } - restore_flags(flags); + spin_unlock_irqrestore(¬ifier_lock, flags); } static inline struct capi_notifier *notify_dequeue(void) @@ -563,15 +575,14 @@ static inline struct capi_notifier *notify_dequeue(void) struct capi_notifier *np = 0; unsigned long flags; - save_flags(flags); - cli(); + spin_lock_irqsave(¬ifier_lock, flags); if (q->head) { np = q->head; if ((q->head = np->next) == 0) q->tail = 0; np->next = 0; } - restore_flags(flags); + spin_unlock_irqrestore(¬ifier_lock, flags); return np; } @@ -580,18 +591,24 @@ static int notify_push(unsigned int cmd, __u32 controller, { struct capi_notifier *np; + MOD_INC_USE_COUNT; np = (struct capi_notifier *)kmalloc(sizeof(struct capi_notifier), GFP_ATOMIC); - if (!np) + if (!np) { + MOD_DEC_USE_COUNT; return -1; + } memset(np, 0, sizeof(struct capi_notifier)); np->cmd = cmd; np->controller = controller; np->applid = applid; np->ncci = ncci; notify_enqueue(np); - MOD_INC_USE_COUNT; - queue_task(&tq_state_notify, &tq_immediate); - mark_bh(IMMEDIATE_BH); + /* + * The notifier will result in adding/deleteing + * of devices. Devices can only removed in + * user process, not in bh. + */ + queue_task(&tq_state_notify, &tq_scheduler); return 0; } @@ -1732,6 +1749,8 @@ int kcapi_init(void) char *p; char rev[10]; + MOD_INC_USE_COUNT; + skb_queue_head_init(&recv_queue); /* init_bh(CAPI_BH, do_capi_bh); */ @@ -1773,6 +1792,7 @@ int kcapi_init(void) (void)c4_init(); #endif #endif + MOD_DEC_USE_COUNT; return 0; } diff --git a/drivers/isdn/avmb1/t1isa.c b/drivers/isdn/avmb1/t1isa.c index e1efd3939ffb..b87f7293e3ab 100644 --- a/drivers/isdn/avmb1/t1isa.c +++ b/drivers/isdn/avmb1/t1isa.c @@ -1,11 +1,15 @@ /* - * $Id: t1isa.c,v 1.10 2000/02/02 18:36:04 calle Exp $ + * $Id: t1isa.c,v 1.11 2000/04/03 13:29:25 calle Exp $ * * Module for AVM T1 HEMA-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: t1isa.c,v $ + * Revision 1.11 2000/04/03 13:29:25 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.10 2000/02/02 18:36:04 calle * - Modules are now locked while init_module is running * - fixed problem with memory mapping if address is not aligned @@ -81,7 +85,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.10 $"; +static char *revision = "$Revision: 1.11 $"; /* ------------------------------------------------------------- */ @@ -598,6 +602,9 @@ int t1isa_init(void) { struct capi_driver *driver = &t1isa_driver; char *p; + int retval = 0; + + MOD_INC_USE_COUNT; if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); @@ -612,9 +619,11 @@ int t1isa_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); - return -EIO; + retval = -EIO; } - return 0; + + MOD_DEC_USE_COUNT; + return retval; } #ifdef MODULE diff --git a/drivers/isdn/avmb1/t1pci.c b/drivers/isdn/avmb1/t1pci.c index d24894d9b843..10304be3b065 100644 --- a/drivers/isdn/avmb1/t1pci.c +++ b/drivers/isdn/avmb1/t1pci.c @@ -1,11 +1,18 @@ /* - * $Id: t1pci.c,v 1.5 2000/02/02 18:36:04 calle Exp $ + * $Id: t1pci.c,v 1.7 2000/04/07 15:26:55 calle Exp $ * * Module for AVM T1 PCI-card. * * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de) * * $Log: t1pci.c,v $ + * Revision 1.7 2000/04/07 15:26:55 calle + * better error message if cabel not connected or T1 has no power. + * + * Revision 1.6 2000/04/03 13:29:25 calle + * make Tim Waugh happy (module unload races in 2.3.99-pre3). + * no real problem there, but now it is much cleaner ... + * * Revision 1.5 2000/02/02 18:36:04 calle * - Modules are now locked while init_module is running * - fixed problem with memory mapping if address is not aligned @@ -47,7 +54,7 @@ #include "capilli.h" #include "avmcard.h" -static char *revision = "$Revision: 1.5 $"; +static char *revision = "$Revision: 1.7 $"; #undef CONFIG_T1PCI_DEBUG #undef CONFIG_T1PCI_POLLDEBUG @@ -164,7 +171,11 @@ static int t1pci_add_card(struct capi_driver *driver, struct capicardparams *p) b1dma_reset(card); if ((retval = t1pci_detect(card)) != 0) { - printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", + if (retval < 6) + printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n", + driver->name, card->port, retval); + else + printk(KERN_NOTICE "%s: card at 0x%x, but cabel not connected or T1 has no power (%d)\n", driver->name, card->port, retval); iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK)); kfree(card->ctrlinfo); @@ -264,6 +275,8 @@ int t1pci_init(void) char *p; int retval; + MOD_INC_USE_COUNT; + if ((p = strchr(revision, ':'))) { strncpy(driver->revision, p + 1, sizeof(driver->revision)); p = strchr(driver->revision, '$'); @@ -277,6 +290,7 @@ int t1pci_init(void) if (!di) { printk(KERN_ERR "%s: failed to attach capi_driver\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; } @@ -284,6 +298,7 @@ int t1pci_init(void) if (!pci_present()) { printk(KERN_ERR "%s: no PCI bus present\n", driver->name); detach_capi_driver(driver); + MOD_DEC_USE_COUNT; return -EIO; } @@ -305,6 +320,7 @@ int t1pci_init(void) #ifdef MODULE cleanup_module(); #endif + MOD_DEC_USE_COUNT; return retval; } ncards++; @@ -312,12 +328,15 @@ int t1pci_init(void) if (ncards) { printk(KERN_INFO "%s: %d T1-PCI card(s) detected\n", driver->name, ncards); + MOD_DEC_USE_COUNT; return 0; } printk(KERN_ERR "%s: NO T1-PCI card detected\n", driver->name); + MOD_DEC_USE_COUNT; return -ESRCH; #else printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name); + MOD_DEC_USE_COUNT; return -EIO; #endif } diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h index da55eb2df384..8495fed83601 100644 --- a/drivers/isdn/hisax/hisax.h +++ b/drivers/isdn/hisax/hisax.h @@ -1,8 +1,11 @@ -/* $Id: hisax.h,v 2.41 2000/02/26 00:35:13 keil Exp $ +/* $Id: hisax.h,v 2.42 2000/04/09 19:02:44 keil Exp $ * Basic declarations, defines and prototypes * * $Log: hisax.h,v $ + * Revision 2.42 2000/04/09 19:02:44 keil + * retry pump modulation settings if it fails + * * Revision 2.41 2000/02/26 00:35:13 keil * Fix skb freeing in interrupt context * @@ -500,6 +503,7 @@ struct isar_hw { u_char mod; u_char newcmd; u_char newmod; + char try_mod; struct timer_list ftimer; u_char *rcvbuf; /* B-Channel receive Buffer */ u_char conmsg[16]; diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c index d53dc729a89f..3f0a5c5aa751 100644 --- a/drivers/isdn/hisax/isar.c +++ b/drivers/isdn/hisax/isar.c @@ -1,4 +1,4 @@ -/* $Id: isar.c,v 1.10 2000/02/26 00:35:13 keil Exp $ +/* $Id: isar.c,v 1.11 2000/04/09 19:02:44 keil Exp $ * isar.c ISAR (Siemens PSB 7110) specific routines * @@ -6,6 +6,9 @@ * * * $Log: isar.c,v $ + * Revision 1.11 2000/04/09 19:02:44 keil + * retry pump modulation settings if it fails + * * Revision 1.10 2000/02/26 00:35:13 keil * Fix skb freeing in interrupt context * @@ -1085,13 +1088,14 @@ isar_pump_statev_fax(struct BCState *bcs, u_char devt) { break; case PCTRL_CMD_FRH: case PCTRL_CMD_FRM: - p1 = bcs->hw.isar.newmod; + p1 = bcs->hw.isar.mod = bcs->hw.isar.newmod; bcs->hw.isar.newmod = 0; bcs->hw.isar.cmd = bcs->hw.isar.newcmd; bcs->hw.isar.newcmd = 0; sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, bcs->hw.isar.cmd, 1, &p1); bcs->hw.isar.state = STFAX_LINE; + bcs->hw.isar.try_mod = 3; break; default: if (cs->debug & L1_DEB_HSCX) @@ -1117,13 +1121,14 @@ isar_pump_statev_fax(struct BCState *bcs, u_char devt) { if (cs->debug & L1_DEB_HSCX) debugl1(cs, "pump stev RSP_SILDET"); if (bcs->hw.isar.state == STFAX_SILDET) { - p1 = bcs->hw.isar.newmod; + p1 = bcs->hw.isar.mod = bcs->hw.isar.newmod; bcs->hw.isar.newmod = 0; bcs->hw.isar.cmd = bcs->hw.isar.newcmd; bcs->hw.isar.newcmd = 0; sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, bcs->hw.isar.cmd, 1, &p1); bcs->hw.isar.state = STFAX_LINE; + bcs->hw.isar.try_mod = 3; } break; case PSEV_RSP_SILOFF: @@ -1131,6 +1136,17 @@ isar_pump_statev_fax(struct BCState *bcs, u_char devt) { debugl1(cs, "pump stev RSP_SILOFF"); break; case PSEV_RSP_FCERR: + if (bcs->hw.isar.state == STFAX_LINE) { + if (cs->debug & L1_DEB_HSCX) + debugl1(cs, "pump stev RSP_FCERR try %d", + bcs->hw.isar.try_mod); + if (bcs->hw.isar.try_mod--) { + sendmsg(cs, dps | ISAR_HIS_PUMPCTRL, + bcs->hw.isar.cmd, 1, + &bcs->hw.isar.mod); + break; + } + } if (cs->debug & L1_DEB_HSCX) debugl1(cs, "pump stev RSP_FCERR"); bcs->hw.isar.state = STFAX_ESCAPE; @@ -1441,6 +1457,7 @@ isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para) bcs->hw.isar.mod = para; bcs->hw.isar.newmod = 0; bcs->hw.isar.newcmd = 0; + bcs->hw.isar.try_mod = 3; } else if ((bcs->hw.isar.state == STFAX_ACTIV) && (bcs->hw.isar.cmd == PCTRL_CMD_FTM) && (bcs->hw.isar.mod == para)) { @@ -1463,6 +1480,7 @@ isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para) bcs->hw.isar.mod = para; bcs->hw.isar.newmod = 0; bcs->hw.isar.newcmd = 0; + bcs->hw.isar.try_mod = 3; } else if ((bcs->hw.isar.state == STFAX_ACTIV) && (bcs->hw.isar.cmd == PCTRL_CMD_FTH) && (bcs->hw.isar.mod == para)) { @@ -1485,6 +1503,7 @@ isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para) bcs->hw.isar.mod = para; bcs->hw.isar.newmod = 0; bcs->hw.isar.newcmd = 0; + bcs->hw.isar.try_mod = 3; } else if ((bcs->hw.isar.state == STFAX_ACTIV) && (bcs->hw.isar.cmd == PCTRL_CMD_FRM) && (bcs->hw.isar.mod == para)) { @@ -1507,6 +1526,7 @@ isar_pump_cmd(struct BCState *bcs, u_char cmd, u_char para) bcs->hw.isar.mod = para; bcs->hw.isar.newmod = 0; bcs->hw.isar.newcmd = 0; + bcs->hw.isar.try_mod = 3; } else if ((bcs->hw.isar.state == STFAX_ACTIV) && (bcs->hw.isar.cmd == PCTRL_CMD_FRH) && (bcs->hw.isar.mod == para)) { diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index 69e320262ccd..6353c88dbed5 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c @@ -1,4 +1,4 @@ -/* $Id: isdnl2.c,v 2.20 1999/08/25 16:52:04 keil Exp $ +/* $Id: isdnl2.c,v 2.22 2000/04/12 20:28:37 keil Exp $ * Author Karsten Keil (keil@isdn4linux.de) * based on the teles driver from Jan den Ouden @@ -11,6 +11,13 @@ * Fritz Elfert * * $Log: isdnl2.c,v $ + * Revision 2.22 2000/04/12 20:28:37 keil + * a I frame may be contain zero information bytes + * + * Revision 2.21 2000/04/12 16:41:01 kai + * fix max iframe size + * fix bug in multicasting DL_RELEASE_IND + * * Revision 2.20 1999/08/25 16:52:04 keil * Make gcc on AXP happy * @@ -83,7 +90,7 @@ #include "hisax.h" #include "isdnl2.h" -const char *l2_revision = "$Revision: 2.20 $"; +const char *l2_revision = "$Revision: 2.22 $"; static void l2m_debug(struct FsmInst *fi, char *fmt, ...); @@ -361,7 +368,7 @@ IsRNR(u_char * data, struct PStack *st) int iframe_error(struct PStack *st, struct sk_buff *skb) { - int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 1 : 0); + int i = l2addrsize(&st->l2) + (test_bit(FLG_MOD128, &st->l2.flag) ? 2 : 1); int rsp = *skb->data & 0x2; if (test_bit(FLG_ORIG, &st->l2.flag)) @@ -371,7 +378,7 @@ iframe_error(struct PStack *st, struct sk_buff *skb) return 'L'; - if (skb->len <= i) + if (skb->len < i) return 'N'; if ((skb->len - i) > st->l2.maxlen) diff --git a/drivers/isdn/hisax/isdnl3.c b/drivers/isdn/hisax/isdnl3.c index 6dc8bd9d06c8..1783c5556d94 100644 --- a/drivers/isdn/hisax/isdnl3.c +++ b/drivers/isdn/hisax/isdnl3.c @@ -1,4 +1,4 @@ -/* $Id: isdnl3.c,v 2.10 1999/07/21 14:46:19 keil Exp $ +/* $Id: isdnl3.c,v 2.11 2000/04/12 16:41:01 kai Exp $ * Author Karsten Keil (keil@isdn4linux.de) * based on the teles driver from Jan den Ouden @@ -11,6 +11,10 @@ * Fritz Elfert * * $Log: isdnl3.c,v $ + * Revision 2.11 2000/04/12 16:41:01 kai + * fix max iframe size + * fix bug in multicasting DL_RELEASE_IND + * * Revision 2.10 1999/07/21 14:46:19 keil * changes from EICON certification * @@ -68,7 +72,7 @@ #include "isdnl3.h" #include -const char *l3_revision = "$Revision: 2.10 $"; +const char *l3_revision = "$Revision: 2.11 $"; static struct Fsm l3fsm = @@ -375,10 +379,13 @@ static void l3ml3p(struct PStack *st, int pr) { struct l3_process *p = st->l3.proc; + struct l3_process *np; while (p) { + /* p might be kfreed under us, so we need to save where we want to go on */ + np = p->next; st->l3.l3ml3(st, pr, p); - p = p->next; + p = np; } } diff --git a/drivers/isdn/hisax/md5sums.asc b/drivers/isdn/hisax/md5sums.asc index ec21e78c7f26..3ccbfc33ae5a 100644 --- a/drivers/isdn/hisax/md5sums.asc +++ b/drivers/isdn/hisax/md5sums.asc @@ -8,8 +8,8 @@ # 3fb9c99465857a4c136ae2881f4e30ba isac.c dd3955847bbf680b41233478fe521d88 isdnl1.c -bb51bd223040b511c18f091da5ab6456 isdnl2.c -b7aa7f97b2374967a4aca7c52991142c isdnl3.c +d362523462c424a8bce8b596ed5bdf2e isdnl2.c +92ea268891c222963a6ca70935bf1556 isdnl3.c a23fbf8879c1432b04640b8b04bdf419 tei.c 838791b14269ec94c74ba4ae89c022e6 callc.c bf9605b36429898f7be6630034e83230 cert.c @@ -23,9 +23,9 @@ a296edc459b508bf0346c3132815a4db diva.c Version: 2.6.3i Charset: noconv -iQCVAwUBONlcejpxHvX/mS9tAQFWYAP/WmxgwQ7W6gVnsMkUlwzE1TKGWVJdGUTC -7WrKEtdweuzW3/7WEzjBoZgUEcpugJYK3JENby1xjh3yIHfws4HqLme1yXAmkYUK -6LmW96HC2g4wj7PH0hvLnzTOtXDGTppU7KJibbB+ziyhBbs6SGXOD4zHrCWmT9ld -CURhfNgftIs= -=AA+Q +iQCVAwUBOPT2aTpxHvX/mS9tAQFJyAQAj+eY8MhPxQ2TS3rtfjK7bv8jrOGeJYu6 +P0YPnkkc09pCA6UdmYP6VSFkhtDS43HEZiGMb1MV/Y4LQ4wVDNrFDk9AyUNhP2/0 +gY+nYON6hT9ilXYqsbqoqGmh5qLaxj64p9mKu+MIgZ69CS4g7aj/OAXWB06zh7li +MiC65PNo6k0= +=d7xA -----END PGP SIGNATURE----- diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c index 4198bb5e0fa3..2cfbd146cf33 100644 --- a/drivers/isdn/hisax/niccy.c +++ b/drivers/isdn/hisax/niccy.c @@ -1,4 +1,4 @@ -/* $Id: niccy.c,v 1.8 1999/08/11 21:01:33 keil Exp $ +/* $Id: niccy.c,v 1.10 2000/04/11 11:12:39 keil Exp $ * niccy.c low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and * compatible (SAGEM cybermodem) @@ -8,6 +8,12 @@ * Thanks to Dr. Neuhaus and SAGEM for informations * * $Log: niccy.c,v $ + * Revision 1.10 2000/04/11 11:12:39 keil + * cleanup + * + * Revision 1.9 2000/04/09 19:09:19 keil + * Bugfix: reset IRQ enable only valid for PCI version + * * Revision 1.8 1999/08/11 21:01:33 keil * new PCI codefix * @@ -42,7 +48,7 @@ #include extern const char *CardType[]; -const char *niccy_revision = "$Revision: 1.8 $"; +const char *niccy_revision = "$Revision: 1.10 $"; #define byteout(addr,val) outb(val,addr) #define bytein(addr) inb(addr) @@ -228,12 +234,13 @@ release_io_niccy(struct IsdnCardState *cs) static void niccy_reset(struct IsdnCardState *cs) { - int val, nval; - - val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG); - nval = val | PCI_IRQ_ENABLE; - outl(nval, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG); + if (cs->subtyp == NICCY_PCI) { + int val; + val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG); + val |= PCI_IRQ_ENABLE; + outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG); + } inithscxisac(cs, 3); } diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c index e9c3ce50b1f2..6462a10bc5df 100644 --- a/drivers/isdn/isdn_common.c +++ b/drivers/isdn/isdn_common.c @@ -1,4 +1,4 @@ -/* $Id: isdn_common.c,v 1.100 2000/03/03 16:37:11 kai Exp $ +/* $Id: isdn_common.c,v 1.101 2000/04/07 14:50:34 calle Exp $ * Linux ISDN subsystem, common used functions (linklevel). * @@ -21,6 +21,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn_common.c,v $ + * Revision 1.101 2000/04/07 14:50:34 calle + * Bugfix: on my system 2.3.99-pre3 Dual PII 350, unload of module isdn.o + * hangs if vfree is called with interrupt disabled. After moving + * restore_flags in front of vfree it doesn't hang. + * * Revision 1.100 2000/03/03 16:37:11 kai * incorporated some cosmetic changes from the official kernel tree back * into CVS @@ -453,7 +458,7 @@ isdn_dev *dev = (isdn_dev *) 0; -static char *isdn_revision = "$Revision: 1.100 $"; +static char *isdn_revision = "$Revision: 1.101 $"; extern char *isdn_net_revision; extern char *isdn_tty_revision; @@ -2780,12 +2785,14 @@ cleanup_module(void) } if (devfs_unregister_chrdev(ISDN_MAJOR, "isdn") != 0) { printk(KERN_WARNING "isdn: controldevice busy, remove cancelled\n"); + restore_flags(flags); } else { isdn_cleanup_devfs(); del_timer(&dev->timer); + restore_flags(flags); + /* call vfree with interrupts enabled, else it will hang */ vfree(dev); printk(KERN_NOTICE "ISDN-subsystem unloaded\n"); } - restore_flags(flags); } #endif diff --git a/drivers/isdn/isdn_net.c b/drivers/isdn/isdn_net.c index 8948e43f55bf..c22aadc4ac3d 100644 --- a/drivers/isdn/isdn_net.c +++ b/drivers/isdn/isdn_net.c @@ -1,4 +1,4 @@ -/* $Id: isdn_net.c,v 1.122 2000/03/20 22:37:46 detabc Exp $ +/* $Id: isdn_net.c,v 1.125 2000/04/05 21:25:55 detabc Exp $ * Linux ISDN subsystem, network interfaces and related functions (linklevel). * @@ -21,6 +21,15 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Log: isdn_net.c,v $ + * Revision 1.125 2000/04/05 21:25:55 detabc + * add leased-line support to abc-stuff + * + * Revision 1.124 2000/04/03 21:07:22 detabc + * change write_super handling for abc-stuff + * + * Revision 1.123 2000/04/03 19:14:36 kai + * fix "isdn BUG at isdn_net.c:1440!" + * * Revision 1.122 2000/03/20 22:37:46 detabc * modify abc-extension to work together with the new LL. * remove abc frame-counter (is obsolete now). @@ -647,7 +656,7 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp) int isdn_net_force_dial_lp(isdn_net_local *); static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); -char *isdn_net_revision = "$Revision: 1.122 $"; +char *isdn_net_revision = "$Revision: 1.125 $"; /* * Code for raw-networking over ISDN @@ -1437,12 +1446,16 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb) { if (in_interrupt()) { - printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__); + // we can't grab the lock from irq context, + // so we just queue the packet + skb_queue_tail(&lp->super_tx_queue, skb); + queue_task(&lp->tqueue, &tq_immediate); return; } spin_lock_bh(&lp->xmit_lock); - if (!isdn_net_lp_busy(lp)) { + if (!isdn_net_lp_busy(lp)) + { isdn_net_writebuf_skb(lp, skb); } else { skb_queue_tail(&lp->super_tx_queue, skb); diff --git a/drivers/parport/ChangeLog b/drivers/parport/ChangeLog index 3d00ebbce4ae..1e09974c9d4b 100644 --- a/drivers/parport/ChangeLog +++ b/drivers/parport/ChangeLog @@ -1,7 +1,20 @@ -2000-03-29 Tim Waugh +2000-04-04 Tim Waugh * parport_pc.c: Add support for another PCI card. +2000-04-04 Tim Waugh + + * daisy.c: Documentation in kernel-doc format. + + * ieee1284.c: Likewise. + + * share.c: Likewise. + +2000-04-01 Tim Waugh + + * share.c (parport_register_device): Need to hold the module + reference counts before sleeping. + 2000-03-27 Tim Waugh * parport_pc.c (parport_pc_ecp_read_block_pio): Correct operation diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index b0460aad4c32..7791c115c35d 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -427,6 +427,8 @@ static size_t parport_pc_ecpepp_read_data (struct parport *port, void *buf, size_t got; frob_econtrol (port, 0xe0, ECR_EPP << 5); + parport_pc_data_reverse (port); + parport_pc_write_control (port, 0x4); got = parport_pc_epp_read_data (port, buf, length, flags); frob_econtrol (port, 0xe0, ECR_PS2 << 5); @@ -440,6 +442,8 @@ static size_t parport_pc_ecpepp_write_data (struct parport *port, size_t written; frob_econtrol (port, 0xe0, ECR_EPP << 5); + parport_pc_write_control (port, 0x4); + parport_pc_data_forward (port); written = parport_pc_epp_write_data (port, buf, length, flags); frob_econtrol (port, 0xe0, ECR_PS2 << 5); @@ -452,6 +456,8 @@ static size_t parport_pc_ecpepp_read_addr (struct parport *port, void *buf, size_t got; frob_econtrol (port, 0xe0, ECR_EPP << 5); + parport_pc_data_reverse (port); + parport_pc_write_control (port, 0x4); got = parport_pc_epp_read_addr (port, buf, length, flags); frob_econtrol (port, 0xe0, ECR_PS2 << 5); @@ -465,6 +471,8 @@ static size_t parport_pc_ecpepp_write_addr (struct parport *port, size_t written; frob_econtrol (port, 0xe0, ECR_EPP << 5); + parport_pc_write_control (port, 0x4); + parport_pc_data_forward (port); written = parport_pc_epp_write_addr (port, buf, length, flags); frob_econtrol (port, 0xe0, ECR_PS2 << 5); @@ -1733,7 +1741,7 @@ static int __devinit parport_ECPEPP_supported(struct parport *pb) oecr = inb (ECONTROL (pb)); /* Search for SMC style EPP+ECP mode */ outb (0x80, ECONTROL (pb)); - + outb (0x04, CONTROL (pb)); result = parport_EPP_supported(pb); outb (oecr, ECONTROL (pb)); diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 27cd907e1127..63a185029fd8 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -104,18 +104,19 @@ static void get_lowlevel_driver (void) } /** - * parport_register_driver - register a parallel port device driver - * @drv: structure describing the driver + * parport_register_driver - register a parallel port device driver + * @drv: structure describing the driver * - * This can be called by a parallel port device driver in order to - * receive notifications about ports being found in the system, as - * well as ports no longer available. + * This can be called by a parallel port device driver in order + * to receive notifications about ports being found in the + * system, as well as ports no longer available. * - * The @drv structure is allocated by the caller and must not be - * deallocated until after calling parport_unregister_driver(). + * The @drv structure is allocated by the caller and must not be + * deallocated until after calling parport_unregister_driver(). * - * Returns 0 on success. Currently it always succeeds. + * Returns 0 on success. Currently it always succeeds. **/ + int parport_register_driver (struct parport_driver *drv) { struct parport *port; @@ -135,22 +136,23 @@ int parport_register_driver (struct parport_driver *drv) } /** - * parport_unregister_driver - deregister a parallel port device driver - * @arg: structure describing the driver that was given to - * parport_register_driver() + * parport_unregister_driver - deregister a parallel port device driver + * @arg: structure describing the driver that was given to + * parport_register_driver() * - * This should be called by a parallel port device driver that has - * registered itself using parport_register_driver() when it is about - * to be unloaded. + * This should be called by a parallel port device driver that + * has registered itself using parport_register_driver() when it + * is about to be unloaded. * - * When it returns, the driver's attach() routine will no longer be - * called, and for each port that attach() was called for, the - * detach() routine will hae been called. + * When it returns, the driver's attach() routine will no longer + * be called, and for each port that attach() was called for, the + * detach() routine will have been called. * - * If the caller's attach() function can block, it is their - * responsibility to make sure to wait for it to exit before - * unloading. + * If the caller's attach() function can block, it is their + * responsibility to make sure to wait for it to exit before + * unloading. **/ + void parport_unregister_driver (struct parport_driver *arg) { struct parport_driver *drv = driver_chain, *olddrv = NULL; @@ -180,16 +182,17 @@ void parport_unregister_driver (struct parport_driver *arg) } /** - * parport_enumerate - return a list of the system's parallel ports + * parport_enumerate - return a list of the system's parallel ports * - * This returns the head of the list of parallel ports in the system. - * The structure that is returned describes the first port in the - * list, and its 'next' member points to the next port, or %NULL if - * it's the last port. + * This returns the head of the list of parallel ports in the + * system, as a &struct parport. The structure that is returned + * describes the first port in the list, and its 'next' member + * points to the next port, or %NULL if it's the last port. * - * If there are no parallel ports in the system, parport_enumerate() - * will return %NULL. + * If there are no parallel ports in the system, + * parport_enumerate() will return %NULL. **/ + struct parport *parport_enumerate(void) { if (!portlist) @@ -199,32 +202,34 @@ struct parport *parport_enumerate(void) } /** - * parport_register_port - register a parallel port - * @base: base I/O address - * @irq: IRQ line - * @dma: DMA channel - * @ops: pointer to the port driver's port operations structure + * parport_register_port - register a parallel port + * @base: base I/O address + * @irq: IRQ line + * @dma: DMA channel + * @ops: pointer to the port driver's port operations structure * - * When a parallel port (lowlevel) driver finds a port that should be - * made available to parallel port device drivers, it should call - * parport_register_port(). The @base, @irq, and @dma parameters are - * for the convenience of port drivers, and for ports where they - * aren't meaningful needn't be set to anything special. They can be - * altered afterwards by adjusting the relevant members of the parport - * structure that is returned and represents the port. They should - * not be tampered with after calling parport_announce_port, however. + * When a parallel port (lowlevel) driver finds a port that + * should be made available to parallel port device drivers, it + * should call parport_register_port(). The @base, @irq, and + * @dma parameters are for the convenience of port drivers, and + * for ports where they aren't meaningful needn't be set to + * anything special. They can be altered afterwards by adjusting + * the relevant members of the parport structure that is returned + * and represents the port. They should not be tampered with + * after calling parport_announce_port, however. * - * If there are parallel port device drivers in the system that have - * registered themselves using parport_register_driver(), they are not - * told about the port at this time; that is done by - * parport_announce_port(). + * If there are parallel port device drivers in the system that + * have registered themselves using parport_register_driver(), + * they are not told about the port at this time; that is done by + * parport_announce_port(). * - * The @ops structure is allocated by the caller, and must not be - * deallocated before calling parport_unregister_port(). + * The @ops structure is allocated by the caller, and must not be + * deallocated before calling parport_unregister_port(). * - * If there is no memory to allocate a new parport structure, this - * function will return %NULL. + * If there is no memory to allocate a new parport structure, + * this function will return %NULL. **/ + struct parport *parport_register_port(unsigned long base, int irq, int dma, struct parport_operations *ops) { @@ -310,16 +315,17 @@ struct parport *parport_register_port(unsigned long base, int irq, int dma, } /** - * parport_announce_port - tell device drivers about a parallel port - * @port: parallel port to announce + * parport_announce_port - tell device drivers about a parallel port + * @port: parallel port to announce * - * After a port driver has registered a parallel port with - * parport_register_port, and performed any necessary initialisation - * or adjustments, it should call parport_announce_port() in order to - * notify all device drivers that have called - * parport_register_driver(). Their attach() functions will be - * called, with @port as the parameter. + * After a port driver has registered a parallel port with + * parport_register_port, and performed any necessary + * initialisation or adjustments, it should call + * parport_announce_port() in order to notify all device drivers + * that have called parport_register_driver(). Their attach() + * functions will be called, with @port as the parameter. **/ + void parport_announce_port (struct parport *port) { #ifdef CONFIG_PARPORT_1284 @@ -364,22 +370,24 @@ static void free_port (struct parport *port) } /** - * parport_unregister_port - deregister a parallel port - * @port: parallel port to deregister + * parport_unregister_port - deregister a parallel port + * @port: parallel port to deregister * - * When a parallel port driver is forcibly unloaded, or a parallel - * port becomes inaccessible, the port driver must call this function - * in order to deal with device drivers that still want to use it. + * When a parallel port driver is forcibly unloaded, or a + * parallel port becomes inaccessible, the port driver must call + * this function in order to deal with device drivers that still + * want to use it. * - * The parport structure associated with the port has its operations - * structure replaced with one containing 'null' operations that - * return errors or just don't do anything. + * The parport structure associated with the port has its + * operations structure replaced with one containing 'null' + * operations that return errors or just don't do anything. * - * Any drivers that have registered themselves using - * parport_register_driver() are notified that the port is no longer - * accessible by having their detach() routines called with @port as - * the parameter. + * Any drivers that have registered themselves using + * parport_register_driver() are notified that the port is no + * longer accessible by having their detach() routines called + * with @port as the parameter. **/ + void parport_unregister_port(struct parport *port) { struct parport *p; @@ -415,70 +423,74 @@ void parport_unregister_port(struct parport *port) } /** - * parport_register_device - register a device on a parallel port - * @port: port to which the device is attached - * @name: a name to refer to the device - * @pf: preemption callback - * @kf: kick callback (wake-up) - * @irq_func: interrupt handler - * @flags: registration flags - * @handle: data for callback functions + * parport_register_device - register a device on a parallel port + * @port: port to which the device is attached + * @name: a name to refer to the device + * @pf: preemption callback + * @kf: kick callback (wake-up) + * @irq_func: interrupt handler + * @flags: registration flags + * @handle: data for callback functions * - * This function, called by parallel port device drivers, declares - * that a device is connected to a port, and tells the system all it - * needs to know. + * This function, called by parallel port device drivers, + * declares that a device is connected to a port, and tells the + * system all it needs to know. * - * The @name is allocated by the caller and must not be deallocated - * until the caller calls @parport_unregister_device for that device. + * The @name is allocated by the caller and must not be + * deallocated until the caller calls @parport_unregister_device + * for that device. * - * The preemption callback function, @pf, is called when this device - * driver has claimed access to the port but another device driver - * wants to use it. It is given @handle as its parameter, and should - * return zero if it is willing for the system to release the port to - * another driver on its behalf. If it wants to keep control of the - * port it should return non-zero, and no action will be taken. It is - * good manners for the driver to try to release the port at the - * earliest opportunity after its preemption callback rejects a - * preemption attempt. Note that if a preemption callback is happy - * for preemption to go ahead, there is no need to release the port; - * it is done automatically. This function may not block, as it may - * be called from interrupt context. If the device driver does not - * support preemption, @pf can be %NULL. + * The preemption callback function, @pf, is called when this + * device driver has claimed access to the port but another + * device driver wants to use it. It is given @handle as its + * parameter, and should return zero if it is willing for the + * system to release the port to another driver on its behalf. + * If it wants to keep control of the port it should return + * non-zero, and no action will be taken. It is good manners for + * the driver to try to release the port at the earliest + * opportunity after its preemption callback rejects a preemption + * attempt. Note that if a preemption callback is happy for + * preemption to go ahead, there is no need to release the port; + * it is done automatically. This function may not block, as it + * may be called from interrupt context. If the device driver + * does not support preemption, @pf can be %NULL. * - * The wake-up ("kick") callback function, @kf, is called when the - * port is available to be claimed for exclusive access; that is, - * parport_claim() is guaranteed to succeed when called from inside - * the wake-up callback function. If the driver wants to claim the - * port it should do so; otherwise, it need not take any action. This - * function may not block, as it may be called from interrupt context. - * If the device driver does not want to be explicitly invited to - * claim the port in this way, @kf can be %NULL. + * The wake-up ("kick") callback function, @kf, is called when + * the port is available to be claimed for exclusive access; that + * is, parport_claim() is guaranteed to succeed when called from + * inside the wake-up callback function. If the driver wants to + * claim the port it should do so; otherwise, it need not take + * any action. This function may not block, as it may be called + * from interrupt context. If the device driver does not want to + * be explicitly invited to claim the port in this way, @kf can + * be %NULL. * - * The interrupt handler, @irq_func, is called when an interrupt - * arrives from the parallel port. Note that if a device driver wants - * to use interrupts it should use parport_enable_irq(), and can also - * check the irq member of the parport structure representing the - * port. + * The interrupt handler, @irq_func, is called when an interrupt + * arrives from the parallel port. Note that if a device driver + * wants to use interrupts it should use parport_enable_irq(), + * and can also check the irq member of the parport structure + * representing the port. * - * The parallel port (lowlevel) driver is the one that has called - * request_irq() and whose interrupt handler is called first. This - * handler does whatever needs to be done to the hardware to - * acknowledge the interrupt (for PC-style ports there is nothing - * special to be done). It then tells the IEEE 1284 code about the - * interrupt, which may involve reacting to an IEEE 1284 event - * depending on the current IEEE 1284 phase. After this, it calls - * @irq_func. Needless to say, @irq_func will be called from - * interrupt context, and may not block. + * The parallel port (lowlevel) driver is the one that has called + * request_irq() and whose interrupt handler is called first. + * This handler does whatever needs to be done to the hardware to + * acknowledge the interrupt (for PC-style ports there is nothing + * special to be done). It then tells the IEEE 1284 code about + * the interrupt, which may involve reacting to an IEEE 1284 + * event depending on the current IEEE 1284 phase. After this, + * it calls @irq_func. Needless to say, @irq_func will be called + * from interrupt context, and may not block. * - * The %PARPORT_DEV_EXCL flag is for preventing port sharing, and so - * should only be used when sharing the port with other device drivers - * is impossible and would lead to incorrect behaviour. Use it - * sparingly! Normally, @flags will be zero. + * The %PARPORT_DEV_EXCL flag is for preventing port sharing, and + * so should only be used when sharing the port with other device + * drivers is impossible and would lead to incorrect behaviour. + * Use it sparingly! Normally, @flags will be zero. * - * This function returns a pointer to a structure that represents the - * device on the port, or %NULL if there is not enough memory to - * allocate space for that structure. + * This function returns a pointer to a structure that represents + * the device on the port, or %NULL if there is not enough memory + * to allocate space for that structure. **/ + struct pardevice * parport_register_device(struct parport *port, const char *name, int (*pf)(void *), void (*kf)(void *), @@ -581,11 +593,12 @@ parport_register_device(struct parport *port, const char *name, } /** - * parport_unregister_device - deregister a device on a parallel port - * @dev: pointer to structure representing device + * parport_unregister_device - deregister a device on a parallel port + * @dev: pointer to structure representing device * - * This undoes the effect of parport_register_device(). + * This undoes the effect of parport_register_device(). **/ + void parport_unregister_device(struct pardevice *dev) { struct parport *port; @@ -633,15 +646,17 @@ void parport_unregister_device(struct pardevice *dev) } /** - * parport_claim - claim access to a parallel port device - * @dev: pointer to structure representing a device on the port + * parport_claim - claim access to a parallel port device + * @dev: pointer to structure representing a device on the port * - * This function will not block and so can be used from interrupt - * context. If parport_claim() succeeds in claiming access to the - * port it returns zero and the port is available to use. It may fail - * (returning non-zero) if the port is in use by another driver and - * that driver is not willing to relinquish control of the port. + * This function will not block and so can be used from interrupt + * context. If parport_claim() succeeds in claiming access to + * the port it returns zero and the port is available to use. It + * may fail (returning non-zero) if the port is in use by another + * driver and that driver is not willing to relinquish control of + * the port. **/ + int parport_claim(struct pardevice *dev) { struct pardevice *oldcad; @@ -744,14 +759,15 @@ blocked: } /** - * parport_claim_or_block - claim access to a parallel port device - * @dev: pointer to structure representing a device on the port + * parport_claim_or_block - claim access to a parallel port device + * @dev: pointer to structure representing a device on the port * - * This behaves like parport_claim(), but will block if necessary to - * wait for the port to be free. A return value of 1 indicates that - * it slept; 0 means that it succeeded without needing to sleep. A - * negative error code indicates failure. + * This behaves like parport_claim(), but will block if necessary + * to wait for the port to be free. A return value of 1 + * indicates that it slept; 0 means that it succeeded without + * needing to sleep. A negative error code indicates failure. **/ + int parport_claim_or_block(struct pardevice *dev) { int r; @@ -795,13 +811,14 @@ int parport_claim_or_block(struct pardevice *dev) } /** - * parport_release - give up access to a parallel port device - * @dev: pointer to structure representing parallel port device + * parport_release - give up access to a parallel port device + * @dev: pointer to structure representing parallel port device * - * This function cannot fail, but it should not be called without the - * port claimed. Similarly, if the port is already claimed you should - * not try claiming it again. + * This function cannot fail, but it should not be called without + * the port claimed. Similarly, if the port is already claimed + * you should not try claiming it again. **/ + void parport_release(struct pardevice *dev) { struct parport *port = dev->port->physport; diff --git a/drivers/usb/acm.c b/drivers/usb/acm.c index 453c4af197b7..70f8c9163164 100644 --- a/drivers/usb/acm.c +++ b/drivers/usb/acm.c @@ -52,10 +52,6 @@ #define DEBUG #include -void tty_register_devfs (struct tty_driver *driver, unsigned int flags, - unsigned minor); -void tty_unregister_devfs (struct tty_driver *driver, unsigned minor); - /* * CMSPAR, some architectures can't have space and mark parity. */ diff --git a/drivers/usb/mousedev.c b/drivers/usb/mousedev.c index 765f61556d03..ccabdf000714 100644 --- a/drivers/usb/mousedev.c +++ b/drivers/usb/mousedev.c @@ -39,11 +39,11 @@ #include #include -#ifndef CONFIG_MOUSEDEV_SCREEN_X -#define CONFIG_MOUSEDEV_SCREEN_X 1024 +#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X +#define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 #endif -#ifndef CONFIG_MOUSEDEV_SCREEN_Y -#define CONFIG_MOUSEDEV_SCREEN_Y 768 +#ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_Y +#define CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768 #endif struct mousedev { @@ -93,12 +93,12 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig switch (code) { case ABS_X: size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - list->dx += (value * CONFIG_MOUSEDEV_SCREEN_X - list->oldx) / size; + list->dx += (value * CONFIG_INPUT_MOUSEDEV_SCREEN_X - list->oldx) / size; list->oldx += list->dx * size; break; case ABS_Y: size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - list->dy -= (value * CONFIG_MOUSEDEV_SCREEN_Y - list->oldy) / size; + list->dy -= (value * CONFIG_INPUT_MOUSEDEV_SCREEN_Y - list->oldy) / size; list->oldy -= list->dy * size; break; } diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 151c4bfe76d8..a305283bb3cb 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -153,7 +153,7 @@ struct usb_serial_device_type ftdi_sio_device = { /* do some startup allocations not currently performed by usb_serial_probe() */ static int ftdi_sio_startup (struct usb_serial *serial) { - init_waitqueue_head(&serial->write_wait); + init_waitqueue_head(&serial->port[0].write_wait); return (0); } @@ -291,7 +291,7 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user, /* Was seeing a race here, got a read callback, then write callback before hitting interuptible_sleep_on - so wrapping in add_wait_queue stuff */ - add_wait_queue(&serial->write_wait, &wait); + add_wait_queue(&port->write_wait, &wait); set_current_state (TASK_INTERRUPTIBLE); while (port->write_urb->status == -EINPROGRESS) { dbg("ftdi_sio - write in progress - retrying"); @@ -301,13 +301,13 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user, } if (signal_pending(current)) { current->state = TASK_RUNNING; - remove_wait_queue(&serial->write_wait, &wait); + remove_wait_queue(&port->write_wait, &wait); rc = -ERESTARTSYS; goto err; } schedule(); } - remove_wait_queue(&serial->write_wait, &wait); + remove_wait_queue(&port->write_wait, &wait); set_current_state(TASK_RUNNING); count += data_offset; @@ -388,7 +388,7 @@ static void ftdi_sio_write_bulk_callback (struct urb *urb) return; } - wake_up_interruptible(&serial->write_wait); + wake_up_interruptible(&port->write_wait); if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 9fb22e4a89bb..c63f1b856df6 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -52,78 +52,20 @@ struct ezusb_hex_record { #include "usb-serial.h" +struct keyspan_pda_private { + int tx_room; + int tx_throttled; +}; + #define KEYSPAN_VENDOR_ID 0x06cd #define KEYSPAN_PDA_FAKE_ID 0x0103 #define KEYSPAN_PDA_ID 0x0104 /* no clue */ -/* function prototypes for a Keyspan PDA serial converter */ -static int keyspan_pda_open (struct usb_serial_port *port, - struct file *filp); -static void keyspan_pda_close (struct usb_serial_port *port, - struct file *filp); -static int keyspan_pda_startup (struct usb_serial *serial); -static void keyspan_pda_rx_throttle (struct usb_serial_port *port); -static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port); -static int keyspan_pda_setbaud (struct usb_serial *serial, int baud); -static int keyspan_pda_write_room (struct usb_serial_port *port); -static int keyspan_pda_write (struct usb_serial_port *port, - int from_user, - const unsigned char *buf, - int count); -static void keyspan_pda_write_bulk_callback (struct urb *urb); -static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port); -static int keyspan_pda_ioctl (struct usb_serial_port *port, - struct file *file, - unsigned int cmd, - unsigned long arg); -static void keyspan_pda_set_termios (struct usb_serial_port *port, - struct termios *old); -static void keyspan_pda_break_ctl (struct usb_serial_port *port, - int break_state); -static int keyspan_pda_fake_startup (struct usb_serial *serial); - - /* All of the device info needed for the Keyspan PDA serial converter */ static __u16 keyspan_vendor_id = KEYSPAN_VENDOR_ID; static __u16 keyspan_pda_fake_product_id = KEYSPAN_PDA_FAKE_ID; static __u16 keyspan_pda_product_id = KEYSPAN_PDA_ID; -struct usb_serial_device_type keyspan_pda_fake_device = { - name: "Keyspan PDA - (prerenumeration)", - idVendor: &keyspan_vendor_id, /* the Keyspan PDA vendor ID */ - idProduct: &keyspan_pda_fake_product_id, /* the Keyspan PDA initial product id */ - needs_interrupt_in: DONT_CARE, /* don't have to have an interrupt in endpoint */ - needs_bulk_in: DONT_CARE, /* don't have to have a bulk in endpoint */ - needs_bulk_out: DONT_CARE, /* don't have to have a bulk out endpoint */ - num_interrupt_in: NUM_DONT_CARE, - num_bulk_in: NUM_DONT_CARE, - num_bulk_out: NUM_DONT_CARE, - num_ports: 1, - startup: keyspan_pda_fake_startup -}; -struct usb_serial_device_type keyspan_pda_device = { - name: "Keyspan PDA", - idVendor: &keyspan_vendor_id, /* the Keyspan PDA vendor ID */ - idProduct: &keyspan_pda_product_id, /* the Keyspan PDA product id */ - needs_interrupt_in: MUST_HAVE, - needs_bulk_in: DONT_CARE, - needs_bulk_out: MUST_HAVE, - num_interrupt_in: 1, - num_bulk_in: 0, - num_bulk_out: 1, - num_ports: 1, - open: keyspan_pda_open, - close: keyspan_pda_close, - write: keyspan_pda_write, - write_room: keyspan_pda_write_room, - write_bulk_callback: keyspan_pda_write_bulk_callback, - chars_in_buffer: keyspan_pda_chars_in_buffer, - throttle: keyspan_pda_rx_throttle, - unthrottle: keyspan_pda_rx_unthrottle, - startup: keyspan_pda_startup, - ioctl: keyspan_pda_ioctl, - set_termios: keyspan_pda_set_termios, - break_ctl: keyspan_pda_break_ctl, -}; + static void keyspan_pda_rx_interrupt (struct urb *urb) @@ -133,6 +75,8 @@ static void keyspan_pda_rx_interrupt (struct urb *urb) struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int i; + struct keyspan_pda_private *priv; + priv = (struct keyspan_pda_private *)(port->private); /* the urb might have been killed. */ if (urb->status) @@ -167,8 +111,8 @@ static void keyspan_pda_rx_interrupt (struct urb *urb) break; case 2: /* tx unthrottle interrupt */ tty = serial->port[0].tty; - serial->tx_throttled = 0; - wake_up(&serial->write_wait); /* wake up writer */ + priv->tx_throttled = 0; + wake_up(&port->write_wait); /* wake up writer */ wake_up(&tty->write_wait); /* them too */ break; default: @@ -193,7 +137,7 @@ static void keyspan_pda_rx_throttle (struct usb_serial_port *port) upon the device too. */ dbg("keyspan_pda_rx_throttle port %d", port->number); - usb_unlink_urb(port->read_urb); + usb_unlink_urb(port->interrupt_in_urb); } @@ -201,7 +145,7 @@ static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port) { /* just restart the receive interrupt URB */ dbg("keyspan_pda_rx_unthrottle port %d", port->number); - if (usb_submit_urb(port->read_urb)) + if (usb_submit_urb(port->interrupt_in_urb)) dbg(" usb_submit_urb(read urb) failed"); return; } @@ -409,8 +353,10 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, struct usb_serial *serial = port->serial; int request_unthrottle = 0; int rc = 0; + struct keyspan_pda_private *priv; DECLARE_WAITQUEUE(wait, current); + priv = (struct keyspan_pda_private *)(port->private); /* guess how much room is left in the device's ring buffer, and if we want to send more than that, check first, updating our notion of what is left. If our write will result in no room left, ask the @@ -419,7 +365,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, select() or poll() too) until we receive that unthrottle interrupt. Block if we can't write anything at all, otherwise write as much as we can. */ - + dbg("keyspan_pda_write(%d)",count); if (count == 0) { dbg(" write request of 0 bytes"); return (0); @@ -434,7 +380,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, rc = -EAGAIN; goto err; } - interruptible_sleep_on(&serial->write_wait); + interruptible_sleep_on(&port->write_wait); if (signal_pending(current)) { rc = -ERESTARTSYS; goto err; @@ -451,16 +397,16 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, have to be careful to avoid a race that would cause us to sleep forever. */ - add_wait_queue(&serial->write_wait, &wait); + add_wait_queue(&port->write_wait, &wait); set_current_state(TASK_INTERRUPTIBLE); - while (serial->tx_throttled) { + while (priv->tx_throttled) { /* device can't accomodate any more characters. Sleep until it can. Woken up by an Rx interrupt message, which clears tx_throttled first. */ dbg(" tx_throttled, going to sleep"); if (signal_pending(current)) { current->state = TASK_RUNNING; - remove_wait_queue(&serial->write_wait, &wait); + remove_wait_queue(&port->write_wait, &wait); dbg(" woke up because of signal"); rc = -ERESTARTSYS; goto err; @@ -468,11 +414,11 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, schedule(); dbg(" woke up"); } - remove_wait_queue(&serial->write_wait, &wait); + remove_wait_queue(&port->write_wait, &wait); set_current_state(TASK_RUNNING); count = (count > port->bulk_out_size) ? port->bulk_out_size : count; - if (count > serial->tx_room) { + if (count > priv->tx_room) { unsigned char room; /* Looks like we might overrun the Tx buffer. Ask the device how much room it really has */ @@ -495,15 +441,15 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, return -EIO; /* device didn't return any data */ } dbg(" roomquery says %d", room); - serial->tx_room = room; - if (count > serial->tx_room) { + priv->tx_room = room; + if (count > priv->tx_room) { /* we're about to completely fill the Tx buffer, so we'll be throttled afterwards. */ - count = serial->tx_room; + count = priv->tx_room; request_unthrottle = 1; } } - serial->tx_room -= count; + priv->tx_room -= count; if (count) { /* now transfer data */ @@ -529,7 +475,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, dbg(" request_unthrottle"); /* ask the device to tell us when the tx buffer becomes sufficiently empty */ - serial->tx_throttled = 1; /* block writers */ + priv->tx_throttled = 1; /* block writers */ rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 7, /* request_unthrottle */ @@ -563,7 +509,7 @@ static void keyspan_pda_write_bulk_callback (struct urb *urb) return; } - wake_up_interruptible(&serial->write_wait); + wake_up_interruptible(&port->write_wait); tty = port->tty; if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && @@ -576,23 +522,25 @@ static void keyspan_pda_write_bulk_callback (struct urb *urb) static int keyspan_pda_write_room (struct usb_serial_port *port) { - struct usb_serial *serial = port->serial; + struct keyspan_pda_private *priv; + priv = (struct keyspan_pda_private *)(port->private); /* used by n_tty.c for processing of tabs and such. Giving it our conservative guess is probably good enough, but needs testing by running a console through the device. */ - return (serial->tx_room); + return (priv->tx_room); } static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port) { - struct usb_serial *serial = port->serial; + struct keyspan_pda_private *priv; + priv = (struct keyspan_pda_private *)(port->private); /* when throttled, return at least WAKEUP_CHARS to tell select() (via n_tty.c:normal_poll() ) that we're not writeable. */ - if (serial->tx_throttled) + if (priv->tx_throttled) return 256; return 0; } @@ -603,6 +551,8 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) struct usb_serial *serial = port->serial; unsigned char room; int rc; + struct keyspan_pda_private *priv; + priv = (struct keyspan_pda_private *)(port->private); if (port->active) { return -EINVAL; @@ -627,8 +577,8 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) dbg(" roomquery returned 0 bytes"); return -EIO; /* device didn't return any data */ } - serial->tx_room = room; - serial->tx_throttled = room ? 0 : 1; + priv->tx_room = room; + priv->tx_throttled = room ? 0 : 1; /* the normal serial device seems to always turn on DTR and RTS here, so do the same */ @@ -638,7 +588,7 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) keyspan_pda_set_modem_info(serial, 0); /*Start reading from the device*/ - if (usb_submit_urb(port->read_urb)) + if (usb_submit_urb(port->interrupt_in_urb)) dbg(" usb_submit_urb(read int) failed"); return (0); @@ -655,7 +605,7 @@ static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp) /* shutdown our bulk reads and writes */ usb_unlink_urb (port->write_urb); - usb_unlink_urb (port->read_urb); + usb_unlink_urb (port->interrupt_in_urb); port->active = 0; } @@ -691,27 +641,63 @@ static int keyspan_pda_fake_startup (struct usb_serial *serial) return (1); } - -/* do some startup allocations not currently performed by usb_serial_probe() */ static int keyspan_pda_startup (struct usb_serial *serial) { - struct usb_endpoint_descriptor *intin; - intin = serial->port[0].interrupt_in_endpoint; - - /* set up the receive interrupt urb */ - FILL_INT_URB(serial->port[0].read_urb, serial->dev, - usb_rcvintpipe(serial->dev, intin->bEndpointAddress), - serial->port[0].interrupt_in_buffer, - intin->wMaxPacketSize, - keyspan_pda_rx_interrupt, - serial, - intin->bInterval); - - init_waitqueue_head(&serial->write_wait); - + /* allocate the private data structures for all ports. Well, for all + one ports. */ + + serial->port[0].private = kmalloc(sizeof(struct keyspan_pda_private), + GFP_KERNEL); + if (!serial->port[0].private) + return (1); /* error */ + init_waitqueue_head(&serial->port[0].write_wait); return (0); } -#endif /* CONFIG_USB_SERIAL_KEYSPAN_PDA */ +static void keyspan_pda_shutdown (struct usb_serial *serial) +{ + kfree(serial->port[0].private); +} +struct usb_serial_device_type keyspan_pda_fake_device = { + name: "Keyspan PDA - (prerenumeration)", + idVendor: &keyspan_vendor_id, + idProduct: &keyspan_pda_fake_product_id, + needs_interrupt_in: DONT_CARE, + needs_bulk_in: DONT_CARE, + needs_bulk_out: DONT_CARE, + num_interrupt_in: NUM_DONT_CARE, + num_bulk_in: NUM_DONT_CARE, + num_bulk_out: NUM_DONT_CARE, + num_ports: 1, + startup: keyspan_pda_fake_startup, +}; +struct usb_serial_device_type keyspan_pda_device = { + name: "Keyspan PDA", + idVendor: &keyspan_vendor_id, + idProduct: &keyspan_pda_product_id, + needs_interrupt_in: MUST_HAVE, + needs_bulk_in: DONT_CARE, + needs_bulk_out: MUST_HAVE, + num_interrupt_in: 1, + num_bulk_in: 0, + num_bulk_out: 1, + num_ports: 1, + open: keyspan_pda_open, + close: keyspan_pda_close, + write: keyspan_pda_write, + write_room: keyspan_pda_write_room, + write_bulk_callback: keyspan_pda_write_bulk_callback, + read_int_callback: keyspan_pda_rx_interrupt, + chars_in_buffer: keyspan_pda_chars_in_buffer, + throttle: keyspan_pda_rx_throttle, + unthrottle: keyspan_pda_rx_unthrottle, + ioctl: keyspan_pda_ioctl, + set_termios: keyspan_pda_set_termios, + break_ctl: keyspan_pda_break_ctl, + startup: keyspan_pda_startup, + shutdown: keyspan_pda_shutdown, +}; + +#endif /* CONFIG_USB_SERIAL_KEYSPAN_PDA */ diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index 6211a6309d86..285b11032e6e 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h @@ -39,10 +39,8 @@ struct usb_serial_port { unsigned char number; char active; /* someone has this device open */ - struct usb_endpoint_descriptor * interrupt_in_endpoint; - __u8 interrupt_in_interval; unsigned char * interrupt_in_buffer; - struct urb * control_urb; + struct urb * interrupt_in_urb; unsigned char * bulk_in_buffer; struct urb * read_urb; @@ -50,7 +48,10 @@ struct usb_serial_port { unsigned char * bulk_out_buffer; int bulk_out_size; struct urb * write_urb; - void * private; /* data private to the specific driver */ + + wait_queue_head_t write_wait; + + void * private; /* data private to the specific port */ }; struct usb_serial { @@ -65,11 +66,6 @@ struct usb_serial { char num_bulk_out; /* number of bulk out endpoints we have */ struct usb_serial_port port[MAX_NUM_PORTS]; - /* FIXME! These should move to the private area of the keyspan driver */ - int tx_room; - int tx_throttled; - wait_queue_head_t write_wait; - void * private; /* data private to the specific driver */ }; @@ -99,7 +95,8 @@ struct usb_serial_device_type { /* function call to make before accepting driver */ int (*startup) (struct usb_serial *serial); /* return 0 to continue initialization, anything else to abort */ - + void (*shutdown) (struct usb_serial *serial); + /* serial function calls */ int (*open) (struct usb_serial_port *port, struct file * filp); void (*close) (struct usb_serial_port *port, struct file * filp); @@ -111,7 +108,8 @@ struct usb_serial_device_type { int (*chars_in_buffer) (struct usb_serial_port *port); void (*throttle) (struct usb_serial_port *port); void (*unthrottle) (struct usb_serial_port *port); - + + void (*read_int_callback)(struct urb *urb); void (*read_bulk_callback)(struct urb *urb); void (*write_bulk_callback)(struct urb *urb); }; diff --git a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c index 0c197267569a..e6c551aa5300 100644 --- a/drivers/usb/serial/usbserial.c +++ b/drivers/usb/serial/usbserial.c @@ -997,235 +997,231 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum) int num_bulk_out = 0; int num_ports; - /* loop through our list of known serial converters, and see if this device matches */ - device_num = 0; - while (usb_serial_devices[device_num] != NULL) { + /* loop through our list of known serial converters, and see if this + device matches. */ + for (device_num = 0; usb_serial_devices[device_num]; device_num++) { type = usb_serial_devices[device_num]; - dbg ("Looking at %s Vendor id=%.4x Product id=%.4x", type->name, *(type->idVendor), *(type->idProduct)); + dbg ("Looking at %s Vendor id=%.4x Product id=%.4x", + type->name, *(type->idVendor), *(type->idProduct)); /* look at the device descriptor */ if ((dev->descriptor.idVendor == *(type->idVendor)) && (dev->descriptor.idProduct == *(type->idProduct))) { + dbg("descriptor matches"); + break; + } + } + if (!usb_serial_devices[device_num]) { + /* no match */ + dbg("none matched"); + return(NULL); + } - dbg("descriptor matches...looking at the endpoints"); - - /* descriptor matches, let's try to find the endpoints needed */ - interrupt_pipe = bulk_in_pipe = bulk_out_pipe = HAS_NOT; + /* descriptor matches, let's find the endpoints needed */ + interrupt_pipe = bulk_in_pipe = bulk_out_pipe = HAS_NOT; - /* check out the endpoints */ - interface = &dev->actconfig->interface[ifnum].altsetting[0]; - for (i = 0; i < interface->bNumEndpoints; ++i) { - endpoint = &interface->endpoint[i]; + /* check out the endpoints */ + interface = &dev->actconfig->interface[ifnum].altsetting[0]; + for (i = 0; i < interface->bNumEndpoints; ++i) { + endpoint = &interface->endpoint[i]; - if ((endpoint->bEndpointAddress & 0x80) && - ((endpoint->bmAttributes & 3) == 0x02)) { - /* we found a bulk in endpoint */ - dbg("found bulk in"); - bulk_in_pipe = HAS; - bulk_in_endpoint[num_bulk_in] = endpoint; - ++num_bulk_in; - } - - if (((endpoint->bEndpointAddress & 0x80) == 0x00) && - ((endpoint->bmAttributes & 3) == 0x02)) { - /* we found a bulk out endpoint */ - dbg("found bulk out"); - bulk_out_pipe = HAS; - bulk_out_endpoint[num_bulk_out] = endpoint; - ++num_bulk_out; - } - - if ((endpoint->bEndpointAddress & 0x80) && - ((endpoint->bmAttributes & 3) == 0x03)) { - /* we found a interrupt in endpoint */ - dbg("found interrupt in"); - interrupt_pipe = HAS; - interrupt_in_endpoint[num_interrupt_in] = endpoint; - ++num_interrupt_in; - } + if ((endpoint->bEndpointAddress & 0x80) && + ((endpoint->bmAttributes & 3) == 0x02)) { + /* we found a bulk in endpoint */ + dbg("found bulk in"); + bulk_in_pipe = HAS; + bulk_in_endpoint[num_bulk_in] = endpoint; + ++num_bulk_in; + } - } + if (((endpoint->bEndpointAddress & 0x80) == 0x00) && + ((endpoint->bmAttributes & 3) == 0x02)) { + /* we found a bulk out endpoint */ + dbg("found bulk out"); + bulk_out_pipe = HAS; + bulk_out_endpoint[num_bulk_out] = endpoint; + ++num_bulk_out; + } + + if ((endpoint->bEndpointAddress & 0x80) && + ((endpoint->bmAttributes & 3) == 0x03)) { + /* we found a interrupt in endpoint */ + dbg("found interrupt in"); + interrupt_pipe = HAS; + interrupt_in_endpoint[num_interrupt_in] = endpoint; + ++num_interrupt_in; + } + } - /* verify that we found all of the endpoints that we need */ - if ((interrupt_pipe & type->needs_interrupt_in) && - (bulk_in_pipe & type->needs_bulk_in) && - (bulk_out_pipe & type->needs_bulk_out)) { - /* found all that we need */ - MOD_INC_USE_COUNT; - info("%s converter detected", type->name); + /* verify that we found all of the endpoints that we need */ + if (!((interrupt_pipe & type->needs_interrupt_in) && + (bulk_in_pipe & type->needs_bulk_in) && + (bulk_out_pipe & type->needs_bulk_out))) { + /* nope, they don't match what we expected */ + info("descriptors matched, but endpoints did not"); + return NULL; + } + + /* found all that we need */ + MOD_INC_USE_COUNT; + info("%s converter detected", type->name); #ifdef CONFIG_USB_SERIAL_GENERIC - if (type == &generic_device) - num_ports = num_bulk_out; - else -#endif - num_ports = type->num_ports; - - serial = get_free_serial (num_ports, &minor); - if (serial == NULL) { - err("No more free serial devices"); - MOD_DEC_USE_COUNT; - return NULL; - } - - serial->dev = dev; - serial->type = type; - serial->minor = minor; - serial->num_ports = num_ports; - serial->num_bulk_in = num_bulk_in; - serial->num_bulk_out = num_bulk_out; - serial->num_interrupt_in = num_interrupt_in; - - /* initialize a tty_driver for this device */ - serial->tty_driver = usb_serial_tty_driver_init (serial); - if (serial->tty_driver == NULL) { - err("Can't create a tty_serial_driver"); - goto probe_error; - } - - if (tty_register_driver (serial->tty_driver)) { - err("failed to register tty driver"); - goto probe_error; - } - - /* collect interrupt_in endpoints now, because - the keyspan_pda startup function needs - to know about them */ - for (i = 0; i < num_interrupt_in; ++i) { - port = &serial->port[i]; - buffer_size = interrupt_in_endpoint[i]->wMaxPacketSize; - port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL); - if (!port->interrupt_in_buffer) { - err("Couldn't allocate interrupt_in_buffer"); - goto probe_error; - } - port->interrupt_in_endpoint = interrupt_in_endpoint[i]; - } - - /* if this device type has a startup function, call it */ - if (type->startup) { - if (type->startup (serial)) { - goto probe_error; - } - } - - /* set up the endpoint information */ - for (i = 0; i < num_bulk_in; ++i) { - port = &serial->port[i]; - port->read_urb = usb_alloc_urb (0); - if (!port->read_urb) { - err("No free urbs available"); - goto probe_error; - } - buffer_size = bulk_in_endpoint[i]->wMaxPacketSize; - port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL); - if (!port->bulk_in_buffer) { - err("Couldn't allocate bulk_in_buffer"); - goto probe_error; - } - if (serial->type->read_bulk_callback) { - FILL_BULK_URB(port->read_urb, dev, usb_rcvbulkpipe (dev, bulk_in_endpoint[i]->bEndpointAddress), - port->bulk_in_buffer, buffer_size, serial->type->read_bulk_callback, port); - } else { - FILL_BULK_URB(port->read_urb, dev, usb_rcvbulkpipe (dev, bulk_in_endpoint[i]->bEndpointAddress), - port->bulk_in_buffer, buffer_size, generic_read_bulk_callback, port); - } - } - - for (i = 0; i < num_bulk_out; ++i) { - port = &serial->port[i]; - port->write_urb = usb_alloc_urb(0); - if (!port->write_urb) { - err("No free urbs available"); - goto probe_error; - } - port->bulk_out_size = bulk_out_endpoint[i]->wMaxPacketSize; - port->bulk_out_buffer = kmalloc (port->bulk_out_size, GFP_KERNEL); - if (!port->bulk_out_buffer) { - err("Couldn't allocate bulk_out_buffer"); - goto probe_error; - } - if (serial->type->write_bulk_callback) { - FILL_BULK_URB(port->write_urb, dev, usb_sndbulkpipe (dev, bulk_out_endpoint[i]->bEndpointAddress), - port->bulk_out_buffer, port->bulk_out_size, serial->type->write_bulk_callback, port); - } else { - FILL_BULK_URB(port->write_urb, dev, usb_sndbulkpipe (dev, bulk_out_endpoint[i]->bEndpointAddress), - port->bulk_out_buffer, port->bulk_out_size, generic_write_bulk_callback, port); - } - } - -#if 0 /* use this code when WhiteHEAT is up and running */ - for (i = 0; i < num_interrupt_in; ++i) { - port = &serial->port[i]; - port->control_urb = usb_alloc_urb(0); - if (!port->control_urb) { - err("No free urbs available"); - goto probe_error; - } - buffer_size = interrupt_in_endpoint[i]->wMaxPacketSize; - port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL); - if (!port->interrupt_in_buffer) { - err("Couldn't allocate interrupt_in_buffer"); - goto probe_error; - } - FILL_INT_URB(port->control_urb, dev, usb_rcvintpipe (dev, interrupt_in_endpoint[i]->bEndpointAddress), - port->interrupt_in_buffer, buffer_size, serial_control_irq, - port, interrupt_in_endpoint[i]->bInterval); - } + if (type == &generic_device) + num_ports = num_bulk_out; + else #endif + num_ports = type->num_ports; - for (i = 0; i < serial->num_ports; ++i) { - info("%s converter now attached to ttyUSB%d", type->name, serial->minor + i); - } + serial = get_free_serial (num_ports, &minor); + if (serial == NULL) { + err("No more free serial devices"); + MOD_DEC_USE_COUNT; + return NULL; + } + + serial->dev = dev; + serial->type = type; + serial->minor = minor; + serial->num_ports = num_ports; + serial->num_bulk_in = num_bulk_in; + serial->num_bulk_out = num_bulk_out; + serial->num_interrupt_in = num_interrupt_in; + + /* initialize a tty_driver for this device */ + serial->tty_driver = usb_serial_tty_driver_init (serial); + if (serial->tty_driver == NULL) { + err("Can't create a tty_serial_driver"); + goto probe_error; + } - return serial; - } else { - info("descriptors matched, but endpoints did not"); - } + if (tty_register_driver (serial->tty_driver)) { + err("failed to register tty driver"); + goto probe_error; + } + + /* if this device type has a startup function, call it */ + if (type->startup) { + if (type->startup (serial)) { + goto probe_error; } - - /* look at the next type in our list */ - ++device_num; } -probe_error: - if (serial) { - for (i = 0; i < num_bulk_in; ++i) { - port = &serial->port[i]; - if (port->read_urb) - usb_free_urb (port->read_urb); - if (serial->port[i].bulk_in_buffer[i]) - kfree (serial->port[i].bulk_in_buffer); + /* set up the endpoint information */ + for (i = 0; i < num_bulk_in; ++i) { + endpoint = bulk_in_endpoint[i]; + port = &serial->port[i]; + port->read_urb = usb_alloc_urb (0); + if (!port->read_urb) { + err("No free urbs available"); + goto probe_error; } - for (i = 0; i < num_bulk_out; ++i) { - port = &serial->port[i]; - if (port->write_urb) - usb_free_urb (port->write_urb); - if (serial->port[i].bulk_out_buffer) - kfree (serial->port[i].bulk_out_buffer); + buffer_size = endpoint->wMaxPacketSize; + port->bulk_in_buffer = kmalloc (buffer_size, GFP_KERNEL); + if (!port->bulk_in_buffer) { + err("Couldn't allocate bulk_in_buffer"); + goto probe_error; } - for (i = 0; i < num_interrupt_in; ++i) { - port = &serial->port[i]; - if (port->control_urb) - usb_free_urb (port->control_urb); - if (serial->port[i].interrupt_in_buffer) - kfree (serial->port[i].interrupt_in_buffer); + FILL_BULK_URB(port->read_urb, dev, + usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), + port->bulk_in_buffer, buffer_size, + ((serial->type->read_bulk_callback) ? + serial->type->read_bulk_callback : + generic_read_bulk_callback), + port); + } + + for (i = 0; i < num_bulk_out; ++i) { + endpoint = bulk_out_endpoint[i]; + port = &serial->port[i]; + port->write_urb = usb_alloc_urb(0); + if (!port->write_urb) { + err("No free urbs available"); + goto probe_error; } - - /* return the minor range that this device had */ - return_serial (serial); + buffer_size = endpoint->wMaxPacketSize; + port->bulk_out_size = buffer_size; + port->bulk_out_buffer = kmalloc (buffer_size, GFP_KERNEL); + if (!port->bulk_out_buffer) { + err("Couldn't allocate bulk_out_buffer"); + goto probe_error; + } + FILL_BULK_URB(port->write_urb, dev, + usb_sndbulkpipe(dev, endpoint->bEndpointAddress), + port->bulk_out_buffer, buffer_size, + ((serial->type->write_bulk_callback) ? + serial->type->write_bulk_callback : + generic_write_bulk_callback), + port); + } - /* if this device has a tty_driver, then unregister it and free it */ - if (serial->tty_driver) { - tty_unregister_driver (serial->tty_driver); - kfree (serial->tty_driver); - serial->tty_driver = NULL; + for (i = 0; i < num_interrupt_in; ++i) { + endpoint = interrupt_in_endpoint[i]; + port = &serial->port[i]; + port->interrupt_in_urb = usb_alloc_urb(0); + if (!port->interrupt_in_urb) { + err("No free urbs available"); + goto probe_error; } + buffer_size = endpoint->wMaxPacketSize; + port->interrupt_in_buffer = kmalloc (buffer_size, GFP_KERNEL); + if (!port->interrupt_in_buffer) { + err("Couldn't allocate interrupt_in_buffer"); + goto probe_error; + } + FILL_INT_URB(port->interrupt_in_urb, dev, + usb_rcvintpipe(dev, endpoint->bEndpointAddress), + port->interrupt_in_buffer, buffer_size, + serial->type->read_int_callback, + port, + endpoint->bInterval); + } - /* free up any memory that we allocated */ - kfree (serial); - MOD_DEC_USE_COUNT; + + for (i = 0; i < serial->num_ports; ++i) { + info("%s converter now attached to ttyUSB%d", + type->name, serial->minor + i); + } + + return serial; /* success */ + + +probe_error: + for (i = 0; i < num_bulk_in; ++i) { + port = &serial->port[i]; + if (port->read_urb) + usb_free_urb (port->read_urb); + if (port->bulk_in_buffer) + kfree (port->bulk_in_buffer); } + for (i = 0; i < num_bulk_out; ++i) { + port = &serial->port[i]; + if (port->write_urb) + usb_free_urb (port->write_urb); + if (port->bulk_out_buffer) + kfree (port->bulk_out_buffer); + } + for (i = 0; i < num_interrupt_in; ++i) { + port = &serial->port[i]; + if (port->interrupt_in_urb) + usb_free_urb (port->interrupt_in_urb); + if (port->interrupt_in_buffer) + kfree (port->interrupt_in_buffer); + } + + /* return the minor range that this device had */ + return_serial (serial); + + /* if this device has a tty_driver, then unregister it and free it */ + if (serial->tty_driver) { + tty_unregister_driver (serial->tty_driver); + kfree (serial->tty_driver); + serial->tty_driver = NULL; + } + + /* free up any memory that we allocated */ + kfree (serial); + MOD_DEC_USE_COUNT; return NULL; } @@ -1237,6 +1233,9 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr) int i; if (serial) { + if (serial->type->shutdown) + serial->type->shutdown(serial); + for (i = 0; i < serial->num_ports; ++i) serial->port[i].active = 0; @@ -1260,9 +1259,9 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr) } for (i = 0; i < serial->num_interrupt_in; ++i) { port = &serial->port[i]; - if (port->control_urb) { - usb_unlink_urb (port->control_urb); - usb_free_urb (port->control_urb); + if (port->interrupt_in_urb) { + usb_unlink_urb (port->interrupt_in_urb); + usb_free_urb (port->interrupt_in_urb); } if (port->interrupt_in_buffer) kfree (port->interrupt_in_buffer); diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 37523fb9cbdd..4abff232c887 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c @@ -252,7 +252,6 @@ static unsigned long * create_aout_tables(char * p, struct linux_binprm * bprm) static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) { struct exec ex; - int fd; unsigned long error; unsigned long fd_offset; unsigned long rlim; @@ -284,10 +283,10 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) return retval; /* OK, This is the point of no return */ - current->personality = PER_LINUX; - -#if defined(__sparc__) - current->personality = PER_SUNOS; +#if !defined(__sparc__) + set_personality(PER_LINUX); +#else + set_personality(PER_SUNOS); #if !defined(__sparc_v9__) memcpy(¤t->thread.core_exec, &ex, sizeof(struct exec)); #endif @@ -344,12 +343,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) error_time2 = jiffies; } - fd = get_unused_fd(); - if (fd < 0) - return fd; - get_file(bprm->file); - fd_install(fd, bprm->file); - if ((fd_offset & ~PAGE_MASK) != 0 && (jiffies-error_time) > 5*HZ) { @@ -361,7 +354,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) { loff_t pos = fd_offset; - sys_close(fd); do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data); bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -377,7 +369,6 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) fd_offset); if (error != N_TXTADDR(ex)) { - sys_close(fd); send_sig(SIGKILL, current, 0); return error; } @@ -386,20 +377,13 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); - sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); return error; } } beyond_if: - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &aout_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); + set_binfmt(&aout_format); set_brk(current->mm->start_brk, current->mm->brk); diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 9a43f9570c1a..f6d5a236188e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -668,19 +668,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) if (interpreter_type != INTERPRETER_AOUT) sys_close(elf_exec_fileno); - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &elf_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); - -#ifndef VM_STACK_FLAGS - lock_kernel(); - current->executable = dget(bprm->file->f_dentry); - unlock_kernel(); -#endif + set_binfmt(&elf_format); + compute_creds(bprm); current->flags &= ~PF_FORKNOEXEC; bprm->p = (unsigned long) diff --git a/fs/exec.c b/fs/exec.c index 22e151141c40..ae30b4d44ea7 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -858,6 +858,16 @@ out: return retval; } +void set_binfmt(struct linux_binfmt *new) +{ + struct linux_binfmt *old = current->binfmt; + if (new && new->module) + __MOD_INC_USE_COUNT(new->module); + current->binfmt = new; + if (old && old->module) + __MOD_DEC_USE_COUNT(old->module); +} + int do_coredump(long signr, struct pt_regs * regs) { struct linux_binfmt * binfmt; diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index c5bc9471dfec..85e0040aff0b 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c @@ -284,13 +284,13 @@ int ext2_add_entry (struct inode * dir, const char * name, int namelen, de->rec_len = cpu_to_le16(EXT2_DIR_REC_LEN(de->name_len)); de = de1; } + de->file_type = EXT2_FT_UNKNOWN; if (inode) { de->inode = cpu_to_le32(inode->i_ino); ext2_set_de_type(dir->i_sb, de, inode->i_mode); } else de->inode = 0; de->name_len = namelen; - de->file_type = 0; memcpy (de->name, name, namelen); /* * XXX shouldn't update any times until successful diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 0adfacd3e50b..980f90b98c3c 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c @@ -120,10 +120,12 @@ xdr_encode_dirpath(struct rpc_rqst *req, u32 *p, const char *path) static int xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) { - memset((u8 *)res, 0, sizeof(*res)); + struct nfs_fh *fh = res->fh; + + memset((void *)fh, 0, sizeof(*fh)); if ((res->status = ntohl(*p++)) == 0) { - res->fh->size = NFS2_FHSIZE; - memcpy(res->fh->data, p, NFS2_FHSIZE); + fh->size = NFS2_FHSIZE; + memcpy(fh->data, p, NFS2_FHSIZE); } return 0; } @@ -131,12 +133,14 @@ xdr_decode_fhstatus(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) static int xdr_decode_fhstatus3(struct rpc_rqst *req, u32 *p, struct mnt_fhstatus *res) { - memset((u8 *)res, 0, sizeof(*res)); + struct nfs_fh *fh = res->fh; + + memset((void *)fh, 0, sizeof(*fh)); if ((res->status = ntohl(*p++)) == 0) { int size = ntohl(*p++); if (size <= NFS3_FHSIZE) { - res->fh->size = size; - memcpy(res->fh->data, p, res->fh->size); + fh->size = size; + memcpy(fh->data, p, size); } else res->status = -EBADHANDLE; } diff --git a/include/asm-alpha/elf.h b/include/asm-alpha/elf.h index 8d614e38fdd0..26b2b27a7e9b 100644 --- a/include/asm-alpha/elf.h +++ b/include/asm-alpha/elf.h @@ -127,8 +127,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #ifdef __KERNEL__ #define SET_PERSONALITY(EX, IBCS2) \ - current->personality = \ - ((EX).e_flags & EF_ALPHA_32BIT \ + set_personality((EX).e_flags & EF_ALPHA_32BIT \ ? PER_LINUX_32BIT : (IBCS2) ? PER_SVR4 : PER_LINUX) #endif diff --git a/include/asm-arm/proc-armo/elf.h b/include/asm-arm/proc-armo/elf.h index 1fc5e957e6e1..b5901f767c6d 100644 --- a/include/asm-arm/proc-armo/elf.h +++ b/include/asm-arm/proc-armo/elf.h @@ -10,7 +10,6 @@ #define ELF_PROC_OK(x) \ ((x)->e_flags & EF_ARM_APCS26) -#define SET_PERSONALITY(ex,ibcs2) \ - current->personality = PER_LINUX +#define SET_PERSONALITY(ex,ibcs2) set_personality(PER_LINUX) #endif diff --git a/include/asm-arm/proc-armv/elf.h b/include/asm-arm/proc-armv/elf.h index a865dce68682..3c41d577b40b 100644 --- a/include/asm-arm/proc-armv/elf.h +++ b/include/asm-arm/proc-armv/elf.h @@ -17,7 +17,6 @@ there is no other ELF system currently supported by iBCS. @@ Could print a warning message to encourage users to upgrade. */ #define SET_PERSONALITY(ex,ibcs2) \ - current->personality = (ex.e_flags & EF_ARM_APCS26) ? \ - PER_LINUX : PER_LINUX_32BIT + set_personality((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT) #endif diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index dacd01b99eb9..0083b3f20341 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -94,8 +94,7 @@ typedef struct user_i387_struct elf_fpregset_t; #define ELF_PLATFORM ("i386\0i486\0i586\0i686"+((boot_cpu_data.x86-3)*5)) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-ia64/elf.h b/include/asm-ia64/elf.h index 8176841d1669..c0ae62524ce6 100644 --- a/include/asm-ia64/elf.h +++ b/include/asm-ia64/elf.h @@ -82,8 +82,7 @@ extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst); #define ELF_PLATFORM 0 #ifdef __KERNEL__ -# define SET_PERSONALITY(EX,IBCS2) \ - (current->personality = (IBCS2) ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* _ASM_IA64_ELF_H */ diff --git a/include/asm-ia64/ia32.h b/include/asm-ia64/ia32.h index d76ce8b58bc5..fc26420e9941 100644 --- a/include/asm-ia64/ia32.h +++ b/include/asm-ia64/ia32.h @@ -221,8 +221,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define ELF_PLATFORM 0 #ifdef __KERNEL__ -# define SET_PERSONALITY(EX,IBCS2) \ - (current->personality = (IBCS2) ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #define IA32_EFLAG 0x200 diff --git a/include/asm-m68k/elf.h b/include/asm-m68k/elf.h index 28dce0967142..7456c3114a58 100644 --- a/include/asm-m68k/elf.h +++ b/include/asm-m68k/elf.h @@ -89,8 +89,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t; #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index ceb8e5941711..64239c53904e 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -75,8 +75,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex,ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* __ASM_MIPS_ELF_H */ diff --git a/include/asm-mips64/elf.h b/include/asm-mips64/elf.h index ed01432c937e..57855c7d7518 100644 --- a/include/asm-mips64/elf.h +++ b/include/asm-mips64/elf.h @@ -91,9 +91,9 @@ do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ else \ current->thread.mflags &= ~MF_32BIT; \ if (ibcs2) \ - current->personality = PER_SVR4; \ + set_personality(PER_SVR4); \ else if (current->personality != PER_LINUX32) \ - current->personality = PER_LINUX; \ + set_personality(PER_LINUX); \ } while (0) #endif diff --git a/include/asm-ppc/elf.h b/include/asm-ppc/elf.h index 758e1a93c992..a175e8061f52 100644 --- a/include/asm-ppc/elf.h +++ b/include/asm-ppc/elf.h @@ -66,8 +66,7 @@ typedef elf_vrreg_t elf_vrregset_t[ELF_NVRREG]; #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 72b78b81346d..fffea89bc5eb 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h @@ -69,8 +69,7 @@ typedef struct user_fpu_struct elf_fpregset_t; _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; } while (0) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = PER_LINUX_32BIT +#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) #endif #endif /* __ASM_SH_ELF_H */ diff --git a/include/asm-sparc/elf.h b/include/asm-sparc/elf.h index acc8f418e3b7..b775a4b6546f 100644 --- a/include/asm-sparc/elf.h +++ b/include/asm-sparc/elf.h @@ -105,8 +105,7 @@ typedef struct { #define ELF_PLATFORM (NULL) #ifdef __KERNEL__ -#define SET_PERSONALITY(ex, ibcs2) \ - current->personality = (ibcs2 ? PER_SVR4 : PER_LINUX) +#define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif #endif /* !(__ASMSPARC_ELF_H) */ diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index e99eea69775f..87c37b68c949 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -96,9 +96,9 @@ do { unsigned char flags = current->thread.flags; \ } \ \ if (ibcs2) \ - current->personality = PER_SVR4; \ + set_personality(PER_SVR4); \ else if (current->personality != PER_LINUX32) \ - current->personality = PER_LINUX; \ + set_personality(PER_LINUX); \ } while (0) #endif diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index 04e9963de41b..0644ae74cc06 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -54,6 +54,7 @@ extern int copy_strings(int argc,char ** argv,struct linux_binprm *bprm); extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); extern void compute_creds(struct linux_binprm *binprm); extern int do_coredump(long signr, struct pt_regs * regs); +extern void set_binfmt(struct linux_binfmt *new); #if 0 diff --git a/include/linux/parport.h b/include/linux/parport.h index e17005f7d99a..0597addd43f3 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -410,7 +410,7 @@ extern __inline__ int parport_yield(struct pardevice *dev) } /** - * parport_yield - relinquish a parallel port temporarily + * parport_yield_blocking - relinquish a parallel port temporarily * @dev: a device on the parallel port * * This function relinquishes the port if it would be helpful to other diff --git a/include/linux/personality.h b/include/linux/personality.h index 6685a9dc255e..c74bd825db56 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h @@ -3,7 +3,7 @@ #include #include - +#include /* Flags for bug emulation. These occupy the top three bytes. */ #define STICKY_TIMEOUTS 0x4000000 @@ -52,11 +52,15 @@ struct exec_domain { extern struct exec_domain default_exec_domain; -extern struct exec_domain *lookup_exec_domain(unsigned long personality); extern int register_exec_domain(struct exec_domain *it); extern int unregister_exec_domain(struct exec_domain *it); #define put_exec_domain(it) \ if (it && it->module) __MOD_DEC_USE_COUNT(it->module); +extern void __set_personality(unsigned long personality); +#define set_personality(pers) do { \ + if (current->personality != pers) \ + __set_personality(pers); \ +} while (0) asmlinkage long sys_personality(unsigned long personality); #endif /* _PERSONALITY_H */ diff --git a/include/linux/usb.h b/include/linux/usb.h index 96ad349989b4..9724ec8f5d99 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -618,7 +618,7 @@ int usb_get_current_frame_number (struct usb_device *usb_dev); * - current Data0/1 state (1 bit) * - direction (1 bit) * - speed (1 bit) - * - max packet size (2 bits: 8, 16, 32 or 64) + * - max packet size (2 bits: 8, 16, 32 or 64) [Historical; now gone.] * - pipe type (2 bits: control, interrupt, bulk, isochronous) * * That's 18 bits. Really. Nothing more. And the USB people have @@ -628,7 +628,7 @@ int usb_get_current_frame_number (struct usb_device *usb_dev); * Let's not fall in that trap. We'll just encode it as a simple * unsigned int. The encoding is: * - * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64) + * - max size: bits 0-1 (00 = 8, 01 = 16, 10 = 32, 11 = 64) [Historical; now gone.] * - direction: bit 7 (0 = Host-to-Device [Out], 1 = Device-to-Host [In]) * - device: bits 8-14 * - endpoint: bits 15-18 diff --git a/init/main.c b/init/main.c index 0a40b06235bb..3487c7e93ce0 100644 --- a/init/main.c +++ b/init/main.c @@ -69,7 +69,7 @@ extern void nubus_init(void); * To avoid associated bogus bug reports, we flatly refuse to compile * with a gcc that is known to be too old from the very beginning. */ -#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) +#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) #error sorry, your GCC is too old. It builds incorrect kernels. #endif diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c index 111a3d69c1d9..eda7f58a51d4 100644 --- a/kernel/exec_domain.c +++ b/kernel/exec_domain.c @@ -32,9 +32,7 @@ static asmlinkage void no_lcall7(int segment, struct pt_regs * regs) * personality set incorrectly. Check to see whether SVr4 is available, * and use it, otherwise give the user a SEGV. */ - put_exec_domain(current->exec_domain); - current->personality = PER_SVR4; - current->exec_domain = lookup_exec_domain(current->personality); + set_personality(PER_SVR4); if (current->exec_domain && current->exec_domain->handler && current->exec_domain->handler != no_lcall7) { @@ -45,7 +43,7 @@ static asmlinkage void no_lcall7(int segment, struct pt_regs * regs) send_sig(SIGSEGV, current, 1); } -struct exec_domain *lookup_exec_domain(unsigned long personality) +static struct exec_domain *lookup_exec_domain(unsigned long personality) { unsigned long pers = personality & PER_MASK; struct exec_domain *it; @@ -104,28 +102,26 @@ int unregister_exec_domain(struct exec_domain *it) return -EINVAL; } -asmlinkage long sys_personality(unsigned long personality) +void __set_personality(unsigned long personality) { struct exec_domain *it; - unsigned long old_personality; - int ret; - - if (personality == 0xffffffff) - return current->personality; - ret = -EINVAL; - lock_kernel(); it = lookup_exec_domain(personality); - if (!it) - goto out; - - old_personality = current->personality; - put_exec_domain(current->exec_domain); - current->personality = personality; - current->exec_domain = it; - ret = old_personality; -out: - unlock_kernel(); + if (it) { + put_exec_domain(current->exec_domain); + current->personality = personality; + current->exec_domain = it; + } +} + +asmlinkage long sys_personality(unsigned long personality) +{ + int ret = current->personality; + if (personality != 0xffffffff) { + set_personality(personality); + if (current->personality != personality) + ret = -EINVAL; + } return ret; } diff --git a/kernel/ksyms.c b/kernel/ksyms.c index f941facfdd9c..af36ce2a81e4 100644 --- a/kernel/ksyms.c +++ b/kernel/ksyms.c @@ -315,11 +315,12 @@ EXPORT_SYMBOL(search_binary_handler); EXPORT_SYMBOL(prepare_binprm); EXPORT_SYMBOL(compute_creds); EXPORT_SYMBOL(remove_arg_zero); +EXPORT_SYMBOL(set_binfmt); /* execution environment registration */ -EXPORT_SYMBOL(lookup_exec_domain); EXPORT_SYMBOL(register_exec_domain); EXPORT_SYMBOL(unregister_exec_domain); +EXPORT_SYMBOL(__set_personality); /* sysctl table registration */ EXPORT_SYMBOL(register_sysctl_table); diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index bed8c5cc2fa8..fff3d2b8fafe 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -1215,9 +1215,9 @@ static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg, static void irda_data_wait(struct sock *sk) { if (!skb_peek(&sk->receive_queue)) { - sk->socket->flags |= SO_WAITDATA; + set_bit(SOCK_ASYNC_WAITDATA, &sk->socket->flags); interruptible_sleep_on(sk->sleep); - sk->socket->flags &= ~SO_WAITDATA; + clear_bit(SOCK_ASYNC_WAITDATA, &sk->socket->flags); } } @@ -1241,7 +1241,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg, self = sk->protinfo.irda; ASSERT(self != NULL, return -1;); - if (sock->flags & SO_ACCEPTCON) + if (sock->flags & __SO_ACCEPTCON) return(-EINVAL); if (flags & MSG_OOB) diff --git a/scripts/usb/procusb b/scripts/usb/procusb deleted file mode 100644 index f88f35fcc751..000000000000 --- a/scripts/usb/procusb +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/perl - -# Reads /proc/bus/usb/devices and selectively lists and/or -# interprets it. - -$DEVFILENAME = "/proc/bus/usb/devices"; -$PROGNAME = $0; - -print "\n"; - -$TAGS = $ARGV[0]; # save user TAGS -if (length ($TAGS) == 0) -{ - print "usage: $PROGNAME tags\n"; - print " where 'tags' can be any number of 'TBDPCIE' or 'A(LL)'\n"; - exit 1; -} - -$ALL = ($TAGS =~ /all/i) || ($TAGS =~ /a/i); - -# TBD: Check that $TAGS is valid. -if (! $ALL) -{ -} - -if (! open (DEVNUM, "<$DEVFILENAME")) -{ - print "$PROGNAME: cannot open '$DEVFILENAME'\n"; - exit 1; -} - -while ($line = ) # read a text line from DEVNUM -{ - if (($ALL) || ($line =~ /^[$TAGS]:/i)) # any of TAGS at beg. of line? - { - print "$line"; # still has newline char on it - # TBD: add more/paging functionality. - } -} # end while DEVNUM - -close (DEVNUM); -print "\n"; - -# END. diff --git a/scripts/usb/usbtree b/scripts/usb/usbtree deleted file mode 100644 index 54b9e64fd169..000000000000 --- a/scripts/usb/usbtree +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/perl - -# Reads /proc/bus/usb/devices and selectively lists and/or -# interprets it. - -$DEVFILENAME = "/proc/bus/usb/devices"; -$PROGNAME = $0; - -print "\n"; - -$TAGS = $ARGV[0]; # save user TAGS -if (length ($TAGS) == 0) -{ -} - -if (! open (DEVNUM, "<$DEVFILENAME")) -{ - print "$PROGNAME: cannot open '$DEVFILENAME'\n"; - exit 1; -} - -while ($line = ) # read a text line from DEVNUM -{ - # skip all lines except those that begin with "T:" or "D:" or "I:". - if (($line !~ "^T:") && ($line !~ "^I:") && ($line !~ "^D:")) - { - next; # to the next line - } - - chomp $line; # remove line endings - - # First convert '=' signs to spaces. - $line =~ tr/=/ /; - - # and convert all ( and ) to spaces. - $line =~ tr/(/ /; - $line =~ tr/)/ /; - - # split the line at spaces. - @fields = split / +/, $line; - - if ($line =~ "^T:") - { - # split yields: $level, $port, $devnum, $speed, $maxchild. - - $level = @fields [2]; - $port = @fields [6]; - $devnum = @fields [10]; - $speed = @fields [12]; - $maxchild = @fields [14]; - $devclass = "?"; - $intclass = "?"; - $driver = "?"; - - if (($devnum == -1) && ($level == 0)) - { - print "/: Dev# -1, root hub/$maxchild ports, $speed Mbps\n"; - } - next; - } # end T: line - elsif ($line =~ "^D:") - { # for D: line - $devclass = @fields [5]; - next; - } - else - { # for I: line - $intclass = @fields [9]; - $ifnum = @fields [2]; - $driver = @fields [15]; - } # end I: line - - if ($level > 1) - { - $temp = $level; - while ($temp > 1) - { - print " "; - $temp--; - } - } - - print sprintf ("|__ Port# $port: Dev# $devnum, If# $ifnum, Class=$devclass, Ifc=$intclass, Driver=$driver%s, $speed Mbps\n", - ($maxchild == 0) ? "" : ("/" . $maxchild . " ports")); -} # end while DEVNUM - -close (DEVNUM); -print "\n"; - -# END. -- 2.39.5