diff --git a/Documentation/Configure.help b/Documentation/Configure.help index 537ed1c..e915761 100644 --- a/Documentation/Configure.help +++ b/Documentation/Configure.help @@ -6059,11 +6059,11 @@ CONFIG_IP_ADVANCED_ROUTER asymmetric routing (packets from you to a host take a different path than packets from that host to you) or if you operate a non-routing host which has several IP addresses on different interfaces. To turn - rp_filter off use: + rp_filter on use: - echo 0 > /proc/sys/net/ipv4/conf//rp_filter - or - echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter + echo 1 > /proc/sys/net/ipv4/conf//rp_filter + and + echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter If unsure, say N here. diff --git a/Makefile b/Makefile index fd6884d..6e42078 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 -SUBLEVEL = 33 -EXTRAVERSION = +SUBLEVEL = 34 +EXTRAVERSION = -pre5 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) @@ -93,11 +93,17 @@ CPPFLAGS := -D__KERNEL__ -I$(HPATH) CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \ -fno-strict-aliasing -fno-common +CFLAGS += -fno-builtin-sprintf ifndef CONFIG_FRAME_POINTER CFLAGS += -fomit-frame-pointer endif AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) +check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) + +# disable pointer signedness warnings in gcc 4.0 +CFLAGS += $(call check_gcc,-Wno-pointer-sign,) + # # ROOT_DEV specifies the default root-device when making the image. # This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case diff --git a/arch/i386/Makefile b/arch/i386/Makefile index c8e2978..8f93efd 100644 --- a/arch/i386/Makefile +++ b/arch/i386/Makefile @@ -23,8 +23,6 @@ LINKFLAGS =-T $(TOPDIR)/arch/i386/vmlinu CFLAGS += -pipe -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) - # prevent gcc from keeping the stack 16 byte aligned CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,) diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index 8d7e5ef..a3144f0 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S @@ -325,27 +325,21 @@ ENTRY(stack_start) /* This is the default interrupt "handler" :-) */ int_msg: - .asciz "Unknown interrupt\n" + .asciz "Unknown interrupt, stack: %p %p %p %p\n" ALIGN ignore_int: cld - pushl %eax - pushl %ecx - pushl %edx - pushl %es - pushl %ds movl $(__KERNEL_DS),%eax movl %eax,%ds movl %eax,%es + pushl 12(%esp) + pushl 12(%esp) + pushl 12(%esp) + pushl 12(%esp) pushl $int_msg call SYMBOL_NAME(printk) - popl %eax - popl %ds - popl %es - popl %edx - popl %ecx - popl %eax - iret +1: hlt + jmp 1b /* * The interrupt descriptor table has room for 256 idt's, diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 60a064a..30508a9 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -30,8 +30,6 @@ endif MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) - # # # GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel diff --git a/arch/mips64/Makefile b/arch/mips64/Makefile index 2f4e998..8937bff 100644 --- a/arch/mips64/Makefile +++ b/arch/mips64/Makefile @@ -26,7 +26,6 @@ ifdef CONFIG_CROSSCOMPILE CROSS_COMPILE = $(tool-prefix) endif -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) check_gas = $(shell if $(CC) $(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi) # diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S index 34125f6..340a66a 100644 --- a/arch/ppc/kernel/head.S +++ b/arch/ppc/kernel/head.S @@ -1705,6 +1705,8 @@ ppc970_setup_hid: mfspr r0,SPRN_HID0 li r11,5 /* clear DOZE and SLEEP */ rldimi r0,r11,52,8 /* and set NAP and DPM */ + li r11,0 + rldimi r0,r11,32,31 /* clear EN_ATTN */ mtspr SPRN_HID0,r0 mfspr r0,SPRN_HID0 mfspr r0,SPRN_HID0 diff --git a/arch/ppc/kernel/open_pic_defs.h b/arch/ppc/kernel/open_pic_defs.h index 4c2289d..43051d0 100644 --- a/arch/ppc/kernel/open_pic_defs.h +++ b/arch/ppc/kernel/open_pic_defs.h @@ -172,9 +172,6 @@ struct OpenPIC { OpenPIC_Processor Processor[OPENPIC_MAX_PROCESSORS]; }; -extern volatile struct OpenPIC *OpenPIC; - - /* * Current Task Priority Register */ diff --git a/arch/s390/lib/uaccess.S b/arch/s390/lib/uaccess.S index 1490bc6..6207032 100644 --- a/arch/s390/lib/uaccess.S +++ b/arch/s390/lib/uaccess.S @@ -19,8 +19,8 @@ __copy_from_user_asm: sacf 512 0: mvcle %r2,%r4,0 jo 0b -1: sacf 0 lr %r2,%r5 +1: sacf 0 br %r14 2: lhi %r1,-4096 lr %r3,%r4 @@ -28,17 +28,23 @@ __copy_from_user_asm: nr %r3,%r1 # %r3 = (%r4 + 4096) & -4096 slr %r3,%r4 # %r3 = #bytes to next user page boundary clr %r5,%r3 # copy crosses next page boundary ? - jnh 1b # no, this page fauled + jnh 4f # no, this page faulted # The page after the current user page might have faulted. - # We cant't find out which page because the program check handler - # might have callled schedule, destroying all lowcore information. + # We can't find out which page because the program check handler + # might have called schedule, destroying all lowcore information. # We retry with the shortened length. 3: mvcle %r2,%r4,0 jo 3b +4: lr %r1,%r5 # pad remaining bytes with 0 + lr %r3,%r5 + slr %r5,%r5 +5: mvcle %r2,%r4,0 + jo 5b + lr %r2,%r1 j 1b .section __ex_table,"a" .long 0b,2b - .long 3b,1b + .long 3b,4b .previous .align 4 diff --git a/arch/s390x/lib/uaccess.S b/arch/s390x/lib/uaccess.S index 7e90f20..9916621 100644 --- a/arch/s390x/lib/uaccess.S +++ b/arch/s390x/lib/uaccess.S @@ -19,8 +19,8 @@ __copy_from_user_asm: sacf 512 0: mvcle %r2,%r4,0 jo 0b -1: sacf 0 lgr %r2,%r5 +1: sacf 0 br %r14 2: lghi %r1,-4096 lgr %r3,%r4 @@ -28,17 +28,23 @@ __copy_from_user_asm: ngr %r3,%r1 # %r3 = (%r4 + 4096) & -4096 slgr %r3,%r4 # %r3 = #bytes to next user page boundary clgr %r5,%r3 # copy crosses next page boundary ? - jnh 1b # no, this page fauled + jnh 4f # no, this page faulted # The page after the current user page might have faulted. - # We cant't find out which page because the program check handler - # might have callled schedule, destroying all lowcore information. + # We can't find out which page because the program check handler + # might have called schedule, destroying all lowcore information. # We retry with the shortened length. 3: mvcle %r2,%r4,0 jo 3b +4: lgr %r1,%r5 # pad remaining bytes with 0 + lgr %r3,%r5 + slgr %r5,%r5 +5: mvcle %r2,%r4,0 + jo 5b + lgr %r2,%r1 j 1b .section __ex_table,"a" .quad 0b,2b - .quad 3b,1b + .quad 3b,4b .previous .align 4 diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c index fe9f6c0..28c9245 100644 --- a/arch/sparc/kernel/signal.c +++ b/arch/sparc/kernel/signal.c @@ -1336,7 +1336,7 @@ do_sys_sigstack(struct sigstack *ssptr, if (ssptr) { void *ss_sp; - if (get_user((long)ss_sp, &ssptr->the_stack)) + if (get_user(ss_sp, &ssptr->the_stack)) goto out; /* If the current stack was set with sigaltstack, don't swap stacks while we are on it. */ diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c index 1c08204..f5058fe 100644 --- a/arch/sparc/kernel/sparc_ksyms.c +++ b/arch/sparc/kernel/sparc_ksyms.c @@ -297,6 +297,7 @@ EXPORT_SYMBOL_NOVERS(memcmp); EXPORT_SYMBOL_NOVERS(memcpy); EXPORT_SYMBOL_NOVERS(memset); EXPORT_SYMBOL_NOVERS(memmove); +EXPORT_SYMBOL_NOVERS(memchr); EXPORT_SYMBOL_NOVERS(__ashrdi3); EXPORT_SYMBOL_NOVERS(__ashldi3); EXPORT_SYMBOL_NOVERS(__lshrdi3); diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index 0f1f31f..40accab 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -359,6 +359,7 @@ EXPORT_SYMBOL_NOVERS(__ret_efault); /* No version information on these, as gcc produces such symbols. */ EXPORT_SYMBOL_NOVERS(memcmp); EXPORT_SYMBOL_NOVERS(memcpy); +EXPORT_SYMBOL_NOVERS(memchr); EXPORT_SYMBOL_NOVERS(memset); EXPORT_SYMBOL_NOVERS(memmove); diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index 9ea5957..5a4d297 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -95,7 +95,7 @@ int do_check_pgt_cache(int low, int high if (page2) page2->next_hash = page->next_hash; else - (struct page *)pgd_quicklist = page->next_hash; + pgd_quicklist = (unsigned long *)page->next_hash; page->next_hash = NULL; page->pprev_hash = NULL; pgd_cache_size -= 2; diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile index 32467e9..7fa4cb7 100644 --- a/arch/x86_64/Makefile +++ b/arch/x86_64/Makefile @@ -38,8 +38,6 @@ OBJCOPY=$(CROSS_COMPILE)objcopy -O binar LDFLAGS=-e stext LINKFLAGS =-T $(TOPDIR)/arch/x86_64/vmlinux.lds $(LDFLAGS) -check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then echo "$(1)"; else echo "$(2)"; fi) - CFLAGS += -mno-red-zone CFLAGS += -mcmodel=kernel CFLAGS += -pipe diff --git a/arch/x86_64/boot/compressed/Makefile b/arch/x86_64/boot/compressed/Makefile index 0832d02..ad748e6 100644 --- a/arch/x86_64/boot/compressed/Makefile +++ b/arch/x86_64/boot/compressed/Makefile @@ -28,7 +28,7 @@ head.o: head.S $(IA32_AS) -c head.S misc.o: misc.c - $(IA32_CC) $(IA32_CFLAGS) -c misc.c + $(IA32_CC) $(IA32_CFLAGS) -fno-strict-aliasing -c misc.c piggy.o: $(SYSTEM) tmppiggy=_tmp_$$$$piggy; \ diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index a172a62..b599234 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S @@ -113,9 +113,18 @@ quiet_ni_syscall: PTREGSCALL stub32_fork, sys32_fork PTREGSCALL stub32_clone, sys32_clone PTREGSCALL stub32_vfork, sys32_vfork - PTREGSCALL stub32_iopl, sys_iopl PTREGSCALL stub32_rt_sigsuspend, sys_rt_sigsuspend + .macro PTREGSCALL3 label, func, arg + .globl \label +\label: + leaq \func(%rip),%rax + leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */ + jmp ia32_ptregs_common + .endm + + PTREGSCALL3 stub32_iopl, sys_iopl, %rsi + ENTRY(ia32_ptregs_common) popq %r11 SAVE_REST diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S index 00ba6fa..ab4a7db 100644 --- a/arch/x86_64/kernel/entry.S +++ b/arch/x86_64/kernel/entry.S @@ -249,7 +249,16 @@ intret_signal_test: PTREGSCALL stub_vfork, sys_vfork PTREGSCALL stub_rt_sigsuspend, sys_rt_sigsuspend PTREGSCALL stub_sigaltstack, sys_sigaltstack - PTREGSCALL stub_iopl, sys_iopl + + .macro PTREGSCALL3 label,func,arg + .globl \label +\label: + leaq \func(%rip),%rax + leaq -ARGOFFSET+8(%rsp),\arg /* 8 for return address */ + jmp ptregscall_common + .endm + + PTREGSCALL3 stub_iopl, sys_iopl, %rsi ENTRY(ptregscall_common) popq %r11 diff --git a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c index 2f44868..d96d85b 100644 --- a/arch/x86_64/kernel/ioport.c +++ b/arch/x86_64/kernel/ioport.c @@ -81,9 +81,9 @@ asmlinkage long sys_ioperm(unsigned long * code. */ -asmlinkage long sys_iopl(unsigned int level, struct pt_regs regs) +asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs) { - unsigned int old = (regs.eflags >> 12) & 3; + unsigned int old = (regs->eflags >> 12) & 3; if (level > 3) return -EINVAL; @@ -92,6 +92,6 @@ asmlinkage long sys_iopl(unsigned int le if (!capable(CAP_SYS_RAWIO)) return -EPERM; } - regs.eflags = (regs.eflags & 0xffffffffffffcfff) | (level << 12); + regs->eflags = (regs->eflags &~ 0x3000UL) | (level << 12); return 0; } diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c index cc845d2..91345ee 100644 --- a/arch/x86_64/lib/delay.c +++ b/arch/x86_64/lib/delay.c @@ -19,7 +19,7 @@ void __delay(unsigned long loops) { - unsigned long bclock, now; + unsigned bclock, now; rdtscl(bclock); do diff --git a/crypto/cipher.c b/crypto/cipher.c index 6ab56eb..9b03eda 100644 --- a/crypto/cipher.c +++ b/crypto/cipher.c @@ -147,6 +147,15 @@ static int ecb_encrypt(struct crypto_tfm ecb_process, 1, NULL); } +static int ecb_encrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + ecb_encrypt(tfm, dst, src, nbytes); + return -ENOSYS; +} + static int ecb_decrypt(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, @@ -157,6 +166,15 @@ static int ecb_decrypt(struct crypto_tfm ecb_process, 1, NULL); } +static int ecb_decrypt_iv(struct crypto_tfm *tfm, + struct scatterlist *dst, + struct scatterlist *src, + unsigned int nbytes, u8 *iv) +{ + ecb_decrypt(tfm, dst, src, nbytes); + return -ENOSYS; +} + static int cbc_encrypt(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, @@ -197,11 +215,20 @@ static int cbc_decrypt_iv(struct crypto_ cbc_process, 0, iv); } +/* + * nocrypt*() zeroize the destination buffer to make sure we don't leak + * uninitialized memory contents if the caller ignores the return value. + * This is bad since the data in the source buffer is unused and may be + * lost, but an infoleak would be even worse. The performance cost of + * memset() is irrelevant since a well-behaved caller would not bump into + * the error repeatedly. + */ static int nocrypt(struct crypto_tfm *tfm, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { + memset(dst, 0, nbytes); return -ENOSYS; } @@ -210,6 +237,7 @@ static int nocrypt_iv(struct crypto_tfm struct scatterlist *src, unsigned int nbytes, u8 *iv) { + memset(dst, 0, nbytes); return -ENOSYS; } @@ -235,6 +263,11 @@ int crypto_init_cipher_ops(struct crypto case CRYPTO_TFM_MODE_ECB: ops->cit_encrypt = ecb_encrypt; ops->cit_decrypt = ecb_decrypt; +/* These should have been nocrypt_iv, but patch-cryptoloop-jari-2.4.22.0 + * (and its other revisions) directly calls the *_iv() functions even in + * ECB mode and ignores their return value. */ + ops->cit_encrypt_iv = ecb_encrypt_iv; + ops->cit_decrypt_iv = ecb_decrypt_iv; break; case CRYPTO_TFM_MODE_CBC: diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 21fa974..20c3ad5 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -623,7 +623,7 @@ acpi_bus_generate_event ( int data) { struct acpi_bus_event *event = NULL; - u32 flags = 0; + unsigned long flags = 0; ACPI_FUNCTION_TRACE("acpi_bus_generate_event"); @@ -656,7 +656,7 @@ int acpi_bus_receive_event ( struct acpi_bus_event *event) { - u32 flags = 0; + unsigned long flags = 0; struct acpi_bus_event *entry = NULL; DECLARE_WAITQUEUE(wait, current); diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c index ea6ac5e..51199da 100644 --- a/drivers/atm/fore200e.c +++ b/drivers/atm/fore200e.c @@ -112,8 +112,8 @@ #endif -extern const struct atmdev_ops fore200e_ops; -extern const struct fore200e_bus fore200e_bus[]; +static const struct atmdev_ops fore200e_ops; +static const struct fore200e_bus fore200e_bus[]; static struct fore200e* fore200e_boards = NULL; diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c index dc902ac..15b8caf 100644 --- a/drivers/atm/horizon.c +++ b/drivers/atm/horizon.c @@ -481,6 +481,7 @@ static inline void dump_skb (char * pref return; } +#if 0 /* unused and in conflict with */ static inline void dump_regs (hrz_dev * dev) { #ifdef DEBUG_HORIZON PRINTD (DBG_REGS, "CONTROL 0: %#x", rd_regl (dev, CONTROL_0_REG)); @@ -494,6 +495,7 @@ static inline void dump_regs (hrz_dev * #endif return; } +#endif static inline void dump_framer (hrz_dev * dev) { #ifdef DEBUG_HORIZON diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index d84d761..978fe10 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -82,6 +82,7 @@ static IADEV *ia_dev[8]; static struct atm_dev *_ia_dev[8]; static int iadev_count; static void ia_led_timer(unsigned long arg); +static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb); static struct timer_list ia_timer = { function: ia_led_timer }; struct atm_vcc *vcc_close_que[100]; static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ; @@ -627,7 +628,6 @@ static int ia_que_tx (IADEV *iadev) { int num_desc; struct atm_vcc *vcc; struct ia_vcc *iavcc; - static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb); num_desc = ia_avail_descs(iadev); while (num_desc && (skb = skb_dequeue(&iadev->tx_backlog))) { if (!(vcc = ATM_SKB(skb)->vcc)) { diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h index 24acc43..6676ac8 100644 --- a/drivers/atm/iphase.h +++ b/drivers/atm/iphase.h @@ -68,8 +68,6 @@ #define IF_IADBG_SUNI_STAT 0x02000000 // suni statistics #define IF_IADBG_RESET 0x04000000 -extern unsigned int IADebugFlag; - #define IF_IADBG(f) if (IADebugFlag & (f)) #ifdef CONFIG_ATM_IA_DEBUG /* Debug build */ diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index cb5a3bb..085c855 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c @@ -49,7 +49,7 @@ static int sendcmd( unsigned char *scsi3addr ); -int __init cciss_scsi_detect(Scsi_Host_Template *tpnt); +int cciss_scsi_detect(Scsi_Host_Template *tpnt); int cciss_scsi_release(struct Scsi_Host *sh); const char *cciss_scsi_info(struct Scsi_Host *sa); @@ -777,7 +777,7 @@ complete_scsi_command( CommandList_struc The scsi mid layer (scsi_register_module) is called from cciss.c:cciss_init_one(). */ -int __init +int cciss_scsi_detect(Scsi_Host_Template *tpnt) { int i; diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 3924b24..c259cee 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -575,6 +575,7 @@ static struct request *get_request(reque rq->rq_status = RQ_ACTIVE; rq->cmd = rw; rq->special = NULL; + rq->io_account = 0; rq->q = q; } @@ -813,6 +814,7 @@ void req_new_io(struct request *req, int struct hd_struct *hd1, *hd2; locate_hd_struct(req, &hd1, &hd2); + req->io_account = 1; if (hd1) account_io_start(hd1, req, merge, sectors); if (hd2) @@ -823,6 +825,8 @@ void req_merged_io(struct request *req) { struct hd_struct *hd1, *hd2; + if (unlikely(req->io_account == 0)) + return; locate_hd_struct(req, &hd1, &hd2); if (hd1) down_ios(hd1); @@ -834,6 +838,8 @@ void req_finished_io(struct request *req { struct hd_struct *hd1, *hd2; + if (unlikely(req->io_account == 0)) + return; locate_hd_struct(req, &hd1, &hd2); if (hd1) account_io_end(hd1, req); diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 777712f..4b1afa6 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -693,12 +693,23 @@ static int loop_set_fd(struct loop_devic set_blocksize(dev, bs); lo->lo_bh = lo->lo_bhtail = NULL; - kernel_thread(loop_thread, lo, CLONE_FS | CLONE_FILES | CLONE_SIGHAND); - down(&lo->lo_sem); + error = kernel_thread(loop_thread, lo, + CLONE_FS | CLONE_FILES | CLONE_SIGHAND); + if (error < 0) + goto out_clr; + down(&lo->lo_sem); /* wait for the thread to start */ fput(file); return 0; + out_clr: + lo->lo_backing_file = NULL; + lo->lo_device = 0; + lo->lo_flags = 0; + loop_sizes[lo->lo_number] = 0; + inode->i_mapping->gfp_mask = lo->old_gfp_mask; + lo->lo_state = Lo_unbound; + fput(file); /* yes, have to do it twice */ out_putf: fput(file); out: diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 21f1d03..c79ba85 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -74,6 +74,29 @@ static int requests_in; static int requests_out; #endif +static void +nbd_end_request(struct request *req) +{ + struct buffer_head *bh; + unsigned nsect; + unsigned long flags; + int uptodate = (req->errors == 0) ? 1 : 0; + +#ifdef PARANOIA + requests_out++; +#endif + spin_lock_irqsave(&io_request_lock, flags); + while((bh = req->bh) != NULL) { + nsect = bh->b_size >> 9; + blk_finished_io(nsect); + req->bh = bh->b_reqnext; + bh->b_reqnext = NULL; + bh->b_end_io(bh, uptodate); + } + blkdev_release_request(req); + spin_unlock_irqrestore(&io_request_lock, flags); +} + static int nbd_open(struct inode *inode, struct file *file) { int dev; diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 4db93fe..31acbed 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -343,7 +343,14 @@ static char *pd_errs[17] = { "ERR","INDE /* kernel glue structures */ -extern struct block_device_operations pd_fops; +static struct block_device_operations pd_fops = { + owner: THIS_MODULE, + open: pd_open, + release: pd_release, + ioctl: pd_ioctl, + check_media_change: pd_check_media, + revalidate: pd_revalidate +}; static struct gendisk pd_gendisk = { major: PD_MAJOR, @@ -355,15 +362,6 @@ static struct gendisk pd_gendisk = { fops: &pd_fops, }; -static struct block_device_operations pd_fops = { - owner: THIS_MODULE, - open: pd_open, - release: pd_release, - ioctl: pd_ioctl, - check_media_change: pd_check_media, - revalidate: pd_revalidate -}; - void pd_init_units( void ) { int unit, j; diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 5014c45..8f72792 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c @@ -125,7 +125,12 @@ static int xd_sizes[XD_MAXDRIVES << 6], static int xd_blocksizes[XD_MAXDRIVES << 6]; static int xd_maxsect[XD_MAXDRIVES << 6]; -extern struct block_device_operations xd_fops; +static struct block_device_operations xd_fops = { + owner: THIS_MODULE, + open: xd_open, + release: xd_release, + ioctl: xd_ioctl, +}; static struct gendisk xd_gendisk = { major: MAJOR_NR, @@ -138,13 +143,6 @@ static struct gendisk xd_gendisk = { fops: &xd_fops, }; -static struct block_device_operations xd_fops = { - owner: THIS_MODULE, - open: xd_open, - release: xd_release, - ioctl: xd_ioctl, -}; - static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int); static DECLARE_WAIT_QUEUE_HEAD(xd_wait_open); static u8 xd_valid[XD_MAXDRIVES] = { 0,0 }; diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index c477caa..180309f 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -525,6 +525,8 @@ static int sbp_data(struct request *req) static int cmd_out(void); static int DiskInfo(void); static int sbpcd_chk_disk_change(kdev_t); +static int cmd_out_T(void); +static int cc_DriveReset(void); /*==========================================================================*/ @@ -1213,8 +1215,6 @@ static int get_state_T(void) { int i; - static int cmd_out_T(void); - clr_cmdbuf(); D_S[d].n_bytes=1; drvcmd[0]=CMDT_STATUS; @@ -1362,7 +1362,6 @@ static int cmd_out_T(void) #define CMDT_TRIES 1000 #define TEST_FALSE_FF 1 - static int cc_DriveReset(void); int i, j, l=0, m, ntries; long flags; diff --git a/drivers/char/drm-4.0/drmP.h b/drivers/char/drm-4.0/drmP.h index 3a68e0a..dc14f92 100644 --- a/drivers/char/drm-4.0/drmP.h +++ b/drivers/char/drm-4.0/drmP.h @@ -257,9 +257,9 @@ static inline unsigned long __cmpxchg(vo /* Macros to make printk easier */ #define DRM_ERROR(fmt, arg...) \ - printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ "] *ERROR* " fmt , ##arg) + printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __FUNCTION__ , ##arg) #define DRM_MEM_ERROR(area, fmt, arg...) \ - printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ + printk(KERN_ERR "[" DRM_NAME ":%s:%s] *ERROR* " fmt , __FUNCTION__, \ drm_mem_stats[area].name , ##arg) #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) @@ -268,8 +268,8 @@ static inline unsigned long __cmpxchg(vo do { \ if (drm_flags&DRM_FLAG_DEBUG) \ printk(KERN_DEBUG \ - "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ + "[" DRM_NAME ":%s] " fmt , \ + __FUNCTION__ , ##arg); \ } while (0) #else #define DRM_DEBUG(fmt, arg...) do { } while (0) diff --git a/drivers/char/ip2/i2lib.c b/drivers/char/ip2/i2lib.c index 972822b..c1ec184 100644 --- a/drivers/char/ip2/i2lib.c +++ b/drivers/char/ip2/i2lib.c @@ -1262,7 +1262,7 @@ i2RetryFlushOutput(i2ChanStrPtr pCh) } if ( old_flags & STOPFL_FLAG ) { - if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL) > 0 ) { + if ( 1 == i2QueueCommands(PTYPE_INLINE, pCh, 0, 1, CMD_STOPFL)) { old_flags = 0; // Success - clear flags } diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index 73cfdc5..80050c3 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c @@ -1205,8 +1205,8 @@ static int __init rio_init(void) hp->Ivec = get_irq (pdev); if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; @@ -1277,8 +1277,8 @@ static int __init rio_init(void) if (((1 << hp->Ivec) & rio_irqmask) == 0) hp->Ivec = 0; hp->Ivec |= 0x8000; /* Mark as non-sharable */ - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_PCI; hp->Copy = rio_pcicopy; hp->Mode = RIO_PCI_BOOT_FROM_RAM; @@ -1329,8 +1329,8 @@ static int __init rio_init(void) hp->PaddrP = rio_probe_addrs[i]; /* There was something about the IRQs of these cards. 'Forget what.--REW */ hp->Ivec = 0; - hp->CardP = (struct DpRam *) hp->Caddr = ioremap(p->RIOHosts[p->RIONumHosts].PaddrP, RIO_WINDOW_LEN); + hp->CardP = (struct DpRam *) hp->Caddr; hp->Type = RIO_AT; hp->Copy = rio_pcicopy; /* AT card PCI???? - PVDL * -- YES! this is now a normal copy. Only the diff --git a/drivers/char/sc1200wdt.c b/drivers/char/sc1200wdt.c index 73827c7..7c9940c 100644 --- a/drivers/char/sc1200wdt.c +++ b/drivers/char/sc1200wdt.c @@ -382,7 +382,7 @@ static int __init sc1200wdt_init(void) if (io == -1) { printk(KERN_ERR PFX "io parameter must be specified\n"); ret = -EINVAL; - goto out_clean; + goto out_pnp; } if (!request_region(io, io_len, SC1200_MODULE_NAME)) { diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index bc092e6..6cba9b1 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -60,6 +60,35 @@ static int compat; /* = 0 */ static int useinput = 1; static unsigned long mask = 0xffffffff; +static inline int sonypi_ec_write(u8 addr, u8 value) { +#ifdef CONFIG_ACPI_EC + if (SONYPI_ACPI_ACTIVE) + return ec_write(addr, value); +#endif + wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG); + outb_p(0x81, SONYPI_CST_IOPORT); + wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); + outb_p(addr, SONYPI_DATA_IOPORT); + wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); + outb_p(value, SONYPI_DATA_IOPORT); + wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); + return 0; +} + +static inline int sonypi_ec_read(u8 addr, u8 *value) { +#ifdef CONFIG_ACPI_EC + if (SONYPI_ACPI_ACTIVE) + return ec_read(addr, value); +#endif + wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG); + outb_p(0x80, SONYPI_CST_IOPORT); + wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); + outb_p(addr, SONYPI_DATA_IOPORT); + wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); + *value = inb_p(SONYPI_DATA_IOPORT); + return 0; +} + /* Inits the queue */ static inline void sonypi_initq(void) { sonypi_device.queue.head = sonypi_device.queue.tail = 0; diff --git a/drivers/char/sonypi.h b/drivers/char/sonypi.h index 83a6c5b..545f056 100644 --- a/drivers/char/sonypi.h +++ b/drivers/char/sonypi.h @@ -401,37 +401,6 @@ struct sonypi_device { #define SONYPI_ACPI_ACTIVE 0 #endif /* CONFIG_ACPI */ -extern int verbose; - -static inline int sonypi_ec_write(u8 addr, u8 value) { -#ifdef CONFIG_ACPI_EC - if (SONYPI_ACPI_ACTIVE) - return ec_write(addr, value); -#endif - wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG); - outb_p(0x81, SONYPI_CST_IOPORT); - wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); - outb_p(addr, SONYPI_DATA_IOPORT); - wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); - outb_p(value, SONYPI_DATA_IOPORT); - wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); - return 0; -} - -static inline int sonypi_ec_read(u8 addr, u8 *value) { -#ifdef CONFIG_ACPI_EC - if (SONYPI_ACPI_ACTIVE) - return ec_read(addr, value); -#endif - wait_on_command(1, inb_p(SONYPI_CST_IOPORT) & 3, ITERATIONS_LONG); - outb_p(0x80, SONYPI_CST_IOPORT); - wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); - outb_p(addr, SONYPI_DATA_IOPORT); - wait_on_command(0, inb_p(SONYPI_CST_IOPORT) & 2, ITERATIONS_LONG); - *value = inb_p(SONYPI_DATA_IOPORT); - return 0; -} - #endif /* __KERNEL__ */ #endif /* _SONYPI_PRIV_H_ */ diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 5e62045..8cc448c 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -522,13 +522,13 @@ static int sx_busy_wait_eq (struct sx_bo func_enter (); - for (i=0; i < TIMEOUT_1 > 0;i++) + for (i=0; i < TIMEOUT_1 ;i++) if ((read_sx_byte (board, offset) & mask) == correctval) { func_exit (); return 1; } - for (i=0; i < TIMEOUT_2 > 0;i++) { + for (i=0; i < TIMEOUT_2 ;i++) { if ((read_sx_byte (board, offset) & mask) == correctval) { func_exit (); return 1; @@ -548,13 +548,13 @@ static int sx_busy_wait_neq (struct sx_b func_enter (); - for (i=0; i < TIMEOUT_1 > 0;i++) + for (i=0; i < TIMEOUT_1 ;i++) if ((read_sx_byte (board, offset) & mask) != badval) { func_exit (); return 1; } - for (i=0; i < TIMEOUT_2 > 0;i++) { + for (i=0; i < TIMEOUT_2 ;i++) { if ((read_sx_byte (board, offset) & mask) != badval) { func_exit (); return 1; diff --git a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c index d694f43..f9d5742 100644 --- a/drivers/char/tpqic02.c +++ b/drivers/char/tpqic02.c @@ -202,6 +202,7 @@ static int mode_access; /* access mode: static int qic02_get_resources(void); static void qic02_release_resources(void); +static void finish_rw(int cmd); /* This is a pointer to the actual kernel buffer where the interrupt routines * read from/write to. It is needed because the DMA channels 1 and 3 cannot @@ -820,7 +821,6 @@ static int get_ext_status3(void) static int tp_sense(int ignore) { unsigned err = 0, exnr = 0, gs = 0; - static void finish_rw(int cmd); if (TPQDBG(SENSE_TEXT)) printk(TPQIC02_NAME ": tp_sense(ignore=0x%x) enter\n", @@ -2173,16 +2173,6 @@ static ssize_t qic02_tape_write(struct f * Don't rewind if the minor bits specify density 0. */ -static int qic02_tape_open(struct inode *inode, struct file *filp) -{ - static int qic02_tape_open_no_use_count(struct inode *, - struct file *); - int open_error; - - open_error = qic02_tape_open_no_use_count(inode, filp); - return open_error; -} - static int qic02_tape_open_no_use_count(struct inode *inode, struct file *filp) { @@ -2385,6 +2375,14 @@ static int qic02_tape_open_no_use_count( } /* qic02_tape_open */ +static int qic02_tape_open(struct inode *inode, struct file *filp) +{ + int open_error; + + open_error = qic02_tape_open_no_use_count(inode, filp); + return open_error; +} + static int qic02_tape_release(struct inode *inode, struct file *filp) { kdev_t dev = inode->i_rdev; diff --git a/drivers/fc4/soc.h b/drivers/fc4/soc.h index 740e1a3..0461960 100644 --- a/drivers/fc4/soc.h +++ b/drivers/fc4/soc.h @@ -118,14 +118,16 @@ static inline void xram_copy_from (void val = ((sbus_readw(x + 0x00UL) << 16) | (sbus_readw(x + 0x02UL))); - *((u32 *)p)++ = val; + *(u32 *)p = val; + p += sizeof(u32); } } static inline void xram_copy_to (xram_p x, void *p, int len) { for (len >>= 2; len > 0; len--, x += sizeof(u32)) { - u32 tmp = *((u32 *)p)++; + u32 tmp = *(u32 *)p; + p += sizeof(u32); sbus_writew(tmp >> 16, x + 0x00UL); sbus_writew(tmp, x + 0x02UL); } diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 516f8f4..db3f1aa 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -720,7 +720,7 @@ int i2cproc_cleanup(void) * ---------------------------------------------------- */ -int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num) +int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs,int num) { int ret; @@ -750,7 +750,7 @@ int i2c_master_send(struct i2c_client *c msg.addr = client->addr; msg.flags = client->flags & I2C_M_TEN; msg.len = count; - (const char *)msg.buf = buf; + msg.buf = (char *)buf; DEB2(printk(KERN_DEBUG "i2c-core.o: master_send: writing %d bytes on %s.\n", count,client->adapter->name)); diff --git a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c index f5feeb6..fb870ea 100644 --- a/drivers/i2c/i2c-proc.c +++ b/drivers/i2c/i2c-proc.c @@ -205,7 +205,7 @@ void i2c_deregister_entry(int id) table = i2c_entries[id]->ctl_table; unregister_sysctl_table(i2c_entries[id]); /* 2-step kfree needed to keep gcc happy about const points */ - (const char *) temp = table[4].procname; + temp = (char *) table[4].procname; kfree(temp); kfree(table); i2c_entries[id] = NULL; @@ -287,7 +287,7 @@ int i2c_proc_chips(ctl_table * ctl, int if(copy_to_user(buffer, BUF, buflen)) return -EFAULT; curbufsize += buflen; - (char *) buffer += buflen; + buffer = (char *) buffer + buflen; } *lenp = curbufsize; filp->f_pos += curbufsize; @@ -318,7 +318,7 @@ int i2c_sysctl_chips(ctl_table * table, sizeof(struct i2c_chips_data))) return -EFAULT; - (char *) oldval += + oldval = (char *) oldval + sizeof(struct i2c_chips_data); nrels++; } @@ -473,7 +473,7 @@ int i2c_parse_reals(int *nrels, void *bu !((ret=get_user(nextchar, (char *) buffer))) && isspace((int) nextchar)) { bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } if (ret) @@ -492,7 +492,7 @@ int i2c_parse_reals(int *nrels, void *bu && (nextchar == '-')) { min = 1; bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } if (ret) return -EFAULT; @@ -503,7 +503,7 @@ int i2c_parse_reals(int *nrels, void *bu isdigit((int) nextchar)) { res = res * 10 + nextchar - '0'; bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } if (ret) return -EFAULT; @@ -517,7 +517,7 @@ int i2c_parse_reals(int *nrels, void *bu if (bufsize && (nextchar == '.')) { /* Skip the dot */ bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; /* Read digits while they are significant */ while (bufsize && (mag > 0) && @@ -526,7 +526,7 @@ int i2c_parse_reals(int *nrels, void *bu res = res * 10 + nextchar - '0'; mag--; bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } if (ret) return -EFAULT; @@ -542,7 +542,7 @@ int i2c_parse_reals(int *nrels, void *bu !((ret=get_user(nextchar, (char *) buffer))) && !isspace((int) nextchar)) { bufsize--; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } if (ret) return -EFAULT; @@ -574,7 +574,7 @@ int i2c_write_reals(int nrels, void *buf if(put_user(' ', (char *) buffer)) return -EFAULT; curbufsize++; - ((char *) buffer)++; + buffer = (char *) buffer + 1; } /* Fill BUF with the representation of the next string */ @@ -615,7 +615,7 @@ int i2c_write_reals(int nrels, void *buf if(copy_to_user(buffer, BUF, buflen)) return -EFAULT; curbufsize += buflen; - (char *) buffer += buflen; + buffer = (char *) buffer + buflen; nr++; } diff --git a/drivers/ide/legacy/hd.c b/drivers/ide/legacy/hd.c index 3c7b0e0..353a0e2 100644 --- a/drivers/ide/legacy/hd.c +++ b/drivers/ide/legacy/hd.c @@ -694,7 +694,11 @@ static int hd_release(struct inode * ino return 0; } -extern struct block_device_operations hd_fops; +static struct block_device_operations hd_fops = { + open: hd_open, + release: hd_release, + ioctl: hd_ioctl, +}; static struct gendisk hd_gendisk = { major: MAJOR_NR, @@ -718,12 +722,6 @@ static void hd_interrupt(int irq, void * sti(); } -static struct block_device_operations hd_fops = { - open: hd_open, - release: hd_release, - ioctl: hd_ioctl, -}; - /* * This is the hard disk IRQ description. The SA_INTERRUPT in sa_flags * means we run the IRQ-handler with interrupts disabled: this is bad for diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c index b61c16c..0f7524f 100644 --- a/drivers/ieee1394/highlevel.c +++ b/drivers/ieee1394/highlevel.c @@ -500,7 +500,7 @@ int highlevel_read(struct hpsb_host *hos rcode = RCODE_TYPE_ERROR; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength; @@ -546,7 +546,7 @@ int highlevel_write(struct hpsb_host *ho rcode = RCODE_TYPE_ERROR; } - (u8 *)data += partlength; + data += partlength; length -= partlength; addr += partlength; diff --git a/drivers/isdn/avmb1/c4.c b/drivers/isdn/avmb1/c4.c index 0cf7b30..dc17479 100644 --- a/drivers/isdn/avmb1/c4.c +++ b/drivers/isdn/avmb1/c4.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "capicmd.h" @@ -151,6 +152,7 @@ static inline int wait_for_doorbell(avmc while (c4inmeml(card->mbase+DOORBELL) != 0xffffffff) { if (!time_before(jiffies, stop)) return -1; + cpu_relax(); } return 0; } @@ -305,6 +307,7 @@ static void c4_reset(avmcard *card) if (!time_before(jiffies, stop)) return; c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); + cpu_relax(); } c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0); @@ -328,6 +331,7 @@ static int c4_detect(avmcard *card) if (!time_before(jiffies, stop)) return 2; c4outmeml(card->mbase+DOORBELL, DBELL_ADDR); + cpu_relax(); } c4_poke(card, DC21285_ARMCSR_BASE + CHAN_1_CONTROL, 0); diff --git a/drivers/isdn/eicon/eicon.h b/drivers/isdn/eicon/eicon.h index 1fce94a..3833ddc 100644 --- a/drivers/isdn/eicon/eicon.h +++ b/drivers/isdn/eicon/eicon.h @@ -154,18 +154,18 @@ typedef struct { __u16 NextReq __attribute__ ((packed)); /* pointer to next Req Buffer */ __u16 NextRc __attribute__ ((packed)); /* pointer to next Rc Buffer */ __u16 NextInd __attribute__ ((packed)); /* pointer to next Ind Buffer */ - __u8 ReqInput __attribute__ ((packed)); /* number of Req Buffers sent */ - __u8 ReqOutput __attribute__ ((packed)); /* number of Req Buffers returned */ - __u8 ReqReserved __attribute__ ((packed));/*number of Req Buffers reserved */ - __u8 Int __attribute__ ((packed)); /* ISDN-P interrupt */ - __u8 XLock __attribute__ ((packed)); /* Lock field for arbitration */ - __u8 RcOutput __attribute__ ((packed)); /* number of Rc buffers received */ - __u8 IndOutput __attribute__ ((packed)); /* number of Ind buffers received */ - __u8 IMask __attribute__ ((packed)); /* Interrupt Mask Flag */ - __u8 Reserved1[2] __attribute__ ((packed)); /* reserved field, do not use */ - __u8 ReadyInt __attribute__ ((packed)); /* request field for ready int */ - __u8 Reserved2[12] __attribute__ ((packed)); /* reserved field, do not use */ - __u8 InterfaceType __attribute__ ((packed)); /* interface type 1=16K */ + __u8 ReqInput; /* number of Req Buffers sent */ + __u8 ReqOutput; /* number of Req Buffers returned */ + __u8 ReqReserved;/*number of Req Buffers reserved */ + __u8 Int; /* ISDN-P interrupt */ + __u8 XLock; /* Lock field for arbitration */ + __u8 RcOutput; /* number of Rc buffers received */ + __u8 IndOutput; /* number of Ind buffers received */ + __u8 IMask; /* Interrupt Mask Flag */ + __u8 Reserved1[2]; /* reserved field, do not use */ + __u8 ReadyInt; /* request field for ready int */ + __u8 Reserved2[12]; /* reserved field, do not use */ + __u8 InterfaceType; /* interface type 1=16K */ __u16 Signature __attribute__ ((packed)); /* ISDN-P initialized ind */ __u8 B[1]; /* buffer space for Req,Ind and Rc */ } eicon_pr_ram; @@ -344,7 +344,6 @@ typedef struct eicon_card { #include "eicon_idi.h" -extern eicon_card *cards; extern char *eicon_ctype_name[]; diff --git a/drivers/isdn/eicon/eicon_idi.h b/drivers/isdn/eicon/eicon_idi.h index eefa56e..579f672 100644 --- a/drivers/isdn/eicon/eicon_idi.h +++ b/drivers/isdn/eicon/eicon_idi.h @@ -58,35 +58,35 @@ typedef struct { typedef struct { __u16 next __attribute__ ((packed)); - __u8 Req __attribute__ ((packed)); - __u8 ReqId __attribute__ ((packed)); - __u8 ReqCh __attribute__ ((packed)); - __u8 Reserved1 __attribute__ ((packed)); + __u8 Req; + __u8 ReqId; + __u8 ReqCh; + __u8 Reserved1; __u16 Reference __attribute__ ((packed)); - __u8 Reserved[8] __attribute__ ((packed)); + __u8 Reserved[8]; eicon_PBUFFER XBuffer; } eicon_REQ; typedef struct { __u16 next __attribute__ ((packed)); - __u8 Rc __attribute__ ((packed)); - __u8 RcId __attribute__ ((packed)); - __u8 RcCh __attribute__ ((packed)); - __u8 Reserved1 __attribute__ ((packed)); + __u8 Rc; + __u8 RcId; + __u8 RcCh; + __u8 Reserved1; __u16 Reference __attribute__ ((packed)); - __u8 Reserved2[8] __attribute__ ((packed)); + __u8 Reserved2[8]; } eicon_RC; typedef struct { __u16 next __attribute__ ((packed)); - __u8 Ind __attribute__ ((packed)); - __u8 IndId __attribute__ ((packed)); - __u8 IndCh __attribute__ ((packed)); - __u8 MInd __attribute__ ((packed)); + __u8 Ind; + __u8 IndId; + __u8 IndCh; + __u8 MInd; __u16 MLength __attribute__ ((packed)); __u16 Reference __attribute__ ((packed)); - __u8 RNR __attribute__ ((packed)); - __u8 Reserved __attribute__ ((packed)); + __u8 RNR; + __u8 Reserved; __u32 Ack __attribute__ ((packed)); eicon_PBUFFER RBuffer; } eicon_IND; diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c index 01cf494..9c0607b 100644 --- a/drivers/isdn/hisax/hfc_pci.c +++ b/drivers/isdn/hisax/hfc_pci.c @@ -1742,7 +1742,7 @@ setup_hfcpci(struct IsdnCard *card) /* Allocate memory for FIFOS */ /* Because the HFC-PCI needs a 32K physical alignment, we */ /* need to allocate the double mem and align the address */ - if (!((void *) cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) { + if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) { printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); return 0; } diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h index a2432ca..1b57b71 100644 --- a/drivers/isdn/hisax/hisax.h +++ b/drivers/isdn/hisax/hisax.h @@ -395,15 +395,15 @@ struct isar_hw { struct hdlc_stat_reg { #ifdef __BIG_ENDIAN - u_char fill __attribute__((packed)); - u_char mode __attribute__((packed)); - u_char xml __attribute__((packed)); - u_char cmd __attribute__((packed)); + u_char fill; + u_char mode; + u_char xml; + u_char cmd; #else - u_char cmd __attribute__((packed)); - u_char xml __attribute__((packed)); - u_char mode __attribute__((packed)); - u_char fill __attribute__((packed)); + u_char cmd; + u_char xml; + u_char mode; + u_char fill; #endif }; diff --git a/drivers/isdn/isdn_common.c b/drivers/isdn/isdn_common.c index c2f4c30..3155dc8 100644 --- a/drivers/isdn/isdn_common.c +++ b/drivers/isdn/isdn_common.c @@ -1058,6 +1058,10 @@ isdn_read(struct file *file, char *buf, len = dev->drv[drvidx]->interface-> readstat(buf, count, 1, drvidx, isdn_minor2chan(minor)); + if (len < 0) { + retval = len; + goto out; + } } else { len = 0; } diff --git a/drivers/md/lvm-internal.h b/drivers/md/lvm-internal.h index f95069e..aca8632 100644 --- a/drivers/md/lvm-internal.h +++ b/drivers/md/lvm-internal.h @@ -45,7 +45,6 @@ extern int loadtime; extern const char *const lvm_name; -extern uint vg_count; extern vg_t *vg[]; extern struct file_operations lvm_chr_fops; diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 3ed4d66..998fe25 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h @@ -58,7 +58,6 @@ extern int pvr_boot(struct bttv *btv); #define BTTV_MAX 16 extern unsigned int bttv_num; /* number of Bt848s in use */ -extern struct bttv bttvs[BTTV_MAX]; #define UNSET -1U @@ -203,6 +202,8 @@ struct bttv { int shutdown; void (*audio_hook)(struct bttv *btv, struct video_audio *v, int set); }; + +extern struct bttv bttvs[BTTV_MAX]; #endif #define btwrite(dat,adr) writel((dat), (char *) (btv->bt848_mem+(adr))) diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index 9621a90..42b6f54 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c @@ -489,7 +489,18 @@ static void videodev_proc_destroy_dev (s #endif /* CONFIG_VIDEO_PROC_FS */ -extern struct file_operations video_fops; +static struct file_operations video_fops= +{ + owner: THIS_MODULE, + llseek: no_llseek, + read: video_read, + write: video_write, + ioctl: video_ioctl, + mmap: video_mmap, + open: video_open, + release: video_release, + poll: video_poll, +}; /** * video_register_device - register video4linux devices @@ -633,19 +644,6 @@ void video_unregister_device(struct vide } -static struct file_operations video_fops= -{ - owner: THIS_MODULE, - llseek: no_llseek, - read: video_read, - write: video_write, - ioctl: video_ioctl, - mmap: video_mmap, - open: video_open, - release: video_release, - poll: video_poll, -}; - /* * Initialise video for linux */ diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index aa76e61..d01556c 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -510,7 +510,7 @@ static int do_write_oneword(struct map_i or tells us why it failed. */ dq6 = CMD(1<<6); dq5 = CMD(1<<5); - timeo = jiffies + (HZ/1000); /* setting timeout to 1ms for now */ + timeo = jiffies + (HZ/1000) + 1; /* setting timeout to 1ms for now */ oldstatus = cfi_read(map, adr); status = cfi_read(map, adr); @@ -547,7 +547,7 @@ static int do_write_oneword(struct map_i printk(KERN_WARNING "Internal flash device timeout occurred or write operation was performed while flash was programming.\n" ); } } else { - printk(KERN_WARNING "Waiting for write to complete timed out in do_write_oneword."); + printk(KERN_WARNING "Waiting for write to complete timed out in do_write_oneword.\n"); chip->state = FL_READY; wake_up(&chip->wq); @@ -825,7 +825,7 @@ static inline int do_erase_chip(struct m chip->state = FL_READY; wake_up(&chip->wq); cfi_spin_unlock(chip->mutex); - printk("waiting for erase to complete timed out."); + printk("waiting for erase to complete timed out.\n"); DISABLE_VPP(map); return -EIO; } @@ -963,7 +963,7 @@ static inline int do_erase_oneblock(stru } else { - printk( "Waiting for erase to complete timed out in do_erase_oneblock."); + printk( "Waiting for erase to complete timed out in do_erase_oneblock.\n"); chip->state = FL_READY; wake_up(&chip->wq); diff --git a/drivers/mtd/devices/blkmtd.c b/drivers/mtd/devices/blkmtd.c index f4280a1..9399d4e 100644 --- a/drivers/mtd/devices/blkmtd.c +++ b/drivers/mtd/devices/blkmtd.c @@ -195,6 +195,7 @@ static int commit_pages(struct blkmtd_de int err = 0; iobuf->length = iobuf->nr_pages << PAGE_SHIFT; + iobuf->offset = 0; /* all pages are aligned */ iobuf->locked = 1; if(iobuf->length) { int i; diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index 4ae5078..4359a64 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c @@ -306,6 +306,7 @@ static void el16_tx_timeout (struct net_ static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad); static void init_82586_mem(struct net_device *dev); static struct ethtool_ops netdev_ethtool_ops; +static void init_rx_bufs(struct net_device *); /* Check for a network adaptor of this type, and return '0' iff one exists. @@ -602,7 +603,6 @@ static void el16_interrupt(int irq, void } if ((status & 0x0070) != 0x0040 && netif_running(dev)) { - static void init_rx_bufs(struct net_device *); /* The Rx unit is not ready, it must be hung. Restart the receiver by initializing the rx buffers, and issuing an Rx start command. */ if (net_debug) diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index e09a485..5ad93f4 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c @@ -594,6 +594,7 @@ static struct net_device *root_dev; static int probed __initdata = 0; +static void ace_watchdog(struct net_device *dev); int __devinit acenic_probe (ACE_PROBE_ARG) { @@ -665,7 +666,6 @@ int __devinit acenic_probe (ACE_PROBE_AR dev->vlan_rx_kill_vid = ace_vlan_rx_kill_vid; #endif if (1) { - static void ace_watchdog(struct net_device *dev); dev->tx_timeout = &ace_watchdog; dev->watchdog_timeo = 5*HZ; } diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index 77687bb..ae79284 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c @@ -277,7 +277,7 @@ static void release_arcbuf(struct net_de BUGLVL(D_DURING) { BUGMSG(D_DURING, "release_arcbuf: freed #%d; buffer queue is now: ", bufnum); - for (i = lp->next_buf; i != lp->first_free_buf; i = ++i % 5) + for (i = lp->next_buf; i != lp->first_free_buf; i = (i+1) % 5) BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]); BUGMSG2(D_DURING, "\n"); } @@ -310,7 +310,7 @@ static int get_arcbuf(struct net_device BUGLVL(D_DURING) { BUGMSG(D_DURING, "get_arcbuf: got #%d; buffer queue is now: ", buf); - for (i = lp->next_buf; i != lp->first_free_buf; i = ++i % 5) + for (i = lp->next_buf; i != lp->first_free_buf; i = (i+1) % 5) BUGMSG2(D_DURING, "#%d ", lp->buf_queue[i]); BUGMSG2(D_DURING, "\n"); } diff --git a/drivers/net/arlan.c b/drivers/net/arlan.c index 204e651..f61269a 100644 --- a/drivers/net/arlan.c +++ b/drivers/net/arlan.c @@ -12,7 +12,7 @@ # error FIXME: this driver requires a 32-bit platform #endif -static const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee Oct'98, http://www.ylenurme.ee/~elmer/655/"; +const char *arlan_version = "C.Jennigs 97 & Elmer.Joandi@ut.ee Oct'98, http://www.ylenurme.ee/~elmer/655/"; struct net_device *arlan_device[MAX_ARLANS]; int last_arlan; diff --git a/drivers/net/arlan.h b/drivers/net/arlan.h index f0c19ea..b80ea02 100644 --- a/drivers/net/arlan.h +++ b/drivers/net/arlan.h @@ -47,7 +47,6 @@ extern int init_arlan_proc(void); extern struct net_device *arlan_device[MAX_ARLANS]; extern int arlan_debug; -extern char * siteName; extern int arlan_entry_debug; extern int arlan_exit_debug; extern int testMemory; diff --git a/drivers/net/de4x5.c b/drivers/net/de4x5.c index 955fc66..d119720 100644 --- a/drivers/net/de4x5.c +++ b/drivers/net/de4x5.c @@ -5109,7 +5109,7 @@ mii_get_phy(struct net_device *dev) lp->useMII = TRUE; /* Search the MII address space for possible PHY devices */ - for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(++i)%DE4X5_MAX_MII) { + for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(i+1)%DE4X5_MAX_MII) { lp->phy[lp->active].addr = i; if (i==0) n++; /* Count cycles */ while (de4x5_reset_phy(dev)<0) udelay(100);/* Wait for reset */ diff --git a/drivers/net/depca.c b/drivers/net/depca.c index 3479e73..3b981d5 100644 --- a/drivers/net/depca.c +++ b/drivers/net/depca.c @@ -1746,7 +1746,7 @@ static int load_packet(struct net_device /* set up the buffer descriptors */ len = (skb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len; - for (i = entry; i != end; i = (++i) & lp->txRingMask) { + for (i = entry; i != end; i = (i+1) & lp->txRingMask) { /* clean out flags */ writel(readl(&lp->tx_ring[i].base) & ~T_FLAGS, &lp->tx_ring[i].base); writew(0x0000, &lp->tx_ring[i].misc); /* clears other error flags */ diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 76f26b6..2f76d9c 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -60,8 +60,10 @@ #include #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ +static int my_errno; +#define errno my_errno #define __KERNEL_SYSCALLS__ -#include +#include /* --------------------------------------------------------------------- */ @@ -370,8 +372,6 @@ static char eppconfig_path[256] = "/usr/ static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL }; -static int errno; - static int exec_eppfpga(void *b) { struct baycom_state *bc = (struct baycom_state *)b; @@ -478,14 +478,14 @@ static void inline do_kiss_params(struct */ #define ENCODEITERA(j) \ -({ \ +do { \ if (!(notbitstream & (0x1f0 << j))) \ goto stuff##j; \ encodeend##j: ; \ -}) +} while (0) #define ENCODEITERB(j) \ -({ \ +do { \ stuff##j: \ bitstream &= ~(0x100 << j); \ bitbuf = (bitbuf & (((2 << j) << numbit) - 1)) | \ @@ -493,7 +493,7 @@ static void inline do_kiss_params(struct numbit++; \ notbitstream = ~bitstream; \ goto encodeend##j; \ -}) +} while (0) static void encode_hdlc(struct baycom_state *bc) @@ -710,16 +710,16 @@ static void do_rxpacket(struct net_devic } #define DECODEITERA(j) \ -({ \ +do { \ if (!(notbitstream & (0x0fc << j))) /* flag or abort */ \ goto flgabrt##j; \ if ((bitstream & (0x1f8 << j)) == (0xf8 << j)) /* stuffed bit */ \ goto stuff##j; \ enditer##j: ; \ -}) +} while (0) #define DECODEITERB(j) \ -({ \ +do { \ flgabrt##j: \ if (!(notbitstream & (0x1fc << j))) { /* abort received */ \ state = 0; \ @@ -738,7 +738,7 @@ static void do_rxpacket(struct net_devic numbits--; \ bitbuf = (bitbuf & ((~0xff) << j)) | ((bitbuf & ~((~0xff) << j)) << 1); \ goto enditer##j; \ -}) +} while (0) static int receive(struct net_device *dev, int cnt) { diff --git a/drivers/net/hamradio/soundmodem/sm.h b/drivers/net/hamradio/soundmodem/sm.h index 25c47f9..b1105c2 100644 --- a/drivers/net/hamradio/soundmodem/sm.h +++ b/drivers/net/hamradio/soundmodem/sm.h @@ -151,7 +151,6 @@ struct hardware_info { /* --------------------------------------------------------------------- */ extern const char sm_drvname[]; -extern const char sm_drvinfo[]; /* --------------------------------------------------------------------- */ /* @@ -353,7 +352,6 @@ extern const struct hardware_info sm_hw_ extern const struct modem_tx_info *sm_modem_tx_table[]; extern const struct modem_rx_info *sm_modem_rx_table[]; -extern const struct hardware_info *sm_hardware_table[]; /* --------------------------------------------------------------------- */ diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 5b78bb1..7d1bc00 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c @@ -209,7 +209,11 @@ static int do_probe = DO_PROBE; #ifdef CRC_EXPORTED extern __u16 const irda_crc16_table[]; #else -static __u16 const irda_crc16_table[256] = { +/* Our local version of irda_crc16_table must have a unique + name to prevent extern-redefined-as-static compile errors. + This #define redirects the irda_fcs() macro to our version. */ +#define irda_crc16_table donauboe_irda_crc16_table +static __u16 const donauboe_irda_crc16_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index 1953c4a..02d05b3 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c @@ -639,6 +639,7 @@ int pppoe_connect(struct socket *sock, s po->chan.hdrlen = (sizeof(struct pppoe_hdr) + dev->hard_header_len); + po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr); po->chan.private = sk; po->chan.ops = &pppoe_chan_ops; diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c index 7838e0d..8bb368c 100644 --- a/drivers/net/rrunner.c +++ b/drivers/net/rrunner.c @@ -234,7 +234,7 @@ int __init rr_hippi_probe (struct net_de * Don't access any registes before this point! */ #ifdef __BIG_ENDIAN - writel(readl(®s->HostCtrl) | NO_SWAP, ®s->HostCtrl); + writel(readl(&rrpriv->regs->HostCtrl) | NO_SWAP, &rrpriv->regs->HostCtrl); #endif /* * Need to add a case for little-endian 64-bit hosts here. diff --git a/drivers/net/sk98lin/skvpd.c b/drivers/net/sk98lin/skvpd.c index f03dc79..be0a169 100644 --- a/drivers/net/sk98lin/skvpd.c +++ b/drivers/net/sk98lin/skvpd.c @@ -472,7 +472,7 @@ SK_IOC IoC) /* IO Context */ ((unsigned char)pAC->vpd.vpd_buf[0x40] == 0x3c) && ((unsigned char)pAC->vpd.vpd_buf[0x41] == 0x45) ) { printk(KERN_INFO "sk98lin : humm... Asus mainboard with buggy VPD ? correcting data.\n"); - (unsigned char)pAC->vpd.vpd_buf[0x40] = 0x38; + pAC->vpd.vpd_buf[0x40] = 0x38; } /* find the end tag of the RO area */ diff --git a/drivers/net/wan/comx-hw-comx.c b/drivers/net/wan/comx-hw-comx.c index dedb224..e78738e 100644 --- a/drivers/net/wan/comx-hw-comx.c +++ b/drivers/net/wan/comx-hw-comx.c @@ -92,9 +92,9 @@ struct comx_privdata { }; static struct net_device *memory_used[(COMX_MEM_MAX - COMX_MEM_MIN) / 0x10000]; -extern struct comx_hardware hicomx_hw; -extern struct comx_hardware comx_hw; -extern struct comx_hardware cmx_hw; +static struct comx_hardware hicomx_hw; +static struct comx_hardware comx_hw; +static struct comx_hardware cmx_hw; static void COMX_interrupt(int irq, void *dev_id, struct pt_regs *regs); diff --git a/drivers/net/wan/comx.h b/drivers/net/wan/comx.h index 0f7404f..4c58d4d 100644 --- a/drivers/net/wan/comx.h +++ b/drivers/net/wan/comx.h @@ -212,8 +212,6 @@ typedef u16 word; #define SEEK_END 2 #endif -extern struct proc_dir_entry * comx_root_dir; - extern int comx_register_hardware(struct comx_hardware *comx_hw); extern int comx_unregister_hardware(char *name); extern int comx_register_protocol(struct comx_protocol *comx_line); diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c index fe74a21..d0ed22a 100644 --- a/drivers/net/wan/sdla.c +++ b/drivers/net/wan/sdla.c @@ -319,7 +319,7 @@ static int sdla_cpuspeed(struct net_devi struct _dlci_stat { short dlci __attribute__((packed)); - char flags __attribute__((packed)); + char flags; }; struct _frad_stat diff --git a/drivers/net/wan/sdla_fr.c b/drivers/net/wan/sdla_fr.c index 4fd68ec..8a094e9 100644 --- a/drivers/net/wan/sdla_fr.c +++ b/drivers/net/wan/sdla_fr.c @@ -302,7 +302,7 @@ typedef struct fr_channel typedef struct dlci_status { unsigned short dlci PACKED; - unsigned char state PACKED; + unsigned char state; } dlci_status_t; typedef struct dlci_IB_mapping @@ -316,9 +316,9 @@ typedef struct dlci_IB_mapping */ typedef struct fr_dlci_interface { - unsigned char gen_interrupt PACKED; + unsigned char gen_interrupt; unsigned short packet_length PACKED; - unsigned char reserved PACKED; + unsigned char reserved; } fr_dlci_interface_t; /* variable for keeping track of enabling/disabling FT1 monitor status */ @@ -3929,7 +3929,7 @@ static int process_udp_mgmt_pkt(sdla_t* break; } - (void *)ptr_trc_el = card->u.f.curr_trc_el; + ptr_trc_el = (void *)card->u.f.curr_trc_el; buffer_length = 0; fr_udp_pkt->data[0x00] = 0x00; @@ -3980,7 +3980,7 @@ static int process_udp_mgmt_pkt(sdla_t* ptr_trc_el ++; if((void *)ptr_trc_el > card->u.f.trc_el_last) - (void*)ptr_trc_el = card->u.f.trc_el_base; + ptr_trc_el = (void*)card->u.f.trc_el_base; buffer_length += sizeof(fpipemon_trc_hdr_t); if(fpipemon_trc->fpipemon_trc_hdr.data_passed) { diff --git a/drivers/net/wan/sdla_x25.c b/drivers/net/wan/sdla_x25.c index 0cfc8a4..3915c37 100644 --- a/drivers/net/wan/sdla_x25.c +++ b/drivers/net/wan/sdla_x25.c @@ -304,26 +304,26 @@ typedef struct x25_channel #ifdef NEX_OLD_CALL_INFO typedef struct x25_call_info { - char dest[17]; PACKED;/* ASCIIZ destination address */ - char src[17]; PACKED;/* ASCIIZ source address */ - char nuser; PACKED;/* number of user data bytes */ - unsigned char user[127]; PACKED;/* user data */ - char nfacil; PACKED;/* number of facilities */ + char dest[17]; /* ASCIIZ destination address */ + char src[17]; /* ASCIIZ source address */ + char nuser; /* number of user data bytes */ + unsigned char user[127]; /* user data */ + char nfacil; /* number of facilities */ struct { - unsigned char code; PACKED; - unsigned char parm; PACKED; + unsigned char code; + unsigned char parm; } facil[64]; /* facilities */ } x25_call_info_t; #else typedef struct x25_call_info { - char dest[MAX_X25_ADDR_SIZE] PACKED;/* ASCIIZ destination address */ - char src[MAX_X25_ADDR_SIZE] PACKED;/* ASCIIZ source address */ - unsigned char nuser PACKED; - unsigned char user[MAX_X25_DATA_SIZE] PACKED;/* user data */ - unsigned char nfacil PACKED; - unsigned char facil[MAX_X25_FACL_SIZE] PACKED; + char dest[MAX_X25_ADDR_SIZE]; /* ASCIIZ destination address */ + char src[MAX_X25_ADDR_SIZE]; /* ASCIIZ source address */ + unsigned char nuser; + unsigned char user[MAX_X25_DATA_SIZE];/* user data */ + unsigned char nfacil; + unsigned char facil[MAX_X25_FACL_SIZE]; unsigned short lcn PACKED; } x25_call_info_t; #endif diff --git a/drivers/net/wan/sdladrv.c b/drivers/net/wan/sdladrv.c index be2b7f7..48ccf19 100644 --- a/drivers/net/wan/sdladrv.c +++ b/drivers/net/wan/sdladrv.c @@ -1002,7 +1002,7 @@ int sdla_peek (sdlahw_t* hw, unsigned lo peek_by_4 ((unsigned long)hw->dpmbase + curpos, buf, curlen); addr += curlen; - (char*)buf += curlen; + buf = (char*)buf + curlen; len -= curlen; } @@ -1086,7 +1086,7 @@ int sdla_poke (sdlahw_t* hw, unsigned lo poke_by_4 ((unsigned long)hw->dpmbase + curpos, buf, curlen); addr += curlen; - (char*)buf += curlen; + buf = (char*)buf + curlen; len -= curlen; } @@ -2127,10 +2127,10 @@ static int detect_s514 (sdlahw_t* hw) modname, hw->irq); /* map the physical PCI memory to virtual memory */ - (void *)hw->dpmbase = ioremap((unsigned long)S514_mem_base_addr, + hw->dpmbase = (void *)ioremap((unsigned long)S514_mem_base_addr, (unsigned long)MAX_SIZEOF_S514_MEMORY); /* map the physical control register memory to virtual memory */ - (void *)hw->vector = ioremap( + hw->vector = (unsigned long)ioremap( (unsigned long)(S514_mem_base_addr + S514_CTRL_REG_BYTE), (unsigned long)16); diff --git a/drivers/net/wan/sdlamain.c b/drivers/net/wan/sdlamain.c index 3db44fc..0cc10a6 100644 --- a/drivers/net/wan/sdlamain.c +++ b/drivers/net/wan/sdlamain.c @@ -1027,7 +1027,7 @@ static int ioctl_dump (sdla_t* card, sdl #endif dump.length -= len; dump.offset += len; - (char*)dump.ptr += len; + dump.ptr = (char*)dump.ptr + len; } sdla_mapmem(&card->hw, oldvec);/* restore DPM window position */ diff --git a/drivers/sbus/char/pcikbd.h b/drivers/sbus/char/pcikbd.h index a9e3809..2fb826a 100644 --- a/drivers/sbus/char/pcikbd.h +++ b/drivers/sbus/char/pcikbd.h @@ -31,9 +31,6 @@ extern unsigned char pckbd_read_mask; extern unsigned char aux_device_present; -extern unsigned long pcikbd_iobase; -extern unsigned int pcikbd_irq; - /* * Keyboard Controller Registers * diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index d84b30b..9f96173 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -3456,9 +3456,9 @@ do { \ /* * Default EEPROM Configuration structure defined in a_init.c. */ -extern ADVEEP_3550_CONFIG Default_3550_EEPROM_Config; -extern ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config; -extern ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config; +static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config; +static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config; +static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config; /* * DvcGetPhyAddr() flag arguments @@ -7171,7 +7171,7 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_va * then return the number of underrun bytes. */ if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 && - qdonep->remain_bytes <= scp->request_bufflen != 0) { + qdonep->remain_bytes <= scp->request_bufflen) { ASC_DBG1(1, "asc_isr_callback: underrun condition %u bytes\n", (unsigned) qdonep->remain_bytes); scp->resid = qdonep->remain_bytes; diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 7dc4261..1648276 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -807,19 +807,19 @@ oktosend: bttl = virt_to_bus(sgpnt[j].address); l = sgpnt[j].length; while (l > 0x10000) { - (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000; - (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = 0x0000; - (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl; + (((unsigned short int *) (prd))[i + 3]) = 0x0000; + (((unsigned short int *) (prd))[i + 2]) = 0x0000; + (((unsigned long *) (prd))[i >> 1]) = bttl; l -= 0x10000; bttl += 0x10000; i += 0x04; } - (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl; - (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = l; - (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0; + (((unsigned long *) (prd))[i >> 1]) = bttl; + (((unsigned short int *) (prd))[i + 2]) = l; + (((unsigned short int *) (prd))[i + 3]) = 0; i += 0x04; } - (unsigned short int) (((unsigned short int *) (prd))[i - 1]) = 0x8000; + (((unsigned short int *) (prd))[i - 1]) = 0x8000; } else { /* * For a linear request write a chain of blocks @@ -828,16 +828,16 @@ oktosend: l = workrequ->request_bufflen; i = 0; while (l > 0x10000) { - (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x0000; - (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = 0x0000; - (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl; + (((unsigned short int *) (prd))[i + 3]) = 0x0000; + (((unsigned short int *) (prd))[i + 2]) = 0x0000; + (((unsigned long *) (prd))[i >> 1]) = bttl; l -= 0x10000; bttl += 0x10000; i += 0x04; } - (unsigned short int) (((unsigned short int *) (prd))[i + 3]) = 0x8000; - (unsigned short int) (((unsigned short int *) (prd))[i + 2]) = l; - (unsigned long) (((unsigned long *) (prd))[i >> 1]) = bttl; + (((unsigned short int *) (prd))[i + 3]) = 0x8000; + (((unsigned short int *) (prd))[i + 2]) = l; + (((unsigned long *) (prd))[i >> 1]) = bttl; } tmpcip = tmpcip + 4; dev->id[target_id].prdaddru = virt_to_bus(dev->id[target_id].prd_tableu); diff --git a/drivers/scsi/cpqfcTSstructs.h b/drivers/scsi/cpqfcTSstructs.h index 414aa7b..4ae0069 100644 --- a/drivers/scsi/cpqfcTSstructs.h +++ b/drivers/scsi/cpqfcTSstructs.h @@ -965,7 +965,6 @@ void fcSestReset(CPQFCHBA *); void cpqfc_pci_unmap(struct pci_dev *pcidev, Scsi_Cmnd * cmd, PTACHYON fcChip, __u32 x_ID); -extern const __u8 valid_al_pa[]; extern const int number_of_al_pa; #define FCP_RESID_UNDER 0x80000 diff --git a/drivers/scsi/cpqfcTSworker.c b/drivers/scsi/cpqfcTSworker.c index b1dda80..7ce9b01 100644 --- a/drivers/scsi/cpqfcTSworker.c +++ b/drivers/scsi/cpqfcTSworker.c @@ -48,6 +48,7 @@ #include "cpqfcTSchip.h" #include "cpqfcTSstructs.h" #include "cpqfcTStrigger.h" +static const __u8 valid_al_pa[]; //#define LOGIN_DBG 1 diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 905b8a0..8b8f281 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -1192,7 +1192,7 @@ static int sg_mmap(struct file * filp, s sg_rb_correct4mmap(rsv_schp, 1); /* do only once per fd lifetime */ sfp->mmap_called = 1; } - vma->vm_flags |= (VM_RESERVED | VM_IO); + vma->vm_flags |= VM_RESERVED; vma->vm_private_data = sfp; vma->vm_ops = &sg_mmap_vm_ops; return 0; diff --git a/drivers/sound/sound_firmware.c b/drivers/sound/sound_firmware.c index 9e8691d..7babebd 100644 --- a/drivers/sound/sound_firmware.c +++ b/drivers/sound/sound_firmware.c @@ -4,10 +4,11 @@ #include #include #include -#include +static int my_errno; +#define errno my_errno +#include #include -static int errno; static int do_mod_firmware_load(const char *fn, char **fp) { int fd; diff --git a/drivers/sound/wavfront.c b/drivers/sound/wavfront.c index 632e731..92fcb20 100644 --- a/drivers/sound/wavfront.c +++ b/drivers/sound/wavfront.c @@ -2484,11 +2484,11 @@ static int __init detect_wavefront (int #include #include #include -#include +static int my_errno; +#define errno my_errno +#include #include -static int errno; - static int wavefront_download_firmware (char *path) diff --git a/drivers/usb/audio.c b/drivers/usb/audio.c index 732a7ba..18b5e76 100644 --- a/drivers/usb/audio.c +++ b/drivers/usb/audio.c @@ -217,9 +217,6 @@ #define dprintk(x) -#undef abs -extern int abs(int __x) __attribute__ ((__const__)); /* Shut up warning */ - /* --------------------------------------------------------------------- */ /* @@ -461,8 +458,8 @@ struct usb_audio_state { /* --------------------------------------------------------------------- */ /* prevent picking up a bogus abs macro */ -#undef abs -static inline int abs(int x) +#undef my_abs +static inline int my_abs(int x) { if (x < 0) return -x; @@ -1401,7 +1398,7 @@ static int usbout_sync_retire_desc(struc continue; } f = cp[0] | (cp[1] << 8) | (cp[2] << 16); - if (abs(f - u->freqn) > (u->freqn >> 3) || f > u->freqmax) { + if (my_abs(f - u->freqn) > (u->freqn >> 3) || f > u->freqmax) { printk(KERN_WARNING "usbout_sync_retire_desc: requested frequency %u (nominal %u) out of range!\n", f, u->freqn); continue; } diff --git a/drivers/usb/devices.c b/drivers/usb/devices.c index eb2722e..a50f090 100644 --- a/drivers/usb/devices.c +++ b/drivers/usb/devices.c @@ -392,7 +392,7 @@ static char *usb_dump_desc(char *start, * Grab device's exclusive_access mutex to prevent its driver or * devio from using this device while we are accessing it. */ - down (&dev->exclusive_access); + usb_excl_lock(dev, 3, 0); start = usb_dump_device_descriptor(start, end, &dev->descriptor); @@ -411,7 +411,7 @@ static char *usb_dump_desc(char *start, } out: - up (&dev->exclusive_access); + usb_excl_unlock(dev, 3); return start; } diff --git a/drivers/usb/devio.c b/drivers/usb/devio.c index 2851cd6..314f84b 100644 --- a/drivers/usb/devio.c +++ b/drivers/usb/devio.c @@ -623,7 +623,12 @@ static int proc_bulk(struct dev_state *p free_page((unsigned long)tbuf); return -EINVAL; } + if (usb_excl_lock(dev, 1, 1) != 0) { + free_page((unsigned long)tbuf); + return -ERESTARTSYS; + } i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); + usb_excl_unlock(dev, 1); if (!i && len2) { if (copy_to_user(bulk.data, tbuf, len2)) { free_page((unsigned long)tbuf); @@ -637,7 +642,12 @@ static int proc_bulk(struct dev_state *p return -EFAULT; } } + if (usb_excl_lock(dev, 2, 1) != 0) { + free_page((unsigned long)tbuf); + return -ERESTARTSYS; + } i = usb_bulk_msg(dev, pipe, tbuf, len1, &len2, tmo); + usb_excl_unlock(dev, 2); } free_page((unsigned long)tbuf); if (i < 0) { @@ -1160,12 +1170,6 @@ static int usbdev_ioctl_exclusive(struct inode->i_mtime = CURRENT_TIME; break; - case USBDEVFS_BULK: - ret = proc_bulk(ps, (void *)arg); - if (ret >= 0) - inode->i_mtime = CURRENT_TIME; - break; - case USBDEVFS_RESETEP: ret = proc_resetep(ps, (void *)arg); if (ret >= 0) @@ -1259,8 +1263,13 @@ static int usbdev_ioctl(struct inode *in ret = proc_disconnectsignal(ps, (void *)arg); break; - case USBDEVFS_CONTROL: case USBDEVFS_BULK: + ret = proc_bulk(ps, (void *)arg); + if (ret >= 0) + inode->i_mtime = CURRENT_TIME; + break; + + case USBDEVFS_CONTROL: case USBDEVFS_RESETEP: case USBDEVFS_RESET: case USBDEVFS_CLEAR_HALT: @@ -1272,9 +1281,9 @@ static int usbdev_ioctl(struct inode *in case USBDEVFS_RELEASEINTERFACE: case USBDEVFS_IOCTL: ret = -ERESTARTSYS; - if (down_interruptible(&ps->dev->exclusive_access) == 0) { + if (usb_excl_lock(ps->dev, 3, 1) == 0) { ret = usbdev_ioctl_exclusive(ps, inode, cmd, arg); - up(&ps->dev->exclusive_access); + usb_excl_unlock(ps->dev, 3); } break; diff --git a/drivers/usb/host/usb-ohci.c b/drivers/usb/host/usb-ohci.c index 27fc5fe..82817f5 100644 --- a/drivers/usb/host/usb-ohci.c +++ b/drivers/usb/host/usb-ohci.c @@ -2159,7 +2159,7 @@ static int rh_submit_urb (struct urb * u static int rh_unlink_urb (struct urb * urb) { ohci_t * ohci = urb->dev->bus->hcpriv; - unsigned int flags; + unsigned long flags; spin_lock_irqsave(&ohci->ohci_lock, flags); if (ohci->rh.urb == urb) { diff --git a/drivers/usb/inode.c b/drivers/usb/inode.c index 74a3480..7598b3b 100644 --- a/drivers/usb/inode.c +++ b/drivers/usb/inode.c @@ -41,6 +41,9 @@ #include #include +static struct inode_operations usbdevfs_bus_inode_operations; +static struct file_operations usbdevfs_bus_file_operations; + /* --------------------------------------------------------------------- */ /* diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index 1bc4e4b..0260b4e 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h @@ -308,20 +308,9 @@ static inline int port_paranoia_check (s return 0; } - -static inline struct usb_serial* get_usb_serial (struct usb_serial_port *port, const char *function) -{ - /* if no port was specified, or it fails a paranoia check */ - if (!port || - port_paranoia_check (port, function) || - serial_paranoia_check (port->serial, function)) { - /* then say that we don't have a valid usb_serial thing, which will - * end up genrating -ENODEV return values */ - return NULL; - } - - return port->serial; -} +#define get_usb_serial(p, f) usb_serial_get_serial(p, f) +extern struct usb_serial *usb_serial_get_serial(struct usb_serial_port *port, + const char *function_name); static inline void usb_serial_debug_data (const char *file, const char *function, int size, const unsigned char *data) diff --git a/drivers/usb/serial/usbserial.c b/drivers/usb/serial/usbserial.c index 319bb03..ee6ef01 100644 --- a/drivers/usb/serial/usbserial.c +++ b/drivers/usb/serial/usbserial.c @@ -408,6 +408,25 @@ static struct usb_serial *serial_table[S static LIST_HEAD(usb_serial_driver_list); +struct usb_serial *usb_serial_get_serial(struct usb_serial_port *port, + const char *function) +{ + + /* if no port was specified, or it fails a paranoia check */ + if (!port || + port_paranoia_check (port, function) || + serial_paranoia_check (port->serial, function)) { + return NULL; + } + + /* disconnected, cut off all operations */ + if (port->serial->dev == NULL) + return NULL; + + return port->serial; +} + + static struct usb_serial *get_serial_by_minor (unsigned int minor) { return serial_table[minor]; @@ -467,6 +486,23 @@ static void return_serial (struct usb_se } /* + * A regular foo_put(), except a) it's open-coded without kref, and + * b) it's not the only place which does --serial->ref (due to locking). + * + * This does not do an equivalent of return_serial() because serial_table[] + * has a lifetime from probe to disconnect. + */ +static void serial_put(struct usb_serial *serial) +{ + unsigned long flags; + + spin_lock_irqsave(&post_lock, flags); + if (--serial->ref == 0) + kfree(serial); + spin_unlock_irqrestore(&post_lock, flags); +} + +/* * The post kludge. * * Our component drivers are hideously buggy and written by people @@ -495,7 +531,7 @@ static void post_helper(void *arg) while (pos != &post_list) { job = list_entry(pos, struct usb_serial_post_job, link); port = job->port; - /* get_usb_serial checks port->tty, so cannot be used */ + /* get_usb_serial checks serial->dev, so cannot be used */ serial = port->serial; if (port->write_busy) { dbg("%s - port %d busy", __FUNCTION__, port->number); @@ -508,7 +544,7 @@ static void post_helper(void *arg) down(&port->sem); dbg("%s - port %d len %d backlog %d", __FUNCTION__, port->number, job->len, port->write_backlog); - if (port->tty != NULL) { + if (serial->dev != NULL) { int rc; int sent = 0; while (sent < job->len) { @@ -581,17 +617,25 @@ static int serial_open (struct tty_struc struct usb_serial_port *port; unsigned int portNumber; int retval = 0; - + unsigned long flags; + dbg("%s", __FUNCTION__); /* initialize the pointer incase something fails */ tty->driver_data = NULL; + /* + * In a sane refcounting system, this would've been called serial_get(). + */ + spin_lock_irqsave(&post_lock, flags); /* get the serial object associated with this tty pointer */ serial = get_serial_by_minor (MINOR(tty->device)); - - if (serial_paranoia_check (serial, __FUNCTION__)) + if (serial_paranoia_check(serial, __FUNCTION__) || serial->dev == NULL) { + spin_unlock_irqrestore(&post_lock, flags); return -ENODEV; + } + serial->ref++; /* Protect the port->sem from kfree() */ + spin_unlock_irqrestore(&post_lock, flags); /* set up our port structure making the tty driver remember our port object, and us it */ portNumber = MINOR(tty->device) - serial->minor; @@ -600,7 +644,7 @@ static int serial_open (struct tty_struc down (&port->sem); port->tty = tty; - + /* lock this module before we call it */ if (serial->type->owner) __MOD_INC_USE_COUNT(serial->type->owner); @@ -622,13 +666,16 @@ static int serial_open (struct tty_struc } up (&port->sem); + if (retval) + serial_put(serial); return retval; } static void __serial_close(struct usb_serial_port *port, struct file *filp) { + if (!port->open_count) { - dbg ("%s - port not opened", __FUNCTION__); + err("%s - port %d: not open", __FUNCTION__, port->number); return; } @@ -653,36 +700,33 @@ static void __serial_close(struct usb_se static void serial_close(struct tty_struct *tty, struct file * filp) { - struct usb_serial_port *port = (struct usb_serial_port *) tty->driver_data; - struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); + struct usb_serial_port *port; + struct usb_serial *serial; - if (!serial) + if ((port = tty->driver_data) == NULL) { + /* This happens if someone opened us with O_NDELAY */ return; - - down (&port->sem); + } + if ((serial = port->serial) == NULL) { + err("%s - port %d: not open (count %d)", __FUNCTION__, port->number, port->open_count); + return; + } dbg("%s - port %d", __FUNCTION__, port->number); - /* if disconnect beat us to the punch here, there's nothing to do */ - if (tty->driver_data) { - /* - * XXX The right thing would be to wait for the output to drain. - * But we are not sufficiently daring to experiment in 2.4. - * N.B. If we do wait, no need to run post_helper here. - * Normall callback mechanism wakes it up just fine. - */ -#if I_AM_A_DARING_HACKER - tty->closing = 1; - up (&port->sem); - if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) - tty_wait_until_sent(tty, info->closing_wait); - down (&port->sem); - if (!tty->driver_data) /* woopsie, disconnect, now what */ ; -#endif - __serial_close(port, filp); + tty->closing = 1; + if (serial->dev != NULL) { + /* In most drivers, this is set with setserial */ + /** if (info->closing_wait != ASYNC_CLOSING_WAIT_NONE) **/ + tty_wait_until_sent(tty, /** info->closing_wait **/ 30*HZ); } + down (&port->sem); + __serial_close(port, filp); up (&port->sem); + + serial_put(serial); + tty->closing = 0; } static int __serial_write (struct usb_serial_port *port, int from_user, const unsigned char *buf, int count) @@ -696,7 +740,7 @@ static int __serial_write (struct usb_se dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); if (!port->open_count) { - dbg("%s - port not opened", __FUNCTION__); + dbg("%s - port not open", __FUNCTION__); goto exit; } @@ -806,6 +850,9 @@ static int serial_post_one(struct usb_se struct usb_serial_post_job *job; unsigned long flags; + if (!serial) + return -ENODEV; + dbg("%s - port %d user %d count %d", __FUNCTION__, port->number, from_user, count); job = kmalloc(sizeof(struct usb_serial_post_job), gfp); @@ -1239,24 +1286,25 @@ static int generic_chars_in_buffer (stru static void generic_read_bulk_callback (struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; - struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); + struct usb_serial *serial = port->serial; struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int i; int result; - dbg("%s - port %d", __FUNCTION__, port->number); - if (!serial) { - dbg("%s - bad serial pointer, exiting", __FUNCTION__); + err("%s - null serial pointer, exiting", __FUNCTION__); return; } if (urb->status) { - dbg("%s - nonzero read bulk status received: %d", __FUNCTION__, urb->status); + dbg("%s - nonzero read bulk status received: %d, pipe 0x%x", + __FUNCTION__, urb->status, urb->pipe); return; } + dbg("%s - port %d", __FUNCTION__, port->number); + usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); tty = port->tty; @@ -1272,6 +1320,9 @@ static void generic_read_bulk_callback ( tty_flip_buffer_push(tty); } + if (serial->dev == NULL) + return; + /* Continue trying to always read */ usb_fill_bulk_urb (port->read_urb, serial->dev, usb_rcvbulkpipe (serial->dev, @@ -1289,18 +1340,12 @@ static void generic_read_bulk_callback ( static void generic_write_bulk_callback (struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; - struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); dbg("%s - port %d", __FUNCTION__, port->number); port->write_busy = 0; wmb(); - if (!serial) { - err("%s - null serial pointer, exiting", __FUNCTION__); - return; - } - if (urb->status) { dbg("%s - nonzero write bulk status received: %d", __FUNCTION__, urb->status); } @@ -1658,26 +1703,22 @@ static void usb_serial_disconnect(struct { struct usb_serial *serial = (struct usb_serial *) ptr; struct usb_serial_port *port; - unsigned long flags; int i; dbg ("%s", __FUNCTION__); if (serial) { - /* fail all future close/read/write/ioctl/etc calls */ for (i = 0; i < serial->num_ports; ++i) { port = &serial->port[i]; down (&port->sem); if (port->tty != NULL) - while (port->open_count > 0) - __serial_close(port, NULL); + tty_hangup(port->tty); up (&port->sem); } - - serial->dev = NULL; serial_shutdown (serial); - for (i = 0; i < serial->num_ports; ++i) - serial->port[i].open_count = 0; + /* fail all future close/read/write/ioctl/etc calls */ + serial->dev = NULL; + wmb(); for (i = 0; i < serial->num_bulk_in; ++i) { port = &serial->port[i]; @@ -1716,10 +1757,7 @@ static void usb_serial_disconnect(struct return_serial (serial); /* free up any memory that we allocated */ - spin_lock_irqsave(&post_lock, flags); - if (--serial->ref == 0) - kfree(serial); - spin_unlock_irqrestore(&post_lock, flags); + serial_put (serial); } else { info("device disconnected"); @@ -1813,6 +1851,11 @@ static void __exit usb_serial_exit(void) usb_deregister(&usb_serial_driver); tty_unregister_driver(&serial_tty_driver); + + while (!list_empty(&usb_serial_driver_list)) { + err("%s - module is in use, hanging...", __FUNCTION__); + msleep(5000); + } } @@ -1862,7 +1905,7 @@ EXPORT_SYMBOL(usb_serial_deregister); EXPORT_SYMBOL(ezusb_writememory); EXPORT_SYMBOL(ezusb_set_reset); #endif - +EXPORT_SYMBOL(usb_serial_get_serial); /* Module information */ MODULE_AUTHOR( DRIVER_AUTHOR ); diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 1594597..62d9352 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -628,16 +628,16 @@ void usb_stor_invoke_transport(Scsi_Cmnd int result; /* - * Grab device's exclusive_access mutex to prevent libusb/usbfs from + * Grab device's exclusive access lock to prevent libusb/usbfs from * sending out a command in the middle of ours (if libusb sends a * get_descriptor or something on pipe 0 after our CBW and before * our CSW, and then we get a stall, we have trouble). */ - down(&(us->pusb_dev->exclusive_access)); + usb_excl_lock(us->pusb_dev, 3, 0); /* send the command to the transport layer */ result = us->transport(srb, us); - up(&(us->pusb_dev->exclusive_access)); + usb_excl_unlock(us->pusb_dev, 3); /* if the command gets aborted by the higher layers, we need to * short-circuit all other processing @@ -757,9 +757,9 @@ void usb_stor_invoke_transport(Scsi_Cmnd srb->use_sg = 0; /* issue the auto-sense command */ - down(&(us->pusb_dev->exclusive_access)); + usb_excl_lock(us->pusb_dev, 3, 0); temp_result = us->transport(us->srb, us); - up(&(us->pusb_dev->exclusive_access)); + usb_excl_unlock(us->pusb_dev, 3); /* let's clean up right away */ srb->request_buffer = old_request_buffer; diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c index 52be3ca..695db60 100644 --- a/drivers/usb/usb.c +++ b/drivers/usb/usb.c @@ -989,7 +989,8 @@ struct usb_device *usb_alloc_dev(struct INIT_LIST_HEAD(&dev->filelist); init_MUTEX(&dev->serialize); - init_MUTEX(&dev->exclusive_access); + spin_lock_init(&dev->excl_lock); + init_waitqueue_head(&dev->excl_wait); dev->bus->op->allocate(dev); @@ -2380,6 +2381,61 @@ struct list_head *usb_bus_get_list(void) } #endif +int usb_excl_lock(struct usb_device *dev, unsigned int type, int interruptible) +{ + DECLARE_WAITQUEUE(waita, current); + + add_wait_queue(&dev->excl_wait, &waita); + if (interruptible) + set_current_state(TASK_INTERRUPTIBLE); + else + set_current_state(TASK_UNINTERRUPTIBLE); + + for (;;) { + spin_lock_irq(&dev->excl_lock); + switch (type) { + case 1: /* 1 - read */ + case 2: /* 2 - write */ + case 3: /* 3 - control: excludes both read and write */ + if ((dev->excl_type & type) == 0) { + dev->excl_type |= type; + spin_unlock_irq(&dev->excl_lock); + set_current_state(TASK_RUNNING); + remove_wait_queue(&dev->excl_wait, &waita); + return 0; + } + break; + default: + spin_unlock_irq(&dev->excl_lock); + set_current_state(TASK_RUNNING); + remove_wait_queue(&dev->excl_wait, &waita); + return -EINVAL; + } + spin_unlock_irq(&dev->excl_lock); + + if (interruptible) { + schedule(); + if (signal_pending(current)) { + remove_wait_queue(&dev->excl_wait, &waita); + return 1; + } + set_current_state(TASK_INTERRUPTIBLE); + } else { + schedule(); + set_current_state(TASK_UNINTERRUPTIBLE); + } + } +} + +void usb_excl_unlock(struct usb_device *dev, unsigned int type) +{ + unsigned long flags; + + spin_lock_irqsave(&dev->excl_lock, flags); + dev->excl_type &= ~type; + wake_up(&dev->excl_wait); + spin_unlock_irqrestore(&dev->excl_lock, flags); +} /* * Init @@ -2473,5 +2529,8 @@ EXPORT_SYMBOL(usb_unlink_urb); EXPORT_SYMBOL(usb_control_msg); EXPORT_SYMBOL(usb_bulk_msg); +EXPORT_SYMBOL(usb_excl_lock); +EXPORT_SYMBOL(usb_excl_unlock); + EXPORT_SYMBOL(usb_devfs_handle); MODULE_LICENSE("GPL"); diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index cf616e1..fac9c73 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c @@ -388,7 +388,7 @@ static int fbmem_read_proc(char *buf, ch int clen; clen = 0; - for (fi = registered_fb; fi < ®istered_fb[FB_MAX] && len < 4000; fi++) + for (fi = registered_fb; fi < ®istered_fb[FB_MAX] && clen < 4000; fi++) if (*fi) clen += sprintf(buf + clen, "%d %s\n", GET_FB_IDX((*fi)->node), diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index b0ad905..32c8ec6 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -77,7 +77,7 @@ static struct linux_binfmt elf_format = NULL, THIS_MODULE, load_elf_binary, load_elf_library, elf_core_dump, ELF_EXEC_PAGESIZE }; -#define BAD_ADDR(x) ((unsigned long)(x) > TASK_SIZE) +#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) static int set_brk(unsigned long start, unsigned long end) { @@ -345,7 +345,7 @@ static unsigned long load_elf_interp(str * <= p_memsize so it is only necessary to check p_memsz. */ k = load_addr + eppnt->p_vaddr; - if (k > TASK_SIZE || eppnt->p_filesz > eppnt->p_memsz || + if (BAD_ADDR(k) || eppnt->p_filesz > eppnt->p_memsz || eppnt->p_memsz > TASK_SIZE || TASK_SIZE - eppnt->p_memsz < k) { error = -ENOMEM; goto out_close; @@ -772,7 +772,7 @@ static int load_elf_binary(struct linux_ * allowed task size. Note that p_filesz must always be * <= p_memsz so it is only necessary to check p_memsz. */ - if (k > TASK_SIZE || elf_ppnt->p_filesz > elf_ppnt->p_memsz || + if (BAD_ADDR(k) || elf_ppnt->p_filesz > elf_ppnt->p_memsz || elf_ppnt->p_memsz > TASK_SIZE || TASK_SIZE - elf_ppnt->p_memsz < k) { /* set_brk can never work. Avoid overflows. */ @@ -822,10 +822,13 @@ static int load_elf_binary(struct linux_ interpreter, &interp_load_addr); if (BAD_ADDR(elf_entry)) { - printk(KERN_ERR "Unable to load interpreter %.128s\n", - elf_interpreter); + // FIXME - ratelimit this before re-enabling + // printk(KERN_ERR "Unable to load interpreter %.128s\n", + // elf_interpreter); + force_sig(SIGSEGV, current); - retval = IS_ERR((void *)elf_entry) ? PTR_ERR((void *)elf_entry) : -ENOEXEC; + retval = IS_ERR((void *)elf_entry) ? + (int)elf_entry : -EINVAL; goto out_free_dentry; } reloc_func_desc = interp_load_addr; @@ -833,6 +836,12 @@ static int load_elf_binary(struct linux_ allow_write_access(interpreter); fput(interpreter); kfree(elf_interpreter); + } else { + if (BAD_ADDR(elf_entry)) { + force_sig(SIGSEGV, current); + retval = -EINVAL; + goto out_free_dentry; + } } kfree(elf_phdata); diff --git a/fs/hfs/trans.c b/fs/hfs/trans.c index 64adf73..37b0655 100644 --- a/fs/hfs/trans.c +++ b/fs/hfs/trans.c @@ -33,6 +33,7 @@ #include #include #include +#include /*================ File-local variables ================*/ @@ -78,7 +79,7 @@ static unsigned char mac2latin_map[128] * * Given a hexadecimal digit in ASCII, return the integer representation. */ -static inline const unsigned char dehex(char c) { +static inline __attribute_const__ unsigned char dehex(char c) { if ((c>='0')&&(c<='9')) { return c-'0'; } diff --git a/fs/intermezzo/presto.c b/fs/intermezzo/presto.c index c665ea1..155419c 100644 --- a/fs/intermezzo/presto.c +++ b/fs/intermezzo/presto.c @@ -344,8 +344,8 @@ int izo_mark_cache(struct dentry *dentry return -EBADF; } - ((int)cache->cache_flags) &= and_flag; - ((int)cache->cache_flags) |= or_flag; + cache->cache_flags &= and_flag; + cache->cache_flags |= or_flag; if (res) *res = (int)cache->cache_flags; @@ -383,8 +383,8 @@ int izo_mark_fset(struct dentry *dentry, make_bad_inode(dentry->d_inode); return -EBADF; } - ((int)fset->fset_flags) &= and_flag; - ((int)fset->fset_flags) |= or_flag; + fset->fset_flags &= and_flag; + fset->fset_flags |= or_flag; if (res) *res = (int)fset->fset_flags; diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 48ab5af..30e03c2 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -860,7 +860,10 @@ static int nfs_safe_remove(struct dentry if (inode) NFS_CACHEINV(inode); error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); - if (error < 0) + + /* if server returned ENOENT, assume that the dentry is already gone + * and update the cache accordingly */ + if (error < 0 && (error != -ENOENT)) goto out; if (inode) inode->i_nlink--; diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 3235723..f99c836 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -204,7 +204,8 @@ char *disk_name (struct gendisk *hd, int /* * Add a partitions details to the devices partition description. */ -void add_gd_partition(struct gendisk *hd, int minor, int start, int size) +void add_gd_partition(struct gendisk *hd, int minor, unsigned int start, + unsigned int size) { #ifndef CONFIG_DEVFS_FS char buf[40]; diff --git a/fs/partitions/check.h b/fs/partitions/check.h index 32d7940..dd93517 100644 --- a/fs/partitions/check.h +++ b/fs/partitions/check.h @@ -2,7 +2,8 @@ * add_partition adds a partitions details to the devices partition * description. */ -void add_gd_partition(struct gendisk *hd, int minor, int start, int size); +void add_gd_partition(struct gendisk *hd, int minor, unsigned int start, + unsigned int size); typedef struct {struct page *v;} Sector; diff --git a/fs/partitions/sun.c b/fs/partitions/sun.c index a0ca0b1..cd087ca 100644 --- a/fs/partitions/sun.c +++ b/fs/partitions/sun.c @@ -86,7 +86,7 @@ int sun_partition(struct gendisk *hd, st spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect); for (i = 0; i < 8; i++, p++) { unsigned long st_sector; - int num_sectors; + unsigned int num_sectors; st_sector = first_sector + be32_to_cpu(p->start_cylinder) * spc; num_sectors = be32_to_cpu(p->num_sectors); diff --git a/fs/udf/super.c b/fs/udf/super.c index 9df2fa2..0c5b54e 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1515,7 +1515,7 @@ udf_read_super(struct super_block *sb, v iput(inode); goto error_out; } - sb->s_maxbytes = MAX_LFS_FILESIZE; + sb->s_maxbytes = 1<<30; return sb; error_out: diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c index 0ae7e96..0567211 100644 --- a/fs/udf/truncate.c +++ b/fs/udf/truncate.c @@ -182,37 +182,51 @@ void udf_truncate_extents(struct inode * { if (offset) { - extoffset -= adsize; - etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1); - if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) - { - extoffset -= adsize; - elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset); - udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0); + /* + * OK, there is not extent covering inode->i_size and + * no extent above inode->i_size => truncate is + * extending the file by 'offset'. + */ + if ((!bh && extoffset == udf_file_entry_alloc_offset(inode)) || + (bh && extoffset == sizeof(struct allocExtDesc))) { + /* File has no extents at all! */ + memset(&eloc, 0x00, sizeof(lb_addr)); + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; + udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); } - else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) - { - lb_addr neloc = { 0, 0 }; + else { extoffset -= adsize; - nelen = EXT_NOT_RECORDED_NOT_ALLOCATED | - ((elen + offset + inode->i_sb->s_blocksize - 1) & - ~(inode->i_sb->s_blocksize - 1)); - udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1); - udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1); - } - else - { - if (elen & (inode->i_sb->s_blocksize - 1)) + etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1); + if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) + { + extoffset -= adsize; + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset); + udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0); + } + else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) { + lb_addr neloc = { 0, 0 }; extoffset -= adsize; - elen = EXT_RECORDED_ALLOCATED | - ((elen + inode->i_sb->s_blocksize - 1) & + nelen = EXT_NOT_RECORDED_NOT_ALLOCATED | + ((elen + offset + inode->i_sb->s_blocksize - 1) & ~(inode->i_sb->s_blocksize - 1)); - udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1); + udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1); + udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1); + } + else + { + if (elen & (inode->i_sb->s_blocksize - 1)) + { + extoffset -= adsize; + elen = EXT_RECORDED_ALLOCATED | + ((elen + inode->i_sb->s_blocksize - 1) & + ~(inode->i_sb->s_blocksize - 1)); + udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1); + } + memset(&eloc, 0x00, sizeof(lb_addr)); + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; + udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); } - memset(&eloc, 0x00, sizeof(lb_addr)); - elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset; - udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1); } } } diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index 9b6b55e..bb63c10 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -38,7 +38,7 @@ static __inline__ void set_bit(int nr, v __asm__ __volatile__( LOCK_PREFIX "btsl %1,%0" :"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); } /** @@ -55,7 +55,7 @@ static __inline__ void __set_bit(int nr, __asm__( "btsl %1,%0" :"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); } /** @@ -73,7 +73,7 @@ static __inline__ void clear_bit(int nr, __asm__ __volatile__( LOCK_PREFIX "btrl %1,%0" :"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); } #define smp_mb__before_clear_bit() barrier() #define smp_mb__after_clear_bit() barrier() @@ -92,7 +92,7 @@ static __inline__ void __change_bit(int __asm__ __volatile__( "btcl %1,%0" :"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); } /** @@ -109,7 +109,7 @@ static __inline__ void change_bit(int nr __asm__ __volatile__( LOCK_PREFIX "btcl %1,%0" :"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); } /** @@ -127,7 +127,7 @@ static __inline__ int test_and_set_bit(i __asm__ __volatile__( LOCK_PREFIX "btsl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); + :"Ir" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -147,7 +147,7 @@ static __inline__ int __test_and_set_bit __asm__( "btsl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); return oldbit; } @@ -166,7 +166,7 @@ static __inline__ int test_and_clear_bit __asm__ __volatile__( LOCK_PREFIX "btrl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); + :"Ir" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -186,7 +186,7 @@ static __inline__ int __test_and_clear_b __asm__( "btrl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr)); + :"Ir" (nr), "m" (ADDR)); return oldbit; } @@ -198,7 +198,7 @@ static __inline__ int __test_and_change_ __asm__ __volatile__( "btcl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); + :"Ir" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -217,7 +217,7 @@ static __inline__ int test_and_change_bi __asm__ __volatile__( LOCK_PREFIX "btcl %2,%1\n\tsbbl %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); + :"Ir" (nr), "m" (ADDR) : "memory"); return oldbit; } diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h index b164317..f448a15 100644 --- a/include/asm-i386/byteorder.h +++ b/include/asm-i386/byteorder.h @@ -2,6 +2,7 @@ #define _I386_BYTEORDER_H #include +#include #ifdef __GNUC__ @@ -10,7 +11,7 @@ #include #endif -static __inline__ __const__ __u32 ___arch__swab32(__u32 x) +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) { #ifdef CONFIG_X86_BSWAP __asm__("bswap %0" : "=r" (x) : "0" (x)); @@ -26,7 +27,7 @@ static __inline__ __const__ __u32 ___arc /* gcc should generate this for open coded C now too. May be worth switching to it because inline assembly cannot be scheduled. -AK */ -static __inline__ __const__ __u16 ___arch__swab16(__u16 x) +static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) { __asm__("xchgb %b0,%h0" /* swap bytes */ : "=q" (x) diff --git a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h index ceaaeeb..de336ea 100644 --- a/include/asm-i386/mpspec.h +++ b/include/asm-i386/mpspec.h @@ -84,7 +84,7 @@ struct mpc_config_bus { unsigned char mpc_type; unsigned char mpc_busid; - unsigned char mpc_bustype[6] __attribute((packed)); + unsigned char mpc_bustype[6]; }; /* List of Bus Type string values, Intel MP Spec. */ diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h index 90424fd..8b6b3ab 100644 --- a/include/asm-i386/page.h +++ b/include/asm-i386/page.h @@ -41,11 +41,13 @@ typedef struct { unsigned long pte_low, typedef struct { unsigned long long pmd; } pmd_t; typedef struct { unsigned long long pgd; } pgd_t; #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) +#define __pte(x) ({ pte_t __pte = {(x), (x) >> 32}; __pte; }) #else typedef struct { unsigned long pte_low; } pte_t; typedef struct { unsigned long pmd; } pmd_t; typedef struct { unsigned long pgd; } pgd_t; #define pte_val(x) ((x).pte_low) +#define __pte(x) ((pte_t) { (x) } ) #endif #define PTE_MASK PAGE_MASK @@ -55,7 +57,6 @@ typedef struct { unsigned long pgprot; } #define pgd_val(x) ((x).pgd) #define pgprot_val(x) ((x).pgprot) -#define __pte(x) ((pte_t) { (x) } ) #define __pmd(x) ((pmd_t) { (x) } ) #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 64550c4..81afef2 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -72,7 +72,6 @@ struct cpuinfo_x86 { */ extern struct cpuinfo_x86 boot_cpu_data; -extern struct tss_struct init_tss[NR_CPUS]; #ifdef CONFIG_SMP extern struct cpuinfo_x86 cpu_data[]; @@ -357,6 +356,8 @@ struct tss_struct { unsigned long __cacheline_filler[5]; }; +extern struct tss_struct init_tss[NR_CPUS]; + struct thread_struct { unsigned long esp0; unsigned long eip; diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h index d4d7899..acee435 100644 --- a/include/asm-i386/string.h +++ b/include/asm-i386/string.h @@ -337,7 +337,7 @@ extern void __struct_cpy_bug (void); #define struct_cpy(x,y) \ ({ \ if (sizeof(*(x)) != sizeof(*(y))) \ - __struct_cpy_bug; \ + __struct_cpy_bug(); \ memcpy(x, y, sizeof(*(x))); \ }) diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 5d436fe..fa83113 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -302,7 +302,7 @@ static inline unsigned long __cmpxchg(vo #define smp_mb() mb() #define smp_rmb() rmb() #define smp_wmb() wmb() -#define set_mb(var, value) do { xchg(&var, value); } while (0) +#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) #else #define smp_mb() barrier() #define smp_rmb() barrier() diff --git a/include/asm-m68k/setup.h b/include/asm-m68k/setup.h index 6d198bc..f1b441a 100644 --- a/include/asm-m68k/setup.h +++ b/include/asm-m68k/setup.h @@ -361,12 +361,13 @@ extern int m68k_is040or060; #ifndef __ASSEMBLY__ extern int m68k_num_memory; /* # of memory blocks found (and used) */ extern int m68k_realnum_memory; /* real # of memory blocks found */ -extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ struct mem_info { unsigned long addr; /* physical address of memory chunk */ unsigned long size; /* length of memory chunk (in bytes) */ }; + +extern struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */ #endif #endif /* __KERNEL__ */ diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h index 341262e..5e4f341 100644 --- a/include/asm-mips/page.h +++ b/include/asm-mips/page.h @@ -77,13 +77,16 @@ static inline void copy_user_page(void * #ifdef CONFIG_CPU_MIPS32 typedef struct { unsigned long pte_low, pte_high; } pte_t; #define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) + #define __pte(x) ({ pte_t __pte = {(x), ((unsigned long long)(x)) >> 32}; __pte; }) #else typedef struct { unsigned long long pte_low; } pte_t; #define pte_val(x) ((x).pte_low) + #define __pte(x) ((pte_t) { (x) } ) #endif #else typedef struct { unsigned long pte_low; } pte_t; #define pte_val(x) ((x).pte_low) +#define __pte(x) ((pte_t) { (x) } ) #endif typedef struct { unsigned long pmd; } pmd_t; @@ -96,7 +99,6 @@ typedef struct { unsigned long pgprot; } #define ptep_buddy(x) ((pte_t *)((unsigned long)(x) ^ sizeof(pte_t))) -#define __pte(x) ((pte_t) { (x) } ) #define __pmd(x) ((pmd_t) { (x) } ) #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h index d080ab6..6758801 100644 --- a/include/asm-ppc/byteorder.h +++ b/include/asm-ppc/byteorder.h @@ -2,6 +2,7 @@ #define _PPC_BYTEORDER_H #include +#include #ifdef __GNUC__ #ifdef __KERNEL__ @@ -50,7 +51,7 @@ extern __inline__ void st_le64(volatile __asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (taddr+4)); } -static __inline__ __const__ __u16 ___arch__swab16(__u16 value) +static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 value) { __u16 result; @@ -58,7 +59,7 @@ static __inline__ __const__ __u16 ___arc return result; } -static __inline__ __const__ __u32 ___arch__swab32(__u32 value) +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 value) { __u32 result; diff --git a/include/asm-ppc/spinlock.h b/include/asm-ppc/spinlock.h index 855b815..d553ee2 100644 --- a/include/asm-ppc/spinlock.h +++ b/include/asm-ppc/spinlock.h @@ -40,7 +40,6 @@ typedef struct { extern void _spin_lock(spinlock_t *lock); extern void _spin_unlock(spinlock_t *lock); extern int spin_trylock(spinlock_t *lock); -extern unsigned long __spin_trylock(volatile unsigned long *lock); #define spin_lock(lp) _spin_lock(lp) #define spin_unlock(lp) _spin_unlock(lp) diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h index b11210f..0621d24 100644 --- a/include/asm-ppc/time.h +++ b/include/asm-ppc/time.h @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -57,7 +58,7 @@ static __inline__ void set_dec(unsigned /* Accessor functions for the timebase (RTC on 601) registers. */ /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ #ifdef CONFIG_6xx -extern __inline__ int const __USE_RTC(void) { +extern __inline__ int __attribute_const__ __USE_RTC(void) { return (mfspr(SPRN_PVR)>>16) == 1; } #else diff --git a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h index be60a9a..7718ffe 100644 --- a/include/asm-sparc/mostek.h +++ b/include/asm-sparc/mostek.h @@ -127,7 +127,6 @@ struct mostek48t08 { char offset[6*1024]; /* Magic things may be here, who knows? */ struct mostek48t02 regs; /* Here is what we are interested in. */ }; -extern struct mostek48t08 *mstk48t08_regs; extern enum sparc_clock_type sp_clock_typ; diff --git a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h index b000c15..ccf2f5f 100644 --- a/include/asm-sparc64/mostek.h +++ b/include/asm-sparc64/mostek.h @@ -134,13 +134,11 @@ do { u8 __val = mostek_read(regs + MOSTE */ #define MOSTEK_48T08_OFFSET 0x0000UL /* Lower NVRAM portions */ #define MOSTEK_48T08_48T02 0x1800UL /* Offset to 48T02 chip */ -extern unsigned long mstk48t08_regs; /* SUN5 systems usually have 48t59 model clock chipsets. But we keep the older * clock chip definitions around just in case. */ #define MOSTEK_48T59_OFFSET 0x0000UL /* Lower NVRAM portions */ #define MOSTEK_48T59_48T02 0x1800UL /* Offset to 48T02 chip */ -extern unsigned long mstk48t59_regs; #endif /* !(_SPARC64_MOSTEK_H) */ diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h index 5aeed9b..b69562c 100644 --- a/include/asm-sparc64/smp.h +++ b/include/asm-sparc64/smp.h @@ -60,7 +60,6 @@ extern cpuinfo_sparc cpu_data[NR_CPUS]; * Private routines/data */ -extern unsigned char boot_cpu_id; extern unsigned long cpu_present_map; #define cpu_online_map cpu_present_map diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index e33621b..eb44b62 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h @@ -28,7 +28,7 @@ static __inline void apic_write(unsigned static __inline void apic_write_atomic(unsigned long reg, unsigned int v) { - xchg((volatile unsigned int *)(APIC_BASE+reg), v); + (void) xchg((volatile unsigned int *)(APIC_BASE+reg), v); } static __inline unsigned int apic_read(unsigned long reg) diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index c8a4749..f6a2a4f 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h @@ -38,7 +38,7 @@ static __inline__ void set_bit(long nr, __asm__ __volatile__( LOCK_PREFIX "btsq %1,%0" :"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); } /** @@ -55,7 +55,7 @@ static __inline__ void __set_bit(long nr __asm__( "btsq %1,%0" :"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); } /** @@ -73,7 +73,7 @@ static __inline__ void clear_bit(long nr __asm__ __volatile__( LOCK_PREFIX "btrq %1,%0" :"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); } #define smp_mb__before_clear_bit() barrier() #define smp_mb__after_clear_bit() barrier() @@ -92,7 +92,7 @@ static __inline__ void __change_bit(long __asm__ __volatile__( "btcq %1,%0" :"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); } /** @@ -109,7 +109,7 @@ static __inline__ void change_bit(long n __asm__ __volatile__( LOCK_PREFIX "btcq %1,%0" :"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); } /** @@ -127,7 +127,7 @@ static __inline__ int test_and_set_bit(l __asm__ __volatile__( LOCK_PREFIX "btsq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr) : "memory"); + :"dIr" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -147,7 +147,7 @@ static __inline__ int __test_and_set_bit __asm__( "btsq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); return oldbit; } @@ -166,7 +166,7 @@ static __inline__ int test_and_clear_bit __asm__ __volatile__( LOCK_PREFIX "btrq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr) : "memory"); + :"dIr" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -186,7 +186,7 @@ static __inline__ int __test_and_clear_b __asm__( "btrq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr)); + :"dIr" (nr), "m" (ADDR)); return oldbit; } @@ -198,7 +198,7 @@ static __inline__ int __test_and_change_ __asm__ __volatile__( "btcq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr) : "memory"); + :"dIr" (nr), "m" (ADDR) : "memory"); return oldbit; } @@ -217,7 +217,7 @@ static __inline__ int test_and_change_bi __asm__ __volatile__( LOCK_PREFIX "btcq %2,%1\n\tsbbq %0,%0" :"=r" (oldbit),"=m" (ADDR) - :"dIr" (nr) : "memory"); + :"dIr" (nr), "m" (ADDR) : "memory"); return oldbit; } diff --git a/include/asm-x86_64/byteorder.h b/include/asm-x86_64/byteorder.h index daef6af..c98de31 100644 --- a/include/asm-x86_64/byteorder.h +++ b/include/asm-x86_64/byteorder.h @@ -2,16 +2,17 @@ #define _X86_64_BYTEORDER_H #include +#include #ifdef __GNUC__ -static __inline__ __const__ __u64 ___arch__swab64(__u64 x) +static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) { __asm__("bswapq %0" : "=r" (x) : "0" (x)); return x; } -static __inline__ __const__ __u32 ___arch__swab32(__u32 x) +static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) { __asm__("bswapl %0" : "=r" (x) : "0" (x)); return x; diff --git a/include/asm-x86_64/mpspec.h b/include/asm-x86_64/mpspec.h index ca724cc..b88b3fa 100644 --- a/include/asm-x86_64/mpspec.h +++ b/include/asm-x86_64/mpspec.h @@ -76,7 +76,7 @@ struct mpc_config_bus { unsigned char mpc_type; unsigned char mpc_busid; - unsigned char mpc_bustype[6] __attribute((packed)); + unsigned char mpc_bustype[6]; }; /* List of Bus Type string values, Intel MP Spec. */ diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index da7a5a3..9b789b5 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -68,7 +68,6 @@ struct cpuinfo_x86 { #define X86_VENDOR_UNKNOWN 0xff extern struct cpuinfo_x86 boot_cpu_data; -extern struct tss_struct init_tss[NR_CPUS]; #ifdef CONFIG_SMP extern struct cpuinfo_x86 cpu_data[]; @@ -300,6 +299,8 @@ struct tss_struct { u32 io_bitmap[IO_BITMAP_SIZE]; } __attribute__((packed)) ____cacheline_aligned; +extern struct tss_struct init_tss[NR_CPUS]; + struct thread_struct { unsigned long rsp0; unsigned long rip; diff --git a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h index 2402c2c..31df110 100644 --- a/include/asm-x86_64/system.h +++ b/include/asm-x86_64/system.h @@ -251,7 +251,7 @@ static inline unsigned long __cmpxchg(vo #define mb() asm volatile("mfence":::"memory") #define rmb() asm volatile("lfence":::"memory") #define wmb() asm volatile("sfence":::"memory") -#define set_mb(var, value) do { xchg(&var, value); } while (0) +#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) #define set_wmb(var, value) do { var = value; wmb(); } while (0) #define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0) diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 5c2c0c3..def2ffe 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -137,14 +137,14 @@ struct elapaarp #define AARP_REQUEST 1 #define AARP_REPLY 2 #define AARP_PROBE 3 - __u8 hw_src[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_src_zero __attribute__ ((packed)); + __u8 hw_src[ETH_ALEN]; + __u8 pa_src_zero; __u16 pa_src_net __attribute__ ((packed)); - __u8 pa_src_node __attribute__ ((packed)); - __u8 hw_dst[ETH_ALEN] __attribute__ ((packed)); - __u8 pa_dst_zero __attribute__ ((packed)); + __u8 pa_src_node; + __u8 hw_dst[ETH_ALEN]; + __u8 pa_dst_zero; __u16 pa_dst_net __attribute__ ((packed)); - __u8 pa_dst_node __attribute__ ((packed)); + __u8 pa_dst_node; }; #define AARP_EXPIRY_TIME (5*60*HZ) /* Not specified - how long till we drop a resolved entry */ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fd524f2..57230bf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -46,6 +46,7 @@ struct request { struct buffer_head * bh; struct buffer_head * bhtail; request_queue_t *q; + char io_account; }; #include diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h index bd85d37..800931f 100644 --- a/include/linux/byteorder/swab.h +++ b/include/linux/byteorder/swab.h @@ -15,6 +15,8 @@ * */ +#include + /* casts are necessary for constants, because we never know how for sure * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. */ @@ -156,7 +158,7 @@ #endif /* OPTIMIZE */ -static __inline__ __const__ __u16 __fswab16(__u16 x) +static __inline__ __attribute_const__ __u16 __fswab16(__u16 x) { return __arch__swab16(x); } @@ -169,7 +171,7 @@ static __inline__ void __swab16s(__u16 * __arch__swab16s(addr); } -static __inline__ __const__ __u32 __fswab24(__u32 x) +static __inline__ __attribute_const__ __u32 __fswab24(__u32 x) { return __arch__swab24(x); } @@ -182,7 +184,7 @@ static __inline__ void __swab24s(__u32 * __arch__swab24s(addr); } -static __inline__ __const__ __u32 __fswab32(__u32 x) +static __inline__ __attribute_const__ __u32 __fswab32(__u32 x) { return __arch__swab32(x); } @@ -196,7 +198,7 @@ static __inline__ void __swab32s(__u32 * } #ifdef __BYTEORDER_HAS_U64__ -static __inline__ __const__ __u64 __fswab64(__u64 x) +static __inline__ __attribute_const__ __u64 __fswab64(__u64 x) { # ifdef __SWAB_64_THRU_32__ __u32 h = x >> 32; diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 0eef5e4..ba73dbf 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -27,6 +27,12 @@ #define __attribute_used__ /* not implemented */ #endif /* __GNUC__ */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +#define __attribute_const__ __attribute__((__const__)) +#else +#define __attribute_const__ /* unimplemented */ +#endif + #if __GNUC__ == 3 #if __GNUC_MINOR__ >= 1 # define inline __inline__ __attribute__((always_inline)) diff --git a/include/linux/fs.h b/include/linux/fs.h index 2d5a06c..c59e01d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1559,7 +1559,6 @@ static inline int is_mounted(kdev_t dev) unsigned long generate_cluster(kdev_t, int b[], int); unsigned long generate_cluster_swab32(kdev_t, int b[], int); extern kdev_t ROOT_DEV; -extern char root_device_name[]; extern void show_buffers(void); diff --git a/include/linux/fsfilter.h b/include/linux/fsfilter.h index 0cd4677..cb495b6 100644 --- a/include/linux/fsfilter.h +++ b/include/linux/fsfilter.h @@ -70,7 +70,6 @@ struct filter_fs { #define FILTER_FS_XFS 3 #define FILTER_FS_OBDFS 4 #define FILTER_FS_TMPFS 5 -extern struct filter_fs filter_oppar[FILTER_FS_TYPES]; struct filter_fs *filter_get_filter_fs(const char *cache_type); void filter_setup_journal_ops(struct filter_fs *ops, char *cache_type); diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h index 5c30fc9..58773a8 100644 --- a/include/linux/generic_serial.h +++ b/include/linux/generic_serial.h @@ -98,6 +98,4 @@ int gs_setserial(struct gs_port *port, int gs_getserial(struct gs_port *port, struct serial_struct *sp); void gs_got_break(struct gs_port *port); -extern int gs_debug; - #endif diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 87a6dd0..a1061eb 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -70,7 +70,7 @@ extern int i2c_master_recv(struct i2c_cl /* Transfer num messages. */ -extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num); +extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg,int num); /* * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor. @@ -197,7 +197,7 @@ struct i2c_algorithm { to NULL. If an adapter algorithm can do SMBus access, set smbus_xfer. If set to NULL, the SMBus protocol is simulated using common I2C messages */ - int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], + int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, int num); int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write, diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h index e691fdc..c4c2c82 100644 --- a/include/linux/if_frad.h +++ b/include/linux/if_frad.h @@ -131,13 +131,13 @@ struct frad_conf /* these are the fields of an RFC 1490 header */ struct frhdr { - unsigned char control __attribute__((packed)); + unsigned char control; /* for IP packets, this can be the NLPID */ - unsigned char pad __attribute__((packed)); + unsigned char pad ; - unsigned char NLPID __attribute__((packed)); - unsigned char OUI[3] __attribute__((packed)); + unsigned char NLPID ; + unsigned char OUI[3]; unsigned short PID __attribute__((packed)); #define IP_NLPID pad diff --git a/include/linux/intermezzo_fs.h b/include/linux/intermezzo_fs.h index 850150e..98800d0 100644 --- a/include/linux/intermezzo_fs.h +++ b/include/linux/intermezzo_fs.h @@ -321,7 +321,6 @@ int presto_fwrite(struct file *file, con int presto_ispresto(struct inode *); /* super.c */ -extern struct file_system_type presto_fs_type; extern int init_intermezzo_fs(void); /* fileset.c */ diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h index e309f24..c61c3aa 100644 --- a/include/linux/isdnif.h +++ b/include/linux/isdnif.h @@ -282,42 +282,42 @@ typedef struct setup_parm { typedef struct T30_s { /* session parameters */ - __u8 resolution __attribute__ ((packed)); - __u8 rate __attribute__ ((packed)); - __u8 width __attribute__ ((packed)); - __u8 length __attribute__ ((packed)); - __u8 compression __attribute__ ((packed)); - __u8 ecm __attribute__ ((packed)); - __u8 binary __attribute__ ((packed)); - __u8 scantime __attribute__ ((packed)); - __u8 id[FAXIDLEN] __attribute__ ((packed)); + __u8 resolution; + __u8 rate; + __u8 width; + __u8 length; + __u8 compression; + __u8 ecm; + __u8 binary; + __u8 scantime; + __u8 id[FAXIDLEN]; /* additional parameters */ - __u8 phase __attribute__ ((packed)); - __u8 direction __attribute__ ((packed)); - __u8 code __attribute__ ((packed)); - __u8 badlin __attribute__ ((packed)); - __u8 badmul __attribute__ ((packed)); - __u8 bor __attribute__ ((packed)); - __u8 fet __attribute__ ((packed)); - __u8 pollid[FAXIDLEN] __attribute__ ((packed)); - __u8 cq __attribute__ ((packed)); - __u8 cr __attribute__ ((packed)); - __u8 ctcrty __attribute__ ((packed)); - __u8 minsp __attribute__ ((packed)); - __u8 phcto __attribute__ ((packed)); - __u8 rel __attribute__ ((packed)); - __u8 nbc __attribute__ ((packed)); + __u8 phase; + __u8 direction; + __u8 code; + __u8 badlin; + __u8 badmul; + __u8 bor; + __u8 fet; + __u8 pollid[FAXIDLEN]; + __u8 cq; + __u8 cr; + __u8 ctcrty; + __u8 minsp; + __u8 phcto; + __u8 rel; + __u8 nbc; /* remote station parameters */ - __u8 r_resolution __attribute__ ((packed)); - __u8 r_rate __attribute__ ((packed)); - __u8 r_width __attribute__ ((packed)); - __u8 r_length __attribute__ ((packed)); - __u8 r_compression __attribute__ ((packed)); - __u8 r_ecm __attribute__ ((packed)); - __u8 r_binary __attribute__ ((packed)); - __u8 r_scantime __attribute__ ((packed)); - __u8 r_id[FAXIDLEN] __attribute__ ((packed)); - __u8 r_code __attribute__ ((packed)); + __u8 r_resolution; + __u8 r_rate; + __u8 r_width; + __u8 r_length; + __u8 r_compression; + __u8 r_ecm; + __u8 r_binary; + __u8 r_scantime; + __u8 r_id[FAXIDLEN]; + __u8 r_code; } T30_s; #define ISDN_TTY_FAX_CONN_IN 0 diff --git a/include/linux/nbd.h b/include/linux/nbd.h index bf276f3..c24f302 100644 --- a/include/linux/nbd.h +++ b/include/linux/nbd.h @@ -29,34 +29,6 @@ #include -#ifdef PARANOIA -extern int requests_in; -extern int requests_out; -#endif - -static void -nbd_end_request(struct request *req) -{ - struct buffer_head *bh; - unsigned nsect; - unsigned long flags; - int uptodate = (req->errors == 0) ? 1 : 0; - -#ifdef PARANOIA - requests_out++; -#endif - spin_lock_irqsave(&io_request_lock, flags); - while((bh = req->bh) != NULL) { - nsect = bh->b_size >> 9; - blk_finished_io(nsect); - req->bh = bh->b_reqnext; - bh->b_reqnext = NULL; - bh->b_end_io(bh, uptodate); - } - blkdev_release_request(req); - spin_unlock_irqrestore(&io_request_lock, flags); -} - #define MAX_NBD 128 struct nbd_device { diff --git a/include/linux/ncp.h b/include/linux/ncp.h index c9bf6dd..95b611d 100644 --- a/include/linux/ncp.h +++ b/include/linux/ncp.h @@ -20,28 +20,28 @@ #define NCP_DEALLOC_SLOT_REQUEST (0x5555) struct ncp_request_header { - __u16 type __attribute__((packed)); - __u8 sequence __attribute__((packed)); - __u8 conn_low __attribute__((packed)); - __u8 task __attribute__((packed)); - __u8 conn_high __attribute__((packed)); - __u8 function __attribute__((packed)); - __u8 data[0] __attribute__((packed)); -}; + __u16 type; + __u8 sequence; + __u8 conn_low; + __u8 task; + __u8 conn_high; + __u8 function; + __u8 data[0]; +} __attribute__((packed)); #define NCP_REPLY (0x3333) #define NCP_POSITIVE_ACK (0x9999) struct ncp_reply_header { - __u16 type __attribute__((packed)); - __u8 sequence __attribute__((packed)); - __u8 conn_low __attribute__((packed)); - __u8 task __attribute__((packed)); - __u8 conn_high __attribute__((packed)); - __u8 completion_code __attribute__((packed)); - __u8 connection_state __attribute__((packed)); - __u8 data[0] __attribute__((packed)); -}; + __u16 type; + __u8 sequence; + __u8 conn_low; + __u8 task; + __u8 conn_high; + __u8 completion_code; + __u8 connection_state; + __u8 data[0]; +} __attribute__((packed)); #define NCP_VOLNAME_LEN (16) #define NCP_NUMBER_OF_VOLUMES (256) @@ -110,33 +110,33 @@ struct ncp_volume_info { #endif struct nw_info_struct { - __u32 spaceAlloc __attribute__((packed)); - __u32 attributes __attribute__((packed)); - __u16 flags __attribute__((packed)); - __u32 dataStreamSize __attribute__((packed)); - __u32 totalStreamSize __attribute__((packed)); - __u16 numberOfStreams __attribute__((packed)); - __u16 creationTime __attribute__((packed)); - __u16 creationDate __attribute__((packed)); - __u32 creatorID __attribute__((packed)); - __u16 modifyTime __attribute__((packed)); - __u16 modifyDate __attribute__((packed)); - __u32 modifierID __attribute__((packed)); - __u16 lastAccessDate __attribute__((packed)); - __u16 archiveTime __attribute__((packed)); - __u16 archiveDate __attribute__((packed)); - __u32 archiverID __attribute__((packed)); - __u16 inheritedRightsMask __attribute__((packed)); - __u32 dirEntNum __attribute__((packed)); - __u32 DosDirNum __attribute__((packed)); - __u32 volNumber __attribute__((packed)); - __u32 EADataSize __attribute__((packed)); - __u32 EAKeyCount __attribute__((packed)); - __u32 EAKeySize __attribute__((packed)); - __u32 NSCreator __attribute__((packed)); - __u8 nameLen __attribute__((packed)); - __u8 entryName[256] __attribute__((packed)); -}; + __u32 spaceAlloc; + __u32 attributes; + __u16 flags; + __u32 dataStreamSize; + __u32 totalStreamSize; + __u16 numberOfStreams; + __u16 creationTime; + __u16 creationDate; + __u32 creatorID; + __u16 modifyTime; + __u16 modifyDate; + __u32 modifierID; + __u16 lastAccessDate; + __u16 archiveTime; + __u16 archiveDate; + __u32 archiverID; + __u16 inheritedRightsMask; + __u32 dirEntNum; + __u32 DosDirNum; + __u32 volNumber; + __u32 EADataSize; + __u32 EAKeyCount; + __u32 EAKeySize; + __u32 NSCreator; + __u8 nameLen; + __u8 entryName[256]; +} __attribute__((packed)); /* modify mask - use with MODIFY_DOS_INFO structure */ #define DM_ATTRIBUTES (ntohl(0x02000000L)) @@ -154,26 +154,26 @@ struct nw_info_struct { #define DM_MAXIMUM_SPACE (ntohl(0x00200000L)) struct nw_modify_dos_info { - __u32 attributes __attribute__((packed)); - __u16 creationDate __attribute__((packed)); - __u16 creationTime __attribute__((packed)); - __u32 creatorID __attribute__((packed)); - __u16 modifyDate __attribute__((packed)); - __u16 modifyTime __attribute__((packed)); - __u32 modifierID __attribute__((packed)); - __u16 archiveDate __attribute__((packed)); - __u16 archiveTime __attribute__((packed)); - __u32 archiverID __attribute__((packed)); - __u16 lastAccessDate __attribute__((packed)); - __u16 inheritanceGrantMask __attribute__((packed)); - __u16 inheritanceRevokeMask __attribute__((packed)); - __u32 maximumSpace __attribute__((packed)); -}; + __u32 attributes; + __u16 creationDate; + __u16 creationTime; + __u32 creatorID; + __u16 modifyDate; + __u16 modifyTime; + __u32 modifierID; + __u16 archiveDate; + __u16 archiveTime; + __u32 archiverID; + __u16 lastAccessDate; + __u16 inheritanceGrantMask; + __u16 inheritanceRevokeMask; + __u32 maximumSpace; +} __attribute__((packed)); struct nw_search_sequence { - __u8 volNumber __attribute__((packed)); - __u32 dirBase __attribute__((packed)); - __u32 sequence __attribute__((packed)); -}; + __u8 volNumber; + __u32 dirBase; + __u32 sequence; +} __attribute__((packed)); #endif /* _LINUX_NCP_H */ diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h index 919fc65..9bf0b6b 100644 --- a/include/linux/ncp_fs.h +++ b/include/linux/ncp_fs.h @@ -180,9 +180,9 @@ struct ncp_entry_info { ino_t ino; int opened; int access; - __u32 server_file_handle __attribute__((packed)); - __u8 open_create_action __attribute__((packed)); - __u8 file_handle[6] __attribute__((packed)); + __u32 server_file_handle; + __u8 open_create_action; + __u8 file_handle[6]; }; /* Guess, what 0x564c is :-) */ diff --git a/include/linux/ncp_fs_i.h b/include/linux/ncp_fs_i.h index ffdf49f..04f9552 100644 --- a/include/linux/ncp_fs_i.h +++ b/include/linux/ncp_fs_i.h @@ -15,16 +15,16 @@ * all the information we need to work with an inode after creation. */ struct ncp_inode_info { - __u32 dirEntNum __attribute__((packed)); - __u32 DosDirNum __attribute__((packed)); - __u32 volNumber __attribute__((packed)); + __u32 dirEntNum; + __u32 DosDirNum; + __u32 volNumber; __u32 nwattr; struct semaphore open_sem; atomic_t opened; int access; - __u32 server_file_handle __attribute__((packed)); - __u8 open_create_action __attribute__((packed)); - __u8 file_handle[6] __attribute__((packed)); + __u32 server_file_handle; + __u8 open_create_action; + __u8 file_handle[6]; }; #endif /* __KERNEL__ */ diff --git a/include/linux/sdla.h b/include/linux/sdla.h index 44ae55b..4a4ea5b 100644 --- a/include/linux/sdla.h +++ b/include/linux/sdla.h @@ -293,23 +293,23 @@ void sdla(void *cfg_info, char *dev, str #define SDLA_S508_INTEN 0x10 struct sdla_cmd { - char opp_flag __attribute__((packed)); - char cmd __attribute__((packed)); + char opp_flag; + char cmd; short length __attribute__((packed)); - char retval __attribute__((packed)); + char retval; short dlci __attribute__((packed)); - char flags __attribute__((packed)); + char flags; short rxlost_int __attribute__((packed)); long rxlost_app __attribute__((packed)); - char reserve[2] __attribute__((packed)); - char data[SDLA_MAX_DATA] __attribute__((packed)); /* transfer data buffer */ + char reserve[2]; + char data[SDLA_MAX_DATA]; /* transfer data buffer */ }; struct intr_info { - char flags __attribute__((packed)); + char flags; short txlen __attribute__((packed)); - char irq __attribute__((packed)); - char flags2 __attribute__((packed)); + char irq; + char flags2; short timeout __attribute__((packed)); }; @@ -325,10 +325,10 @@ struct buf_info { /* structure pointed to by rse_base in RXBUF_INFO struct */ struct buf_entry { - char opp_flag __attribute__((packed)); + char opp_flag; short length __attribute__((packed)); short dlci __attribute__((packed)); - char flags __attribute__((packed)); + char flags; short timestamp __attribute__((packed)); short reserved[2] __attribute__((packed)); long buf_addr __attribute__((packed)); diff --git a/include/linux/sdla_chdlc.h b/include/linux/sdla_chdlc.h index d2e35a2..d6090b9 100644 --- a/include/linux/sdla_chdlc.h +++ b/include/linux/sdla_chdlc.h @@ -61,12 +61,12 @@ #define PRI_MAX_NO_DATA_BYTES_IN_FRAME 15354 /* PRIMARY - max length of the CHDLC data field */ typedef struct { - unsigned char opp_flag PACKED; /* the opp flag */ - unsigned char command PACKED; /* the user command */ + unsigned char opp_flag; /* the opp flag */ + unsigned char command; /* the user command */ unsigned short buffer_length PACKED; /* the data length */ - unsigned char return_code PACKED; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */ - unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; /* the data area */ + unsigned char return_code; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES]; /* reserved for later */ + unsigned char data[SIZEOF_MB_DATA_BFR]; /* the data area */ } CHDLC_MAILBOX_STRUCT; typedef struct { @@ -248,7 +248,7 @@ typedef struct { /* the trace configuration structure (SET_TRACE_CONFIGURATION/READ_TRACE_CONFIGURATION commands) */ typedef struct { - unsigned char trace_config PACKED; /* trace configuration */ + unsigned char trace_config; /* trace configuration */ unsigned short trace_deactivation_timer PACKED; /* trace deactivation timer */ unsigned long ptr_trace_stat_el_cfg_struct PACKED; /* a pointer to the line trace element configuration structure */ } LINE_TRACE_CONFIG_STRUCT; @@ -272,9 +272,9 @@ typedef struct { /* the line trace status element structure */ typedef struct { - unsigned char opp_flag PACKED; /* opp flag */ + unsigned char opp_flag; /* opp flag */ unsigned short trace_length PACKED; /* trace length */ - unsigned char trace_type PACKED; /* trace type */ + unsigned char trace_type; /* trace type */ unsigned short trace_time_stamp PACKED; /* time stamp */ unsigned short trace_reserved_1 PACKED; /* reserved for later use */ unsigned long trace_reserved_2 PACKED; /* reserved for later use */ @@ -415,10 +415,10 @@ typedef struct { /* the CHDLC status structure */ typedef struct { - unsigned char CHDLC_link_status PACKED; /* CHDLC link status */ - unsigned char no_Data_frms_for_app PACKED; /* number of Data frames available for the application */ - unsigned char receiver_status PACKED; /* enabled/disabled */ - unsigned char SLARP_state PACKED; /* internal SLARP state */ + unsigned char CHDLC_link_status; /* CHDLC link status */ + unsigned char no_Data_frms_for_app; /* number of Data frames available for the application */ + unsigned char receiver_status; /* enabled/disabled */ + unsigned char SLARP_state; /* internal SLARP state */ } CHDLC_LINK_STATUS_STRUCT; /* settings for the 'CHDLC_link_status' variable */ @@ -519,8 +519,8 @@ typedef struct { /* the structure used for the SET_CHDLC_INTERRUPT_TRIGGERS/READ_CHDLC_INTERRUPT_TRIGGERS command */ typedef struct { - unsigned char CHDLC_interrupt_triggers PACKED; /* CHDLC interrupt trigger configuration */ - unsigned char IRQ PACKED; /* IRQ to be used */ + unsigned char CHDLC_interrupt_triggers; /* CHDLC interrupt trigger configuration */ + unsigned char IRQ; /* IRQ to be used */ unsigned short interrupt_timer PACKED; /* interrupt timer */ unsigned short misc_interrupt_bits PACKED; /* miscellaneous bits */ } CHDLC_INT_TRIGGERS_STRUCT; @@ -563,9 +563,9 @@ typedef struct { /* the Data frame transmit status element structure */ typedef struct { - unsigned char opp_flag PACKED; /* opp flag */ + unsigned char opp_flag; /* opp flag */ unsigned short frame_length PACKED; /* length of the frame to be transmitted */ - unsigned char reserved_1 PACKED; /* reserved for internal use */ + unsigned char reserved_1; /* reserved for internal use */ unsigned long reserved_2 PACKED; /* reserved for internal use */ unsigned long reserved_3 PACKED; /* reserved for internal use */ unsigned long ptr_data_bfr PACKED; /* pointer to the data area */ @@ -588,9 +588,9 @@ typedef struct { /* the Data frame receive status element structure */ typedef struct { - unsigned char opp_flag PACKED; /* opp flag */ + unsigned char opp_flag; /* opp flag */ unsigned short frame_length PACKED; /* length of the received frame */ - unsigned char error_flag PACKED; /* frame errors (HDLC_STREAMING_MODE)*/ + unsigned char error_flag; /* frame errors (HDLC_STREAMING_MODE)*/ unsigned short time_stamp PACKED; /* receive time stamp (HDLC_STREAMING_MODE) */ unsigned long reserved_1 PACKED; /* reserved for internal use */ unsigned short reserved_2 PACKED; /* reserved for internal use */ @@ -605,33 +605,33 @@ typedef struct { /* the global information structure */ typedef struct { - unsigned char global_status PACKED; /* global status */ - unsigned char modem_status PACKED; /* current modem status */ - unsigned char global_excep_conditions PACKED; /* global exception conditions */ - unsigned char glob_info_reserved[5] PACKED; /* reserved */ - unsigned char codename[4] PACKED; /* Firmware name */ - unsigned char codeversion[4] PACKED; /* Firmware version */ + unsigned char global_status; /* global status */ + unsigned char modem_status; /* current modem status */ + unsigned char global_excep_conditions; /* global exception conditions */ + unsigned char glob_info_reserved[5]; /* reserved */ + unsigned char codename[4]; /* Firmware name */ + unsigned char codeversion[4]; /* Firmware version */ } GLOBAL_INFORMATION_STRUCT; /* the CHDLC information structure */ typedef struct { - unsigned char CHDLC_status PACKED; /* CHDLC status */ - unsigned char CHDLC_excep_conditions PACKED; /* CHDLC exception conditions */ - unsigned char CHDLC_info_reserved[14] PACKED; /* reserved */ + unsigned char CHDLC_status; /* CHDLC status */ + unsigned char CHDLC_excep_conditions; /* CHDLC exception conditions */ + unsigned char CHDLC_info_reserved[14]; /* reserved */ } CHDLC_INFORMATION_STRUCT; /* the interrupt information structure */ typedef struct { - unsigned char interrupt_type PACKED; /* type of interrupt triggered */ - unsigned char interrupt_permission PACKED; /* interrupt permission mask */ - unsigned char int_info_reserved[14] PACKED; /* reserved */ + unsigned char interrupt_type; /* type of interrupt triggered */ + unsigned char interrupt_permission; /* interrupt permission mask */ + unsigned char int_info_reserved[14]; /* reserved */ } INTERRUPT_INFORMATION_STRUCT; /* the S508/FT1 information structure */ typedef struct { - unsigned char parallel_port_A_input PACKED; /* input - parallel port A */ - unsigned char parallel_port_B_input PACKED; /* input - parallel port B */ - unsigned char FT1_info_reserved[14] PACKED; /* reserved */ + unsigned char parallel_port_A_input; /* input - parallel port A */ + unsigned char parallel_port_B_input; /* input - parallel port B */ + unsigned char FT1_info_reserved[14]; /* reserved */ } FT1_INFORMATION_STRUCT; /* the shared memory area information structure */ @@ -650,32 +650,32 @@ typedef struct { This is essentially a mailbox structure, without the large data field */ typedef struct { - unsigned char opp_flag PACKED; /* the opp flag */ - unsigned char command PACKED; /* the user command */ + unsigned char opp_flag; /* the opp flag */ + unsigned char command; /* the user command */ unsigned short buffer_length PACKED; /* the data length */ - unsigned char return_code PACKED; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; /* reserved for later */ + unsigned char return_code; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES]; /* reserved for later */ } cblock_t; /* UDP management packet layout (data area of ip packet) */ /* typedef struct { - unsigned char signature[8] PACKED; - unsigned char request_reply PACKED; - unsigned char id PACKED; - unsigned char reserved[6] PACKED; + unsigned char signature[8]; + unsigned char request_reply; + unsigned char id; + unsigned char reserved[6]; cblock_t cblock PACKED; - unsigned char num_frames PACKED; - unsigned char ismoredata PACKED; - unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; + unsigned char num_frames; + unsigned char ismoredata; + unsigned char data[SIZEOF_MB_DATA_BFR]; } udp_management_packet_t; */ typedef struct { - unsigned char num_frames PACKED; - unsigned char ismoredata PACKED; + unsigned char num_frames; + unsigned char ismoredata; } trace_info_t; typedef struct { @@ -684,20 +684,20 @@ typedef struct { wp_mgmt_t wp_mgmt PACKED; cblock_t cblock PACKED; trace_info_t trace_info PACKED; - unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; + unsigned char data[SIZEOF_MB_DATA_BFR]; } chdlc_udp_pkt_t; typedef struct ft1_exec_cmd{ - unsigned char command PACKED; /* the user command */ + unsigned char command; /* the user command */ unsigned short buffer_length PACKED; /* the data length */ - unsigned char return_code PACKED; /* the return code */ - unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES] PACKED; + unsigned char return_code; /* the return code */ + unsigned char MB_reserved[NUMBER_MB_RESERVED_BYTES]; } ft1_exec_cmd_t; typedef struct { - unsigned char opp_flag PACKED; + unsigned char opp_flag; ft1_exec_cmd_t cmd PACKED; - unsigned char data[SIZEOF_MB_DATA_BFR] PACKED; + unsigned char data[SIZEOF_MB_DATA_BFR]; } ft1_exec_t; #define UDPMGMT_SIGNATURE "CTPIPEAB" @@ -706,11 +706,11 @@ typedef struct { /* UDP/IP packet (for UDP management) layout */ /* typedef struct { - unsigned char reserved[2] PACKED; + unsigned char reserved[2]; unsigned short ip_length PACKED; - unsigned char reserved2[4] PACKED; - unsigned char ip_ttl PACKED; - unsigned char ip_protocol PACKED; + unsigned char reserved2[4]; + unsigned char ip_ttl; + unsigned char ip_protocol; unsigned short ip_checksum PACKED; unsigned long ip_src_address PACKED; unsigned long ip_dst_address PACKED; @@ -727,17 +727,17 @@ typedef struct { typedef struct { - unsigned char status PACKED; - unsigned char data_avail PACKED; + unsigned char status; + unsigned char data_avail; unsigned short real_length PACKED; unsigned short time_stamp PACKED; - unsigned char data[1] PACKED; + unsigned char data[1]; } trace_pkt_t; typedef struct { - unsigned char error_flag PACKED; + unsigned char error_flag; unsigned short time_stamp PACKED; - unsigned char reserved[13] PACKED; + unsigned char reserved[13]; } api_rx_hdr_t; typedef struct { @@ -746,8 +746,8 @@ typedef struct { } api_rx_element_t; typedef struct { - unsigned char attr PACKED; - unsigned char reserved[15] PACKED; + unsigned char attr; + unsigned char reserved[15]; } api_tx_hdr_t; typedef struct { diff --git a/include/linux/sdla_x25.h b/include/linux/sdla_x25.h index 9827e74..4dd3647 100644 --- a/include/linux/sdla_x25.h +++ b/include/linux/sdla_x25.h @@ -56,16 +56,16 @@ */ typedef struct X25Cmd { - unsigned char command PACKED; /* command code */ + unsigned char command; /* command code */ unsigned short length PACKED; /* transfer data length */ - unsigned char result PACKED; /* return code */ - unsigned char pf PACKED; /* P/F bit */ + unsigned char result; /* return code */ + unsigned char pf; /* P/F bit */ unsigned short lcn PACKED; /* logical channel */ - unsigned char qdm PACKED; /* Q/D/M bits */ - unsigned char cause PACKED; /* cause field */ - unsigned char diagn PACKED; /* diagnostics */ - unsigned char pktType PACKED; /* packet type */ - unsigned char resrv[4] PACKED; /* reserved */ + unsigned char qdm; /* Q/D/M bits */ + unsigned char cause; /* cause field */ + unsigned char diagn; /* diagnostics */ + unsigned char pktType; /* packet type */ + unsigned char resrv[4]; /* reserved */ } TX25Cmd; /* @@ -228,9 +228,9 @@ typedef struct X25Cmd */ typedef struct X25Mbox { - unsigned char opflag PACKED; /* 00h: execution flag */ + unsigned char opflag; /* 00h: execution flag */ TX25Cmd cmd PACKED; /* 01h: command block */ - unsigned char data[1] PACKED; /* 10h: data buffer */ + unsigned char data[1]; /* 10h: data buffer */ } TX25Mbox; /*---------------------------------------------------------------------------- @@ -238,11 +238,11 @@ typedef struct X25Mbox */ typedef struct X25TimeStamp { - unsigned char month PACKED; - unsigned char date PACKED; - unsigned char sec PACKED; - unsigned char min PACKED; - unsigned char hour PACKED; + unsigned char month; + unsigned char date; + unsigned char sec; + unsigned char min; + unsigned char hour; } TX25TimeStamp; /*---------------------------------------------------------------------------- @@ -257,11 +257,11 @@ typedef struct X25Status unsigned short twc_map PACKED; /* 04h: Two-way Cnan. map */ unsigned short ogc_map PACKED; /* 06h: Outgoing Chan. map */ TX25TimeStamp tstamp PACKED; /* 08h: timestamp (BCD) */ - unsigned char iflags PACKED; /* 0Dh: interrupt flags */ - unsigned char imask PACKED; /* 0Eh: interrupt mask */ - unsigned char resrv PACKED; /* 0Eh: */ - unsigned char gflags PACKED; /* 10h: misc. HDLC/X25 flags */ - unsigned char cflags[X25_MAX_CHAN] PACKED; /* channel status bytes */ + unsigned char iflags; /* 0Dh: interrupt flags */ + unsigned char imask; /* 0Eh: interrupt mask */ + unsigned char resrv; /* 0Eh: */ + unsigned char gflags; /* 10h: misc. HDLC/X25 flags */ + unsigned char cflags[X25_MAX_CHAN]; /* channel status bytes */ } TX25Status; /* @@ -299,9 +299,9 @@ typedef struct X25Status */ typedef struct X25GlobalVars { - unsigned char resrv PACKED; /* 00h: reserved */ - unsigned char dtrCtl PACKED; /* 01h: DTR control code */ - unsigned char resErr PACKED; /* 01h: '1' - reset modem error */ + unsigned char resrv; /* 00h: reserved */ + unsigned char dtrCtl; /* 01h: DTR control code */ + unsigned char resErr; /* 01h: '1' - reset modem error */ } TX25GlobalVars; /* @@ -315,7 +315,7 @@ typedef struct X25GlobalVars */ typedef struct X25ModemStatus { - unsigned char status PACKED; /* 00h: modem status */ + unsigned char status; /* 00h: modem status */ } TX25ModemStatus; /* @@ -329,11 +329,11 @@ typedef struct X25ModemStatus */ typedef struct X25LinkStatus { - unsigned char txQueued PACKED; /* 00h: queued Tx I-frames*/ - unsigned char rxQueued PACKED; /* 01h: queued Rx I-frames*/ - unsigned char station PACKED; /* 02h: DTE/DCE config. */ - unsigned char reserved PACKED; /* 03h: reserved */ - unsigned char sfTally PACKED; /* 04h: supervisory frame tally */ + unsigned char txQueued; /* 00h: queued Tx I-frames*/ + unsigned char rxQueued; /* 01h: queued Rx I-frames*/ + unsigned char station; /* 02h: DTE/DCE config. */ + unsigned char reserved; /* 03h: reserved */ + unsigned char sfTally; /* 04h: supervisory frame tally */ } TX25LinkStatus; /* @@ -371,16 +371,16 @@ typedef struct HdlcStats */ typedef struct HdlcCommErr { /* a number of ... */ - unsigned char rxOverrun PACKED; /* 00h: Rx overrun errors */ - unsigned char rxBadCrc PACKED; /* 01h: Rx CRC errors */ - unsigned char rxAborted PACKED; /* 02h: Rx aborted frames */ - unsigned char rxDropped PACKED; /* 03h: frames lost */ - unsigned char txAborted PACKED; /* 04h: Tx aborted frames */ - unsigned char txUnderrun PACKED; /* 05h: Tx underrun errors */ - unsigned char txMissIntr PACKED; /* 06h: missed underrun ints */ - unsigned char reserved PACKED; /* 07h: reserved */ - unsigned char droppedDCD PACKED; /* 08h: times DCD dropped */ - unsigned char droppedCTS PACKED; /* 09h: times CTS dropped */ + unsigned char rxOverrun; /* 00h: Rx overrun errors */ + unsigned char rxBadCrc; /* 01h: Rx CRC errors */ + unsigned char rxAborted; /* 02h: Rx aborted frames */ + unsigned char rxDropped; /* 03h: frames lost */ + unsigned char txAborted; /* 04h: Tx aborted frames */ + unsigned char txUnderrun; /* 05h: Tx underrun errors */ + unsigned char txMissIntr; /* 06h: missed underrun ints */ + unsigned char reserved; /* 07h: reserved */ + unsigned char droppedDCD; /* 08h: times DCD dropped */ + unsigned char droppedCTS; /* 09h: times CTS dropped */ } THdlcCommErr; /* --------------------------------------------------------------------------- @@ -388,18 +388,18 @@ typedef struct HdlcCommErr */ typedef struct X25Config { -unsigned char baudRate PACKED; /* 00h: */ - unsigned char t1 PACKED; /* 01h: */ - unsigned char t2 PACKED; /* 02h: */ - unsigned char n2 PACKED; /* 03h: */ +unsigned char baudRate; /* 00h: */ + unsigned char t1; /* 01h: */ + unsigned char t2; /* 02h: */ + unsigned char n2; /* 03h: */ unsigned short hdlcMTU PACKED; /* 04h: */ - unsigned char hdlcWindow PACKED; /* 06h: */ - unsigned char t4 PACKED; /* 07h: */ - unsigned char autoModem PACKED; /* 08h: */ - unsigned char autoHdlc PACKED; /* 09h: */ - unsigned char hdlcOptions PACKED; /* 0Ah: */ - unsigned char station PACKED; /* 0Bh: */ - unsigned char pktWindow PACKED; /* 0Ch: */ + unsigned char hdlcWindow; /* 06h: */ + unsigned char t4; /* 07h: */ + unsigned char autoModem; /* 08h: */ + unsigned char autoHdlc; /* 09h: */ + unsigned char hdlcOptions; /* 0Ah: */ + unsigned char station; /* 0Bh: */ + unsigned char pktWindow; /* 0Ch: */ unsigned short defPktSize PACKED; /* 0Dh: */ unsigned short pktMTU PACKED; /* 0Fh: */ unsigned short loPVC PACKED; /* 11h: */ @@ -411,21 +411,21 @@ unsigned char baudRate PACKED; /* 00h: unsigned short loOutgoingSVC PACKED; /* 1Dh: */ unsigned short hiOutgoingSVC PACKED; /* 1Fh: */ unsigned short options PACKED; /* 21h: */ - unsigned char responseOpt PACKED; /* 23h: */ + unsigned char responseOpt; /* 23h: */ unsigned short facil1 PACKED; /* 24h: */ unsigned short facil2 PACKED; /* 26h: */ unsigned short ccittFacil PACKED; /* 28h: */ unsigned short otherFacil PACKED; /* 2Ah: */ unsigned short ccittCompat PACKED; /* 2Ch: */ - unsigned char t10t20 PACKED; /* 2Eh: */ - unsigned char t11t21 PACKED; /* 2Fh: */ - unsigned char t12t22 PACKED; /* 30h: */ - unsigned char t13t23 PACKED; /* 31h: */ - unsigned char t16t26 PACKED; /* 32H: */ - unsigned char t28 PACKED; /* 33h: */ - unsigned char r10r20 PACKED; /* 34h: */ - unsigned char r12r22 PACKED; /* 35h: */ - unsigned char r13r23 PACKED; /* 36h: */ + unsigned char t10t20; /* 2Eh: */ + unsigned char t11t21; /* 2Fh: */ + unsigned char t12t22; /* 30h: */ + unsigned char t13t23; /* 31h: */ + unsigned char t16t26; /* 32H: */ + unsigned char t28; /* 33h: */ + unsigned char r10r20; /* 34h: */ + unsigned char r12r22; /* 35h: */ + unsigned char r13r23; /* 36h: */ } TX25Config; /* --------------------------------------------------------------------------- @@ -445,9 +445,9 @@ typedef struct X25ChanAlloc /*----- Ch typedef struct X25ChanCfg /*------ Channel configuration -----*/ { - unsigned char type PACKED; /* 00h: channel type */ - unsigned char txConf PACKED; /* 01h: Tx packet and window sizes */ - unsigned char rxConf PACKED; /* 01h: Rx packet and window sizes */ + unsigned char type; /* 00h: channel type */ + unsigned char txConf; /* 01h: Tx packet and window sizes */ + unsigned char rxConf; /* 01h: Rx packet and window sizes */ } TX25ChanCfg; /* @@ -502,11 +502,11 @@ typedef struct X25Stats */ typedef struct X25EventLog { - unsigned char type PACKED; /* 00h: transaction type */ + unsigned char type; /* 00h: transaction type */ unsigned short lcn PACKED; /* 01h: logical channel num */ - unsigned char packet PACKED; /* 03h: async packet type */ - unsigned char cause PACKED; /* 04h: X.25 cause field */ - unsigned char diag PACKED; /* 05h: X.25 diag field */ + unsigned char packet; /* 03h: async packet type */ + unsigned char cause; /* 04h: X.25 cause field */ + unsigned char diag; /* 05h: X.25 diag field */ TX25TimeStamp ts PACKED; /* 06h: time stamp */ } TX25EventLog; @@ -540,8 +540,8 @@ typedef struct X25EventLog */ typedef struct X25TraceCfg { - unsigned char flags PACKED; /* 00h: trace configuration flags */ - unsigned char timeout PACKED; /* 01h: timeout for trace delay mode*/ + unsigned char flags; /* 00h: trace configuration flags */ + unsigned char timeout; /* 01h: timeout for trace delay mode*/ } TX25TraceCfg; /* @@ -562,11 +562,11 @@ typedef struct X25TraceCfg typedef struct X25Trace /*----- Trace data structure -------*/ { unsigned short length PACKED; /* 00h: trace data length */ - unsigned char type PACKED; /* 02h: trace type */ - unsigned char lost_cnt PACKED; /* 03h: N of traces lost */ + unsigned char type; /* 02h: trace type */ + unsigned char lost_cnt; /* 03h: N of traces lost */ TX25TimeStamp tstamp PACKED; /* 04h: mon/date/sec/min/hour */ unsigned short millisec PACKED; /* 09h: ms time stamp */ - unsigned char data[0] PACKED; /* 0Bh: traced frame */ + unsigned char data[0]; /* 0Bh: traced frame */ } TX25Trace; /* @@ -591,17 +591,17 @@ typedef struct X25Trace /*----- Trace typedef struct HDLCFrame /*----- DHLC Frame Format ----------*/ { - unsigned char addr PACKED; /* address field */ - unsigned char cntl PACKED; /* control field */ - unsigned char data[0] PACKED; + unsigned char addr; /* address field */ + unsigned char cntl; /* control field */ + unsigned char data[0]; } THDLCFrame; typedef struct X25Pkt /*----- X.25 Paket Format ----------*/ { - unsigned char lcn_hi PACKED; /* 4 MSB of Logical Channel Number */ - unsigned char lcn_lo PACKED; /* 8 LSB of Logical Channel Number */ - unsigned char type PACKED; - unsigned char data[0] PACKED; + unsigned char lcn_hi; /* 4 MSB of Logical Channel Number */ + unsigned char lcn_lo; /* 8 LSB of Logical Channel Number */ + unsigned char type; + unsigned char data[0]; } TX25Pkt; /* @@ -636,25 +636,25 @@ typedef struct X25Pkt /*----- X.25 Pak typedef struct { TX25Cmd cmd PACKED; - char data[X25_MAX_DATA] PACKED; + char data[X25_MAX_DATA]; } mbox_cmd_t; typedef struct { - unsigned char qdm PACKED; /* Q/D/M bits */ - unsigned char cause PACKED; /* cause field */ - unsigned char diagn PACKED; /* diagnostics */ - unsigned char pktType PACKED; + unsigned char qdm; /* Q/D/M bits */ + unsigned char cause; /* cause field */ + unsigned char diagn; /* diagnostics */ + unsigned char pktType; unsigned short length PACKED; - unsigned char result PACKED; + unsigned char result; unsigned short lcn PACKED; - char reserved[7] PACKED; + char reserved[7]; }x25api_hdr_t; typedef struct { x25api_hdr_t hdr PACKED; - char data[X25_MAX_DATA] PACKED; + char data[X25_MAX_DATA]; }x25api_t; @@ -674,17 +674,17 @@ typedef struct { typedef struct { - unsigned char opp_flag PACKED; /* the opp flag */ - unsigned char command PACKED; /* command code */ + unsigned char opp_flag; /* the opp flag */ + unsigned char command; /* command code */ unsigned short length PACKED; /* transfer data length */ - unsigned char result PACKED; /* return code */ - unsigned char pf PACKED; /* P/F bit */ + unsigned char result; /* return code */ + unsigned char pf; /* P/F bit */ unsigned short lcn PACKED; /* logical channel */ - unsigned char qdm PACKED; /* Q/D/M bits */ - unsigned char cause PACKED; /* cause field */ - unsigned char diagn PACKED; /* diagnostics */ - unsigned char pktType PACKED; /* packet type */ - unsigned char resrv[4] PACKED; /* reserved */ + unsigned char qdm; /* Q/D/M bits */ + unsigned char cause; /* cause field */ + unsigned char diagn; /* diagnostics */ + unsigned char pktType; /* packet type */ + unsigned char resrv[4]; /* reserved */ } cblock_t; typedef struct { @@ -692,7 +692,7 @@ typedef struct { udp_pkt_t udp_pkt PACKED; wp_mgmt_t wp_mgmt PACKED; cblock_t cblock PACKED; - unsigned char data[4080] PACKED; + unsigned char data[4080]; } x25_udp_pkt_t; @@ -717,25 +717,25 @@ typedef struct read_hdlc_stat { } read_hdlc_stat_t; typedef struct read_comms_err_stats{ - unsigned char overrun_err_rx PACKED; - unsigned char CRC_err PACKED; - unsigned char abort_frames_rx PACKED; - unsigned char frames_dropped_buf_full PACKED; - unsigned char abort_frames_tx PACKED; - unsigned char transmit_underruns PACKED; - unsigned char missed_tx_underruns_intr PACKED; - unsigned char reserved PACKED; - unsigned char DCD_drop PACKED; - unsigned char CTS_drop PACKED; + unsigned char overrun_err_rx; + unsigned char CRC_err; + unsigned char abort_frames_rx; + unsigned char frames_dropped_buf_full; + unsigned char abort_frames_tx; + unsigned char transmit_underruns; + unsigned char missed_tx_underruns_intr; + unsigned char reserved; + unsigned char DCD_drop; + unsigned char CTS_drop; } read_comms_err_stats_t; typedef struct trace_data { unsigned short length PACKED; - unsigned char type PACKED; - unsigned char trace_dropped PACKED; - unsigned char reserved[5] PACKED; + unsigned char type; + unsigned char trace_dropped; + unsigned char reserved[5]; unsigned short timestamp PACKED; - unsigned char data PACKED; + unsigned char data; } trace_data_t; enum {UDP_XPIPE_TYPE}; diff --git a/include/linux/ufs_fs.h b/include/linux/ufs_fs.h index f776030..11f5738 100644 --- a/include/linux/ufs_fs.h +++ b/include/linux/ufs_fs.h @@ -555,7 +555,6 @@ extern struct buffer_head * ufs_bread (s extern struct file_operations ufs_dir_operations; /* super.c */ -extern struct file_system_type ufs_fs_type; extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); diff --git a/include/linux/usb.h b/include/linux/usb.h index b94720e..52ea639 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -252,14 +252,14 @@ struct usb_device_descriptor { /* Endpoint descriptor */ struct usb_endpoint_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u8 bEndpointAddress __attribute__ ((packed)); - __u8 bmAttributes __attribute__ ((packed)); - __u16 wMaxPacketSize __attribute__ ((packed)); - __u8 bInterval __attribute__ ((packed)); - __u8 bRefresh __attribute__ ((packed)); - __u8 bSynchAddress __attribute__ ((packed)); + __u8 bLength; + __u8 bDescriptorType; + __u8 bEndpointAddress; + __u8 bmAttributes; + __u16 wMaxPacketSize; + __u8 bInterval; + __u8 bRefresh; + __u8 bSynchAddress; unsigned char *extra; /* Extra descriptors */ int extralen; @@ -267,15 +267,15 @@ struct usb_endpoint_descriptor { /* Interface descriptor */ struct usb_interface_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u8 bInterfaceNumber __attribute__ ((packed)); - __u8 bAlternateSetting __attribute__ ((packed)); - __u8 bNumEndpoints __attribute__ ((packed)); - __u8 bInterfaceClass __attribute__ ((packed)); - __u8 bInterfaceSubClass __attribute__ ((packed)); - __u8 bInterfaceProtocol __attribute__ ((packed)); - __u8 iInterface __attribute__ ((packed)); + __u8 bLength; + __u8 bDescriptorType; + __u8 bInterfaceNumber; + __u8 bAlternateSetting; + __u8 bNumEndpoints; + __u8 bInterfaceClass; + __u8 bInterfaceSubClass; + __u8 bInterfaceProtocol; + __u8 iInterface; struct usb_endpoint_descriptor *endpoint; @@ -296,14 +296,14 @@ struct usb_interface { /* Configuration descriptor information.. */ struct usb_config_descriptor { - __u8 bLength __attribute__ ((packed)); - __u8 bDescriptorType __attribute__ ((packed)); - __u16 wTotalLength __attribute__ ((packed)); - __u8 bNumInterfaces __attribute__ ((packed)); - __u8 bConfigurationValue __attribute__ ((packed)); - __u8 iConfiguration __attribute__ ((packed)); - __u8 bmAttributes __attribute__ ((packed)); - __u8 MaxPower __attribute__ ((packed)); + __u8 bLength; + __u8 bDescriptorType; + __u16 wTotalLength; + __u8 bNumInterfaces; + __u8 bConfigurationValue; + __u8 iConfiguration; + __u8 bmAttributes; + __u8 MaxPower; struct usb_interface *interface; @@ -828,8 +828,19 @@ struct usb_device { atomic_t refcnt; /* Reference count */ struct semaphore serialize; - struct semaphore exclusive_access; /* prevent driver & proc accesses */ - /* from overlapping cmds at device */ + + /* + * This is our custom open-coded lock, similar to r/w locks in concept. + * It prevents drivers and /proc access from simultaneous access. + * Type: + * 0 - unlocked + * 1 - locked for reads + * 2 - locked for writes + * 3 - locked for everything + */ + wait_queue_head_t excl_wait; + spinlock_t excl_lock; + unsigned excl_type; unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */ unsigned int halted[2]; /* endpoint halts; one bit per endpoint # & direction; */ @@ -904,6 +915,8 @@ extern void usb_destroy_configuration(st int usb_get_current_frame_number (struct usb_device *usb_dev); +int usb_excl_lock(struct usb_device *dev, unsigned int type, int interruptible); +void usb_excl_unlock(struct usb_device *dev, unsigned int type); /** * usb_make_path - returns stable device path in the usb tree diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h index a555e6c..c362a4e 100644 --- a/include/linux/usbdevice_fs.h +++ b/include/linux/usbdevice_fs.h @@ -185,8 +185,6 @@ extern struct file_operations usbdevfs_d extern struct file_operations usbdevfs_devices_fops; extern struct file_operations usbdevfs_device_file_operations; extern struct inode_operations usbdevfs_device_inode_operations; -extern struct inode_operations usbdevfs_bus_inode_operations; -extern struct file_operations usbdevfs_bus_file_operations; extern void usbdevfs_conn_disc_event(void); #endif /* __KERNEL__ */ diff --git a/include/linux/wanpipe.h b/include/linux/wanpipe.h index 061090a..183f1f2 100644 --- a/include/linux/wanpipe.h +++ b/include/linux/wanpipe.h @@ -227,13 +227,13 @@ typedef struct{ typedef struct { - unsigned char ver_inet_hdr_length PACKED; - unsigned char service_type PACKED; + unsigned char ver_inet_hdr_length; + unsigned char service_type; unsigned short total_length PACKED; unsigned short identifier PACKED; unsigned short flags_frag_offset PACKED; - unsigned char ttl PACKED; - unsigned char protocol PACKED; + unsigned char ttl; + unsigned char protocol; unsigned short hdr_checksum PACKED; unsigned long ip_src_address PACKED; unsigned long ip_dst_address PACKED; @@ -241,10 +241,10 @@ typedef struct { typedef struct { - unsigned char signature[8] PACKED; - unsigned char request_reply PACKED; - unsigned char id PACKED; - unsigned char reserved[6] PACKED; + unsigned char signature[8]; + unsigned char request_reply; + unsigned char id; + unsigned char reserved[6]; } wp_mgmt_t; /************************************************************************* diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h index b042b82..5bd4b74 100644 --- a/include/net/dn_dev.h +++ b/include/net/dn_dev.h @@ -99,56 +99,56 @@ struct dn_dev { struct dn_short_packet { - unsigned char msgflg __attribute__((packed)); + unsigned char msgflg; unsigned short dstnode __attribute__((packed)); unsigned short srcnode __attribute__((packed)); - unsigned char forward __attribute__((packed)); + unsigned char forward; }; struct dn_long_packet { - unsigned char msgflg __attribute__((packed)); - unsigned char d_area __attribute__((packed)); - unsigned char d_subarea __attribute__((packed)); - unsigned char d_id[6] __attribute__((packed)); - unsigned char s_area __attribute__((packed)); - unsigned char s_subarea __attribute__((packed)); - unsigned char s_id[6] __attribute__((packed)); - unsigned char nl2 __attribute__((packed)); - unsigned char visit_ct __attribute__((packed)); - unsigned char s_class __attribute__((packed)); - unsigned char pt __attribute__((packed)); + unsigned char msgflg; + unsigned char d_area; + unsigned char d_subarea; + unsigned char d_id[6]; + unsigned char s_area; + unsigned char s_subarea; + unsigned char s_id[6]; + unsigned char nl2; + unsigned char visit_ct; + unsigned char s_class; + unsigned char pt; }; /*------------------------- DRP - Routing messages ---------------------*/ struct endnode_hello_message { - unsigned char msgflg __attribute__((packed)); - unsigned char tiver[3] __attribute__((packed)); - unsigned char id[6] __attribute__((packed)); - unsigned char iinfo __attribute__((packed)); + unsigned char msgflg; + unsigned char tiver[3]; + unsigned char id[6]; + unsigned char iinfo; unsigned short blksize __attribute__((packed)); - unsigned char area __attribute__((packed)); - unsigned char seed[8] __attribute__((packed)); - unsigned char neighbor[6] __attribute__((packed)); + unsigned char area; + unsigned char seed[8]; + unsigned char neighbor[6]; unsigned short timer __attribute__((packed)); - unsigned char mpd __attribute__((packed)); - unsigned char datalen __attribute__((packed)); - unsigned char data[2] __attribute__((packed)); + unsigned char mpd; + unsigned char datalen; + unsigned char data[2]; }; struct rtnode_hello_message { - unsigned char msgflg __attribute__((packed)); - unsigned char tiver[3] __attribute__((packed)); - unsigned char id[6] __attribute__((packed)); - unsigned char iinfo __attribute__((packed)); + unsigned char msgflg; + unsigned char tiver[3]; + unsigned char id[6]; + unsigned char iinfo; unsigned short blksize __attribute__((packed)); - unsigned char priority __attribute__((packed)); - unsigned char area __attribute__((packed)); + unsigned char priority; + unsigned char area; unsigned short timer __attribute__((packed)); - unsigned char mpd __attribute__((packed)); + unsigned char mpd; }; diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index 3948c30..094a1d1 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h @@ -72,9 +72,9 @@ extern struct sk_buff *dn_alloc_send_skb struct nsp_data_seg_msg { - unsigned char msgflg __attribute__((packed)); - unsigned short dstaddr __attribute__((packed)); - unsigned short srcaddr __attribute__((packed)); + unsigned char msgflg; + unsigned short dstaddr; + unsigned short srcaddr; }; struct nsp_data_opt_msg @@ -94,7 +94,7 @@ struct nsp_data_opt_msg1 /* Acknowledgment Message (data/other data) */ struct nsp_data_ack_msg { - unsigned char msgflg __attribute__((packed)); + unsigned char msgflg; unsigned short dstaddr __attribute__((packed)); unsigned short srcaddr __attribute__((packed)); unsigned short acknum __attribute__((packed)); @@ -103,7 +103,7 @@ struct nsp_data_ack_msg /* Connect Acknowledgment Message */ struct nsp_conn_ack_msg { - unsigned char msgflg __attribute__((packed)); + unsigned char msgflg; unsigned short dstaddr __attribute__((packed)); }; @@ -111,24 +111,24 @@ struct nsp_conn_ack_msg /* Connect Initiate/Retransmit Initiate/Connect Confirm */ struct nsp_conn_init_msg { - unsigned char msgflg __attribute__((packed)); + unsigned char msgflg; #define NSP_CI 0x18 /* Connect Initiate */ #define NSP_RCI 0x68 /* Retrans. Conn Init */ unsigned short dstaddr __attribute__((packed)); unsigned short srcaddr __attribute__((packed)); - unsigned char services __attribute__((packed)); + unsigned char services; #define NSP_FC_NONE 0x00 /* Flow Control None */ #define NSP_FC_SRC 0x04 /* Seg Req. Count */ #define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ #define NSP_FC_MASK 0x0c /* FC type mask */ - unsigned char info __attribute__((packed)); + unsigned char info; unsigned short segsize __attribute__((packed)); }; /* Disconnect Initiate/Disconnect Confirm */ struct nsp_disconn_init_msg { - unsigned char msgflg __attribute__((packed)); + unsigned char msgflg; unsigned short dstaddr __attribute__((packed)); unsigned short srcaddr __attribute__((packed)); unsigned short reason __attribute__((packed)); @@ -138,11 +138,11 @@ struct nsp_disconn_init_msg struct srcobj_fmt { - char format __attribute__((packed)); - unsigned char task __attribute__((packed)); + char format; + unsigned char task; unsigned short grpcode __attribute__((packed)); unsigned short usrcode __attribute__((packed)); - char dlen __attribute__((packed)); + char dlen; }; /* diff --git a/include/net/icmp.h b/include/net/icmp.h index 460cb2c..318c3a8 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h @@ -23,6 +23,7 @@ #include #include +#include struct icmp_err { int errno; diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 5e4d27f..337a761 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -101,6 +101,7 @@ struct frag_hdr { #ifdef __KERNEL__ #include +#include /* sysctls */ extern int sysctl_ipv6_bindv6only; diff --git a/include/net/irda/irlan_event.h b/include/net/irda/irlan_event.h index b9baac9..0765649 100644 --- a/include/net/irda/irlan_event.h +++ b/include/net/irda/irlan_event.h @@ -67,8 +67,6 @@ typedef enum { IRLAN_WATCHDOG_TIMEOUT, } IRLAN_EVENT; -extern char *irlan_state[]; - void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, struct sk_buff *skb); diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index c603927..4aa2376 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h @@ -209,6 +209,4 @@ static inline int irttp_is_primary(struc return(irlap_is_primary(self->lsap->lap->irlap)); } -extern struct irttp_cb *irttp; - #endif /* IRTTP_H */ diff --git a/include/net/irda/qos.h b/include/net/irda/qos.h index fd6e2de..ee7edb2 100644 --- a/include/net/irda/qos.h +++ b/include/net/irda/qos.h @@ -83,7 +83,6 @@ struct qos_info { extern int sysctl_max_baud_rate; extern int sysctl_max_inactive_time; -extern __u32 baud_rates[]; extern __u32 data_sizes[]; extern __u32 min_turn_times[]; extern __u32 add_bofs[]; diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 0e01fef..28d25a3 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -410,19 +410,6 @@ static inline int sctp_list_single_entry return ((head->next != head) && (head->next == head->prev)); } -/* Calculate the size (in bytes) occupied by the data of an iovec. */ -static inline size_t get_user_iov_size(struct iovec *iov, int iovlen) -{ - size_t retval = 0; - - for (; iovlen > 0; --iovlen) { - retval += iov->iov_len; - iov++; - } - - return retval; -} - /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ static inline __s32 sctp_jitter(__u32 rto) { diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 5576db5..9052ddd 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h @@ -221,8 +221,7 @@ struct sctp_chunk *sctp_make_abort_no_da const struct sctp_chunk *, __u32 tsn); struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *, - const struct sctp_chunk *, - const struct msghdr *); + const struct msghdr *, size_t msg_len); struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *, const struct sctp_chunk *, const __u8 *, diff --git a/include/net/udp.h b/include/net/udp.h index d965ac2..8fc13cd 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -25,6 +25,7 @@ #include #include #include +#include #define UDP_HTABLE_SIZE 128 diff --git a/init/main.c b/init/main.c index dea01bf..7a949dc 100644 --- a/init/main.c +++ b/init/main.c @@ -87,9 +87,6 @@ extern int irda_device_init(void); /* * gcc >= 4 is not supported by kernel 2.4 */ -#if __GNUC__ > 3 -#error Sorry, your GCC is too recent for kernel 2.4 -#endif extern char _stext, _etext; extern char *linux_banner; diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 4d2a93a..bda5090 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -293,7 +293,7 @@ void * vmap(struct page **pages, int cou struct vm_struct *area; unsigned long size = count << PAGE_SHIFT; - if (!size || size > (max_mapnr << PAGE_SHIFT)) + if (count <= 0 || count > max_mapnr) return NULL; area = get_vm_area(size, flags); if (!area) { diff --git a/net/atm/clip.c b/net/atm/clip.c index a7ded5b..5905d30 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c @@ -489,9 +489,11 @@ static int clip_mkip(struct atm_vcc *vcc else { unsigned int len = skb->len; + skb_get(skb); clip_push(vcc,skb); PRIV(skb->dev)->stats.rx_packets--; PRIV(skb->dev)->stats.rx_bytes -= len; + kfree_skb(skb); } return 0; } diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index 5d61475..3de15aa 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c @@ -140,8 +140,8 @@ void br_become_root_bridge(struct net_br br->forward_delay = br->bridge_forward_delay; br_topology_change_detection(br); br_timer_clear(&br->tcn_timer); - br_config_bpdu_generation(br); - br_timer_set(&br->hello_timer, jiffies); + + br_timer_set(&br->hello_timer, jiffies - br->hello_time); } /* called under bridge lock */ diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 1465093..75cce3f 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -510,6 +510,8 @@ static struct sk_buff *fill_packet(struc skb->mac.raw = ((u8 *)iph) - 14; skb->dev = odev; skb->pkt_type = PACKET_HOST; + skb->nh.iph = iph; + skb->h.uh = udph; if (info->nfrags <= 0) { pgh = (struct pktgen_hdr *)skb_put(skb, datalen); diff --git a/net/ipv4/netfilter/ip_nat_helper.c b/net/ipv4/netfilter/ip_nat_helper.c index 6298d96..645f46d 100644 --- a/net/ipv4/netfilter/ip_nat_helper.c +++ b/net/ipv4/netfilter/ip_nat_helper.c @@ -522,13 +522,7 @@ int ip_nat_helper_register(struct ip_nat static int kill_helper(struct ip_conntrack *i, void *helper) { - int ret; - - READ_LOCK(&ip_nat_lock); - ret = (i->nat.info.helper == helper); - READ_UNLOCK(&ip_nat_lock); - - return ret; + return (i->nat.info.helper == helper); } void ip_nat_helper_unregister(struct ip_nat_helper *me) diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 7a71632..9c7bff5 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c @@ -95,7 +95,7 @@ static __u32 rt_sernum = 0; static struct timer_list ip6_fib_timer = { function: fib6_run_gc }; -static struct fib6_walker_t fib6_walker_list = { +struct fib6_walker_t fib6_walker_list = { &fib6_walker_list, &fib6_walker_list, }; diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c index b227d01..6c8e39d 100644 --- a/net/ipv6/sysctl_net_ipv6.c +++ b/net/ipv6/sysctl_net_ipv6.c @@ -31,17 +31,14 @@ ctl_table ipv6_table[] = { #ifdef MODULE static struct ctl_table_header *ipv6_sysctl_header; -static struct ctl_table ipv6_root_table[]; -static struct ctl_table ipv6_net_table[]; - -ctl_table ipv6_root_table[] = { - {CTL_NET, "net", NULL, 0, 0555, ipv6_net_table}, +static ctl_table ipv6_net_table[] = { + {NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table}, {0} }; -ctl_table ipv6_net_table[] = { - {NET_IPV6, "ipv6", NULL, 0, 0555, ipv6_table}, +static ctl_table ipv6_root_table[] = { + {CTL_NET, "net", NULL, 0, 0555, ipv6_net_table}, {0} }; diff --git a/net/irda/qos.c b/net/irda/qos.c index 97b8041..11d5e7b 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c @@ -97,7 +97,7 @@ static int irlap_param_min_turn_time(voi int get); __u32 min_turn_times[] = { 10000, 5000, 1000, 500, 100, 50, 10, 0 }; /* us */ -__u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, +static __u32 baud_rates[] = { 2400, 9600, 19200, 38400, 57600, 115200, 576000, 1152000, 4000000, 16000000 }; /* bps */ __u32 data_sizes[] = { 64, 128, 256, 512, 1024, 2048 }; /* bytes */ __u32 add_bofs[] = { 48, 24, 12, 5, 3, 2, 1, 0 }; /* bytes */ diff --git a/net/khttpd/prototypes.h b/net/khttpd/prototypes.h index c478308..3a5482d 100644 --- a/net/khttpd/prototypes.h +++ b/net/khttpd/prototypes.h @@ -49,7 +49,6 @@ extern int sysctl_khttpd_stop; extern struct khttpd_threadinfo threadinfo[CONFIG_KHTTPD_NUMCPU]; extern char CurrentTime[]; extern atomic_t ConnectCount; -extern struct wait_queue main_wait[CONFIG_KHTTPD_NUMCPU]; /* misc.c */ diff --git a/net/sctp/input.c b/net/sctp/input.c index 9ae7175..4218a97 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -123,6 +123,9 @@ int sctp_rcv(struct sk_buff *skb) SCTP_INC_STATS_BH(SctpInSCTPPacks); + if (skb_linearize(skb, GFP_ATOMIC) != 0) + goto discard_it; + sh = (struct sctphdr *) skb->h.raw; /* Pull up the IP and SCTP headers. */ diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 556dee6..08fe461 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c @@ -798,38 +798,26 @@ no_mem: /* Helper to create ABORT with a SCTP_ERROR_USER_ABORT error. */ struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *asoc, - const struct sctp_chunk *chunk, - const struct msghdr *msg) + const struct msghdr *msg, + size_t paylen) { struct sctp_chunk *retval; - void *payload = NULL, *payoff; - size_t paylen = 0; - struct iovec *iov = NULL; - int iovlen = 0; - - if (msg) { - iov = msg->msg_iov; - iovlen = msg->msg_iovlen; - paylen = get_user_iov_size(iov, iovlen); - } + void *payload = NULL; + int err; - retval = sctp_make_abort(asoc, chunk, sizeof(sctp_errhdr_t) + paylen); + retval = sctp_make_abort(asoc, NULL, sizeof(sctp_errhdr_t) + paylen); if (!retval) goto err_chunk; if (paylen) { /* Put the msg_iov together into payload. */ - payload = kmalloc(paylen, GFP_ATOMIC); + payload = kmalloc(paylen, GFP_KERNEL); if (!payload) goto err_payload; - payoff = payload; - for (; iovlen > 0; --iovlen) { - if (copy_from_user(payoff, iov->iov_base,iov->iov_len)) - goto err_copy; - payoff += iov->iov_len; - iov++; - } + err = memcpy_fromiovec(payload, msg->msg_iov, paylen); + if (err < 0) + goto err_copy; } sctp_init_cause(retval, SCTP_ERROR_USER_ABORT, payload, paylen); diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 542f375..992043f 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -3990,18 +3990,12 @@ sctp_disposition_t sctp_sf_do_9_1_prm_ab * from its upper layer, but retransmits data to the far end * if necessary to fill gaps. */ - struct msghdr *msg = arg; - struct sctp_chunk *abort; + struct sctp_chunk *abort = arg; sctp_disposition_t retval; retval = SCTP_DISPOSITION_CONSUME; - /* Generate ABORT chunk to send the peer. */ - abort = sctp_make_abort_user(asoc, NULL, msg); - if (!abort) - retval = SCTP_DISPOSITION_NOMEM; - else - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); /* Even if we can't send the ABORT due to low memory delete the * TCB. This is a departure from our typical NOMEM handling. @@ -4123,8 +4117,7 @@ sctp_disposition_t sctp_sf_cookie_wait_p void *arg, sctp_cmd_seq_t *commands) { - struct msghdr *msg = arg; - struct sctp_chunk *abort; + struct sctp_chunk *abort = arg; sctp_disposition_t retval; /* Stop T1-init timer */ @@ -4132,12 +4125,7 @@ sctp_disposition_t sctp_sf_cookie_wait_p SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT)); retval = SCTP_DISPOSITION_CONSUME; - /* Generate ABORT chunk to send the peer */ - abort = sctp_make_abort_user(asoc, NULL, msg); - if (!abort) - retval = SCTP_DISPOSITION_NOMEM; - else - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort)); sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, SCTP_STATE(SCTP_STATE_CLOSED)); diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 277b19f..8d13849 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -967,9 +967,13 @@ SCTP_STATIC void sctp_close(struct sock sctp_unhash_established(asoc); sctp_association_free(asoc); - } else if (sk->linger && !sk->lingertime) - sctp_primitive_ABORT(asoc, NULL); - else + } else if (sk->linger && !sk->lingertime) { + struct sctp_chunk *chunk; + + chunk = sctp_make_abort_user(asoc, NULL, 0); + if (chunk) + sctp_primitive_ABORT(asoc, NULL); + } else sctp_primitive_SHUTDOWN(asoc, NULL); } else sctp_primitive_SHUTDOWN(asoc, NULL); @@ -1199,8 +1203,16 @@ SCTP_STATIC int sctp_sendmsg(struct sock goto out_unlock; } if (sinfo_flags & MSG_ABORT) { + struct sctp_chunk *chunk; + + chunk = sctp_make_abort_user(asoc, msg, msg_len); + if (!chunk) { + err = -ENOMEM; + goto out_unlock; + } + SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc); - sctp_primitive_ABORT(asoc, msg); + sctp_primitive_ABORT(asoc, chunk); err = 0; goto out_unlock; }