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/<device>/rp_filter
- or
- echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
+ echo 1 > /proc/sys/net/ipv4/conf/<device>/rp_filter
+ and
+ echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
If unsure, say N here.
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
index 942370b..6902c13 100644
--- a/Documentation/i2c/dev-interface
+++ b/Documentation/i2c/dev-interface
@@ -92,10 +92,10 @@ ioctl(file,I2C_TENBIT,long select)
ioctl(file,I2C_FUNCS,unsigned long *funcs)
Gets the adapter functionality and puts it in *funcs.
-ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset)
+ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset)
Do combined read/write transaction without stop in between.
- The argument is a pointer to a struct i2c_ioctl_rdwr_data {
+ The argument is a pointer to a struct i2c_rdwr_ioctl_data {
struct i2c_msg *msgs; /* ptr to array of simple messages */
int nmsgs; /* number of messages to exchange */
diff --git a/Documentation/i2c/functionality b/Documentation/i2c/functionality
index 8a78a95..cfc55cc 100644
--- a/Documentation/i2c/functionality
+++ b/Documentation/i2c/functionality
@@ -17,8 +17,8 @@ For the most up-to-date list of functionality constants, please check
I2C_FUNC_I2C Plain i2c-level commands (Pure SMBus
adapters typically can not do these)
I2C_FUNC_10BIT_ADDR Handles the 10-bit address extensions
- I2C_FUNC_PROTOCOL_MANGLING Knows about the I2C_M_REV_DIR_ADDR,
- I2C_M_REV_DIR_ADDR and I2C_M_REV_DIR_NOSTART
+ I2C_FUNC_PROTOCOL_MANGLING Knows about the
+ I2C_M_REV_DIR_ADDR and I2C_M_NOSTART
flags (which modify the i2c protocol!)
I2C_FUNC_SMBUS_QUICK Handles the SMBus write_quick command
I2C_FUNC_SMBUS_READ_BYTE Handles the SMBus read_byte command
@@ -115,7 +115,7 @@ CHECKING THROUGH /DEV
If you try to access an adapter from a userspace program, you will have
to use the /dev interface. You will still have to check whether the
functionality you need is supported, of course. This is done using
-the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2c_detect
+the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2cdetect
program, is below:
int file;
diff --git a/Documentation/i2c/summary b/Documentation/i2c/summary
index 32f60bd..218de28 100644
--- a/Documentation/i2c/summary
+++ b/Documentation/i2c/summary
@@ -37,7 +37,7 @@ integrated than Algorithm and Adapter.
For a given configuration, you will need a driver for your I2C bus (usually
a separate Adapter and Algorithm driver), and drivers for your I2C devices
(usually one driver for each device). There are no I2C device drivers
-in this package. See the lm_sensors project http://www.lm-sensors.nu
+in this package. See the lm_sensors project http://www.lm-sensors.org/
for device drivers.
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index b24ea0d..d7c6e60 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -28,14 +28,14 @@ static struct i2c_driver foo_driver = {
.name = "Foo version 2.3 driver",
.id = I2C_DRIVERID_FOO, /* from i2c-id.h, optional */
.flags = I2C_DF_NOTIFY,
- .attach_adapter = &foo_attach_adapter,
- .detach_client = &foo_detach_client,
- .command = &foo_command, /* may be NULL */
- .inc_use = &foo_inc_use, /* May be NULL */
- .dec_use = &foo_dec_use, /* May be NULL */
+ .attach_adapter = foo_attach_adapter,
+ .detach_client = foo_detach_client,
+ .command = foo_command, /* may be NULL */
+ .inc_use = foo_inc_use, /* May be NULL */
+ .dec_use = foo_dec_use, /* May be NULL */
}
-The name can be chosen freely, and may be upto 40 characters long. Please
+The name can be chosen freely, and may be up to 31 characters long. Please
use something descriptive here.
If used, the id should be a unique ID. The range 0xf000 to 0xffff is
@@ -64,26 +64,27 @@ main reason why these call-backs were introduced).
To increase or decrease the module usage count, you can use the
MOD_{INC,DEC}_USE_COUNT macros. They must be called from the module
which needs to get its usage count changed; that is why each driver
-module has to implement its own callback.
+module has to implement its own callback functions.
- void foo_inc_use (struct i2c_client *client)
- {
- #ifdef MODULE
- MOD_INC_USE_COUNT;
- #endif
- }
+static void foo_inc_use (struct i2c_client *client)
+{
+#ifdef MODULE
+ MOD_INC_USE_COUNT;
+#endif
+}
- void foo_dec_use (struct i2c_client *client)
- {
- #ifdef MODULE
- MOD_DEC_USE_COUNT;
- #endif
- }
+static void foo_dec_use (struct i2c_client *client)
+{
+#ifdef MODULE
+ MOD_DEC_USE_COUNT;
+#endif
+}
-Do not call these call-back functions directly; instead, use one of the
+Do not call these callback functions directly; instead, use the
following functions defined in i2c.h:
- void i2c_inc_use_client(struct i2c_client *);
- void i2c_dec_use_client(struct i2c_client *);
+
+void i2c_inc_use_client(struct i2c_client *);
+void i2c_dec_use_client(struct i2c_client *);
You should *not* increase the module count just because a device is
detected and a client created. This would make it impossible to remove
@@ -302,7 +303,7 @@ Also used is a list of pointers to sensors_force_data structures:
These are automatically translated to insmod variables of the form
force_foo.
-So we have a generic insmod variabled `force', and chip-specific variables
+So we have a generic insmod variable `force', and chip-specific variables
`force_CHIPNAME'.
Fortunately, as a module writer, you just have to define the `normal'
diff --git a/Documentation/video4linux/bttv/README b/Documentation/video4linux/bttv/README
index c36d3e0..7313668 100644
--- a/Documentation/video4linux/bttv/README
+++ b/Documentation/video4linux/bttv/README
@@ -14,7 +14,7 @@ for 2.0.x, code cleanups, ...
To compile this bttv version, you'll the new i2c stack. Kernels
newer than 2.3.34 have this already included. If you have a older
kernel, download it from:
- http://www2.lm-sensors.nu/~lm78/download.html
+ http://www.lm-sensors.org/wiki/Download
You'll need at least these config options for bttv:
CONFIG_I2C=m
diff --git a/MAINTAINERS b/MAINTAINERS
index 4925bac..13759e9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -820,8 +820,8 @@ S: Maintained
I2C SUBSYSTEM
P: Jean Delvare
M: khali@linux-fr.org
-L: lm-sensors@lm-sensors.org
-W: http://www.lm-sensors.nu/
+L: i2c@lm-sensors.org
+W: http://www.lm-sensors.org/
S: Maintained
i386 BOOT CODE
diff --git a/Makefile b/Makefile
index fd6884d..a82d83f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
VERSION = 2
PATCHLEVEL = 4
-SUBLEVEL = 33
+SUBLEVEL = 34
EXTRAVERSION =
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/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index aba04d2..92f6f4c 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -125,7 +125,7 @@ static int osf_filldir(void *__buf, const char *name, int namlen, loff_t offset,
put_user(reclen, &dirent->d_reclen);
copy_to_user(dirent->d_name, name, namlen);
put_user(0, dirent->d_name + namlen);
- ((char *) dirent) += reclen;
+ dirent = (char *)dirent + reclen;
buf->dirent = dirent;
buf->count -= reclen;
return 0;
diff --git a/arch/alpha/lib/io.c b/arch/alpha/lib/io.c
index 46e7892..e6f2698 100644
--- a/arch/alpha/lib/io.c
+++ b/arch/alpha/lib/io.c
@@ -143,7 +143,7 @@ void insb (unsigned long port, void *dst, unsigned long count)
return;
count--;
*(unsigned char *) dst = inb(port);
- ((unsigned char *) dst)++;
+ dst = (unsigned char *)dst + 1;
}
while (count >= 4) {
@@ -154,13 +154,13 @@ void insb (unsigned long port, void *dst, unsigned long count)
w |= inb(port) << 16;
w |= inb(port) << 24;
*(unsigned int *) dst = w;
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
}
while (count) {
--count;
*(unsigned char *) dst = inb(port);
- ((unsigned char *) dst)++;
+ dst = (unsigned char *)dst + 1;
}
}
@@ -182,7 +182,7 @@ void insw (unsigned long port, void *dst, unsigned long count)
return;
count--;
*(unsigned short* ) dst = inw(port);
- ((unsigned short *) dst)++;
+ dst = (unsigned short *)dst + 1;
}
while (count >= 2) {
@@ -191,7 +191,7 @@ void insw (unsigned long port, void *dst, unsigned long count)
w = inw(port);
w |= inw(port) << 16;
*(unsigned int *) dst = w;
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
}
if (count) {
@@ -219,7 +219,7 @@ void insl (unsigned long port, void *dst, unsigned long count)
while (count--)
{
*(unsigned int *) dst = inl(port);
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
}
break;
@@ -230,13 +230,13 @@ void insl (unsigned long port, void *dst, unsigned long count)
l = inl(port);
*(unsigned short *) dst = l;
- ((unsigned short *) dst)++;
+ dst = (unsigned short *)dst + 1;
while (count--)
{
l2 = inl(port);
*(unsigned int *) dst = l >> 16 | l2 << 16;
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
l = l2;
}
*(unsigned short *) dst = l >> 16;
@@ -246,14 +246,14 @@ void insl (unsigned long port, void *dst, unsigned long count)
l = inl(port);
*(unsigned char *) dst = l;
- ((unsigned char *) dst)++;
+ dst = (unsigned char *)dst + 1;
*(unsigned short *) dst = l >> 8;
- ((unsigned short *) dst)++;
+ dst = (unsigned short *)dst + 1;
while (count--)
{
l2 = inl(port);
*(unsigned int *) dst = l >> 24 | l2 << 8;
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
l = l2;
}
*(unsigned char *) dst = l >> 24;
@@ -263,16 +263,16 @@ void insl (unsigned long port, void *dst, unsigned long count)
l = inl(port);
*(unsigned char *) dst = l;
- ((unsigned char *) dst)++;
+ dst = (unsigned char *)dst + 1;
while (count--)
{
l2 = inl(port);
*(unsigned int *) dst = l << 24 | l2 >> 8;
- ((unsigned int *) dst)++;
+ dst = (unsigned int *)dst + 1;
l = l2;
}
*(unsigned short *) dst = l >> 8;
- ((unsigned short *) dst)++;
+ dst = (unsigned short *)dst + 1;
*(unsigned char *) dst = l >> 24;
break;
}
@@ -290,7 +290,7 @@ void outsb(unsigned long port, const void * src, unsigned long count)
while (count) {
count--;
outb(*(char *)src, port);
- ((char *) src)++;
+ src = (char *)src + 1;
}
}
@@ -307,7 +307,7 @@ void outsw (unsigned long port, const void *src, unsigned long count)
panic("outsw: memory not short aligned");
}
outw(*(unsigned short*)src, port);
- ((unsigned short *) src)++;
+ src = (unsigned short *)src + 1;
--count;
}
@@ -315,7 +315,7 @@ void outsw (unsigned long port, const void *src, unsigned long count)
unsigned int w;
count -= 2;
w = *(unsigned int *) src;
- ((unsigned int *) src)++;
+ src = (unsigned int *)src + 1;
outw(w >> 0, port);
outw(w >> 16, port);
}
@@ -345,7 +345,7 @@ void outsl (unsigned long port, const void *src, unsigned long count)
while (count--)
{
outl(*(unsigned int *) src, port);
- ((unsigned int *) src)++;
+ src = (unsigned int *)src + 1;
}
break;
@@ -355,12 +355,12 @@ void outsl (unsigned long port, const void *src, unsigned long count)
--count;
l = *(unsigned short *) src << 16;
- ((unsigned short *) src)++;
+ src = (unsigned short *)src + 1;
while (count--)
{
l2 = *(unsigned int *) src;
- ((unsigned int *) src)++;
+ src = (unsigned int *)src + 1;
outl (l >> 16 | l2 << 16, port);
l = l2;
}
@@ -371,13 +371,13 @@ void outsl (unsigned long port, const void *src, unsigned long count)
--count;
l = *(unsigned char *) src << 8;
- ((unsigned char *) src)++;
+ src = (unsigned char *)src + 1;
l |= *(unsigned short *) src << 16;
- ((unsigned short *) src)++;
+ src = (unsigned short *)src + 1;
while (count--)
{
l2 = *(unsigned int *) src;
- ((unsigned int *) src)++;
+ src = (unsigned int *)src + 1;
outl (l >> 8 | l2 << 24, port);
l = l2;
}
@@ -388,16 +388,16 @@ void outsl (unsigned long port, const void *src, unsigned long count)
--count;
l = *(unsigned char *) src << 24;
- ((unsigned char *) src)++;
+ src = (unsigned char *)src + 1;
while (count--)
{
l2 = *(unsigned int *) src;
- ((unsigned int *) src)++;
+ src = (unsigned int *)src + 1;
outl (l >> 24 | l2 << 8, port);
l = l2;
}
l2 = *(unsigned short *) src;
- ((unsigned short *) src)++;
+ src = (unsigned short *)src + 1;
l2 |= *(unsigned char *) src << 16;
outl (l >> 24 | l2 << 8, port);
break;
diff --git a/arch/alpha/math-emu/math.c b/arch/alpha/math-emu/math.c
index 0dfa85b..0104ae6 100644
--- a/arch/alpha/math-emu/math.c
+++ b/arch/alpha/math-emu/math.c
@@ -255,11 +255,11 @@ alpha_fp_emul (unsigned long pc)
goto done_d;
case FOP_FNC_CVTxS:
- FP_FROM_INT_S(SR, ((long)vb), 64, long);
+ FP_FROM_INT_S(SR, (*(long*)&vb), 64, long);
goto pack_s;
case FOP_FNC_CVTxT:
- FP_FROM_INT_D(DR, ((long)vb), 64, long);
+ FP_FROM_INT_D(DR, (*(long*)&vb), 64, long);
goto pack_d;
}
goto bad_insn;
diff --git a/arch/arm/mach-integrator/irq.c b/arch/arm/mach-integrator/irq.c
index 69d2e67..cc56534 100644
--- a/arch/arm/mach-integrator/irq.c
+++ b/arch/arm/mach-integrator/irq.c
@@ -55,7 +55,7 @@ void __init integrator_init_irq(void)
unsigned int i;
for (i = 0; i < NR_IRQS; i++) {
- if (((1 << i) && INTEGRATOR_SC_VALID_INT) != 0) {
+ if (((1 << i) & INTEGRATOR_SC_VALID_INT) != 0) {
irq_desc[i].valid = 1;
irq_desc[i].probe_ok = 1;
irq_desc[i].mask_ack = sc_mask_irq;
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/vmlinux.lds $(LDFLAGS)
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/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 79bb602..ea17eb0 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -237,14 +237,14 @@ static int find_matching_ucodes (void)
}
total_size = get_totalsize(&mc_header);
- if ((cursor + total_size > user_buffer_size) || (total_size < DEFAULT_UCODE_TOTALSIZE)) {
+ if (cursor + total_size > user_buffer_size) {
printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
error = -EINVAL;
goto out;
}
data_size = get_datasize(&mc_header);
- if ((data_size + MC_HEADER_SIZE > total_size) || (data_size < DEFAULT_UCODE_DATASIZE)) {
+ if (data_size + MC_HEADER_SIZE > total_size) {
printk(KERN_ERR "microcode: error! Bad data in microcode data file\n");
error = -EINVAL;
goto out;
@@ -438,11 +438,6 @@ static ssize_t microcode_write (struct file *file, const char *buf, size_t len,
{
ssize_t ret;
- if (len < DEFAULT_UCODE_TOTALSIZE) {
- printk(KERN_ERR "microcode: not enough data\n");
- return -EINVAL;
- }
-
if ((len >> PAGE_SHIFT) > num_physpages) {
printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
return -EINVAL;
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, struct sigstack *ossptr, unsigned long s
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 binary -R .note -R .comment -S
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 from, unsigned long num, int turn_on)
* 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 level, struct pt_regs regs)
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 *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 *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_tfm *tfm,
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 *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_tfm *tfm)
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 * prefix, unsigned int vc, struct sk_buff * sk
return;
}
+#if 0 /* unused and in conflict with <asm-ppc/system.h> */
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 * 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_struct *cp, int timeout, __u32 tag)
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(request_queue_t *q, int rw)
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 merge, int sectors)
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_device *lo, struct file *lo_file, kdev_t dev,
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","INDEX","ECC","DRQ","SEEK","WRERR",
/* 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/ps2esdi.c b/drivers/block/ps2esdi.c
index 291b9b9..08583c4 100644
--- a/drivers/block/ps2esdi.c
+++ b/drivers/block/ps2esdi.c
@@ -741,7 +741,7 @@ static void ps2esdi_geometry_int_handler(u_int int_ret_code)
drive_num = int_ret_code >> 5;
switch (int_ret_code & 0xf) {
case INT_CMD_COMPLETE:
- for (i = ESDI_TIMEOUT; i & !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--);
+ for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--);
if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) {
printk("%s: timeout reading status word\n", DEVICE_NAME);
outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN);
@@ -876,7 +876,7 @@ static void ps2esdi_normal_interrupt_handler(u_int int_ret_code)
break;
case INT_CMD_COMPLETE:
- for (i = ESDI_TIMEOUT; i & !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--);
+ for (i = ESDI_TIMEOUT; i && !(inb(ESDI_STATUS) & STATUS_STAT_AVAIL); i--);
if (!(inb(ESDI_STATUS) & STATUS_STAT_AVAIL)) {
printk("%s: timeout reading status word\n", DEVICE_NAME);
outb((int_ret_code & 0xe0) | ATT_EOI, ESDI_ATTN);
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], xd_access[XD_MAXDRIVES];
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(volatile void *ptr, unsigned long old,
/* 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(volatile void *ptr, unsigned long old,
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/mem.c b/drivers/char/mem.c
index fae3ffb..8c43ddc 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -402,7 +402,8 @@ static inline size_t read_zero_pagealigned(char * buf, size_t size)
count = size;
zap_page_range(mm, addr, count);
- zeromap_page_range(addr, count, PAGE_COPY);
+ if (zeromap_page_range(addr, count, PAGE_COPY))
+ break;
size -= count;
buf += count;
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 73cfdc5..b4910c8 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
@@ -1384,7 +1384,7 @@ static int __init rio_init(void)
rio_dprintk (RIO_DEBUG_INIT, "Enabling interrupts on rio card.\n");
hp->Mode |= RIO_PCI_INT_ENABLE;
} else
- hp->Mode &= !RIO_PCI_INT_ENABLE;
+ hp->Mode &= ~RIO_PCI_INT_ENABLE;
rio_dprintk (RIO_DEBUG_INIT, "New Mode: %x\n", hp->Mode);
rio_start_card_running (hp);
}
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_board *board,
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_board *board,
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: READ or WRITE */
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 file *filp, const char *buf,
* 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(struct inode *inode,
} /* 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 *p, xram_p x, int len)
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/Config.in b/drivers/i2c/Config.in
index 8f69e5d..5e3c033 100644
--- a/drivers/i2c/Config.in
+++ b/drivers/i2c/Config.in
@@ -1,5 +1,5 @@
#
-# Character device configuration
+# I2C subsystem configuration
#
mainmenu_option next_comment
comment 'I2C support'
diff --git a/drivers/i2c/i2c-algo-bit.c b/drivers/i2c/i2c-algo-bit.c
index d4ef817..0b1a039 100644
--- a/drivers/i2c/i2c-algo-bit.c
+++ b/drivers/i2c/i2c-algo-bit.c
@@ -367,10 +367,6 @@ static int sendbytes(struct i2c_adapter *i2c_adap,const char *buf, int count)
return (retval<0)? retval : -EFAULT;
/* got a better one ?? */
}
-#if 0
- /* from asm/delay.h */
- __delay(adap->mdelay * (loops_per_sec / 1000) );
-#endif
}
return wrcount;
}
@@ -384,7 +380,6 @@ static inline int readbytes(struct i2c_adapter *i2c_adap,char *buf,int count)
while (count > 0) {
inval = i2c_inb(i2c_adap);
-/*printk("%#02x ",inval); if ( ! (count % 16) ) printk("\n"); */
if (inval>=0) {
*temp = inval;
rdcount++;
@@ -528,14 +523,11 @@ static u32 bit_func(struct i2c_adapter *adap)
/* -----exported algorithm data: ------------------------------------- */
static struct i2c_algorithm i2c_bit_algo = {
- "Bit-shift algorithm",
- I2C_ALGO_BIT,
- bit_xfer,
- NULL,
- NULL, /* slave_xmit */
- NULL, /* slave_recv */
- algo_control, /* ioctl */
- bit_func, /* functionality */
+ .name = "Bit-shift algorithm",
+ .id = I2C_ALGO_BIT,
+ .master_xfer = bit_xfer,
+ .algo_control = algo_control,
+ .functionality = bit_func,
};
/*
@@ -583,9 +575,8 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
- i2c_add_adapter(adap);
- return 0;
+ return i2c_add_adapter(adap);
}
@@ -610,8 +601,6 @@ int __init i2c_algo_bit_init (void)
return 0;
}
-
-
EXPORT_SYMBOL(i2c_bit_add_bus);
EXPORT_SYMBOL(i2c_bit_del_bus);
diff --git a/drivers/i2c/i2c-algo-ite.c b/drivers/i2c/i2c-algo-ite.c
index fe6007f..2da6506 100644
--- a/drivers/i2c/i2c-algo-ite.c
+++ b/drivers/i2c/i2c-algo-ite.c
@@ -783,7 +783,6 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
MOD_INC_USE_COUNT;
#endif
- i2c_add_adapter(adap);
iic_init(iic_adap);
/* scan bus */
@@ -804,7 +803,8 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
udelay(iic_adap->udelay);
}
}
- return 0;
+
+ return i2c_add_adapter(adap);
}
diff --git a/drivers/i2c/i2c-algo-pcf.c b/drivers/i2c/i2c-algo-pcf.c
index ba6e357..c289f48 100644
--- a/drivers/i2c/i2c-algo-pcf.c
+++ b/drivers/i2c/i2c-algo-pcf.c
@@ -440,14 +440,11 @@ static u32 pcf_func(struct i2c_adapter *adap)
/* -----exported algorithm data: ------------------------------------- */
static struct i2c_algorithm pcf_algo = {
- "PCF8584 algorithm",
- I2C_ALGO_PCF,
- pcf_xfer,
- NULL,
- NULL, /* slave_xmit */
- NULL, /* slave_recv */
- algo_control, /* ioctl */
- pcf_func, /* functionality */
+ .name = "PCF8584 algorithm",
+ .id = I2C_ALGO_PCF,
+ .master_xfer = pcf_xfer,
+ .algo_control = algo_control,
+ .functionality = pcf_func,
};
/*
@@ -477,8 +474,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
MOD_INC_USE_COUNT;
#endif
- i2c_add_adapter(adap);
-
/* scan bus */
if (pcf_scan) {
printk(KERN_INFO " i2c-algo-pcf.o: scanning bus %s.\n",
@@ -502,7 +497,8 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
}
printk("\n");
}
- return 0;
+
+ return i2c_add_adapter(adap);
}
@@ -525,7 +521,6 @@ int __init i2c_algo_pcf_init (void)
return 0;
}
-
EXPORT_SYMBOL(i2c_pcf_add_bus);
EXPORT_SYMBOL(i2c_pcf_del_bus);
diff --git a/drivers/i2c/i2c-algo-sibyte.c b/drivers/i2c/i2c-algo-sibyte.c
index 632205d..a845e47 100644
--- a/drivers/i2c/i2c-algo-sibyte.c
+++ b/drivers/i2c/i2c-algo-sibyte.c
@@ -184,9 +184,8 @@ int i2c_sibyte_add_bus(struct i2c_adapter *i2c_adap, int speed)
#ifdef MODULE
MOD_INC_USE_COUNT;
#endif
- i2c_add_adapter(i2c_adap);
- return 0;
+ return i2c_add_adapter(i2c_adap);
}
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 516f8f4..f10716b 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -87,7 +87,7 @@ static int read_bus_i2c(char *buf, char **start, off_t offset, int len,
/* To implement the dynamic /proc/bus/i2c-? files, we need our own
implementation of the read hook */
static struct file_operations i2cproc_operations = {
- read: i2cproc_bus_read,
+ .read = i2cproc_bus_read,
};
static int i2cproc_initialized = 0;
@@ -208,14 +208,14 @@ int i2c_del_adapter(struct i2c_adapter *adap)
if ((res = drivers[j]->attach_adapter(adap))) {
printk(KERN_WARNING "i2c-core.o: can't detach adapter %s "
"while detaching driver %s: driver not "
- "detached!",adap->name,drivers[j]->name);
+ "detached!\n", adap->name, drivers[j]->name);
goto ERROR1;
}
DRV_UNLOCK();
/* detach any active clients. This must be done first, because
- * it can fail; in which case we give upp. */
+ * it can fail; in which case we give up. */
for (j=0;j<I2C_CLIENT_MAX;j++) {
struct i2c_client *client = adap->clients[j];
if (client!=NULL)
@@ -226,11 +226,12 @@ int i2c_del_adapter(struct i2c_adapter *adap)
if ((res=client->driver->detach_client(client))) {
printk(KERN_ERR "i2c-core.o: adapter %s not "
"unregistered, because client at "
- "address %02x can't be detached. ",
+ "address %02x can't be detached\n",
adap->name, client->addr);
goto ERROR0;
}
}
+
#ifdef CONFIG_PROC_FS
if (i2cproc_initialized) {
char name[8];
@@ -339,7 +340,7 @@ int i2c_del_driver(struct i2c_driver *driver)
printk(KERN_WARNING "i2c-core.o: while unregistering "
"dummy driver %s, adapter %s could "
"not be detached properly; driver "
- "not unloaded!",driver->name,
+ "not unloaded!\n", driver->name,
adap->name);
ADAP_UNLOCK();
return res;
@@ -359,9 +360,9 @@ int i2c_del_driver(struct i2c_driver *driver)
"unregistering driver "
"`%s', the client at "
"address %02x of "
- "adapter `%s' could not"
- "be detached; driver"
- "not unloaded!",
+ "adapter `%s' could not "
+ "be detached; driver "
+ "not unloaded!\n",
driver->name,
client->addr,
adap->name);
@@ -448,7 +449,7 @@ int i2c_detach_client(struct i2c_client *client)
if (adapter->client_unregister != NULL)
if ((res = adapter->client_unregister(client))) {
printk(KERN_ERR "i2c-core.o: client_unregister [%s] failed, "
- "client not detached",client->name);
+ "client not detached\n", client->name);
return res;
}
@@ -461,20 +462,16 @@ int i2c_detach_client(struct i2c_client *client)
void i2c_inc_use_client(struct i2c_client *client)
{
-
if (client->driver->inc_use != NULL)
client->driver->inc_use(client);
-
if (client->adapter->inc_use != NULL)
client->adapter->inc_use(client->adapter);
}
void i2c_dec_use_client(struct i2c_client *client)
{
-
if (client->driver->dec_use != NULL)
client->driver->dec_use(client);
-
if (client->adapter->dec_use != NULL)
client->adapter->dec_use(client->adapter);
}
@@ -548,15 +545,13 @@ struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
int i2c_use_client(struct i2c_client *client)
{
- if(client->flags & I2C_CLIENT_ALLOW_USE) {
- if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE)
+ if (client->flags & I2C_CLIENT_ALLOW_USE) {
+ if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE)
+ client->usage_count++;
+ else if (client->usage_count > 0)
+ return -EBUSY;
+ else
client->usage_count++;
- else {
- if(client->usage_count > 0)
- return -EBUSY;
- else
- client->usage_count++;
- }
}
i2c_inc_use_client(client);
@@ -712,7 +707,6 @@ int i2cproc_cleanup(void)
return 0;
}
-
#endif /* def CONFIG_PROC_FS */
/* ----------------------------------------------------
@@ -720,7 +714,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 +744,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count)
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));
@@ -978,13 +972,13 @@ extern s32 i2c_smbus_read_byte(struct i2c_client * client)
I2C_SMBUS_READ,0,I2C_SMBUS_BYTE, &data))
return -1;
else
- return 0x0FF & data.byte;
+ return data.byte;
}
extern s32 i2c_smbus_write_byte(struct i2c_client * client, u8 value)
{
return i2c_smbus_xfer(client->adapter,client->addr,client->flags,
- I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,NULL);
+ I2C_SMBUS_WRITE, value, I2C_SMBUS_BYTE, NULL);
}
extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command)
@@ -994,7 +988,7 @@ extern s32 i2c_smbus_read_byte_data(struct i2c_client * client, u8 command)
I2C_SMBUS_READ,command, I2C_SMBUS_BYTE_DATA,&data))
return -1;
else
- return 0x0FF & data.byte;
+ return data.byte;
}
extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, u8 command,
@@ -1014,7 +1008,7 @@ extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command)
I2C_SMBUS_READ,command, I2C_SMBUS_WORD_DATA, &data))
return -1;
else
- return 0x0FFFF & data.word;
+ return data.word;
}
extern s32 i2c_smbus_write_word_data(struct i2c_client * client,
@@ -1037,7 +1031,7 @@ extern s32 i2c_smbus_process_call(struct i2c_client * client,
I2C_SMBUS_PROC_CALL, &data))
return -1;
else
- return 0x0FFFF & data.word;
+ return data.word;
}
/* Returns the number of read bytes */
@@ -1135,7 +1129,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
else {
msg[0].len=3;
msgbuf0[1] = data->word & 0xff;
- msgbuf0[2] = (data->word >> 8) & 0xff;
+ msgbuf0[2] = data->word >> 8;
}
break;
case I2C_SMBUS_PROC_CALL:
@@ -1143,7 +1137,7 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr,
msg[0].len = 3;
msg[1].len = 2;
msgbuf0[1] = data->word & 0xff;
- msgbuf0[2] = (data->word >> 8) & 0xff;
+ msgbuf0[2] = data->word >> 8;
break;
case I2C_SMBUS_BLOCK_DATA:
if (read_write == I2C_SMBUS_READ) {
@@ -1193,7 +1187,9 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags,
union i2c_smbus_data * data)
{
s32 res;
+
flags = flags & I2C_M_TEN;
+
if (adapter->algo->smbus_xfer) {
I2C_LOCK(adapter);
res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write,
@@ -1202,6 +1198,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter * adapter, u16 addr, unsigned short flags,
} else
res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,
command,size,data);
+
return res;
}
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 231627c..b166da1 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -39,16 +39,14 @@
#ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h>
#endif
-
+#include <linux/init.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
+#include <asm/uaccess.h>
/* If you want debugging uncomment: */
/* #define DEBUG */
-#include <linux/init.h>
-#include <asm/uaccess.h>
-
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
#ifdef MODULE
extern int init_module(void);
@@ -82,13 +80,13 @@ extern
static int i2cdev_cleanup(void);
static struct file_operations i2cdev_fops = {
- owner: THIS_MODULE,
- llseek: no_llseek,
- read: i2cdev_read,
- write: i2cdev_write,
- ioctl: i2cdev_ioctl,
- open: i2cdev_open,
- release: i2cdev_release,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .read = i2cdev_read,
+ .write = i2cdev_write,
+ .ioctl = i2cdev_ioctl,
+ .open = i2cdev_open,
+ .release = i2cdev_release,
};
#define I2CDEV_ADAPS_MAX I2C_ADAP_MAX
@@ -99,24 +97,20 @@ static devfs_handle_t devfs_handle = NULL;
#endif
static struct i2c_driver i2cdev_driver = {
- name: "i2c-dev dummy driver",
- id: I2C_DRIVERID_I2CDEV,
- flags: I2C_DF_DUMMY,
- attach_adapter: i2cdev_attach_adapter,
- detach_client: i2cdev_detach_client,
- command: i2cdev_command,
-/* inc_use: NULL,
- dec_use: NULL, */
+ .name = "i2c-dev dummy driver",
+ .id = I2C_DRIVERID_I2CDEV,
+ .flags = I2C_DF_DUMMY,
+ .attach_adapter = i2cdev_attach_adapter,
+ .detach_client = i2cdev_detach_client,
+ .command = i2cdev_command,
};
static struct i2c_client i2cdev_client_template = {
- name: "I2C /dev entry",
- id: 1,
- flags: 0,
- addr: -1,
-/* adapter: NULL, */
- driver: &i2cdev_driver,
-/* data: NULL */
+ .name = "I2C /dev entry",
+ .id = 1,
+ .flags = 0,
+ .addr = -1,
+ .driver = &i2cdev_driver,
};
static int i2cdev_initialized;
@@ -229,7 +223,7 @@ int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
sizeof(rdwr_arg)))
return -EFAULT;
- /* Put an arbritrary limit on the number of messages that can
+ /* Put an arbitrary limit on the number of messages that can
* be sent at once */
if (rdwr_arg.nmsgs > 42)
return -EINVAL;
diff --git a/drivers/i2c/i2c-elektor.c b/drivers/i2c/i2c-elektor.c
index ea11e42..73f17de 100644
--- a/drivers/i2c/i2c-elektor.c
+++ b/drivers/i2c/i2c-elektor.c
@@ -199,24 +199,24 @@ static void pcf_isa_dec_use(struct i2c_adapter *adap)
* This is only done when more than one hardware adapter is supported.
*/
static struct i2c_algo_pcf_data pcf_isa_data = {
- NULL,
- pcf_isa_setbyte,
- pcf_isa_getbyte,
- pcf_isa_getown,
- pcf_isa_getclock,
- pcf_isa_waitforpin,
- 10, 10, 100, /* waits, timeout */
+ .setpcf = pcf_isa_setbyte,
+ .getpcf = pcf_isa_getbyte,
+ .getown = pcf_isa_getown,
+ .getclock = pcf_isa_getclock,
+ .waitforpin = pcf_isa_waitforpin,
+ .udelay = 10,
+ .mdelay = 10,
+ .timeout = HZ,
};
static struct i2c_adapter pcf_isa_ops = {
- "PCF8584 ISA adapter",
- I2C_HW_P_ELEK,
- NULL,
- &pcf_isa_data,
- pcf_isa_inc_use,
- pcf_isa_dec_use,
- pcf_isa_reg,
- pcf_isa_unreg,
+ .name = "PCF8584 ISA adapter",
+ .id = I2C_HW_P_ELEK,
+ .algo_data = &pcf_isa_data,
+ .inc_use = pcf_isa_inc_use,
+ .dec_use = pcf_isa_dec_use,
+ .client_register = pcf_isa_reg,
+ .client_unregister = pcf_isa_unreg,
};
int __init i2c_pcfisa_init(void)
diff --git a/drivers/i2c/i2c-elv.c b/drivers/i2c/i2c-elv.c
index 242a02e..8ae6a0d 100644
--- a/drivers/i2c/i2c-elv.c
+++ b/drivers/i2c/i2c-elv.c
@@ -28,14 +28,11 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/init.h>
-
-#include <asm/uaccess.h>
-
#include <linux/ioport.h>
-#include <asm/io.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
#define DEFAULT_BASE 0x378
static int base=0;
@@ -99,7 +96,7 @@ static int bit_elv_init(void)
} else {
outb(0x0c,base+2); /* SLCT auf low */
udelay(400);
- if ( !(inb(base+1) && 0x10) ) {
+ if ( !(inb(base+1) & 0x10) ) {
outb(0x04,base+2);
DEBINIT(printk(KERN_DEBUG "i2c-elv.o: Select was high.\n"));
return -ENODEV;
@@ -148,23 +145,23 @@ static void bit_elv_dec_use(struct i2c_adapter *adap)
* This is only done when more than one hardware adapter is supported.
*/
static struct i2c_algo_bit_data bit_elv_data = {
- NULL,
- bit_elv_setsda,
- bit_elv_setscl,
- bit_elv_getsda,
- bit_elv_getscl,
- 80, 80, 100, /* waits, timeout */
+ .setsda = bit_elv_setsda,
+ .setscl = bit_elv_setscl,
+ .getsda = bit_elv_getsda,
+ .getscl = bit_elv_getscl,
+ .udelay = 80,
+ .mdelay = 80,
+ .timeout = HZ
};
static struct i2c_adapter bit_elv_ops = {
- "ELV Parallel port adaptor",
- I2C_HW_B_ELV,
- NULL,
- &bit_elv_data,
- bit_elv_inc_use,
- bit_elv_dec_use,
- bit_elv_reg,
- bit_elv_unreg,
+ .name = "ELV Parallel port adaptor",
+ .id = I2C_HW_B_ELV,
+ .algo_data = &bit_elv_data,
+ .inc_use = bit_elv_inc_use,
+ .dec_use = bit_elv_dec_use,
+ .client_register = bit_elv_reg,
+ .client_unregister = bit_elv_unreg,
};
int __init i2c_bitelv_init(void)
diff --git a/drivers/i2c/i2c-philips-par.c b/drivers/i2c/i2c-philips-par.c
index 57531ba..880e206 100644
--- a/drivers/i2c/i2c-philips-par.c
+++ b/drivers/i2c/i2c-philips-par.c
@@ -156,33 +156,31 @@ static void bit_lp_dec_use(struct i2c_adapter *adap)
*/
static struct i2c_algo_bit_data bit_lp_data = {
- NULL,
- bit_lp_setsda,
- bit_lp_setscl,
- bit_lp_getsda,
- bit_lp_getscl,
- 80, 80, 100, /* waits, timeout */
+ .setsda = bit_lp_setsda,
+ .setscl = bit_lp_setscl,
+ .getsda = bit_lp_getsda,
+ .getscl = bit_lp_getscl,
+ .udelay = 80,
+ .mdelay = 80,
+ .timeout = HZ
};
static struct i2c_algo_bit_data bit_lp_data2 = {
- NULL,
- bit_lp_setsda2,
- bit_lp_setscl2,
- bit_lp_getsda2,
- NULL,
- 80, 80, 100, /* waits, timeout */
+ .setsda = bit_lp_setsda2,
+ .setscl = bit_lp_setscl2,
+ .getsda = bit_lp_getsda2,
+ .udelay = 80,
+ .mdelay = 80,
+ .timeout = HZ
};
static struct i2c_adapter bit_lp_ops = {
- "Philips Parallel port adapter",
- I2C_HW_B_LP,
- NULL,
- NULL,
- bit_lp_inc_use,
- bit_lp_dec_use,
- bit_lp_reg,
-
- bit_lp_unreg,
+ .name = "Philips Parallel port adapter",
+ .id = I2C_HW_B_LP,
+ .inc_use = bit_lp_inc_use,
+ .dec_use = bit_lp_dec_use,
+ .client_register = bit_lp_reg,
+ .client_unregister = bit_lp_unreg,
};
static void i2c_parport_attach (struct parport *port)
diff --git a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c
index f5feeb6..82855af 100644
--- a/drivers/i2c/i2c-proc.c
+++ b/drivers/i2c/i2c-proc.c
@@ -29,23 +29,19 @@
#include <linux/ctype.h>
#include <linux/sysctl.h>
#include <linux/proc_fs.h>
+#include <linux/init.h>
#include <linux/ioport.h>
-#include <asm/uaccess.h>
-
#include <linux/i2c.h>
#include <linux/i2c-proc.h>
-
-#include <linux/init.h>
+#include <asm/uaccess.h>
#ifndef THIS_MODULE
#define THIS_MODULE NULL
#endif
-static int i2c_create_name(char **name, const char *prefix,
- struct i2c_adapter *adapter, int addr);
-static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
+static int i2c_parse_reals(int *nrels, char *buffer, int bufsize,
long *results, int magnitude);
-static int i2c_write_reals(int nrels, void *buffer, int *bufsize,
+static int i2c_write_reals(int nrels, char *buffer, size_t *bufsize,
long *results, int magnitude);
static int i2c_proc_chips(ctl_table * ctl, int write,
struct file *filp, void *buffer,
@@ -126,11 +122,9 @@ int i2c_create_name(char **name, const char *prefix,
If any driver wants subdirectories within the newly created directory,
this function must be updated!
controlling_mod is the controlling module. It should usually be
- THIS_MODULE when calling. Note that this symbol is not defined in
- kernels before 2.3.13; define it to NULL in that case. We will not use it
- for anything older than 2.3.27 anyway. */
+ THIS_MODULE when calling. */
int i2c_register_entry(struct i2c_client *client, const char *prefix,
- ctl_table * ctl_template,
+ ctl_table *ctl_template,
struct module *controlling_mod)
{
int i, res, len, id;
@@ -205,7 +199,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 +281,7 @@ int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
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 +312,7 @@ int i2c_sysctl_chips(ctl_table * table, int *name, int nlen,
sizeof(struct
i2c_chips_data)))
return -EFAULT;
- (char *) oldval +=
+ oldval = (char *) oldval +
sizeof(struct i2c_chips_data);
nrels++;
}
@@ -456,7 +450,7 @@ int i2c_sysctl_real(ctl_table * table, int *name, int nlen,
WARNING! This is tricky code. I have tested it, but there may still be
hidden bugs in it, even leading to crashes and things!
*/
-int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
+static int i2c_parse_reals(int *nrels, char *buffer, int bufsize,
long *results, int magnitude)
{
int maxels, min, mag;
@@ -470,10 +464,10 @@ int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
/* Skip spaces at the start */
while (bufsize &&
- !((ret=get_user(nextchar, (char *) buffer))) &&
+ !((ret=get_user(nextchar, buffer))) &&
isspace((int) nextchar)) {
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
@@ -488,22 +482,22 @@ int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
mag = magnitude;
/* Check for a minus */
- if (!((ret=get_user(nextchar, (char *) buffer)))
+ if (!((ret=get_user(nextchar, buffer)))
&& (nextchar == '-')) {
min = 1;
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
/* Digits before a decimal dot */
while (bufsize &&
- !((ret=get_user(nextchar, (char *) buffer))) &&
+ !((ret=get_user(nextchar, buffer))) &&
isdigit((int) nextchar)) {
res = res * 10 + nextchar - '0';
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -517,16 +511,16 @@ int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
if (bufsize && (nextchar == '.')) {
/* Skip the dot */
bufsize--;
- ((char *) buffer)++;
+ buffer++;
/* Read digits while they are significant */
while (bufsize && (mag > 0) &&
- !((ret=get_user(nextchar, (char *) buffer))) &&
+ !((ret=get_user(nextchar, buffer))) &&
isdigit((int) nextchar)) {
res = res * 10 + nextchar - '0';
mag--;
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -539,10 +533,10 @@ int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
/* Skip everything until we hit whitespace */
while (bufsize &&
- !((ret=get_user(nextchar, (char *) buffer))) &&
+ !((ret=get_user(nextchar, buffer))) &&
!isspace((int) nextchar)) {
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -557,7 +551,7 @@ int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
return 0;
}
-int i2c_write_reals(int nrels, void *buffer, int *bufsize,
+static int i2c_write_reals(int nrels, char *buffer, size_t *bufsize,
long *results, int magnitude)
{
#define BUFLEN 20
@@ -571,10 +565,10 @@ int i2c_write_reals(int nrels, void *buffer, int *bufsize,
mag = magnitude;
if (nr != 0) {
- if(put_user(' ', (char *) buffer))
+ if(put_user(' ', buffer))
return -EFAULT;
curbufsize++;
- ((char *) buffer)++;
+ buffer++;
}
/* Fill BUF with the representation of the next string */
@@ -615,12 +609,12 @@ int i2c_write_reals(int nrels, void *buffer, int *bufsize,
if(copy_to_user(buffer, BUF, buflen))
return -EFAULT;
curbufsize += buflen;
- (char *) buffer += buflen;
+ buffer += buflen;
nr++;
}
if (curbufsize < *bufsize) {
- if(put_user('\n', (char *) buffer))
+ if(put_user('\n', buffer))
return -EFAULT;
curbufsize++;
}
diff --git a/drivers/i2c/i2c-velleman.c b/drivers/i2c/i2c-velleman.c
index ce660b0..feb579b 100644
--- a/drivers/i2c/i2c-velleman.c
+++ b/drivers/i2c/i2c-velleman.c
@@ -24,12 +24,12 @@
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/string.h> /* for 2.0 kernels to get NULL */
-#include <asm/errno.h> /* for 2.0 kernels to get ENODEV */
-#include <asm/io.h>
-
+#include <linux/errno.h>
+#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
+#include <asm/io.h>
+#include <asm/param.h> /* for HZ */
/* ----- global defines ----------------------------------------------- */
#define DEB(x) /* should be reasonable open, close &c. */
@@ -139,23 +139,23 @@ static void bit_velle_dec_use(struct i2c_adapter *adap)
*/
static struct i2c_algo_bit_data bit_velle_data = {
- NULL,
- bit_velle_setsda,
- bit_velle_setscl,
- bit_velle_getsda,
- bit_velle_getscl,
- 10, 10, 100, /* waits, timeout */
+ .setsda = bit_velle_setsda,
+ .setscl = bit_velle_setscl,
+ .getsda = bit_velle_getsda,
+ .getscl = bit_velle_getscl,
+ .udelay = 10,
+ .mdelay = 10,
+ .timeout = HZ
};
static struct i2c_adapter bit_velle_ops = {
- "Velleman K8000",
- I2C_HW_B_VELLE,
- NULL,
- &bit_velle_data,
- bit_velle_inc_use,
- bit_velle_dec_use,
- bit_velle_reg,
- bit_velle_unreg,
+ .name = "Velleman K8000",
+ .id = I2C_HW_B_VELLE,
+ .algo_data = &bit_velle_data,
+ .inc_use = bit_velle_inc_use,
+ .dec_use = bit_velle_dec_use,
+ .client_register = bit_velle_reg,
+ .client_unregister = bit_velle_unreg,
};
int __init i2c_bitvelle_init(void)
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 * inode, struct file * file)
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 *dev_id, struct pt_regs *regs)
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 *host, int nodeid, void *data,
rcode = RCODE_TYPE_ERROR;
}
- (u8 *)data += partlength;
+ data += partlength;
length -= partlength;
addr += partlength;
@@ -546,7 +546,7 @@ int highlevel_write(struct hpsb_host *host, int nodeid, int destid,
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 <linux/kernelcapi.h>
#include <linux/init.h>
#include <asm/io.h>
+#include <asm/processor.h>
#include <asm/uaccess.h>
#include <linux/netdevice.h>
#include "capicmd.h"
@@ -151,6 +152,7 @@ static inline int wait_for_doorbell(avmcard *card, unsigned long t)
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, size_t count, loff_t * off)
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/isdn/isdn_ppp.c b/drivers/isdn/isdn_ppp.c
index 393ca44..bc3ef28 100644
--- a/drivers/isdn/isdn_ppp.c
+++ b/drivers/isdn/isdn_ppp.c
@@ -2335,6 +2335,7 @@ static struct ippp_ccp_reset_state *isdn_ppp_ccp_reset_alloc_state(struct ippp_s
rs->state = CCPResetIdle;
rs->is = is;
rs->id = id;
+ init_timer(&rs->timer);
rs->timer.data = (unsigned long)rs;
rs->timer.function = isdn_ppp_ccp_timer_callback;
is->reset->rs[id] = rs;
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 (struct video_device *vfd)
#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 video_device *vfd)
}
-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_info *map, struct flchip *chip, unsigned
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_info *map, struct flchip *chip, unsigned
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 map_info *map, struct flchip *chip)
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(struct map_info *map, struct flchip *chip, u
}
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_dev *dev)
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_device *dev);
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 *dev_id, struct pt_regs *regs)
}
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_ARG)
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_device *dev, int bufnum)
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 *dev)
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 *dev, struct sk_buff *skb)
/* 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/e100/e100_main.c b/drivers/net/e100/e100_main.c
index c9d801a..d67a145 100644
--- a/drivers/net/e100/e100_main.c
+++ b/drivers/net/e100/e100_main.c
@@ -3292,11 +3292,11 @@ e100_do_ethtool_ioctl(struct net_device *dev, struct ifreq *ifr)
if ((bdp->flags & IS_BACHELOR)
&& (bdp->params.b_params & PRM_FC)) {
epause.autoneg = 1;
- if (bdp->flags && DF_LINK_FC_CAP) {
+ if (bdp->flags & DF_LINK_FC_CAP) {
epause.rx_pause = 1;
epause.tx_pause = 1;
}
- if (bdp->flags && DF_LINK_FC_TX_ONLY)
+ if (bdp->flags & DF_LINK_FC_TX_ONLY)
epause.tx_pause = 1;
}
rc = copy_to_user(ifr->ifr_data, &epause, sizeof(epause))
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 7fe113f..d93e748 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -918,7 +918,7 @@ static void decode_prio_command(unsigned char cmd, struct sixpack *sp)
printk(KERN_DEBUG "6pack: protocol violation\n");
else
sp->status = 0;
- cmd &= !SIXP_RX_DCD_MASK;
+ cmd &= ~SIXP_RX_DCD_MASK;
}
sp->status = cmd & SIXP_PRIO_DATA_MASK;
}
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 <net/ax25.h>
#endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */
+static int my_errno;
+#define errno my_errno
#define __KERNEL_SYSCALLS__
-#include <linux/unistd.h>
+#include <asm/unistd.h>
/* --------------------------------------------------------------------- */
@@ -370,8 +372,6 @@ static char eppconfig_path[256] = "/usr/sbin/eppfpga";
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 baycom_state *bc,
*/
#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 baycom_state *bc,
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_device *dev)
}
#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_device *dev)
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_wssfdx;
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, struct sockaddr *uservaddr,
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_device *dev)
* 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_device *dev, struct ifreq *ifr)
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* card)
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* card)
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 long addr, void* buf, unsigned len)
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 long addr, void* buf, unsigned len)
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, sdla_dump_t* u_dump)
#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/s390/net/qeth.c b/drivers/s390/net/qeth.c
index 22f9444..ea7803a 100644
--- a/drivers/s390/net/qeth.c
+++ b/drivers/s390/net/qeth.c
@@ -6097,7 +6097,7 @@ static void qeth_qdio_input_handler(int irq,unsigned int status,
}
sbalf15=(card->inbound_qdio_buffers[(first_element+count-1)&
QDIO_MAX_BUFFERS_PER_Q].
- element[15].flags)&&0xff;
+ element[15].flags)&0xff;
PRINT_STUPID("inbound qdio transfer error on irq 0x%04x. " \
"qdio_error=0x%x (more than one: %c), " \
"siga_error=0x%x (more than one: %c), " \
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/FlashPoint.c b/drivers/scsi/FlashPoint.c
index 9b07421..af5d980 100644
--- a/drivers/scsi/FlashPoint.c
+++ b/drivers/scsi/FlashPoint.c
@@ -3757,17 +3757,17 @@ STATIC int SetDevSyncRate(PSCCBcard pCurrCard, PUCB p_ucb)
}
if(currTar_Info->TarEEValue && EE_SYNC_MASK == syncVal)
return(0);
- currTar_Info->TarEEValue = (currTar_Info->TarEEValue & !EE_SYNC_MASK)
+ currTar_Info->TarEEValue = (currTar_Info->TarEEValue & ~EE_SYNC_MASK)
| syncVal;
syncOffset = (SYNC_RATE_TBL + scsiID) / 2;
temp2.tempw = utilEERead(ioPort, syncOffset);
if(scsiID & 0x01)
{
- temp2.tempb[0] = (temp2.tempb[0] & !EE_SYNC_MASK) | syncVal;
+ temp2.tempb[0] = (temp2.tempb[0] & ~EE_SYNC_MASK) | syncVal;
}
else
{
- temp2.tempb[1] = (temp2.tempb[1] & !EE_SYNC_MASK) | syncVal;
+ temp2.tempb[1] = (temp2.tempb[1] & ~EE_SYNC_MASK) | syncVal;
}
utilEEWriteOnOff(ioPort, 1);
utilEEWrite(ioPort, temp2.tempw, syncOffset);
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_varp, ASC_QDONE_INFO *qdonep)
* 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..295a40c 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
@@ -1260,7 +1261,7 @@ static void ProcessELS_Request(CPQFCHBA * dev, TachFCHDR_GCMND * fchs)
// Terminate I/O with "retry" potential
cpqfcTSTerminateExchange(dev, &pLoggedInPort->ScsiNexus, PORTID_CHANGED);
} else {
- printk(" Got 3 LOGOuts - terminating comm. with port_id %Xh\n", fchs->s_id && 0xFFFFFF);
+ printk(" Got 3 LOGOuts - terminating comm. with port_id %Xh\n", fchs->s_id & 0xFFFFFF);
GiveUpOnDevice = 1;
}
} else {
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 48a04df..9c816a9 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3667,7 +3667,7 @@ static void gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs)
IStatus &= ~0x80;
#ifdef INT_COAL
if (coalesced)
- ha->status = pcs->ext_status && 0xffff;
+ ha->status = pcs->ext_status & 0xffff;
else
#endif
ha->status = gdth_readw(&dp6m_ptr->i960r.status);
@@ -3679,7 +3679,7 @@ static void gdth_interrupt(int irq,void *dev_id,struct pt_regs *regs)
if (coalesced) {
ha->info = pcs->info0;
ha->info2 = pcs->info1;
- ha->service = (pcs->ext_status >> 16) && 0xffff;
+ ha->service = (pcs->ext_status >> 16) & 0xffff;
} else
#endif
{
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, struct vm_area_struct *vma)
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 <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
-#include <linux/unistd.h>
+static int my_errno;
+#define errno my_errno
+#include <asm/unistd.h>
#include <asm/uaccess.h>
-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 irq, int io_base)
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/slab.h>
-#include <linux/unistd.h>
+static int my_errno;
+#define errno my_errno
+#include <asm/unistd.h>
#include <asm/uaccess.h>
-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(struct usbout *u, struct urb *urb)
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, char *end, struct usb_device *dev)
* 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, char *end, struct usb_device *dev)
}
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 *ps, void *arg)
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 *ps, void *arg)
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 dev_state *ps, struct inode *inode,
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 *inode, struct file *file,
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 *inode, struct file *file,
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 * urb)
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 <linux/usbdevice_fs.h>
#include <asm/uaccess.h>
+static struct inode_operations usbdevfs_bus_inode_operations;
+static struct file_operations usbdevfs_bus_file_operations;
+
/* --------------------------------------------------------------------- */
/*
diff --git a/drivers/usb/pegasus.c b/drivers/usb/pegasus.c
index 8b10308..0d013c6 100644
--- a/drivers/usb/pegasus.c
+++ b/drivers/usb/pegasus.c
@@ -147,6 +147,7 @@ static int get_registers(pegasus_t * pegasus, u16 indx, u16 size,
set_current_state(TASK_UNINTERRUPTIBLE);
if ((ret = usb_submit_urb(pegasus->ctrl_urb))) {
+ set_current_state(TASK_RUNNING);
err("%s: BAD CTRLs %d", __FUNCTION__, ret);
goto out;
}
@@ -197,6 +198,7 @@ static int set_registers(pegasus_t * pegasus, u16 indx, u16 size,
set_current_state(TASK_UNINTERRUPTIBLE);
if ((ret = usb_submit_urb(pegasus->ctrl_urb))) {
+ set_current_state(TASK_RUNNING);
err("%s: BAD CTRL %d", __FUNCTION__, ret);
goto out;
}
@@ -244,6 +246,7 @@ static int set_register(pegasus_t * pegasus, u16 indx, u8 data)
set_current_state(TASK_UNINTERRUPTIBLE);
if ((ret = usb_submit_urb(pegasus->ctrl_urb))) {
+ set_current_state(TASK_RUNNING);
err("%s: BAD CTRL %d", __FUNCTION__, ret);
goto out;
}
diff --git a/drivers/usb/printer.c b/drivers/usb/printer.c
index 6d751cd..a0d18a2 100644
--- a/drivers/usb/printer.c
+++ b/drivers/usb/printer.c
@@ -692,6 +692,7 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count,
usblp->wcomplete = 0;
err = usb_submit_urb(usblp->writeurb);
if (err) {
+ usblp->wcomplete = 1;
if (err != -ENOMEM)
count = -EIO;
else
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 (struct usb_serial_port *port, const char
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[SERIAL_TTY_MINORS]; /* initially all NULL
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_serial *serial)
}
/*
+ * 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).
+ *
+ *