summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Jones <davej@halogen.(none)>2002-12-30 23:08:22 +0000
committerDave Jones <davej@halogen.(none)>2002-12-30 23:08:22 +0000
commit1f46ead556d590cbb585ecaebe8ac1871d3c6dab (patch)
tree680083ed2d1564b17306d6cfee9d2b1a3c973f29
parent05ae9880250d5ffe81f9385a83b8d4e73ca5c4c0 (diff)
parent43fb68dc00a8ab0b728e27c2a8fd4033d2ba0932 (diff)
Merge halogen.(none):/home/davej/src/kernel/2.5/bk-linus
into halogen.(none):/home/davej/src/kernel/2.5/agpgart
-rw-r--r--Documentation/sysctl/fs.txt8
-rw-r--r--arch/alpha/kernel/smp.c6
-rw-r--r--arch/alpha/kernel/time.c1
-rw-r--r--arch/arm/kernel/time.c8
-rw-r--r--arch/cris/drivers/ds1302.c1
-rw-r--r--arch/cris/kernel/time.c1
-rw-r--r--arch/i386/Kconfig56
-rw-r--r--arch/i386/Makefile24
-rw-r--r--arch/i386/boot/setup.S16
-rw-r--r--arch/i386/defconfig7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/elanfreq.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c169
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k6.c66
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep.c2
-rw-r--r--arch/i386/kernel/entry.S4
-rw-r--r--arch/i386/kernel/mpparse.c4
-rw-r--r--arch/i386/kernel/smpboot.c11
-rw-r--r--arch/i386/kernel/sys_i386.c71
-rw-r--r--arch/i386/kernel/time.c1
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c6
-rw-r--r--arch/i386/mm/hugetlbpage.c309
-rw-r--r--arch/ia64/ia32/sys_ia32.c16
-rw-r--r--arch/ia64/kernel/entry.S4
-rw-r--r--arch/ia64/kernel/smpboot.c6
-rw-r--r--arch/ia64/kernel/sys_ia64.c80
-rw-r--r--arch/ia64/mm/hugetlbpage.c205
-rw-r--r--arch/m68k/atari/time.c1
-rw-r--r--arch/m68k/sun3x/time.c32
-rw-r--r--arch/mips/au1000/common/serial.c12
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c37
-rw-r--r--arch/mips/dec/time.c1
-rw-r--r--arch/mips/kernel/old-time.c1
-rw-r--r--arch/mips64/sgi-ip27/ip27-rtc.c1
-rw-r--r--arch/mips64/sgi-ip27/ip27-timer.c1
-rw-r--r--arch/parisc/kernel/smp.c6
-rw-r--r--arch/ppc/iSeries/mf.c1
-rw-r--r--arch/ppc/kernel/smp.c6
-rw-r--r--arch/ppc/platforms/chrp_time.c1
-rw-r--r--arch/ppc/platforms/gemini_setup.c1
-rw-r--r--arch/ppc/platforms/prep_time.c1
-rw-r--r--arch/ppc/syslib/todc_time.c1
-rw-r--r--arch/ppc64/kernel/mf.c1
-rw-r--r--arch/ppc64/kernel/rtc.c1
-rw-r--r--arch/ppc64/kernel/smp.c6
-rw-r--r--arch/s390/kernel/smp.c6
-rw-r--r--arch/s390x/kernel/smp.c6
-rw-r--r--arch/sh/kernel/rtc.c9
-rw-r--r--arch/sparc64/kernel/smp.c6
-rw-r--r--arch/sparc64/kernel/sys_sparc.c98
-rw-r--r--arch/sparc64/kernel/systbls.S10
-rw-r--r--arch/sparc64/kernel/time.c9
-rw-r--r--arch/um/kernel/smp.c5
-rw-r--r--arch/x86_64/kernel/smpboot.c6
-rw-r--r--arch/x86_64/kernel/time.c1
-rw-r--r--crypto/api.c2
-rw-r--r--drivers/acorn/char/pcf8583.c1
-rw-r--r--drivers/acpi/sleep.c1
-rw-r--r--drivers/block/genhd.c4
-rw-r--r--drivers/char/busmouse.c2
-rw-r--r--drivers/char/dz.c4
-rw-r--r--drivers/char/hvc_console.c2
-rw-r--r--drivers/char/ip2main.c8
-rw-r--r--drivers/char/n_tty.c17
-rw-r--r--drivers/char/pty.c7
-rw-r--r--drivers/char/random.c6
-rw-r--r--drivers/char/rtc.c1
-rw-r--r--drivers/char/tty_io.c43
-rw-r--r--drivers/char/vt.c2
-rw-r--r--drivers/i2c/busses/i2c-amd756.c14
-rw-r--r--drivers/i2c/busses/i2c-amd8111.c13
-rw-r--r--drivers/i2c/chips/adm1021.c43
-rw-r--r--drivers/i2c/chips/lm75.c49
-rw-r--r--drivers/i2c/i2c-adap-ite.c41
-rw-r--r--drivers/i2c/i2c-algo-bit.c20
-rw-r--r--drivers/i2c/i2c-algo-ibm_ocp.c8
-rw-r--r--drivers/i2c/i2c-algo-ibm_ocp.h4
-rw-r--r--drivers/i2c/i2c-algo-pcf.c14
-rw-r--r--drivers/i2c/i2c-core.c47
-rw-r--r--drivers/i2c/i2c-dev.c15
-rw-r--r--drivers/i2c/i2c-elektor.c34
-rw-r--r--drivers/i2c/i2c-elv.c36
-rw-r--r--drivers/i2c/i2c-frodo.c29
-rw-r--r--drivers/i2c/i2c-philips-par.c32
-rw-r--r--drivers/i2c/i2c-proc.c58
-rw-r--r--drivers/i2c/i2c-rpx.c37
-rw-r--r--drivers/i2c/i2c-velleman.c48
-rw-r--r--drivers/i2c/scx200_acb.c25
-rw-r--r--drivers/i2c/scx200_i2c.c25
-rw-r--r--drivers/ide/ide-tape.c316
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/ieee1394/ieee1394_core.c3
-rw-r--r--drivers/isdn/capi/capi.c11
-rw-r--r--drivers/isdn/capi/kcapi.c12
-rw-r--r--drivers/isdn/eicon/eicon_mod.c10
-rw-r--r--drivers/isdn/hardware/eicon/i4lididrv.c10
-rw-r--r--drivers/isdn/hisax/callc.c3
-rw-r--r--drivers/media/video/adv7175.c17
-rw-r--r--drivers/media/video/bttv-if.c13
-rw-r--r--drivers/media/video/cpia.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-i2c.c13
-rw-r--r--drivers/media/video/tvmixer.c8
-rw-r--r--drivers/mtd/chips/chipreg.c2
-rw-r--r--drivers/net/defxx.h7
-rw-r--r--drivers/net/irda/sir_dev.c6
-rw-r--r--drivers/net/irda/sir_dongle.c6
-rw-r--r--drivers/s390/block/dasd.c2
-rw-r--r--drivers/s390/block/dasd_ioctl.c11
-rw-r--r--drivers/s390/char/tape_core.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm_pci.c3
-rw-r--r--drivers/scsi/osst.c302
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/scsi_lib.c4
-rw-r--r--drivers/scsi/sd.c17
-rw-r--r--drivers/scsi/sr.c11
-rw-r--r--drivers/scsi/sr_vendor.c15
-rw-r--r--drivers/serial/core.c6
-rw-r--r--drivers/sgi/char/ds1286.c1
-rw-r--r--drivers/tc/zs.c4
-rw-r--r--drivers/usb/class/bluetty.c4
-rw-r--r--drivers/usb/class/cdc-acm.c6
-rw-r--r--drivers/usb/serial/bus.c5
-rw-r--r--drivers/video/console/fonts.c3
-rw-r--r--drivers/video/matrox/i2c-matroxfb.c11
-rw-r--r--drivers/video/matrox/matroxfb_maven.c28
-rw-r--r--fs/devfs/base.c2
-rw-r--r--fs/dquot.c2
-rw-r--r--fs/exec.c4
-rw-r--r--fs/ext3/namei.c4
-rw-r--r--fs/filesystems.c10
-rw-r--r--fs/nls/nls_base.c4
-rw-r--r--fs/proc/proc_misc.c2
-rw-r--r--include/asm-alpha/unistd.h2
-rw-r--r--include/asm-arm/arch-ebsa285/time.h1
-rw-r--r--include/asm-cris/rtc.h5
-rw-r--r--include/asm-generic/rtc.h1
-rw-r--r--include/asm-i386/hw_irq.h2
-rw-r--r--include/asm-i386/mach-numaq/mach_mpparse.h3
-rw-r--r--include/asm-i386/unistd.h2
-rw-r--r--include/asm-ia64/system.h3
-rw-r--r--include/asm-ia64/unistd.h4
-rw-r--r--include/asm-mips/ds1286.h11
-rw-r--r--include/asm-mips64/ds1286.h11
-rw-r--r--include/asm-mips64/m48t35.h8
-rw-r--r--include/asm-ppc/m48t35.h9
-rw-r--r--include/asm-ppc/mk48t59.h8
-rw-r--r--include/asm-ppc/nvram.h8
-rw-r--r--include/asm-ppc/todc.h8
-rw-r--r--include/asm-ppc/unistd.h2
-rw-r--r--include/asm-ppc64/nvram.h8
-rw-r--r--include/asm-ppc64/unistd.h2
-rw-r--r--include/asm-sparc/unistd.h2
-rw-r--r--include/asm-x86_64/ia32_unistd.h2
-rw-r--r--include/linux/bcd.h20
-rw-r--r--include/linux/cache.h3
-rw-r--r--include/linux/cpufreq.h17
-rw-r--r--include/linux/fs.h10
-rw-r--r--include/linux/i2c-algo-bit.h7
-rw-r--r--include/linux/i2c-elektor.h47
-rw-r--r--include/linux/i2c-id.h12
-rw-r--r--include/linux/i2c.h28
-rw-r--r--include/linux/kernel.h1
-rw-r--r--include/linux/mc146818rtc.h11
-rw-r--r--include/linux/mm.h3
-rw-r--r--include/linux/module.h8
-rw-r--r--include/linux/mtd/mtd.h5
-rw-r--r--include/linux/percpu.h61
-rw-r--r--include/linux/sched.h1
-rw-r--r--include/linux/sensors.h690
-rw-r--r--include/linux/smp.h10
-rw-r--r--include/linux/suspend.h3
-rw-r--r--include/linux/tty.h5
-rw-r--r--include/linux/tty_driver.h2
-rw-r--r--init/main.c7
-rw-r--r--kernel/cpufreq.c54
-rw-r--r--kernel/exec_domain.c4
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/intermodule.c2
-rw-r--r--kernel/ksyms.c4
-rw-r--r--kernel/module.c41
-rw-r--r--kernel/params.c7
-rw-r--r--kernel/printk.c16
-rw-r--r--lib/Makefile8
-rw-r--r--lib/crc32.c273
-rw-r--r--lib/crc32defs.h28
-rw-r--r--lib/gen_crc32table.c82
-rw-r--r--mm/page_alloc.c25
-rw-r--r--mm/slab.c82
-rw-r--r--net/core/dev.c2
-rw-r--r--net/ipv4/route.c5
-rw-r--r--net/ipv4/xfrm_policy.c2
-rw-r--r--net/rxrpc/krxsecd.c2
-rw-r--r--sound/core/control.c2
-rw-r--r--sound/core/info.c2
-rw-r--r--sound/core/init.c7
-rw-r--r--sound/core/oss/mixer_oss.c2
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/pcm_native.c2
-rw-r--r--sound/core/rawmidi.c2
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c2
-rw-r--r--sound/core/seq/seq_ports.c2
-rw-r--r--sound/core/seq/seq_virmidi.c4
-rw-r--r--sound/core/timer.c2
-rw-r--r--sound/drivers/opl3/opl3_seq.c2
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/wavefront/wavefront_fx.c2
-rw-r--r--sound/isa/wavefront/wavefront_synth.c2
-rw-r--r--sound/synth/emux/emux_seq.c4
208 files changed, 1515 insertions, 3176 deletions
diff --git a/Documentation/sysctl/fs.txt b/Documentation/sysctl/fs.txt
index 601b91a29f5f..fbbe3cafffa9 100644
--- a/Documentation/sysctl/fs.txt
+++ b/Documentation/sysctl/fs.txt
@@ -82,11 +82,11 @@ of error messages about running out of file handles, you might
want to increase this limit.
The three values in file-nr denote the number of allocated
-file handles, the number of used file handles and the maximum
+file handles, the number of unused file handles and the maximum
number of file handles. When the allocated file handles come
-close to the maximum, but the number of actually used ones is
-far behind, you've encountered a peak in your usage of file
-handles and you don't need to increase the maximum.
+close to the maximum, but the number of unused file handles is
+significantly greater than 0, you've encountered a peak in your
+usage of file handles and you don't need to increase the maximum.
==============================================================
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index a6ab21ca5bb8..148aaaf310f3 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -607,6 +607,12 @@ smp_prepare_cpus(unsigned int max_cpus)
smp_boot_cpus();
}
+void __devinit
+smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_present_mask);
+}
+
int __devinit
__cpu_up(unsigned int cpu)
{
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 4ccda6679804..03fed82384dd 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -37,6 +37,7 @@
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/init.h>
+#include <linux/bcd.h>
#include <asm/uaccess.h>
#include <asm/io.h>
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 2af6dbda06d5..685d59b08623 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -47,14 +47,6 @@ EXPORT_SYMBOL(rtc_lock);
/* change this if you have some constant time drift */
#define USECS_PER_JIFFY (1000000/HZ)
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
static int dummy_set_rtc(void)
{
return 0;
diff --git a/arch/cris/drivers/ds1302.c b/arch/cris/drivers/ds1302.c
index 867f3c63ba0c..23814c3843d3 100644
--- a/arch/cris/drivers/ds1302.c
+++ b/arch/cris/drivers/ds1302.c
@@ -97,6 +97,7 @@
#include <linux/module.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
+#include <linux/bcd.h>
#include <asm/uaccess.h>
#include <asm/system.h>
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 1ee0bbfeab7e..0541e25a48aa 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -32,6 +32,7 @@
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/delay.h>
+#include <linux/bcd.h>
#include <asm/segment.h>
#include <asm/io.h>
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index ddaf6c1e0b16..186f22f8c1cf 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -40,15 +40,15 @@ menu "Processor type and features"
choice
prompt "Subarchitecture Type"
- default PC
+ default X86_PC
-config PC
- bool "IBM PC (and compatible)"
+config X86_PC
+ bool "PC-compatible"
help
Choose this option if your computer is a standard PC or compatible.
-config VOYAGER
- bool "NCR Voyager"
+config X86_VOYAGER
+ bool "Voyager (NCR)"
help
Voyager is a MCA based 32 way capable SMP architecture proprietary
to NCR Corp. Machine classes 345x/35xx/4100/51xx are voyager based.
@@ -59,7 +59,7 @@ config VOYAGER
say N here otherwise the kernel you build will not be bootable.
config X86_NUMAQ
- bool "IBM/Sequent NUMAQ"
+ bool "NUMAQ (IBM/Sequent)"
help
This option is used for getting Linux to run on a (IBM/Sequent) NUMA
multiquad box. This changes the way that processors are bootstrapped,
@@ -68,7 +68,7 @@ config X86_NUMAQ
email to Martin.Bligh@us.ibm.com
config X86_SUMMIT
- bool "IBM x440 (Summit/EXA)"
+ bool "Summit/EXA (IBM x440)"
help
This option is needed for IBM systems that use the Summit/EXA chipset.
In particular, it is needed for the x440.
@@ -407,7 +407,7 @@ config PREEMPT
config X86_UP_APIC
bool "Local APIC support on uniprocessors" if !SMP
- depends on !VOYAGER
+ depends on !X86_VOYAGER
---help---
A local APIC (Advanced Programmable Interrupt Controller) is an
integrated interrupt controller in the CPU. If you have a single-CPU
@@ -737,7 +737,7 @@ endmenu
menu "Power management options (ACPI, APM)"
- depends on !VOYAGER
+ depends on !X86_VOYAGER
config PM
bool "Power Management support"
@@ -1040,18 +1040,18 @@ menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
config X86_VISWS_APIC
bool
- depends on VISWS
+ depends on X86_VISWS
default y
config X86_LOCAL_APIC
bool
- depends on ((!VISWS && SMP) || VISWS) && !VOYAGER
+ depends on (X86_VISWS || SMP) && !X86_VOYAGER
default y
config PCI
- bool "PCI support" if !VISWS
- depends on !VOYAGER
- default y if VISWS
+ bool "PCI support" if !X86_VISWS
+ depends on !X86_VOYAGER
+ default y if X86_VISWS
help
Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside
@@ -1065,12 +1065,12 @@ config PCI
config X86_IO_APIC
bool
- depends on !VISWS && SMP && !VOYAGER
+ depends on SMP && !(X86_VISWS || X86_VOYAGER)
default y
choice
prompt "PCI access mode"
- depends on !VISWS && PCI
+ depends on PCI && !X86_VISWS
default PCI_GOANY
config PCI_GOBIOS
@@ -1099,17 +1099,17 @@ endchoice
config PCI_BIOS
bool
- depends on !VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
+ depends on !X86_VISWS && PCI && (PCI_GOBIOS || PCI_GOANY)
default y
config PCI_DIRECT
bool
- depends on !VISWS && PCI && (PCI_GODIRECT || PCI_GOANY)
+ depends on !X86_VISWS && PCI && (PCI_GODIRECT || PCI_GOANY)
default y
config SCx200
tristate "NatSemi SCx200 support"
- depends on !VOYAGER
+ depends on !X86_VOYAGER
help
This provides basic support for the National Semiconductor SCx200
processor. Right now this is just a driver for the GPIO pins.
@@ -1123,7 +1123,7 @@ source "drivers/pci/Kconfig"
config ISA
bool "ISA support"
- depends on !VOYAGER
+ depends on !(X86_VOYAGER || X86_VISWS)
help
Find out whether you have ISA slots on your motherboard. ISA is the
name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -1149,7 +1149,7 @@ config EISA
config MCA
bool "MCA support"
- depends on !VISWS && !VOYAGER
+ depends on !(X86_VISWS || X86_VOYAGER)
help
MicroChannel Architecture is found in some IBM PS/2 machines and
laptops. It is a bus system similar to PCI or ISA. See
@@ -1157,8 +1157,8 @@ config MCA
there) before attempting to build an MCA bus kernel.
config MCA
- depends on VOYAGER
- default y if VOYAGER
+ depends on X86_VOYAGER
+ default y if X86_VOYAGER
source "drivers/mca/Kconfig"
@@ -1626,12 +1626,12 @@ config FRAME_POINTER
config X86_EXTRA_IRQS
bool
- depends on X86_LOCAL_APIC || VOYAGER
+ depends on X86_LOCAL_APIC || X86_VOYAGER
default y
config X86_FIND_SMP_CONFIG
bool
- depends on X86_LOCAL_APIC || VOYAGER
+ depends on X86_LOCAL_APIC || X86_VOYAGER
default y
config X86_MPPARSE
@@ -1649,17 +1649,17 @@ source "lib/Kconfig"
config X86_SMP
bool
- depends on SMP && !VOYAGER
+ depends on SMP && !X86_VOYAGER
default y
config X86_HT
bool
- depends on SMP && !VOYAGER
+ depends on SMP && !X86_VOYAGER
default y
config X86_BIOS_REBOOT
bool
- depends on !VOYAGER
+ depends on !X86_VOYAGER
default y
config X86_TRAMPOLINE
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 6277bdd05469..976f82eee371 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -49,24 +49,22 @@ cflags-$(CONFIG_MCYRIXIII) += $(call check_gcc,-falign-functions=0 -falign-jumps
CFLAGS += $(cflags-y)
-#default subarch .c files
+# Default subarch .c files
mcore-y := mach-default
-#Voyager subarch support
-mflags-$(CONFIG_VOYAGER) := -Iinclude/asm-i386/mach-voyager
-mcore-$(CONFIG_VOYAGER) := mach-voyager
+# Voyager subarch support
+mflags-$(CONFIG_X86_VOYAGER) := -Iinclude/asm-i386/mach-voyager
+mcore-$(CONFIG_X86_VOYAGER) := mach-voyager
-#VISWS subarch support
-mflags-$(CONFIG_VISWS) := -Iinclude/asm-i386/mach-visws
-mcore-$(CONFIG_VISWS) := mach-visws
+# VISWS subarch support
+mflags-$(CONFIG_X86_VISWS) := -Iinclude/asm-i386/mach-visws
+mcore-$(CONFIG_X86_VISWS) := mach-visws
-#NUMAQ subarch support
-mflags-$(CONFIG_X86_NUMAQ) := -Iinclude/asm-i386/mach-numaq
-mcore-$(CONFIG_X86_NUMAQ) := mach-default
+# NUMAQ subarch support
+mflags-$(CONFIG_X86_NUMAQ) := -Iinclude/asm-i386/mach-numaq
+mcore-$(CONFIG_X86_NUMAQ) := mach-default
-#add other subarch support here
-
-#default subarch .h files
+# default subarch .h files
mflags-y += -Iinclude/asm-i386/mach-default
HEAD := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S
index 59b2c46745a6..e12554fb21ba 100644
--- a/arch/i386/boot/setup.S
+++ b/arch/i386/boot/setup.S
@@ -476,7 +476,7 @@ sysdesc_ok:
movsb
popw %ds
no_mca:
-#ifdef CONFIG_VOYAGER
+#ifdef CONFIG_X86_VOYAGER
movb $0xff, 0x40 # flag on config found
movb $0xc0, %al
mov $0xff, %ah
@@ -758,7 +758,7 @@ A20_TEST_LOOPS = 32 # Iterations per wait
A20_ENABLE_LOOPS = 255 # Total loops to try
-#ifndef CONFIG_VOYAGER
+#ifndef CONFIG_X86_VOYAGER
a20_try_loop:
# First, see if we are on a system with no A20 gate.
@@ -777,11 +777,11 @@ a20_bios:
jnz a20_done
# Try enabling A20 through the keyboard controller
-#endif /* CONFIG_VOYAGER */
+#endif /* CONFIG_X86_VOYAGER */
a20_kbc:
call empty_8042
-#ifndef CONFIG_VOYAGER
+#ifndef CONFIG_X86_VOYAGER
call a20_test # Just in case the BIOS worked
jnz a20_done # but had a delayed reaction.
#endif
@@ -794,7 +794,7 @@ a20_kbc:
outb %al, $0x60
call empty_8042
-#ifndef CONFIG_VOYAGER
+#ifndef CONFIG_X86_VOYAGER
# Wait until a20 really *is* enabled; it can take a fair amount of
# time on certain systems; Toshiba Tecras are known to have this
# problem.
@@ -842,7 +842,7 @@ a20_err_msg:
# If we get here, all is good
a20_done:
-#endif /* CONFIG_VOYAGER */
+#endif /* CONFIG_X86_VOYAGER */
# set up gdt and idt
lidt idt_48 # load idt with 0,0
xorl %eax, %eax # Compute gdt_base
@@ -1009,7 +1009,7 @@ bootsect_panic_mess:
.string "INT15 refuses to access high mem, giving up."
-#ifndef CONFIG_VOYAGER
+#ifndef CONFIG_X86_VOYAGER
# This routine tests whether or not A20 is enabled. If so, it
# exits with zf = 0.
#
@@ -1040,7 +1040,7 @@ a20_test_wait:
popw %cx
ret
-#endif /* CONFIG_VOYAGER */
+#endif /* CONFIG_X86_VOYAGER */
# This routine checks that the keyboard command queue is empty
# (after emptying the output buffers)
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index dc9338a71390..869f19867f7f 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -32,8 +32,10 @@ CONFIG_KMOD=y
#
# Processor type and features
#
-CONFIG_PC=y
-# CONFIG_VOYAGER is not set
+CONFIG_X86_PC=y
+# CONFIG_X86_VOYAGER is not set
+# CONFIG_X86_NUMAQ is not set
+# CONFIG_X86_SUMMIT is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
@@ -70,7 +72,6 @@ CONFIG_SMP=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_NR_CPUS=32
-# CONFIG_X86_NUMA is not set
CONFIG_X86_MCE=y
# CONFIG_X86_MCE_NONFATAL is not set
CONFIG_X86_MCE_P4THERMAL=y
diff --git a/arch/i386/kernel/cpu/cpufreq/elanfreq.c b/arch/i386/kernel/cpu/cpufreq/elanfreq.c
index 2c751897ce36..2623e01b2d87 100644
--- a/arch/i386/kernel/cpu/cpufreq/elanfreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/elanfreq.c
@@ -124,7 +124,7 @@ static void elanfreq_set_cpu_state (unsigned int state) {
freqs.old = elanfreq_get_cpu_frequency();
freqs.new = elan_multiplier[state].clock;
- freqs.cpu = CPUFREQ_ALL_CPUS; /* elanfreq.c is UP only driver */
+ freqs.cpu = 0; /* elanfreq.c is UP only driver */
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 72395b13eb00..d6f3f66d6644 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -313,9 +313,13 @@ static void longhaul_setstate (unsigned int clock_ratio_index, unsigned int newf
if ((!can_scale_fsb) && (newfsb != current_fsb))
return;
+ if (((clock_ratio[clock_ratio_index] * newfsb * 100) > highest_speed) ||
+ ((clock_ratio[clock_ratio_index] * newfsb * 100) < lowest_speed))
+ return;
+
freqs.old = longhaul_get_cpu_mult() * longhaul_get_cpu_fsb() * 100;
freqs.new = clock_ratio[clock_ratio_index] * newfsb * 100;
- freqs.cpu = CPUFREQ_ALL_CPUS; /* longhaul.c is UP only driver */
+ freqs.cpu = 0; /* longhaul.c is UP only driver */
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
@@ -582,18 +586,68 @@ static int longhaul_verify(struct cpufreq_policy *policy)
policy->max = newmax;
+ cpufreq_verify_within_limits(policy, lowest_speed, highest_speed);
+
+ return 0;
+}
+
+
+static int longhaul_get_best_freq_for_fsb(struct cpufreq_policy *policy,
+ unsigned int min_mult,
+ unsigned int max_mult,
+ unsigned int fsb,
+ unsigned int *new_mult)
+{
+ unsigned int optimal = 0;
+ unsigned int found_optimal = 0;
+ unsigned int i;
+
+ switch(policy->policy) {
+ case CPUFREQ_POLICY_POWERSAVE:
+ optimal = max_mult;
+ break;
+ case CPUFREQ_POLICY_PERFORMANCE:
+ optimal = min_mult;
+ }
+
+ for(i=0; i<numscales; i++) {
+ unsigned int freq = fsb * clock_ratio[i] * 100;
+ if ((freq > policy->max) ||
+ (freq < policy->min))
+ continue;
+ switch(policy->policy) {
+ case CPUFREQ_POLICY_POWERSAVE:
+ if (clock_ratio[i] < clock_ratio[optimal]) {
+ found_optimal = 1;
+ optimal = i;
+ }
+ break;
+ case CPUFREQ_POLICY_PERFORMANCE:
+ if (clock_ratio[i] > clock_ratio[optimal]) {
+ found_optimal = 1;
+ optimal = i;
+ }
+ break;
+ }
+ }
+
+ if (found_optimal) {
+ *new_mult = optimal;
+ return 1;
+ }
return 0;
}
static int longhaul_setpolicy (struct cpufreq_policy *policy)
{
- unsigned int number_states = 0;
unsigned int i;
unsigned int fsb_index = 0;
unsigned int new_fsb = 0;
unsigned int new_clock_ratio = 0;
- unsigned int best_freq = -1;
+ unsigned int min_mult = 0;
+ unsigned int max_mult = 0;
+
if (!longhaul_driver)
return -EINVAL;
@@ -603,103 +657,36 @@ static int longhaul_setpolicy (struct cpufreq_policy *policy)
else
fsb_search_table = power_fsb_table;
+ for(i=0;i<numscales;i++) {
+ if (clock_ratio[max_mult] < clock_ratio[i])
+ max_mult = i;
+ else if (clock_ratio[min_mult] > clock_ratio[i])
+ min_mult = i;
+ }
+
if (can_scale_fsb==1) {
- for (fsb_index=0; fsb_search_table[fsb_index]!=-1; fsb_index++)
+ unsigned int found = 0;
+ for (fsb_index=0; fsb_search_table[fsb_index]!=-1; fsb_index++)
{
- unsigned int tmpcount = longhaul_statecount_fsb(policy, fsb_search_table[fsb_index]);
- if (tmpcount == 1)
+ if (longhaul_get_best_freq_for_fsb(policy,
+ min_mult, max_mult,
+ fsb_search_table[fsb_index],
+ &new_clock_ratio)) {
new_fsb = fsb_search_table[fsb_index];
- number_states += tmpcount;
+ break;
+ }
}
+ if (!found)
+ return -EINVAL;
} else {
- number_states = longhaul_statecount_fsb(policy, current_fsb);
new_fsb = current_fsb;
- }
-
- if (!number_states)
- return -EINVAL;
- else if (number_states == 1) {
- for(i=0; i<numscales; i++) {
- if ((clock_ratio[i] != -1) &&
- ((clock_ratio[i] * new_fsb * 100) <= policy->max) &&
- ((clock_ratio[i] * new_fsb * 100) >= policy->min))
- new_clock_ratio = i;
- }
- longhaul_setstate(new_clock_ratio, new_fsb);
- }
-
- switch (policy->policy) {
- case CPUFREQ_POLICY_POWERSAVE:
- best_freq = -1;
- if (can_scale_fsb==1) {
- for (fsb_index=0; fsb_search_table[fsb_index]!=-1; fsb_index++)
- {
- for(i=0; i<numscales; i++) {
- unsigned int tmpfreq = fsb_search_table[fsb_index] * clock_ratio[i] * 100;
- if (clock_ratio[i] == -1)
- continue;
-
- if ((tmpfreq >= policy->min) &&
- (tmpfreq <= policy->max) &&
- (tmpfreq < best_freq)) {
- new_clock_ratio = i;
- new_fsb = fsb_search_table[fsb_index];
- }
- }
- }
- } else {
- for(i=0; i<numscales; i++) {
- unsigned int tmpfreq = current_fsb * clock_ratio[i] * 100;
- if (clock_ratio[i] == -1)
- continue;
-
- if ((tmpfreq >= policy->min) &&
- (tmpfreq <= policy->max) &&
- (tmpfreq < best_freq)) {
- new_clock_ratio = i;
- new_fsb = current_fsb;
- }
- }
- }
- break;
- case CPUFREQ_POLICY_PERFORMANCE:
- best_freq = 0;
- if (can_scale_fsb==1) {
- for (fsb_index=0; fsb_search_table[fsb_index]!=-1; fsb_index++)
- {
- for(i=0; i<numscales; i++) {
- unsigned int tmpfreq = fsb_search_table[fsb_index] * clock_ratio[i] * 100;
- if (clock_ratio[i] == -1)
- continue;
-
- if ((tmpfreq >= policy->min) &&
- (tmpfreq <= policy->max) &&
- (tmpfreq > best_freq)) {
- new_clock_ratio = i;
- new_fsb = fsb_search_table[fsb_index];
- }
- }
- }
- } else {
- for(i=0; i<numscales; i++) {
- unsigned int tmpfreq = current_fsb * clock_ratio[i] * 100;
- if (clock_ratio[i] == -1)
- continue;
-
- if ((tmpfreq >= policy->min) &&
- (tmpfreq <= policy->max) &&
- (tmpfreq > best_freq)) {
- new_clock_ratio = i;
- new_fsb = current_fsb;
- }
- }
- }
- break;
- default:
- return -EINVAL;
+ if (!longhaul_get_best_freq_for_fsb(policy, min_mult,
+ max_mult, new_fsb, &new_clock_ratio))
+ return -EINVAL;
}
longhaul_setstate(new_clock_ratio, new_fsb);
+
return 0;
}
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
index 8021e8a21590..b6ae33f21254 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k6.c
@@ -83,7 +83,7 @@ static void powernow_k6_set_state (unsigned int best_i)
freqs.old = busfreq * powernow_k6_get_cpu_multiplier();
freqs.new = busfreq * clock_ratio[best_i];
- freqs.cpu = CPUFREQ_ALL_CPUS; /* powernow-k6.c is UP only driver */
+ freqs.cpu = 0; /* powernow-k6.c is UP only driver */
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
@@ -144,6 +144,9 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
policy->max = clock_ratio[j] * busfreq;
+ cpufreq_verify_within_limits(policy, (20 * busfreq),
+ (max_multiplier * busfreq));
+
return 0;
}
@@ -156,53 +159,44 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
*/
static int powernow_k6_setpolicy (struct cpufreq_policy *policy)
{
- unsigned int number_states = 0;
- unsigned int i, j=4;
+ unsigned int i;
+ unsigned int optimal;
- if (!powernow_driver)
+ if (!powernow_driver || !policy || policy->cpu)
return -EINVAL;
- for (i=0; i<8; i++)
- if ((policy->min <= (busfreq * clock_ratio[i])) &&
- (policy->max >= (busfreq * clock_ratio[i])))
- {
- number_states++;
- j = i;
- }
-
- if (number_states == 1) {
- /* if only one state is within the limit borders, it
- is easily detected and set */
- powernow_k6_set_state(j);
- return 0;
- }
-
- /* more than one state within limit */
- switch (policy->policy) {
+ switch(policy->policy) {
case CPUFREQ_POLICY_POWERSAVE:
- j = 6;
- for (i=0; i<8; i++)
- if ((policy->min <= (busfreq * clock_ratio[i])) &&
- (policy->max >= (busfreq * clock_ratio[i])) &&
- (clock_ratio[i] < clock_ratio[j]))
- j = i;
+ optimal = 6;
break;
case CPUFREQ_POLICY_PERFORMANCE:
- j = 4;
- for (i=0; i<8; i++)
- if ((policy->min <= (busfreq * clock_ratio[i])) &&
- (policy->max >= (busfreq * clock_ratio[i])) &&
- (clock_ratio[i] > clock_ratio[j]))
- j = i;
+ optimal = max_multiplier;
break;
default:
return -EINVAL;
}
- if (clock_ratio[i] > max_multiplier)
- return -EINVAL;
+ for (i=0;i<8;i++) {
+ unsigned int freq = busfreq * clock_ratio[i];
+ if (clock_ratio[i] > max_multiplier)
+ continue;
+ if ((freq > policy->max) ||
+ (freq < policy->min))
+ continue;
+ switch(policy->policy) {
+ case CPUFREQ_POLICY_POWERSAVE:
+ if (freq < (clock_ratio[optimal] * busfreq))
+ optimal = i;
+ break;
+ case CPUFREQ_POLICY_PERFORMANCE:
+ if (freq > (clock_ratio[optimal] * busfreq))
+ optimal = i;
+ break;
+ }
+ }
+
+ powernow_k6_set_state(optimal);
- powernow_k6_set_state(j);
return 0;
}
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep.c b/arch/i386/kernel/cpu/cpufreq/speedstep.c
index 227e726aa4bd..349f18b8d942 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep.c
@@ -154,7 +154,7 @@ static void speedstep_set_state (unsigned int state, int notify)
freqs.old = (oldstate == SPEEDSTEP_HIGH) ? speedstep_high_freq : speedstep_low_freq;
freqs.new = (state == SPEEDSTEP_HIGH) ? speedstep_high_freq : speedstep_low_freq;
- freqs.cpu = CPUFREQ_ALL_CPUS; /* speedstep.c is UP only driver */
+ freqs.cpu = 0; /* speedstep.c is UP only driver */
if (notify)
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index 22c21444dfb1..5da9aae308d6 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -795,8 +795,8 @@ ENTRY(sys_call_table)
.long sys_io_getevents
.long sys_io_submit
.long sys_io_cancel
- .long sys_alloc_hugepages /* 250 */
- .long sys_free_hugepages
+ .long sys_ni_syscall /* 250 sys_alloc_hugepages - reuse this */
+ .long sys_ni_syscall /* was sys_free_hugepages - reuse this */
.long sys_exit_group
.long sys_lookup_dcookie
.long sys_epoll_create
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index be74791bdbe7..a4fb679c1c97 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -269,7 +269,7 @@ static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m)
BUG();
}
-#if 0
+#ifdef CONFIG_X86_NUMAQ
static void __init MP_translation_info (struct mpc_config_translation *m)
{
printk("Translation: record %d, type %d, quad %d, global %d, local %d\n", mpc_record, m->trans_type, m->trans_quad, m->trans_global, m->trans_local);
@@ -328,7 +328,7 @@ static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable, \
}
}
}
-#endif
+#endif /* CONFIG_X86_NUMAQ */
/*
* Read/parse the MPC
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 7c08f768281c..b602e889879f 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -995,11 +995,6 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
printk("CPU%d: ", 0);
print_cpu_info(&cpu_data[0]);
- /*
- * We have the boot CPU online for sure.
- */
- set_bit(0, &cpu_online_map);
- set_bit(0, &cpu_callout_map);
boot_cpu_logical_apicid = logical_smp_processor_id();
map_cpu_to_boot_apicid(0, boot_cpu_apicid);
@@ -1172,6 +1167,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_boot_cpus(max_cpus);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_callout_map);
+}
+
int __devinit __cpu_up(unsigned int cpu)
{
/* This only works at boot for x86. See "rewrite" above. */
diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c
index 50d6d64b77bd..f38fda8ceb7b 100644
--- a/arch/i386/kernel/sys_i386.c
+++ b/arch/i386/kernel/sys_i386.c
@@ -9,7 +9,6 @@
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
-#include <linux/hugetlb.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/sem.h>
@@ -251,73 +250,3 @@ asmlinkage int sys_olduname(struct oldold_utsname * name)
return error;
}
-
-#ifdef CONFIG_HUGETLB_PAGE
-/* get_addr function gets the currently unused virtaul range in
- * current process's address space. It returns the HPAGE_SIZE
- * aligned address (in cases of success). Other kernel generic
- * routines only could gurantee that allocated address is PAGE_SIZE aligned.
- */
-static unsigned long get_addr(unsigned long addr, unsigned long len)
-{
- struct vm_area_struct *vma;
- if (addr) {
- addr = (addr + HPAGE_SIZE - 1) & HPAGE_MASK;
- vma = find_vma(current->mm, addr);
- if (TASK_SIZE > addr + len && !(vma && addr + len >= vma->vm_start))
- goto found_addr;
- }
- addr = TASK_UNMAPPED_BASE;
- for (vma = find_vma(current->mm, addr); TASK_SIZE > addr + len; vma = vma->vm_next) {
- if (!vma || addr + len < vma->vm_start)
- goto found_addr;
- addr = (vma->vm_end + HPAGE_SIZE - 1) & HPAGE_MASK;
- }
- return -ENOMEM;
-found_addr:
- return addr;
-}
-
-asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- struct mm_struct *mm = current->mm;
- unsigned long raddr;
- int retval = 0;
- extern int alloc_hugetlb_pages(int, unsigned long, unsigned long, int, int);
- if (!cpu_has_pse || key < 0 || len & ~HPAGE_MASK)
- return -EINVAL;
- down_write(&mm->mmap_sem);
- raddr = get_addr(addr, len);
- if (raddr != -ENOMEM)
- retval = alloc_hugetlb_pages(key, raddr, len, prot, flag);
- up_write(&mm->mmap_sem);
- return (retval < 0) ? (unsigned long)retval : raddr;
-}
-
-asmlinkage int sys_free_hugepages(unsigned long addr)
-{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- int retval;
-
- down_write(&mm->mmap_sem);
- vma = find_vma(current->mm, addr);
- if (!vma || !(vma->vm_flags & VM_HUGETLB) || vma->vm_start != addr) {
- retval = -EINVAL;
- goto out;
- }
- retval = do_munmap(vma->vm_mm, addr, vma->vm_end - addr);
-out:
- up_write(&mm->mmap_sem);
- return retval;
-}
-#else
-asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr, size_t len, int prot, int flag)
-{
- return -ENOSYS;
-}
-asmlinkage int sys_free_hugepages(unsigned long addr)
-{
- return -ENOSYS;
-}
-#endif
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index 2040b6039df8..ef1cfa33b154 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -43,6 +43,7 @@
#include <linux/smp.h>
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/bcd.h>
#include <asm/io.h>
#include <asm/smp.h>
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 6875c8346171..a6355ae320fd 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1942,6 +1942,12 @@ smp_prepare_cpus(unsigned int max_cpus)
smp_boot_cpus();
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_callout_map);
+}
+
int __devinit
__cpu_up(unsigned int cpu)
{
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
index 6bbd7ab4ffac..14a61a9bf5c4 100644
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -30,120 +30,6 @@ struct vm_operations_struct hugetlb_vm_ops;
static LIST_HEAD(htlbpage_freelist);
static spinlock_t htlbpage_lock = SPIN_LOCK_UNLOCKED;
-#define MAX_ID 32
-
-struct hugetlb_key {
- struct radix_tree_root tree;
- atomic_t count;
- spinlock_t lock;
- int key;
- int busy;
- uid_t uid;
- gid_t gid;
- umode_t mode;
- loff_t size;
-};
-
-static struct hugetlb_key htlbpagek[MAX_ID];
-
-static void mark_key_busy(struct hugetlb_key *hugetlb_key)
-{
- hugetlb_key->busy = 1;
-}
-
-static void clear_key_busy(struct hugetlb_key *hugetlb_key)
-{
- hugetlb_key->busy = 0;
-}
-
-static int key_busy(struct hugetlb_key *hugetlb_key)
-{
- return hugetlb_key->busy;
-}
-
-static struct hugetlb_key *find_key(int key)
-{
- int i;
-
- for (i = 0; i < MAX_ID; i++) {
- if (htlbpagek[i].key == key)
- return &htlbpagek[i];
- }
- return NULL;
-}
-
-static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag);
-/*
- * Call without htlbpage_lock, returns with htlbpage_lock held.
- */
-struct hugetlb_key *alloc_key(int key, unsigned long len, int prot, int flag)
-{
- struct hugetlb_key *hugetlb_key;
-
- do {
- spin_lock(&htlbpage_lock);
- hugetlb_key = find_key(key);
- if (!hugetlb_key) {
- if (!capable(CAP_SYS_ADMIN) || !capable(CAP_IPC_LOCK) || !in_group_p(0))
- hugetlb_key = ERR_PTR(-EPERM);
- else if (!(flag & IPC_CREAT))
- hugetlb_key = ERR_PTR(-ENOENT);
- else {
- int i;
- for (i = 0; i < MAX_ID; ++i)
- if (!htlbpagek[i].key)
- break;
- if (i == MAX_ID) {
- hugetlb_key = ERR_PTR(-ENOMEM);
- } else {
- hugetlb_key = &htlbpagek[i];
- mark_key_busy(hugetlb_key);
- hugetlb_key->key = key;
- INIT_RADIX_TREE(&hugetlb_key->tree, GFP_ATOMIC);
- hugetlb_key->uid = current->fsuid;
- hugetlb_key->gid = current->fsgid;
- hugetlb_key->mode = prot;
- hugetlb_key->size = len;
- }
- }
- } else if (key_busy(hugetlb_key)) {
- hugetlb_key = ERR_PTR(-EAGAIN);
- spin_unlock(&htlbpage_lock);
- } else if (check_size_prot(hugetlb_key, len, prot, flag) < 0) {
- hugetlb_key = ERR_PTR(-EINVAL);
- }
- } while (hugetlb_key == ERR_PTR(-EAGAIN));
- if (!IS_ERR(hugetlb_key))
- atomic_inc(&hugetlb_key->count);
- return hugetlb_key;
-}
-
-void hugetlb_release_key(struct hugetlb_key *key)
-{
- unsigned long index;
- unsigned long max_idx;
-
- if (!atomic_dec_and_test(&key->count)) {
- spin_lock(&htlbpage_lock);
- clear_key_busy(key);
- spin_unlock(&htlbpage_lock);
- return;
- }
-
- max_idx = (key->size >> HPAGE_SHIFT);
- for (index = 0; index < max_idx; ++index) {
- struct page *page = radix_tree_lookup(&key->tree, index);
- if (!page)
- continue;
- huge_page_release(page);
- }
- spin_lock(&htlbpage_lock);
- key->key = 0;
- clear_key_busy(key);
- INIT_RADIX_TREE(&key->tree, GFP_ATOMIC);
- spin_unlock(&htlbpage_lock);
-}
-
static struct page *alloc_hugetlb_page(void)
{
int i;
@@ -202,69 +88,14 @@ static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma, struc
set_pte(page_table, entry);
}
-static int anon_get_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, int write_access, pte_t *page_table)
-{
- struct page *page = alloc_hugetlb_page();
- if (page)
- set_huge_pte(mm, vma, page, page_table, write_access);
- return page ? 1 : -1;
-}
-
-static int make_hugetlb_pages_present(unsigned long addr, unsigned long end, int flags)
-{
- int write;
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- pte_t *pte;
-
- vma = find_vma(mm, addr);
- if (!vma)
- goto out_error1;
-
- write = (vma->vm_flags & VM_WRITE) != 0;
- if ((vma->vm_end - vma->vm_start) & (HPAGE_SIZE - 1))
- goto out_error1;
- spin_lock(&mm->page_table_lock);
- do {
- pte = huge_pte_alloc(mm, addr);
- if ((pte) && (pte_none(*pte))) {
- if (anon_get_hugetlb_page(mm, vma,
- write ? VM_WRITE : VM_READ,
- pte) == -1)
- goto out_error;
- } else
- goto out_error;
- addr += HPAGE_SIZE;
- } while (addr < end);
- spin_unlock(&mm->page_table_lock);
- vma->vm_flags |= (VM_HUGETLB | VM_RESERVED);
- if (flags & MAP_PRIVATE)
- vma->vm_flags |= VM_DONTCOPY;
- vma->vm_ops = &hugetlb_vm_ops;
- return 0;
-out_error: /* Error case, remove the partial lp_resources. */
- if (addr > vma->vm_start) {
- vma->vm_end = addr;
- zap_hugepage_range(vma, vma->vm_start, vma->vm_end - vma->vm_start);
- vma->vm_end = end;
- }
- spin_unlock(&mm->page_table_lock);
-out_error1:
- return -1;
-}
-
-int
-copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
+int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
struct vm_area_struct *vma)
{
pte_t *src_pte, *dst_pte, entry;
struct page *ptepage;
unsigned long addr = vma->vm_start;
unsigned long end = vma->vm_end;
- struct hugetlb_key *key = vma->vm_private_data;
- if (key)
- atomic_inc(&key->count);
while (addr < end) {
dst_pte = huge_pte_alloc(dst, addr);
if (!dst_pte)
@@ -346,14 +177,11 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsig
unsigned long address;
pte_t *pte;
struct page *page;
- struct hugetlb_key *key = vma->vm_private_data;
BUG_ON(start & (HPAGE_SIZE - 1));
BUG_ON(end & (HPAGE_SIZE - 1));
spin_lock(&htlbpage_lock);
- if (key )
- mark_key_busy(key);
spin_unlock(&htlbpage_lock);
for (address = start; address < end; address += HPAGE_SIZE) {
pte = huge_pte_offset(mm, address);
@@ -363,8 +191,6 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsig
huge_page_release(page);
pte_clear(pte);
}
- if (key)
- hugetlb_release_key(key);
mm->rss -= (end - start) >> PAGE_SHIFT;
flush_tlb_range(vma, start, end);
}
@@ -377,112 +203,6 @@ void zap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigne
spin_unlock(&mm->page_table_lock);
}
-static int check_size_prot(struct hugetlb_key *key, unsigned long len, int prot, int flag)
-{
- if (key->uid != current->fsuid)
- return -1;
- if (key->gid != current->fsgid)
- return -1;
- if (key->size != len)
- return -1;
- return 0;
-}
-
-struct page *key_find_page(struct hugetlb_key *key, unsigned long index)
-{
- struct page *page = radix_tree_lookup(&key->tree, index);
- if (page)
- get_page(page);
- return page;
-}
-
-int key_add_page(struct page *page, struct hugetlb_key *key, unsigned long index)
-{
- int error = radix_tree_insert(&key->tree, index, page);
- if (!error)
- get_page(page);
- return error;
-}
-
-static int prefault_key(struct hugetlb_key *key, struct vm_area_struct *vma)
-{
- struct mm_struct *mm = current->mm;
- unsigned long addr;
- int ret = 0;
-
- BUG_ON(vma->vm_start & ~HPAGE_MASK);
- BUG_ON(vma->vm_end & ~HPAGE_MASK);
-
- spin_lock(&mm->page_table_lock);
- spin_lock(&key->lock);
- for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) {
- unsigned long idx;
- pte_t *pte = huge_pte_alloc(mm, addr);
- struct page *page;
-
- if (!pte) {
- ret = -ENOMEM;
- goto out;
- }
- if (!pte_none(*pte))
- continue;
-
- idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
- + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));
- page = key_find_page(key, idx);
- if (!page) {
- page = alloc_hugetlb_page();
- if (!page) {
- ret = -ENOMEM;
- goto out;
- }
- key_add_page(page, key, idx);
- }
- set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
- }
-out:
- spin_unlock(&key->lock);
- spin_unlock(&mm->page_table_lock);
- return ret;
-}
-
-static int alloc_shared_hugetlb_pages(int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- struct hugetlb_key *hugetlb_key;
- int retval = -ENOMEM;
-
- hugetlb_key = alloc_key(key, len, prot, flag );
- spin_unlock(&htlbpage_lock);
- if (IS_ERR(hugetlb_key))
- return PTR_ERR(hugetlb_key);
-
- addr = do_mmap_pgoff(NULL, addr, len, (unsigned long) prot,
- MAP_NORESERVE|MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, 0);
- if (IS_ERR((void *) addr))
- goto out_release;
-
- vma = find_vma(mm, addr);
- if (!vma) {
- retval = -EINVAL;
- goto out_release;
- }
-
- retval = prefault_key(hugetlb_key, vma);
-
- vma->vm_flags |= (VM_HUGETLB | VM_RESERVED);
- vma->vm_ops = &hugetlb_vm_ops;
- vma->vm_private_data = hugetlb_key;
- spin_lock(&htlbpage_lock);
- clear_key_busy(hugetlb_key);
- spin_unlock(&htlbpage_lock);
- return retval;
-out_release:
- hugetlb_release_key(hugetlb_key);
- return retval;
-}
-
int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
{
struct mm_struct *mm = current->mm;
@@ -524,27 +244,6 @@ out:
return ret;
}
-static int alloc_private_hugetlb_pages(int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- if (!capable(CAP_IPC_LOCK) && !in_group_p(0))
- return -EPERM;
- addr = do_mmap_pgoff(NULL, addr, len, prot,
- MAP_NORESERVE|MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, 0);
- if (IS_ERR((void *) addr))
- return -ENOMEM;
- if (make_hugetlb_pages_present(addr, (addr + len), flag) < 0) {
- do_munmap(current->mm, addr, len);
- return -ENOMEM;
- }
- return 0;
-}
-
-int alloc_hugetlb_pages(int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- if (key > 0)
- return alloc_shared_hugetlb_pages(key, addr, len, prot, flag);
- return alloc_private_hugetlb_pages(key, addr, len, prot, flag);
-}
void update_and_free_page(struct page *page)
{
int j;
@@ -670,10 +369,6 @@ static int __init hugetlb_init(void)
}
htlbpage_max = htlbpagemem = htlbzone_pages = i;
printk("Total HugeTLB memory allocated, %ld\n", htlbpagemem);
- for (i = 0; i < MAX_ID; ++i) {
- atomic_set(&htlbpagek[i].count, 0);
- spin_lock_init(&htlbpagek[i].lock);
- }
return 0;
}
module_init(hugetlb_init);
@@ -696,7 +391,7 @@ int is_hugepage_mem_enough(size_t size)
return 1;
}
-static struct page * hugetlb_nopage(struct vm_area_struct * area, unsigned long address, int unused)
+static struct page *hugetlb_nopage(struct vm_area_struct * area, unsigned long address, int unused)
{
BUG();
return NULL;
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index a7ca7341a90a..d7ffb0124d77 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -2396,6 +2396,17 @@ shmctl32 (int first, int second, void *uptr)
return err;
}
+static long
+semtimedop32(int semid, struct sembuf *tsems, int nsems,
+ const struct timespec32 *timeout32)
+{
+ struct timespec t;
+ if (get_user (t.tv_sec, &timeout32->tv_sec) ||
+ get_user (t.tv_nsec, &timeout32->tv_nsec))
+ return -EFAULT;
+ return sys_semtimedop(semid, tsems, nsems, &t);
+}
+
asmlinkage long
sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
{
@@ -2407,7 +2418,10 @@ sys32_ipc (u32 call, int first, int second, int third, u32 ptr, u32 fifth)
switch (call) {
case SEMOP:
/* struct sembuf is the same on 32 and 64bit :)) */
- return sys_semop(first, (struct sembuf *)AA(ptr), second);
+ return sys_semtimedop(first, (struct sembuf *)AA(ptr), second, NULL);
+ case SEMTIMEDOP:
+ return semtimedop32(first, (struct sembuf *)AA(ptr), second,
+ (const struct timespec32 *)AA(fifth));
case SEMGET:
return sys_semget(first, second, third);
case SEMCTL:
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index bb294e803465..5907111d2a67 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1235,8 +1235,8 @@ sys_call_table:
data8 sys_sched_setaffinity
data8 sys_sched_getaffinity
data8 sys_set_tid_address
- data8 sys_alloc_hugepages
- data8 sys_free_hugepages // 1235
+ data8 ia64_ni_syscall // available. (was sys_alloc_hugepages)
+ data8 ia64_ni_syscall // available (was sys_free_hugepages)
data8 sys_exit_group
data8 sys_lookup_dcookie
data8 sys_io_setup
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index e1c9a5ead71b..6223825e0beb 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -506,6 +506,12 @@ smp_prepare_cpus (unsigned int max_cpus)
}
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_callin_map);
+}
+
void
smp_cpus_done (unsigned int dummy)
{
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index c89bef6a61f1..369fa11df115 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -9,7 +9,6 @@
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/mm.h>
-#include <linux/hugetlb.h>
#include <linux/mman.h>
#include <linux/sched.h>
#include <linux/shm.h>
@@ -21,11 +20,6 @@
#include <asm/shmparam.h>
#include <asm/uaccess.h>
-#ifdef CONFIG_HUGETLB_PAGE
-# define SHMLBA_HPAGE HPAGE_SIZE
-# define COLOR_HALIGN(addr) (((addr) + SHMLBA_HPAGE - 1) & ~(SHMLBA_HPAGE - 1))
-# define TASK_HPAGE_BASE ((REGION_HPAGE << REGION_SHIFT) | HPAGE_SIZE)
-#endif
unsigned long
arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len,
@@ -244,80 +238,6 @@ sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, lo
return addr;
}
-#ifdef CONFIG_HUGETLB_PAGE
-
-asmlinkage unsigned long
-sys_alloc_hugepages (int key, unsigned long addr, size_t len, int prot, int flag)
-{
- struct mm_struct *mm = current->mm;
- long retval;
- extern int alloc_hugetlb_pages (int, unsigned long, unsigned long, int, int);
-
- if ((key < 0) || (len & (HPAGE_SIZE - 1)))
- return -EINVAL;
-
- if (addr && ((REGION_NUMBER(addr) != REGION_HPAGE) || (addr & (HPAGE_SIZE - 1))))
- addr = TASK_HPAGE_BASE;
-
- if (!addr)
- addr = TASK_HPAGE_BASE;
- down_write(&mm->mmap_sem);
- {
- retval = arch_get_unmapped_area(NULL, COLOR_HALIGN(addr), len, 0, 0);
- if (retval != -ENOMEM)
- retval = alloc_hugetlb_pages(key, retval, len, prot, flag);
- }
- up_write(&mm->mmap_sem);
-
- if (IS_ERR((void *) retval))
- return retval;
-
- force_successful_syscall_return();
- return retval;
-}
-
-asmlinkage int
-sys_free_hugepages (unsigned long addr)
-{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- extern int free_hugepages(struct vm_area_struct *);
- int retval;
-
- down_write(&mm->mmap_sem);
- {
- vma = find_vma(mm, addr);
- if (!vma || !is_vm_hugetlb_page(vma) || (vma->vm_start != addr))
- retval = -EINVAL;
- goto out;
-
- spin_lock(&mm->page_table_lock);
- {
- retval = free_hugepages(vma);
- }
- spin_unlock(&mm->page_table_lock);
- }
-out:
- up_write(&mm->mmap_sem);
- return retval;
-}
-
-#else /* !CONFIG_HUGETLB_PAGE */
-
-asmlinkage unsigned long
-sys_alloc_hugepages (int key, size_t addr, unsigned long len, int prot, int flag)
-{
- return -ENOSYS;
-}
-
-asmlinkage unsigned long
-sys_free_hugepages (unsigned long addr)
-{
- return -ENOSYS;
-}
-
-#endif /* !CONFIG_HUGETLB_PAGE */
-
asmlinkage unsigned long
ia64_mremap (unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long flags,
unsigned long new_addr)
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
index ff6a67975c83..36900fb71acc 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
@@ -25,24 +25,6 @@ extern long htlbpagemem;
static void zap_hugetlb_resources (struct vm_area_struct *);
-#define MAX_ID 32
-struct htlbpagekey {
- struct inode *in;
- int key;
-} htlbpagek[MAX_ID];
-
-static struct inode *
-find_key_inode(int key)
-{
- int i;
-
- for (i = 0; i < MAX_ID; i++) {
- if (htlbpagek[i].key == key)
- return (htlbpagek[i].in);
- }
- return NULL;
-}
-
static struct page *
alloc_hugetlb_page (void)
{
@@ -305,193 +287,6 @@ unlink_vma (struct vm_area_struct *mpnt)
}
int
-free_hugepages (struct vm_area_struct *mpnt)
-{
- unlink_vma(mpnt);
- zap_hugetlb_resources(mpnt);
- kmem_cache_free(vm_area_cachep, mpnt);
- return 1;
-}
-
-static struct inode *
-set_new_inode (unsigned long len, int prot, int flag, int key)
-{
- struct inode *inode;
- int i;
-
- for (i = 0; i < MAX_ID; i++) {
- if (htlbpagek[i].key == 0)
- break;
- }
- if (i == MAX_ID)
- return NULL;
- inode = kmalloc(sizeof (struct inode), GFP_ATOMIC);
- if (inode == NULL)
- return NULL;
-
- inode_init_once(inode);
- atomic_inc(&inode->i_writecount);
- inode->i_mapping = &inode->i_data;
- inode->i_mapping->host = inode;
- inode->i_ino = (unsigned long) key;
-
- htlbpagek[i].key = key;
- htlbpagek[i].in = inode;
- inode->i_uid = current->fsuid;
- inode->i_gid = current->fsgid;
- inode->i_mode = prot;
- inode->i_size = len;
- return inode;
-}
-
-static int
-check_size_prot (struct inode *inode, unsigned long len, int prot, int flag)
-{
- if (inode->i_uid != current->fsuid)
- return -1;
- if (inode->i_gid != current->fsgid)
- return -1;
- if (inode->i_size != len)
- return -1;
- return 0;
-}
-
-int
-alloc_shared_hugetlb_pages (int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- struct inode *inode;
- struct address_space *mapping;
- struct page *page;
- int idx;
- int retval = -ENOMEM;
- int newalloc = 0;
-
-try_again:
- spin_lock(&htlbpage_lock);
- inode = find_key_inode(key);
- if (inode == NULL) {
- if (!capable(CAP_SYS_ADMIN)) {
- if (!in_group_p(0)) {
- retval = -EPERM;
- goto out_err;
- }
- }
- if (!(flag & IPC_CREAT)) {
- retval = -ENOENT;
- goto out_err;
- }
- inode = set_new_inode(len, prot, flag, key);
- if (inode == NULL)
- goto out_err;
- newalloc = 1;
- } else {
- if (check_size_prot(inode, len, prot, flag) < 0) {
- retval = -EINVAL;
- goto out_err;
- }
- else if (atomic_read(&inode->i_writecount)) {
- spin_unlock(&htlbpage_lock);
- goto try_again;
- }
- }
- spin_unlock(&htlbpage_lock);
- mapping = inode->i_mapping;
-
- addr = do_mmap_pgoff(NULL, addr, len, (unsigned long) prot,
- MAP_NORESERVE|MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, 0);
- if (IS_ERR((void *) addr))
- goto freeinode;
-
- vma = find_vma(mm, addr);
- if (!vma) {
- retval = -EINVAL;
- goto freeinode;
- }
-
- spin_lock(&mm->page_table_lock);
- do {
- pte_t *pte = huge_pte_alloc(mm, addr);
- if ((pte) && (pte_none(*pte))) {
- idx = (addr - vma->vm_start) >> HPAGE_SHIFT;
- page = find_get_page(mapping, idx);
- if (page == NULL) {
- page = alloc_hugetlb_page();
- if (page == NULL)
- goto out;
- add_to_page_cache(page, mapping, idx);
- }
- set_huge_pte(mm, vma, page, pte,
- (vma->vm_flags & VM_WRITE));
- } else
- goto out;
- addr += HPAGE_SIZE;
- } while (addr < vma->vm_end);
- retval = 0;
- vma->vm_flags |= (VM_HUGETLB | VM_RESERVED);
- vma->vm_ops = &hugetlb_vm_ops;
- spin_unlock(&mm->page_table_lock);
- spin_lock(&htlbpage_lock);
- atomic_set(&inode->i_writecount, 0);
- spin_unlock(&htlbpage_lock);
- return retval;
-out:
- if (addr > vma->vm_start) {
- unsigned long raddr = vma->vm_end;
- vma->vm_end = addr;
- zap_hugetlb_resources(vma);
- vma->vm_end = raddr;
- }
- spin_unlock(&mm->page_table_lock);
- do_munmap(mm, vma->vm_start, len);
- if (newalloc)
- goto freeinode;
- return retval;
-
-out_err:
- spin_unlock(&htlbpage_lock);
-freeinode:
- if (newalloc) {
- for (idx = 0; idx < MAX_ID; idx++)
- if (htlbpagek[idx].key == inode->i_ino) {
- htlbpagek[idx].key = 0;
- htlbpagek[idx].in = NULL;
- break;
- }
- kfree(inode);
- }
- return retval;
-}
-
-static int
-alloc_private_hugetlb_pages (int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- if (!capable(CAP_SYS_ADMIN)) {
- if (!in_group_p(0))
- return -EPERM;
- }
- addr = do_mmap_pgoff(NULL, addr, len, prot,
- MAP_NORESERVE | MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, 0);
- if (IS_ERR((void *) addr))
- return -ENOMEM;
- if (make_hugetlb_pages_present(addr, (addr + len), flag) < 0) {
- do_munmap(current->mm, addr, len);
- return -ENOMEM;
- }
- return 0;
-}
-
-int
-alloc_hugetlb_pages (int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- if (key > 0)
- return alloc_shared_hugetlb_pages(key, addr, len, prot, flag);
- else
- return alloc_private_hugetlb_pages(key, addr, len, prot, flag);
-}
-
-int
set_hugetlb_mem_size (int count)
{
int j, lcount;
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index 98e344a0111c..8a26073adb23 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -15,6 +15,7 @@
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/rtc.h>
+#include <linux/bcd.h>
#include <asm/rtc.h>
diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
index 683a34e815d4..b9b334e0db7f 100644
--- a/arch/m68k/sun3x/time.c
+++ b/arch/m68k/sun3x/time.c
@@ -11,6 +11,7 @@
#include <linux/kernel_stat.h>
#include <linux/interrupt.h>
#include <linux/rtc.h>
+#include <linux/bcd.h>
#include <asm/irq.h>
#include <asm/io.h>
@@ -36,9 +37,6 @@
#define C_SIGN 0x20
#define C_CALIB 0x1f
-#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
-#define BIN_TO_BCD(val) (((val/10) << 4) | (val % 10))
-
int sun3x_hwclk(int set, struct rtc_time *t)
{
volatile struct mostek_dt *h =
@@ -49,23 +47,23 @@ int sun3x_hwclk(int set, struct rtc_time *t)
if(set) {
h->csr |= C_WRITE;
- h->sec = BIN_TO_BCD(t->tm_sec);
- h->min = BIN_TO_BCD(t->tm_min);
- h->hour = BIN_TO_BCD(t->tm_hour);
- h->wday = BIN_TO_BCD(t->tm_wday);
- h->mday = BIN_TO_BCD(t->tm_mday);
- h->month = BIN_TO_BCD(t->tm_mon);
- h->year = BIN_TO_BCD(t->tm_year);
+ h->sec = BIN2BCD(t->tm_sec);
+ h->min = BIN2BCD(t->tm_min);
+ h->hour = BIN2BCD(t->tm_hour);
+ h->wday = BIN2BCD(t->tm_wday);
+ h->mday = BIN2BCD(t->tm_mday);
+ h->month = BIN2BCD(t->tm_mon);
+ h->year = BIN2BCD(t->tm_year);
h->csr &= ~C_WRITE;
} else {
h->csr |= C_READ;
- t->tm_sec = BCD_TO_BIN(h->sec);
- t->tm_min = BCD_TO_BIN(h->min);
- t->tm_hour = BCD_TO_BIN(h->hour);
- t->tm_wday = BCD_TO_BIN(h->wday);
- t->tm_mday = BCD_TO_BIN(h->mday);
- t->tm_mon = BCD_TO_BIN(h->month);
- t->tm_year = BCD_TO_BIN(h->year);
+ t->tm_sec = BCD2BIN(h->sec);
+ t->tm_min = BCD2BIN(h->min);
+ t->tm_hour = BCD2BIN(h->hour);
+ t->tm_wday = BCD2BIN(h->wday);
+ t->tm_mday = BCD2BIN(h->mday);
+ t->tm_mon = BCD2BIN(h->month);
+ t->tm_year = BCD2BIN(h->year);
h->csr &= ~C_READ;
}
diff --git a/arch/mips/au1000/common/serial.c b/arch/mips/au1000/common/serial.c
index c9540cb700f3..52438fc03f93 100644
--- a/arch/mips/au1000/common/serial.c
+++ b/arch/mips/au1000/common/serial.c
@@ -2682,9 +2682,9 @@ static int __init rs_init(void)
(state->flags & ASYNC_FOURPORT) ? " FourPort" : "",
state->port, state->irq,
uart_config[state->type].name);
- tty_register_devfs(&serial_driver, 0,
+ tty_register_device(&serial_driver,
serial_driver.minor_start + state->line);
- tty_register_devfs(&callout_driver, 0,
+ tty_register_device(&callout_driver,
callout_driver.minor_start + state->line);
}
return 0;
@@ -2772,9 +2772,9 @@ int register_serial(struct serial_struct *req)
state->iomem_base ? "iomem" : "port",
state->iomem_base ? (unsigned long)state->iomem_base :
state->port, state->irq, uart_config[state->type].name);
- tty_register_devfs(&serial_driver, 0,
+ tty_register_device(&serial_driver,
serial_driver.minor_start + state->line);
- tty_register_devfs(&callout_driver, 0,
+ tty_register_device(&callout_driver,
callout_driver.minor_start + state->line);
return state->line + SERIAL_DEV_OFFSET;
}
@@ -2801,9 +2801,9 @@ void unregister_serial(int line)
/* These will be hidden, because they are devices that will no longer
* be available to the system. (ie, PCMCIA modems, once ejected)
*/
- tty_unregister_devfs(&serial_driver,
+ tty_unregister_device(&serial_driver,
serial_driver.minor_start + state->line);
- tty_unregister_devfs(&callout_driver,
+ tty_unregister_device(&callout_driver,
callout_driver.minor_start + state->line);
restore_flags(flags);
}
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
index 91ea9749eda0..e8b37abad543 100644
--- a/arch/mips/ddb5xxx/common/rtc_ds1386.c
+++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c
@@ -20,6 +20,7 @@
#include <linux/types.h>
#include <linux/time.h>
+#include <linux/bcd.h>
#include <asm/time.h>
#include <asm/addrspace.h>
@@ -28,12 +29,6 @@
#define EPOCH 2000
-#undef BCD_TO_BIN
-#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
-
-#undef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10)
-
#define READ_RTC(x) *(volatile unsigned char*)(rtc_base+x)
#define WRITE_RTC(x, y) *(volatile unsigned char*)(rtc_base+x) = y
@@ -52,11 +47,11 @@ rtc_ds1386_get_time(void)
WRITE_RTC(0xB, byte);
/* read time data */
- year = BCD_TO_BIN(READ_RTC(0xA)) + EPOCH;
- month = BCD_TO_BIN(READ_RTC(0x9) & 0x1f);
- day = BCD_TO_BIN(READ_RTC(0x8));
- minute = BCD_TO_BIN(READ_RTC(0x2));
- second = BCD_TO_BIN(READ_RTC(0x1));
+ year = BCD2BIN(READ_RTC(0xA)) + EPOCH;
+ month = BCD2BIN(READ_RTC(0x9) & 0x1f);
+ day = BCD2BIN(READ_RTC(0x8));
+ minute = BCD2BIN(READ_RTC(0x2));
+ second = BCD2BIN(READ_RTC(0x1));
/* hour is special - deal with it later */
temp = READ_RTC(0x4);
@@ -68,11 +63,11 @@ rtc_ds1386_get_time(void)
/* calc hour */
if (temp & 0x40) {
/* 12 hour format */
- hour = BCD_TO_BIN(temp & 0x1f);
+ hour = BCD2BIN(temp & 0x1f);
if (temp & 0x20) hour += 12; /* PM */
} else {
/* 24 hour format */
- hour = BCD_TO_BIN(temp & 0x3f);
+ hour = BCD2BIN(temp & 0x3f);
}
return mktime(year, month, day, hour, minute, second);
@@ -95,19 +90,19 @@ rtc_ds1386_set_time(unsigned long t)
to_tm(t, &tm);
/* check each field one by one */
- year = BIN_TO_BCD(tm.tm_year - EPOCH);
+ year = BIN2BCD(tm.tm_year - EPOCH);
if (year != READ_RTC(0xA)) {
WRITE_RTC(0xA, year);
}
temp = READ_RTC(0x9);
- month = BIN_TO_BCD(tm.tm_mon);
+ month = BIN2BCD(tm.tm_mon);
if (month != (temp & 0x1f)) {
WRITE_RTC( 0x9,
(month & 0x1f) | (temp & ~0x1f) );
}
- day = BIN_TO_BCD(tm.tm_mday);
+ day = BIN2BCD(tm.tm_mday);
if (day != READ_RTC(0x8)) {
WRITE_RTC(0x8, day);
}
@@ -117,22 +112,22 @@ rtc_ds1386_set_time(unsigned long t)
/* 12 hour format */
hour = 0x40;
if (tm.tm_hour > 12) {
- hour |= 0x20 | (BIN_TO_BCD(hour-12) & 0x1f);
+ hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
} else {
- hour |= BIN_TO_BCD(tm.tm_hour);
+ hour |= BIN2BCD(tm.tm_hour);
}
} else {
/* 24 hour format */
- hour = BIN_TO_BCD(tm.tm_hour) & 0x3f;
+ hour = BIN2BCD(tm.tm_hour) & 0x3f;
}
if (hour != temp) WRITE_RTC(0x4, hour);
- minute = BIN_TO_BCD(tm.tm_min);
+ minute = BIN2BCD(tm.tm_min);
if (minute != READ_RTC(0x2)) {
WRITE_RTC(0x2, minute);
}
- second = BIN_TO_BCD(tm.tm_sec);
+ second = BIN2BCD(tm.tm_sec);
if (second != READ_RTC(0x1)) {
WRITE_RTC(0x1, second);
}
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 9188af33f678..c7c5640a7d61 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -16,6 +16,7 @@
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
+#include <linux/bcd.h>
#include <asm/cpu.h>
#include <asm/bootinfo.h>
diff --git a/arch/mips/kernel/old-time.c b/arch/mips/kernel/old-time.c
index a58202bfae6f..4793acd60c19 100644
--- a/arch/mips/kernel/old-time.c
+++ b/arch/mips/kernel/old-time.c
@@ -16,6 +16,7 @@
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
+#include <linux/bcd.h>
#include <asm/bootinfo.h>
#include <asm/cpu.h>
diff --git a/arch/mips64/sgi-ip27/ip27-rtc.c b/arch/mips64/sgi-ip27/ip27-rtc.c
index f7983dbb570f..3a71a4b8b2fd 100644
--- a/arch/mips64/sgi-ip27/ip27-rtc.c
+++ b/arch/mips64/sgi-ip27/ip27-rtc.c
@@ -35,6 +35,7 @@
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/smp_lock.h>
+#include <linux/bcd.h>
#include <asm/m48t35.h>
#include <asm/sn/ioc3.h>
diff --git a/arch/mips64/sgi-ip27/ip27-timer.c b/arch/mips64/sgi-ip27/ip27-timer.c
index e0251cd0d379..d4ed43d11d66 100644
--- a/arch/mips64/sgi-ip27/ip27-timer.c
+++ b/arch/mips64/sgi-ip27/ip27-timer.c
@@ -11,6 +11,7 @@
#include <linux/param.h>
#include <linux/timex.h>
#include <linux/mm.h>
+#include <linux/bcd.h>
#include <asm/pgtable.h>
#include <asm/sgialib.h>
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index 50dd06819c85..7ea4390aed85 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -706,6 +706,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_boot_cpus();
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_present_mask);
+}
+
int __devinit __cpu_up(unsigned int cpu)
{
return cpu_online(cpu) ? 0 : -ENOSYS;
diff --git a/arch/ppc/iSeries/mf.c b/arch/ppc/iSeries/mf.c
index aa822233e43c..59b178279734 100644
--- a/arch/ppc/iSeries/mf.c
+++ b/arch/ppc/iSeries/mf.c
@@ -40,6 +40,7 @@
#include <asm/iSeries/iSeries_proc.h>
#include <asm/uaccess.h>
#include <linux/pci.h>
+#include <linux/bcd.h>
/*
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index 6a10bcbe7579..8b5270afcdba 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -351,6 +351,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_ops->space_timers(num_cpus);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_possible_map);
+}
+
int __init setup_profiling_timer(unsigned int multiplier)
{
return 0;
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
index 9a5333428f2c..a7e4e5a81429 100644
--- a/arch/ppc/platforms/chrp_time.c
+++ b/arch/ppc/platforms/chrp_time.c
@@ -20,6 +20,7 @@
#include <linux/kernel_stat.h>
#include <linux/mc146818rtc.h>
#include <linux/init.h>
+#include <linux/bcd.h>
#include <asm/segment.h>
#include <asm/io.h>
diff --git a/arch/ppc/platforms/gemini_setup.c b/arch/ppc/platforms/gemini_setup.c
index 41458519f54b..dc976899f604 100644
--- a/arch/ppc/platforms/gemini_setup.c
+++ b/arch/ppc/platforms/gemini_setup.c
@@ -24,6 +24,7 @@
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
+#include <linux/bcd.h>
#include <asm/system.h>
#include <asm/pgtable.h>
diff --git a/arch/ppc/platforms/prep_time.c b/arch/ppc/platforms/prep_time.c
index 49ac7d2638ed..4c75081fd178 100644
--- a/arch/ppc/platforms/prep_time.c
+++ b/arch/ppc/platforms/prep_time.c
@@ -19,6 +19,7 @@
#include <linux/timex.h>
#include <linux/kernel_stat.h>
#include <linux/init.h>
+#include <linux/bcd.h>
#include <asm/sections.h>
#include <asm/segment.h>
diff --git a/arch/ppc/syslib/todc_time.c b/arch/ppc/syslib/todc_time.c
index 9591c7ee0eef..85ee80b4e581 100644
--- a/arch/ppc/syslib/todc_time.c
+++ b/arch/ppc/syslib/todc_time.c
@@ -19,6 +19,7 @@
#include <linux/kernel.h>
#include <linux/time.h>
#include <linux/timex.h>
+#include <linux/bcd.h>
#include <asm/machdep.h>
#include <asm/io.h>
diff --git a/arch/ppc64/kernel/mf.c b/arch/ppc64/kernel/mf.c
index 3999ea9ee813..876570387150 100644
--- a/arch/ppc64/kernel/mf.c
+++ b/arch/ppc64/kernel/mf.c
@@ -40,6 +40,7 @@
#include <asm/iSeries/iSeries_proc.h>
#include <asm/uaccess.h>
#include <linux/pci.h>
+#include <linux/bcd.h>
extern struct pci_dev * iSeries_vio_dev;
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index 5ace02abc1bc..c0f714551a0d 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -32,6 +32,7 @@
#include <linux/poll.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
+#include <linux/bcd.h>
#include <asm/io.h>
#include <asm/uaccess.h>
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
index 7db75666d205..eeae9cb81e58 100644
--- a/arch/ppc64/kernel/smp.c
+++ b/arch/ppc64/kernel/smp.c
@@ -604,6 +604,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_space_timers(max_cpus);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ /* FIXME: what about cpu_possible()? */
+}
+
int __devinit __cpu_up(unsigned int cpu)
{
struct pt_regs regs;
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index a9dc74a7ca5d..e02e5c8c47fe 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -572,6 +572,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
set_prefix((u32) lowcore_ptr[smp_processor_id()]);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_possible_map);
+}
+
void smp_cpus_done(unsigned int max_cpus)
{
}
diff --git a/arch/s390x/kernel/smp.c b/arch/s390x/kernel/smp.c
index 11b0d8f1d24e..8abfde52cb9a 100644
--- a/arch/s390x/kernel/smp.c
+++ b/arch/s390x/kernel/smp.c
@@ -554,6 +554,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
set_prefix((u32)(u64) lowcore_ptr[smp_processor_id()]);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_possible_map);
+}
+
void smp_cpus_done(unsigned int max_cpis)
{
}
diff --git a/arch/sh/kernel/rtc.c b/arch/sh/kernel/rtc.c
index 6eb2f2cb4a8a..08a029f5e3c1 100644
--- a/arch/sh/kernel/rtc.c
+++ b/arch/sh/kernel/rtc.c
@@ -9,18 +9,11 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/time.h>
+#include <linux/bcd.h>
#include <asm/io.h>
#include <asm/rtc.h>
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
void sh_rtc_gettimeofday(struct timeval *tv)
{
unsigned int sec128, sec, min, hr, wk, day, mon, yr, yr100;
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 64963cd4e949..52c390c34dd8 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -1246,6 +1246,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_store_cpu_info(boot_cpu_id);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &phys_cpu_present_map);
+}
+
int __devinit __cpu_up(unsigned int cpu)
{
int ret = smp_boot_one_cpu(cpu);
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index ea1ef755bd9d..4ce757bf8b8d 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -13,7 +13,6 @@
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/mm.h>
-#include <linux/hugetlb.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
@@ -682,100 +681,3 @@ sys_perfctr(int opcode, unsigned long arg0, unsigned long arg1, unsigned long ar
};
return err;
}
-
-#ifdef CONFIG_HUGETLB_PAGE
-#define HPAGE_ALIGN(x) (((unsigned long)x + (HPAGE_SIZE -1)) & HPAGE_MASK)
-extern long sys_munmap(unsigned long, size_t);
-
-/* get_addr function gets the currently unused virtual range in
- * the current process's address space. It returns the LARGE_PAGE_SIZE
- * aligned address (in cases of success). Other kernel generic
- * routines only could gurantee that allocated address is PAGE_SIZE aligned.
- */
-static long get_addr(unsigned long addr, unsigned long len)
-{
- struct vm_area_struct *vma;
- if (addr) {
- addr = HPAGE_ALIGN(addr);
- vma = find_vma(current->mm, addr);
- if (((TASK_SIZE - len) >= addr) &&
- (!vma || addr + len <= vma->vm_start))
- goto found_addr;
- }
- addr = HPAGE_ALIGN(TASK_UNMAPPED_BASE);
- for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
- if (TASK_SIZE - len < addr)
- return -ENOMEM;
- if (!vma || ((addr + len) < vma->vm_start))
- goto found_addr;
- addr = vma->vm_end;
- }
-found_addr:
- addr = HPAGE_ALIGN(addr);
- return addr;
-}
-
-extern int alloc_hugetlb_pages(int, unsigned long, unsigned long, int, int);
-
-asmlinkage long
-sys_alloc_hugepages(int key, unsigned long addr, unsigned long len, int prot, int flag)
-{
- struct mm_struct *mm = current->mm;
- unsigned long raddr;
- int retval;
-
- if (key < 0)
- return -EINVAL;
- if (len & (HPAGE_SIZE - 1))
- return -EINVAL;
- down_write(&mm->mmap_sem);
- raddr = get_addr(addr, len);
- retval = 0;
- if (raddr == -ENOMEM) {
- retval = -ENOMEM;
- goto raddr_out;
- }
- retval = alloc_hugetlb_pages(key, raddr, len, prot, flag);
-
-raddr_out:
- up_write(&mm->mmap_sem);
- if (retval < 0)
- return (long) retval;
-
- return raddr;
-}
-
-extern int free_hugepages(struct vm_area_struct *);
-
-asmlinkage int
-sys_free_hugepages(unsigned long addr)
-{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- int retval;
-
- vma = find_vma(current->mm, addr);
- if ((!vma) || (!is_vm_hugetlb_page(vma)) || (vma->vm_start!=addr))
- return -EINVAL;
- down_write(&mm->mmap_sem);
- spin_lock(&mm->page_table_lock);
- retval = free_hugepages(vma);
- spin_unlock(&mm->page_table_lock);
- up_write(&mm->mmap_sem);
- return retval;
-}
-
-#else
-
-asmlinkage long
-sys_alloc_hugepages(int key, unsigned long addr, size_t len, int prot, int flag)
-{
- return -ENOSYS;
-}
-asmlinkage int
-sys_free_hugepages(unsigned long addr)
-{
- return -ENOSYS;
-}
-
-#endif
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 1ba169fdf62f..8321c00cbb0b 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -65,8 +65,11 @@ sys_call_table32:
.word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys_getpgid
.word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
-/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_alloc_hugepages
- .word sys_free_hugepages, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
+
+ /* 234 and 235 were for the hugetlb syscalls. They can be reused */
+
+/*230*/ .word sys32_select, sys_time, sys_nis_syscall, sys_stime, sys_ni_syscall
+ .word sys_ni_syscall, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
.word sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
/*250*/ .word sys32_mremap, sys32_sysctl, sys_getsid, sys_fdatasync, sys32_nfsservctl
@@ -124,6 +127,9 @@ sys_call_table:
.word sys_ipc, sys_nis_syscall, sys_clone, sys_nis_syscall, sys_adjtimex
/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
.word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid
+
+ /* 234 and 235 were for the hugetlb syscalls. They can be reused */
+
/*230*/ .word sys_select, sys_nis_syscall, sys_nis_syscall, sys_stime, sys_nis_syscall
.word sys_nis_syscall, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
/*240*/ .word sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index cdb33d996328..3c48ed49ea5a 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -23,6 +23,7 @@
#include <linux/mc146818rtc.h>
#include <linux/delay.h>
#include <linux/profile.h>
+#include <linux/bcd.h>
#include <asm/oplib.h>
#include <asm/mostek.h>
@@ -330,14 +331,6 @@ static int __init has_low_battery(void)
return (data1 == data2); /* Was the write blocked? */
}
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10)
-#endif
-
/* Probe for the real time clock chip. */
static void __init set_system_time(void)
{
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 3503ed13f59a..ad740a718957 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -186,6 +186,11 @@ void smp_prepare_cpus(unsigned int maxcpus)
}
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+}
+
int __cpu_up(unsigned int cpu)
{
set_bit(cpu, &smp_commenced_mask);
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index e7acfed4bf2a..a305c3916e64 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -962,6 +962,12 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
smp_boot_cpus(max_cpus);
}
+void __devinit smp_prepare_boot_cpu(void)
+{
+ set_bit(smp_processor_id(), &cpu_online_map);
+ set_bit(smp_processor_id(), &cpu_callout_map);
+}
+
int __devinit __cpu_up(unsigned int cpu)
{
/* This only works at boot for x86. See "rewrite" above. */
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 67d2cf41c2ed..65a2c76f0021 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -21,6 +21,7 @@
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/bcd.h>
#include <asm/vsyscall.h>
#include <asm/timex.h>
diff --git a/crypto/api.c b/crypto/api.c
index 64886f4d6335..386b04ae587e 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -24,7 +24,7 @@ DECLARE_RWSEM(crypto_alg_sem);
static inline int crypto_alg_get(struct crypto_alg *alg)
{
- return try_inc_mod_count(alg->cra_module);
+ return try_module_get(alg->cra_module);
}
static inline void crypto_alg_put(struct crypto_alg *alg)
diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c
index 115078c60d4c..05ed2e52c190 100644
--- a/drivers/acorn/char/pcf8583.c
+++ b/drivers/acorn/char/pcf8583.c
@@ -14,6 +14,7 @@
#include <linux/string.h>
#include <linux/mc146818rtc.h>
#include <linux/init.h>
+#include <linux/bcd.h>
#include "pcf8583.h"
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index e84ceeb85eeb..cdb4fe6d5b4f 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -16,6 +16,7 @@
#include <linux/device.h>
#include <linux/suspend.h>
#include <linux/seq_file.h>
+#include <linux/bcd.h>
#include <asm/uaccess.h>
#include <asm/acpi.h>
diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c
index c133b454b2fb..c7541b2fe264 100644
--- a/drivers/block/genhd.c
+++ b/drivers/block/genhd.c
@@ -160,7 +160,7 @@ retry:
read_unlock(&gendisk_lock);
return NULL;
}
- if (!try_inc_mod_count(p->owner))
+ if (!try_module_get(p->owner))
continue;
owner = p->owner;
data = p->data;
@@ -422,7 +422,7 @@ struct gendisk *get_disk(struct gendisk *disk)
if (!disk->fops)
return NULL;
owner = disk->fops->owner;
- if (owner && !try_inc_mod_count(owner))
+ if (owner && !try_module_get(owner))
return NULL;
return to_disk(kobject_get(&disk->kobj));
}
diff --git a/drivers/char/busmouse.c b/drivers/char/busmouse.c
index 85baa0cdf51b..c574177b5418 100644
--- a/drivers/char/busmouse.c
+++ b/drivers/char/busmouse.c
@@ -200,7 +200,7 @@ static int busmouse_open(struct inode *inode, struct file *file)
if (!mse || !mse->ops) /* shouldn't happen, but... */
goto end;
- if (mse->ops->owner && !try_inc_mod_count(mse->ops->owner))
+ if (!try_module_get(mse->ops->owner))
goto end;
ret = 0;
diff --git a/drivers/char/dz.c b/drivers/char/dz.c
index f67afe1e21ba..db281901522d 100644
--- a/drivers/char/dz.c
+++ b/drivers/char/dz.c
@@ -1425,9 +1425,9 @@ int __init dz_init(void)
printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line,
info->port, SERIAL);
- tty_register_devfs(&serial_driver, 0,
+ tty_register_device(&serial_driver,
serial_driver.minor_start + info->line);
- tty_register_devfs(&callout_driver, 0,
+ tty_register_device(&callout_driver,
callout_driver.minor_start + info->line);
}
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 7b9b42bc2729..b3fe12431691 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -279,7 +279,7 @@ int __init hvc_init(void)
for (i = 0; i < hvc_driver.num; i++) {
hvc_struct[i].lock = SPIN_LOCK_UNLOCKED;
hvc_struct[i].index = i;
- tty_register_devfs(&hvc_driver, 0, hvc_driver.minor_start + i);
+ tty_register_device(&hvc_driver, hvc_driver.minor_start + i);
}
if (tty_register_driver(&hvc_driver))
diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c
index c43a7f6e569b..1fbc0eb7fb79 100644
--- a/drivers/char/ip2main.c
+++ b/drivers/char/ip2main.c
@@ -899,11 +899,11 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
{
if ( pB->i2eChannelMap[box] & (1 << j) )
{
- tty_register_devfs(&ip2_tty_driver,
- 0, j + ABS_BIGGEST_BOX *
+ tty_register_device(&ip2_tty_driver,
+ j + ABS_BIGGEST_BOX *
(box+i*ABS_MAX_BOXES));
- tty_register_devfs(&ip2_callout_driver,
- 0, j + ABS_BIGGEST_BOX *
+ tty_register_device(&ip2_callout_driver,
+ j + ABS_BIGGEST_BOX *
(box+i*ABS_MAX_BOXES));
}
}
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index dc050fbf9baf..34304a4dcb7f 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -48,10 +48,6 @@
#define IS_CONSOLE_DEV(dev) (kdev_val(dev) == __mkdev(TTY_MAJOR,0))
#define IS_SYSCONS_DEV(dev) (kdev_val(dev) == __mkdev(TTYAUX_MAJOR,1))
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
/* number of characters left in xmit buffer before select has we have room */
#define WAKEUP_CHARS 256
@@ -725,16 +721,18 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
if (tty->real_raw) {
spin_lock_irqsave(&tty->read_lock, cpuflags);
- i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
- N_TTY_BUF_SIZE - tty->read_head));
+ i = min(N_TTY_BUF_SIZE - tty->read_cnt,
+ N_TTY_BUF_SIZE - tty->read_head);
+ i = min(count, i);
memcpy(tty->read_buf + tty->read_head, cp, i);
tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
tty->read_cnt += i;
cp += i;
count -= i;
- i = MIN(count, MIN(N_TTY_BUF_SIZE - tty->read_cnt,
- N_TTY_BUF_SIZE - tty->read_head));
+ i = min(N_TTY_BUF_SIZE - tty->read_cnt,
+ N_TTY_BUF_SIZE - tty->read_head);
+ i = min(count, i);
memcpy(tty->read_buf + tty->read_head, cp, i);
tty->read_head = (tty->read_head + i) & (N_TTY_BUF_SIZE-1);
tty->read_cnt += i;
@@ -915,7 +913,8 @@ static inline int copy_from_read_buf(struct tty_struct *tty,
retval = 0;
spin_lock_irqsave(&tty->read_lock, flags);
- n = MIN(*nr, MIN(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail));
+ n = min(tty->read_cnt, N_TTY_BUF_SIZE - tty->read_tail);
+ n = min((ssize_t)*nr, n);
spin_unlock_irqrestore(&tty->read_lock, flags);
if (n) {
mb();
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 9ae96fac0835..5c23c6b2ec63 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -64,8 +64,6 @@ static struct termios *pts_termios_locked[UNIX98_NR_MAJORS][NR_PTYS];
static struct pty_struct ptm_state[UNIX98_NR_MAJORS][NR_PTYS];
#endif
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-
static void pty_close(struct tty_struct * tty, struct file * filp)
{
if (!tty)
@@ -97,7 +95,7 @@ static void pty_close(struct tty_struct * tty, struct file * filp)
}
}
#endif
- tty_unregister_devfs (&tty->link->driver, minor(tty->device));
+ tty_unregister_device (&tty->link->driver, minor(tty->device));
tty_vhangup(tty->link);
}
}
@@ -156,7 +154,7 @@ static int pty_write(struct tty_struct * tty, int from_user,
n = count;
if (!n) break;
- n = MIN(n, PTY_BUF_SIZE);
+ n = min(n, PTY_BUF_SIZE);
n -= copy_from_user(temp_buffer, buf, n);
if (!n) {
if (!c)
@@ -307,6 +305,7 @@ static void pty_flush_buffer(struct tty_struct *tty)
}
}
+extern void tty_register_devfs (struct tty_driver *driver, unsigned int flags, unsigned minor);
static int pty_open(struct tty_struct *tty, struct file * filp)
{
int retval;
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 5bb5d2929005..48f0b8202da5 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -660,14 +660,16 @@ void batch_entropy_store(u32 a, u32 b, int num)
batch_entropy_credit[batch_head] = num;
new = (batch_head+1) & (batch_max-1);
- if (new != batch_tail) {
+ if ((unsigned)(new - batch_tail) >= (unsigned)(batch_max / 2)) {
/*
* Schedule it for the next timer tick:
*/
schedule_delayed_work(&batch_work, 1);
batch_head = new;
- } else {
+ } else if (new == batch_tail) {
DEBUG_ENT("batch entropy buffer full\n");
+ } else {
+ batch_head = new;
}
}
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 75dffcb2b48c..1e5f4c6ec5a1 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -72,6 +72,7 @@
#include <linux/spinlock.h>
#include <linux/sysctl.h>
#include <linux/wait.h>
+#include <linux/bcd.h>
#include <asm/current.h>
#include <asm/uaccess.h>
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 4d94c4de5c46..d39c31afe0e4 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -90,6 +90,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
+#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -158,13 +159,6 @@ extern void tx3912_console_init(void);
extern void tx3912_rs_init(void);
extern void hvc_console_init(void);
-#ifndef MIN
-#define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef MAX
-#define MAX(a,b) ((a) < (b) ? (b) : (a))
-#endif
-
static struct tty_struct *alloc_tty_struct(void)
{
struct tty_struct *tty;
@@ -713,7 +707,7 @@ static inline ssize_t do_tty_write(
unlock_kernel();
} else {
for (;;) {
- unsigned long size = MAX(PAGE_SIZE*2,16384);
+ unsigned long size = max((unsigned long)PAGE_SIZE*2, 16384UL);
if (size > count)
size = count;
lock_kernel();
@@ -1351,7 +1345,7 @@ retry_open:
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
minor -= driver->minor_start;
devpts_pty_new(driver->other->name_base + minor, MKDEV(driver->other->major, minor + driver->other->minor_start));
- tty_register_devfs(&pts_driver[major], DEVFS_FL_DEFAULT,
+ tty_register_device(&pts_driver[major],
pts_driver[major].minor_start + minor);
noctty = 1;
goto init_dev_done;
@@ -2038,9 +2032,6 @@ void tty_default_put_char(struct tty_struct *tty, unsigned char ch)
tty->driver.write(tty, 0, &ch, 1);
}
-/*
- * Register a tty device described by <driver>, with minor number <minor>.
- */
void tty_register_devfs (struct tty_driver *driver, unsigned int flags, unsigned minor)
{
#ifdef CONFIG_DEVFS_FS
@@ -2077,8 +2068,21 @@ void tty_unregister_devfs (struct tty_driver *driver, unsigned minor)
devfs_remove(driver->name, minor-driver->minor_start+driver->name_base);
}
-EXPORT_SYMBOL(tty_register_devfs);
-EXPORT_SYMBOL(tty_unregister_devfs);
+/*
+ * Register a tty device described by <driver>, with minor number <minor>.
+ */
+void tty_register_device (struct tty_driver *driver, unsigned minor)
+{
+ tty_register_devfs(driver, 0, minor);
+}
+
+void tty_unregister_device (struct tty_driver *driver, unsigned minor)
+{
+ tty_unregister_devfs(driver, minor);
+}
+
+EXPORT_SYMBOL(tty_register_device);
+EXPORT_SYMBOL(tty_unregister_device);
/*
* Called by a tty driver to register itself.
@@ -2104,7 +2108,7 @@ int tty_register_driver(struct tty_driver *driver)
if ( !(driver->flags & TTY_DRIVER_NO_DEVFS) ) {
for(i = 0; i < driver->num; i++)
- tty_register_devfs(driver, 0, driver->minor_start + i);
+ tty_register_device(driver, driver->minor_start + i);
}
proc_tty_register_driver(driver);
return error;
@@ -2159,7 +2163,7 @@ int tty_unregister_driver(struct tty_driver *driver)
driver->termios_locked[i] = NULL;
kfree(tp);
}
- tty_unregister_devfs(driver, driver->minor_start + i);
+ tty_unregister_device(driver, driver->minor_start + i);
}
proc_tty_unregister_driver(driver);
return 0;
@@ -2261,12 +2265,19 @@ static struct tty_driver dev_console_driver;
extern int vty_init(void);
#endif
+struct device_class tty_devclass = {
+ .name = "tty",
+};
+EXPORT_SYMBOL(tty_devclass);
+
/*
* Ok, now we can initialize the rest of the tty devices and can count
* on memory allocations, interrupts etc..
*/
void __init tty_init(void)
{
+ devclass_register(&tty_devclass);
+
/*
* dev_tty_driver and dev_console_driver are actually magic
* devices which get redirected at open time. Nevertheless,
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0be0bd218bfc..0920a11c3683 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2646,7 +2646,7 @@ static void __init con_init_devfs (void)
int i;
for (i = 0; i < console_driver.num; i++)
- tty_register_devfs (&console_driver, DEVFS_FL_DEFAULT,
+ tty_register_device (&console_driver,
console_driver.minor_start + i);
}
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c
index aba96ef80719..b2627572924e 100644
--- a/drivers/i2c/busses/i2c-amd756.c
+++ b/drivers/i2c/busses/i2c-amd756.c
@@ -296,17 +296,6 @@ static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
return 0;
}
-static void amd756_inc(struct i2c_adapter *adapter)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void amd756_dec(struct i2c_adapter *adapter)
-{
-
- MOD_DEC_USE_COUNT;
-}
-
static u32 amd756_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE |
@@ -322,11 +311,10 @@ static struct i2c_algorithm smbus_algorithm = {
};
static struct i2c_adapter amd756_adapter = {
+ .owner = THIS_MODULE,
.name = "unset",
.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD756,
.algo = &smbus_algorithm,
- .inc_use = amd756_inc,
- .dec_use = amd756_dec,
};
enum chiptype { AMD756, AMD766, AMD768, NFORCE };
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c
index ac2f741d3843..eff6dd081745 100644
--- a/drivers/i2c/busses/i2c-amd8111.c
+++ b/drivers/i2c/busses/i2c-amd8111.c
@@ -320,16 +320,6 @@ s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags,
return 0;
}
-void amd8111_inc(struct i2c_adapter *adapter)
-{
- MOD_INC_USE_COUNT;
-}
-
-void amd8111_dec(struct i2c_adapter *adapter)
-{
- MOD_DEC_USE_COUNT;
-}
-
u32 amd8111_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA |
@@ -368,12 +358,11 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_
return -1;
}
+ smbus->adapter.owner = THIS_MODULE;
sprintf(smbus->adapter.name, "SMBus2 AMD8111 adapter at %04x", smbus->base);
smbus->adapter.id = I2C_ALGO_SMBUS | I2C_HW_SMBUS_AMD8111;
smbus->adapter.algo = &smbus_algorithm;
smbus->adapter.algo_data = smbus;
- smbus->adapter.inc_use = amd8111_inc;
- smbus->adapter.dec_use = amd8111_dec;
if (i2c_add_adapter(&smbus->adapter)) {
printk(KERN_WARNING "i2c-amd8111.c: Failed to register adapter.\n");
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
index abab348e5b1b..19c4fed60425 100644
--- a/drivers/i2c/chips/adm1021.c
+++ b/drivers/i2c/chips/adm1021.c
@@ -23,9 +23,20 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
-#include <linux/sensors.h>
+#include <linux/i2c-proc.h>
#include <linux/init.h>
+/* Registers */
+#define ADM1021_SYSCTL_TEMP 1200
+#define ADM1021_SYSCTL_REMOTE_TEMP 1201
+#define ADM1021_SYSCTL_DIE_CODE 1202
+#define ADM1021_SYSCTL_ALARMS 1203
+
+#define ADM1021_ALARM_TEMP_HIGH 0x40
+#define ADM1021_ALARM_TEMP_LOW 0x20
+#define ADM1021_ALARM_RTEMP_HIGH 0x10
+#define ADM1021_ALARM_RTEMP_LOW 0x08
+#define ADM1021_ALARM_RTEMP_NA 0x04
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
@@ -114,8 +125,6 @@ static void adm1021_init_client(struct i2c_client *client);
static int adm1021_detach_client(struct i2c_client *client);
static int adm1021_command(struct i2c_client *client, unsigned int cmd,
void *arg);
-static void adm1021_inc_use(struct i2c_client *client);
-static void adm1021_dec_use(struct i2c_client *client);
static int adm1021_read_value(struct i2c_client *client, u8 reg);
static int adm1021_write_value(struct i2c_client *client, u8 reg,
u16 value);
@@ -136,14 +145,13 @@ static int read_only = 0;
/* This is the driver that will be inserted */
static struct i2c_driver adm1021_driver = {
- /* name */ "ADM1021, MAX1617 sensor driver",
- /* id */ I2C_DRIVERID_ADM1021,
- /* flags */ I2C_DF_NOTIFY,
- /* attach_adapter */ &adm1021_attach_adapter,
- /* detach_client */ &adm1021_detach_client,
- /* command */ &adm1021_command,
- /* inc_use */ &adm1021_inc_use,
- /* dec_use */ &adm1021_dec_use
+ .owner = THIS_MODULE,
+ .name = "ADM1021, MAX1617 sensor driver",
+ .id = I2C_DRIVERID_ADM1021,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = adm1021_attach_adapter,
+ .detach_client = adm1021_detach_client,
+ .command = adm1021_command,
};
/* These files are created for each detected adm1021. This is just a template;
@@ -375,16 +383,6 @@ int adm1021_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0;
}
-void adm1021_inc_use(struct i2c_client *client)
-{
- MOD_INC_USE_COUNT;
-}
-
-void adm1021_dec_use(struct i2c_client *client)
-{
- MOD_DEC_USE_COUNT;
-}
-
/* All registers are byte-sized */
int adm1021_read_value(struct i2c_client *client, u8 reg)
{
@@ -478,8 +476,9 @@ void adm1021_temp(struct i2c_client *client, int operation, int ctl_name,
void adm1021_remote_temp(struct i2c_client *client, int operation,
int ctl_name, int *nrels_mag, long *results)
{
-int prec=0;
struct adm1021_data *data = client->data;
+ int prec = 0;
+
if (operation == SENSORS_PROC_REAL_INFO)
if (data->type == adm1023) { *nrels_mag = 3; }
else { *nrels_mag = 0; }
diff --git a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
index 83b08f63c421..e628f4418420 100644
--- a/drivers/i2c/chips/lm75.c
+++ b/drivers/i2c/chips/lm75.c
@@ -22,10 +22,12 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
-#include <linux/sensors.h>
+#include <linux/i2c-proc.h>
#include <linux/init.h>
+#define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
+
/* Addresses to scan */
static unsigned short normal_i2c[] = { SENSORS_I2C_END };
static unsigned short normal_i2c_range[] = { 0x48, 0x4f, SENSORS_I2C_END };
@@ -72,8 +74,6 @@ static void lm75_init_client(struct i2c_client *client);
static int lm75_detach_client(struct i2c_client *client);
static int lm75_command(struct i2c_client *client, unsigned int cmd,
void *arg);
-static void lm75_inc_use(struct i2c_client *client);
-static void lm75_dec_use(struct i2c_client *client);
static u16 swap_bytes(u16 val);
static int lm75_read_value(struct i2c_client *client, u8 reg);
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value);
@@ -84,14 +84,12 @@ static void lm75_update_client(struct i2c_client *client);
/* This is the driver that will be inserted */
static struct i2c_driver lm75_driver = {
- /* name */ "LM75 sensor chip driver",
- /* id */ I2C_DRIVERID_LM75,
- /* flags */ I2C_DF_NOTIFY,
- /* attach_adapter */ &lm75_attach_adapter,
- /* detach_client */ &lm75_detach_client,
- /* command */ &lm75_command,
- /* inc_use */ &lm75_inc_use,
- /* dec_use */ &lm75_dec_use
+ .name = "LM75 sensor chip driver",
+ .id = I2C_DRIVERID_LM75,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = lm75_attach_adapter,
+ .detach_client = lm75_detach_client,
+ .command = lm75_command,
};
/* These files are created for each detected LM75. This is just a template;
@@ -221,24 +219,11 @@ int lm75_detect(struct i2c_adapter *adapter, int address,
int lm75_detach_client(struct i2c_client *client)
{
- int err;
-
-#ifdef MODULE
- if (MOD_IN_USE)
- return -EBUSY;
-#endif
-
- i2c_deregister_entry(((struct lm75_data *) (client->data))->
- sysctl_id);
-
- if ((err = i2c_detach_client(client))) {
- printk
- ("lm75.o: Client deregistration failed, client not detached.\n");
- return err;
- }
+ struct lm75_data *data = client->data;
+ i2c_deregister_entry(data->sysctl_id);
+ i2c_detach_client(client);
kfree(client);
-
return 0;
}
@@ -247,16 +232,6 @@ int lm75_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0;
}
-void lm75_inc_use(struct i2c_client *client)
-{
- MOD_INC_USE_COUNT;
-}
-
-void lm75_dec_use(struct i2c_client *client)
-{
- MOD_DEC_USE_COUNT;
-}
-
u16 swap_bytes(u16 val)
{
return (val >> 8) | (val << 8);
diff --git a/drivers/i2c/i2c-adap-ite.c b/drivers/i2c/i2c-adap-ite.c
index 9e2904c0f5e8..2c7b5103806c 100644
--- a/drivers/i2c/i2c-adap-ite.c
+++ b/drivers/i2c/i2c-adap-ite.c
@@ -184,35 +184,6 @@ static void iic_ite_release(void)
release_region(gpi.iic_base , 2);
}
-
-static int iic_ite_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-
-static int iic_ite_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-
-static void iic_ite_inc_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-}
-
-
-static void iic_ite_dec_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-}
-
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -228,14 +199,10 @@ static struct i2c_algo_iic_data iic_ite_data = {
};
static struct i2c_adapter iic_ite_ops = {
- "ITE IIC adapter",
- I2C_HW_I_IIC,
- NULL,
- &iic_ite_data,
- iic_ite_inc_use,
- iic_ite_dec_use,
- iic_ite_reg,
- iic_ite_unreg,
+ .owner = THIS_MODULE,
+ .name = "ITE IIC adapter",
+ .id = I2C_HW_I_IIC,
+ .algo_data = &iic_ite_data,
};
/* Called when the module is loaded. This function starts the
diff --git a/drivers/i2c/i2c-algo-bit.c b/drivers/i2c/i2c-algo-bit.c
index 9551f0d27e6f..73b9f304493c 100644
--- a/drivers/i2c/i2c-algo-bit.c
+++ b/drivers/i2c/i2c-algo-bit.c
@@ -529,14 +529,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,
};
/*
@@ -581,11 +578,7 @@ int i2c_bit_add_bus(struct i2c_adapter *adap)
printk("\n");
}
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
i2c_add_adapter(adap);
-
return 0;
}
@@ -599,9 +592,6 @@ int i2c_bit_del_bus(struct i2c_adapter *adap)
DEB2(printk(KERN_DEBUG "i2c-algo-bit.o: adapter unregistered: %s\n",adap->name));
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
return 0;
}
diff --git a/drivers/i2c/i2c-algo-ibm_ocp.c b/drivers/i2c/i2c-algo-ibm_ocp.c
index 77380200a2ef..3b345d2e9d78 100644
--- a/drivers/i2c/i2c-algo-ibm_ocp.c
+++ b/drivers/i2c/i2c-algo-ibm_ocp.c
@@ -877,7 +877,7 @@ static struct i2c_algorithm iic_algo = {
//
// Description: Register bus structure
//
-int i2c_iic_add_bus(struct i2c_adapter *adap)
+int i2c_ocp_add_bus(struct i2c_adapter *adap)
{
struct i2c_algo_iic_data *iic_adap = adap->algo_data;
@@ -912,7 +912,7 @@ int i2c_iic_add_bus(struct i2c_adapter *adap)
//
// Done
//
-int i2c_iic_del_bus(struct i2c_adapter *adap)
+int i2c_ocp_del_bus(struct i2c_adapter *adap)
{
int res;
if ((res = i2c_del_adapter(adap)) < 0)
@@ -942,8 +942,8 @@ void i2c_algo_iic_exit(void)
}
-EXPORT_SYMBOL(i2c_iic_add_bus);
-EXPORT_SYMBOL(i2c_iic_del_bus);
+EXPORT_SYMBOL(i2c_ocp_add_bus);
+EXPORT_SYMBOL(i2c_ocp_del_bus);
//
// The MODULE_* macros resolve to nothing if MODULES is not defined
diff --git a/drivers/i2c/i2c-algo-ibm_ocp.h b/drivers/i2c/i2c-algo-ibm_ocp.h
index e32e5af81b38..5a4e588f19ae 100644
--- a/drivers/i2c/i2c-algo-ibm_ocp.h
+++ b/drivers/i2c/i2c-algo-ibm_ocp.h
@@ -49,7 +49,7 @@ struct i2c_algo_iic_data {
#define I2C_IIC_ADAP_MAX 16
-int i2c_iic_add_bus(struct i2c_adapter *);
-int i2c_iic_del_bus(struct i2c_adapter *);
+int i2c_ocp_add_bus(struct i2c_adapter *);
+int i2c_ocp_del_bus(struct i2c_adapter *);
#endif /* I2C_ALGO_IIC_H */
diff --git a/drivers/i2c/i2c-algo-pcf.c b/drivers/i2c/i2c-algo-pcf.c
index 000b34a84d4c..ffa237cfa2f4 100644
--- a/drivers/i2c/i2c-algo-pcf.c
+++ b/drivers/i2c/i2c-algo-pcf.c
@@ -474,10 +474,6 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
return i;
}
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-
i2c_add_adapter(adap);
/* scan bus */
@@ -509,15 +505,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *adap)
int i2c_pcf_del_bus(struct i2c_adapter *adap)
{
- int res;
- if ((res = i2c_del_adapter(adap)) < 0)
- return res;
- DEB2(printk(KERN_DEBUG "i2c-algo-pcf.o: adapter unregistered: %s\n",adap->name));
-
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
- return 0;
+ return i2c_del_adapter(adap);
}
EXPORT_SYMBOL(i2c_pcf_add_bus);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4ddcb6a26401..f9e41cc508bf 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -446,24 +446,23 @@ int i2c_detach_client(struct i2c_client *client)
return 0;
}
-void i2c_inc_use_client(struct i2c_client *client)
+static int i2c_inc_use_client(struct i2c_client *client)
{
- if (client->driver->inc_use != NULL)
- client->driver->inc_use(client);
+ if (!try_module_get(client->driver->owner))
+ return -ENODEV;
+ if (!try_module_get(client->adapter->owner)) {
+ module_put(client->driver->owner);
+ return -ENODEV;
+ }
- if (client->adapter->inc_use != NULL)
- client->adapter->inc_use(client->adapter);
+ return 0;
}
-void i2c_dec_use_client(struct i2c_client *client)
+static 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);
+ module_put(client->driver->owner);
+ module_put(client->adapter->owner);
}
struct i2c_client *i2c_get_client(int driver_id, int adapter_id,
@@ -535,20 +534,22 @@ 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 (!i2c_inc_use_client(client))
+ return -ENODEV;
+
+ if (client->flags & I2C_CLIENT_ALLOW_USE) {
+ if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE)
+ client->usage_count++;
+ else if (client->usage_count > 0)
+ goto busy;
+ else
client->usage_count++;
- else {
- if(client->usage_count > 0)
- return -EBUSY;
- else
- client->usage_count++;
- }
}
- i2c_inc_use_client(client);
-
return 0;
+ busy:
+ i2c_dec_use_client(client);
+ return -EBUSY;
}
int i2c_release_client(struct i2c_client *client)
@@ -1420,8 +1421,6 @@ EXPORT_SYMBOL(i2c_add_driver);
EXPORT_SYMBOL(i2c_del_driver);
EXPORT_SYMBOL(i2c_attach_client);
EXPORT_SYMBOL(i2c_detach_client);
-EXPORT_SYMBOL(i2c_inc_use_client);
-EXPORT_SYMBOL(i2c_dec_use_client);
EXPORT_SYMBOL(i2c_get_client);
EXPORT_SYMBOL(i2c_use_client);
EXPORT_SYMBOL(i2c_release_client);
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index a702cc953dc7..14d0081b98fe 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -138,9 +138,9 @@ static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
struct inode *inode = file->f_dentry->d_inode;
#endif /* DEBUG */
- if(count > 8192)
+ if (count > 8192)
count = 8192;
-
+
/* copy user space data to kernel space. */
tmp = kmalloc(count,GFP_KERNEL);
if (tmp==NULL)
@@ -364,8 +364,10 @@ int i2cdev_open (struct inode *inode, struct file *file)
client->adapter = i2cdev_adaps[minor];
file->private_data = client;
- if (i2cdev_adaps[minor]->inc_use)
- i2cdev_adaps[minor]->inc_use(i2cdev_adaps[minor]);
+ if (!try_module_get(i2cdev_adaps[minor]->owner)) {
+ kfree(client);
+ return -ENODEV;
+ }
#ifdef DEBUG
printk(KERN_DEBUG "i2c-dev.o: opened i2c-%d\n",minor);
@@ -381,10 +383,7 @@ static int i2cdev_release (struct inode *inode, struct file *file)
#ifdef DEBUG
printk(KERN_DEBUG "i2c-dev.o: Closed: i2c-%d\n", minor);
#endif
- lock_kernel();
- if (i2cdev_adaps[minor]->dec_use)
- i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]);
- unlock_kernel();
+ module_put(i2cdev_adaps[minor]->owner);
return 0;
}
diff --git a/drivers/i2c/i2c-elektor.c b/drivers/i2c/i2c-elektor.c
index f142e72e9b75..66ef1a818de2 100644
--- a/drivers/i2c/i2c-elektor.c
+++ b/drivers/i2c/i2c-elektor.c
@@ -38,7 +38,6 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-pcf.h>
-#include <linux/i2c-elektor.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -142,7 +141,7 @@ static void pcf_isa_handler(int this_irq, void *dev_id, struct pt_regs *regs) {
static int pcf_isa_init(void)
{
if (!mmapped) {
- if (!request_region(base, 2, "i2c (isa bus adapter)"))
+ if (!request_region(base, 2, "i2c (isa bus adapter)")) {
printk(KERN_ERR
"i2c-elektor.o: requested I/O region (0x%X:2) "
"is in use.\n", base);
@@ -159,32 +158,6 @@ static int pcf_isa_init(void)
return 0;
}
-static int pcf_isa_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-
-static int pcf_isa_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void pcf_isa_inc_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-}
-
-static void pcf_isa_dec_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-}
-
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -201,13 +174,10 @@ static struct i2c_algo_pcf_data pcf_isa_data = {
};
static struct i2c_adapter pcf_isa_ops = {
+ .owner = THIS_MODULE,
.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,
};
static int __init i2c_pcfisa_init(void)
diff --git a/drivers/i2c/i2c-elv.c b/drivers/i2c/i2c-elv.c
index a11ba27ffa2e..b4c74e564813 100644
--- a/drivers/i2c/i2c-elv.c
+++ b/drivers/i2c/i2c-elv.c
@@ -115,30 +115,6 @@ fail:
return -ENODEV;
}
-static int bit_elv_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-static int bit_elv_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void bit_elv_inc_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-}
-
-static void bit_elv_dec_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-}
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -153,14 +129,10 @@ static struct i2c_algo_bit_data bit_elv_data = {
};
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,
+ .owner = THIS_MODULE,
+ .name = "ELV Parallel port adaptor",
+ .id = I2C_HW_B_ELV,
+ .algo_data = &bit_elv_data,
};
static int __init i2c_bitelv_init(void)
diff --git a/drivers/i2c/i2c-frodo.c b/drivers/i2c/i2c-frodo.c
index 634a4ac46457..80f6cffcc13f 100644
--- a/drivers/i2c/i2c-frodo.c
+++ b/drivers/i2c/i2c-frodo.c
@@ -61,44 +61,21 @@ static struct i2c_algo_bit_data bit_frodo_data = {
.timeout = 100
};
-static int frodo_client_register (struct i2c_client *client)
-{
- return (0);
-}
-
-static int frodo_client_unregister (struct i2c_client *client)
-{
- return (0);
-}
-
-static void frodo_inc_use (struct i2c_adapter *adapter)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void frodo_dec_use (struct i2c_adapter *adapter)
-{
- MOD_DEC_USE_COUNT;
-}
-
static struct i2c_adapter frodo_ops = {
+ .owner = THIS_MODULE,
.name = "Frodo adapter driver",
.id = I2C_HW_B_FRODO,
.algo_data = &bit_frodo_data,
- .inc_use = frodo_inc_use,
- .dec_use = frodo_dec_use,
- .client_register = frodo_client_register,
- .client_unregister = frodo_client_unregister
};
static int __init i2c_frodo_init (void)
{
- return (i2c_bit_add_bus (&frodo_ops));
+ return i2c_bit_add_bus(&frodo_ops);
}
static void __exit i2c_frodo_exit (void)
{
- i2c_bit_del_bus (&frodo_ops);
+ i2c_bit_del_bus(&frodo_ops);
}
MODULE_AUTHOR ("Abraham van der Merwe <abraham@2d3d.co.za>");
diff --git a/drivers/i2c/i2c-philips-par.c b/drivers/i2c/i2c-philips-par.c
index be9a49f146b8..ce2258a20447 100644
--- a/drivers/i2c/i2c-philips-par.c
+++ b/drivers/i2c/i2c-philips-par.c
@@ -129,26 +129,6 @@ static int bit_lp_getsda2(void *data)
PARPORT_STATUS_BUSY) ? 0 : 1;
}
-static int bit_lp_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-static int bit_lp_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void bit_lp_inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void bit_lp_dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -173,15 +153,9 @@ static struct i2c_algo_bit_data bit_lp_data2 = {
};
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,
+ .owner = THIS_MODULE,
+ .name = "Philips Parallel port adapter",
+ .id = I2C_HW_B_LP,
};
static void i2c_parport_attach (struct parport *port)
diff --git a/drivers/i2c/i2c-proc.c b/drivers/i2c/i2c-proc.c
index 2273dbf684f9..785e9c5f3716 100644
--- a/drivers/i2c/i2c-proc.c
+++ b/drivers/i2c/i2c-proc.c
@@ -97,10 +97,21 @@ int i2c_create_name(char **name, const char *prefix,
struct i2c_adapter *adapter, int addr)
{
char name_buffer[50];
- int id;
+ int id, i, end;
if (i2c_is_isa_adapter(adapter))
sprintf(name_buffer, "%s-isa-%04x", prefix, addr);
- else {
+ else if (!adapter->algo->smbus_xfer && !adapter->algo->master_xfer) {
+ /* dummy adapter, generate prefix */
+ sprintf(name_buffer, "%s-", prefix);
+ end = strlen(name_buffer);
+ for(i = 0; i < 32; i++) {
+ if(adapter->algo->name[i] == ' ')
+ break;
+ name_buffer[end++] = tolower(adapter->algo->name[i]);
+ }
+ name_buffer[end] = 0;
+ sprintf(name_buffer + end, "-%04x", addr);
+ } else {
if ((id = i2c_adapter_id(adapter)) < 0)
return -ENOENT;
sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr);
@@ -210,49 +221,6 @@ void i2c_deregister_entry(int id)
}
}
-/* Monitor access for /proc/sys/dev/sensors; make unloading i2c-proc.o
- impossible if some process still uses it or some file in it */
-void i2c_fill_inode(struct inode *inode, int fill)
-{
- if (fill)
- MOD_INC_USE_COUNT;
- else
- MOD_DEC_USE_COUNT;
-}
-
-/* Monitor access for /proc/sys/dev/sensors/ directories; make unloading
- the corresponding module impossible if some process still uses it or
- some file in it */
-void i2c_dir_fill_inode(struct inode *inode, int fill)
-{
- int i;
- struct i2c_client *client;
-
-#ifdef DEBUG
- if (!inode) {
- printk(KERN_ERR "i2c-proc.o: Warning: inode NULL in fill_inode()\n");
- return;
- }
-#endif /* def DEBUG */
-
- for (i = 0; i < SENSORS_ENTRY_MAX; i++)
- if (i2c_clients[i]
- && (i2c_inodes[i] == inode->i_ino)) break;
-#ifdef DEBUG
- if (i == SENSORS_ENTRY_MAX) {
- printk
- (KERN_ERR "i2c-proc.o: Warning: inode (%ld) not found in fill_inode()\n",
- inode->i_ino);
- return;
- }
-#endif /* def DEBUG */
- client = i2c_clients[i];
- if (fill)
- client->driver->inc_use(client);
- else
- client->driver->dec_use(client);
-}
-
int i2c_proc_chips(ctl_table * ctl, int write, struct file *filp,
void *buffer, size_t * lenp)
{
diff --git a/drivers/i2c/i2c-rpx.c b/drivers/i2c/i2c-rpx.c
index a449ae9c8724..389b738641c8 100644
--- a/drivers/i2c/i2c-rpx.c
+++ b/drivers/i2c/i2c-rpx.c
@@ -66,44 +66,15 @@ static int rpx_install_isr(int irq, void (*func)(void *, void *), void *data)
return 0;
}
-static int rpx_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-static int rpx_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void rpx_inc_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-}
-
-static void rpx_dec_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-}
-
static struct i2c_algo_8xx_data rpx_data = {
.setisr = rpx_install_isr
};
-
static struct i2c_adapter rpx_ops = {
- "m8xx",
- I2C_HW_MPC8XX_EPON,
- NULL,
- &rpx_data,
- rpx_inc_use,
- rpx_dec_use,
- rpx_reg,
- rpx_unreg,
+ .owner = THIS_MODULE,
+ .name = "m8xx",
+ .id = I2C_HW_MPC8XX_EPON,
+ .algo_data = &rpx_data,
};
int __init i2c_rpx_init(void)
diff --git a/drivers/i2c/i2c-velleman.c b/drivers/i2c/i2c-velleman.c
index 9ae1a20cc868..b158fc59a656 100644
--- a/drivers/i2c/i2c-velleman.c
+++ b/drivers/i2c/i2c-velleman.c
@@ -89,43 +89,15 @@ static int bit_velle_getsda(void *data)
static int bit_velle_init(void)
{
- if (check_region(base,(base == 0x3bc)? 3 : 8) < 0 ) {
- DEBE(printk(KERN_DEBUG "i2c-velleman.o: Port %#x already in use.\n",
- base));
+ if (!request_region(base, (base == 0x3bc) ? 3 : 8,
+ "i2c (Vellemann adapter)"))
return -ENODEV;
- } else {
- request_region(base, (base == 0x3bc)? 3 : 8,
- "i2c (Vellemann adapter)");
- bit_velle_setsda((void*)base,1);
- bit_velle_setscl((void*)base,1);
- }
- return 0;
-}
-
-static int bit_velle_reg(struct i2c_client *client)
-{
- return 0;
-}
-static int bit_velle_unreg(struct i2c_client *client)
-{
+ bit_velle_setsda((void*)base,1);
+ bit_velle_setscl((void*)base,1);
return 0;
}
-static void bit_velle_inc_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_INC_USE_COUNT;
-#endif
-}
-
-static void bit_velle_dec_use(struct i2c_adapter *adap)
-{
-#ifdef MODULE
- MOD_DEC_USE_COUNT;
-#endif
-}
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -141,14 +113,10 @@ static struct i2c_algo_bit_data bit_velle_data = {
};
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,
+ .owner = THIS_MODULE,
+ .name = "Velleman K8000",
+ .id = I2C_HW_B_VELLE,
+ .algo_data = &bit_velle_data,
};
static int __init i2c_bitvelle_init(void)
diff --git a/drivers/i2c/scx200_acb.c b/drivers/i2c/scx200_acb.c
index 083df8d02030..6f0575545d5a 100644
--- a/drivers/i2c/scx200_acb.c
+++ b/drivers/i2c/scx200_acb.c
@@ -397,26 +397,6 @@ static u32 scx200_acb_func(struct i2c_adapter *adapter)
I2C_FUNC_SMBUS_BLOCK_DATA;
}
-static int scx200_acb_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-static int scx200_acb_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void scx200_acb_inc_use(struct i2c_adapter *adapter)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void scx200_acb_dec_use(struct i2c_adapter *adapter)
-{
- MOD_DEC_USE_COUNT;
-}
-
/* For now, we only handle combined mode (smbus) */
static struct i2c_algorithm scx200_acb_algorithm = {
.name = "NatSemi SCx200 ACCESS.bus",
@@ -479,12 +459,9 @@ static int __init scx200_acb_create(int base, int index)
adapter = &iface->adapter;
adapter->data = iface;
sprintf(adapter->name, "SCx200 ACB%d", index);
+ adapter->owner = THIS_MODULE;
adapter->id = I2C_ALGO_SMBUS;
adapter->algo = &scx200_acb_algorithm;
- adapter->inc_use = scx200_acb_inc_use;
- adapter->dec_use = scx200_acb_dec_use;
- adapter->client_register = scx200_acb_reg;
- adapter->client_unregister = scx200_acb_unreg;
init_MUTEX(&iface->sem);
diff --git a/drivers/i2c/scx200_i2c.c b/drivers/i2c/scx200_i2c.c
index 515e0c73d523..75d5a56cb32d 100644
--- a/drivers/i2c/scx200_i2c.c
+++ b/drivers/i2c/scx200_i2c.c
@@ -66,26 +66,6 @@ static int scx200_i2c_getsda(void *data)
return scx200_gpio_get(sda);
}
-static int scx200_i2c_reg(struct i2c_client *client)
-{
- return 0;
-}
-
-static int scx200_i2c_unreg(struct i2c_client *client)
-{
- return 0;
-}
-
-static void scx200_i2c_inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void scx200_i2c_dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-
/* ------------------------------------------------------------------------
* Encapsulate the above functions in the correct operations structure.
* This is only done when more than one hardware adapter is supported.
@@ -101,13 +81,10 @@ static struct i2c_algo_bit_data scx200_i2c_data = {
};
static struct i2c_adapter scx200_i2c_ops = {
+ .owner = THIS_MODULE,
.name = "NatSemi SCx200 I2C",
.id = I2C_HW_B_VELLE,
.algo_data = &scx200_i2c_data,
- .inc_use = scx200_i2c_inc_use,
- .dec_use = scx200_i2c_dec_use,
- .client_register = scx200_i2c_reg,
- .client_unregister = scx200_i2c_unreg,
};
int scx200_i2c_init(void)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 0a3c9d65591e..fe2cd1ddb129 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1,5 +1,5 @@
/*
- * linux/drivers/ide/ide-tape.c Version 1.17a Jan, 2001
+ * linux/drivers/ide/ide-tape.c Version 1.17b Oct, 2002
*
* Copyright (C) 1995 - 1999 Gadi Oxman <gadio@netvision.net.il>
*
@@ -291,6 +291,28 @@
* Ver 1.17a Apr 2001 Willem Riede osst@riede.org
* - Get drive's actual block size from mode sense block descriptor
* - Limit size of pipeline
+ * Ver 1.17b Oct 2002 Alan Stern <stern@rowland.harvard.edu>
+ * Changed IDETAPE_MIN_PIPELINE_STAGES to 1 and actually used
+ * it in the code!
+ * Actually removed aborted stages in idetape_abort_pipeline
+ * instead of just changing the command code.
+ * Made the transfer byte count for Request Sense equal to the
+ * actual length of the data transfer.
+ * Changed handling of partial data transfers: they do not
+ * cause DMA errors.
+ * Moved initiation of DMA transfers to the correct place.
+ * Removed reference to unallocated memory.
+ * Made __idetape_discard_read_pipeline return the number of
+ * sectors skipped, not the number of stages.
+ * Replaced errant kfree() calls with __idetape_kfree_stage().
+ * Fixed off-by-one error in testing the pipeline length.
+ * Fixed handling of filemarks in the read pipeline.
+ * Small code optimization for MTBSF and MTBSFM ioctls.
+ * Don't try to unlock the door during device close if is
+ * already unlocked!
+ * Cosmetic fixes to miscellaneous debugging output messages.
+ * Set the minimum /proc/ide/hd?/settings values for "pipeline",
+ * "pipeline_min", and "pipeline_max" to 1.
*
* Here are some words from the first releases of hd.c, which are quoted
* in ide.c and apply here as well:
@@ -400,7 +422,7 @@
* sharing a (fast) ATA-2 disk with any (slow) new ATAPI device.
*/
-#define IDETAPE_VERSION "1.17a"
+#define IDETAPE_VERSION "1.17b"
#include <linux/config.h>
#include <linux/module.h>
@@ -577,9 +599,10 @@ typedef struct {
* whenever we sense that the pipeline is empty, until we reach
* the optimum value or until we reach MAX.
*
- * Setting the following parameter to 0 will disable the pipelined mode.
+ * Setting the following parameter to 0 is illegal: the pipelined mode
+ * cannot be disabled (calculate_speeds() divides by tape->max_stages.)
*/
-#define IDETAPE_MIN_PIPELINE_STAGES 200
+#define IDETAPE_MIN_PIPELINE_STAGES 1
#define IDETAPE_MAX_PIPELINE_STAGES 400
#define IDETAPE_INCREASE_STAGES_RATE 20
@@ -601,8 +624,8 @@ typedef struct {
* is verified to be stable enough. This will make it much more
* esthetic.
*/
-#define IDETAPE_DEBUG_INFO 1
-#define IDETAPE_DEBUG_LOG 1
+#define IDETAPE_DEBUG_INFO 0
+#define IDETAPE_DEBUG_LOG 0
#define IDETAPE_DEBUG_LOG_VERBOSE 0
#define IDETAPE_DEBUG_BUGS 1
@@ -1610,24 +1633,6 @@ static void idetape_analyze_error (ide_drive_t *drive, idetape_request_sense_res
}
}
-static void idetape_abort_pipeline (ide_drive_t *drive)
-{
- idetape_tape_t *tape = drive->driver_data;
- idetape_stage_t *stage = tape->next_stage;
-
-#if IDETAPE_DEBUG_LOG
- if (tape->debug_level >= 4)
- printk(KERN_INFO "ide-tape: %s: idetape_abort_pipeline called\n", tape->name);
-#endif
- while (stage) {
- if (stage->rq.flags == IDETAPE_WRITE_RQ)
- stage->rq.flags = IDETAPE_ABORTED_WRITE_RQ;
- else if (stage->rq.flags == IDETAPE_READ_RQ)
- stage->rq.flags = IDETAPE_ABORTED_READ_RQ;
- stage = stage->next;
- }
-}
-
/*
* idetape_active_next_stage will declare the next stage as "active".
*/
@@ -1672,7 +1677,7 @@ static void idetape_increase_max_pipeline_stages (ide_drive_t *drive)
printk (KERN_INFO "ide-tape: Reached idetape_increase_max_pipeline_stages\n");
#endif /* IDETAPE_DEBUG_LOG */
- tape->max_stages += increase;
+ tape->max_stages += max(increase, 1);
tape->max_stages = max(tape->max_stages, tape->min_pipeline);
tape->max_stages = min(tape->max_stages, tape->max_pipeline);
}
@@ -1745,6 +1750,29 @@ static void idetape_remove_stage_head (ide_drive_t *drive)
}
}
+static void idetape_abort_pipeline (ide_drive_t *drive, idetape_stage_t *last_stage)
+{
+ idetape_tape_t *tape = drive->driver_data;
+ idetape_stage_t *stage = tape->next_stage;
+ idetape_stage_t *nstage;
+
+#if IDETAPE_DEBUG_LOG
+ if (tape->debug_level >= 4)
+ printk(KERN_INFO "ide-tape: %s: idetape_abort_pipeline called\n", tape->name);
+#endif
+ while (stage) {
+ nstage = stage->next;
+ idetape_kfree_stage(tape, stage);
+ --tape->nr_stages;
+ --tape->nr_pending_stages;
+ stage = nstage;
+ }
+ tape->last_stage = last_stage;
+ if (last_stage)
+ last_stage->next = NULL;
+ tape->next_stage = NULL;
+}
+
/*
* idetape_end_request is used to finish servicing a request, and to
* insert a pending pipeline request into the main device queue.
@@ -1756,6 +1784,7 @@ static int idetape_end_request (ide_drive_t *drive, int uptodate)
unsigned long flags;
int error;
int remove_stage = 0;
+ idetape_stage_t *active_stage;
#if ONSTREAM_DEBUG
idetape_stage_t *stage;
os_aux_t *aux;
@@ -1780,6 +1809,7 @@ static int idetape_end_request (ide_drive_t *drive, int uptodate)
/* The request was a pipelined data transfer request */
if (tape->active_data_request == rq) {
+ active_stage = tape->active_stage;
tape->active_stage = NULL;
tape->active_data_request = NULL;
tape->nr_pending_stages--;
@@ -1799,18 +1829,20 @@ static int idetape_end_request (ide_drive_t *drive, int uptodate)
if (tape->first_frame_position == OS_DATA_ENDFRAME1) {
#if ONSTREAM_DEBUG
if (tape->debug_level >= 2)
- printk("ide-tape: %s: skipping over config parition..\n", tape->name);
+ printk("ide-tape: %s: skipping over config partition.\n", tape->name);
#endif
tape->onstream_write_error = OS_PART_ERROR;
- if (tape->waiting)
+ if (tape->waiting) {
+ rq->waiting = NULL;
complete(tape->waiting);
+ }
}
}
remove_stage = 1;
if (error) {
set_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
if (error == IDETAPE_ERROR_EOD)
- idetape_abort_pipeline(drive);
+ idetape_abort_pipeline(drive, active_stage);
if (tape->onstream && !tape->raw &&
error == IDETAPE_ERROR_GENERAL &&
tape->sense.sense_key == 3) {
@@ -1821,14 +1853,16 @@ static int idetape_end_request (ide_drive_t *drive, int uptodate)
tape->nr_pending_stages++;
tape->next_stage = tape->first_stage;
rq->current_nr_sectors = rq->nr_sectors;
- if (tape->waiting)
+ if (tape->waiting) {
+ rq->waiting = NULL;
complete(tape->waiting);
+ }
}
}
} else if (rq->flags == IDETAPE_READ_RQ) {
if (error == IDETAPE_ERROR_EOD) {
set_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
- idetape_abort_pipeline(drive);
+ idetape_abort_pipeline(drive, active_stage);
}
}
if (tape->next_stage != NULL && !tape->onstream_write_error) {
@@ -1879,7 +1913,7 @@ static void idetape_create_request_sense_cmd (idetape_pc_t *pc)
idetape_init_pc(pc);
pc->c[0] = IDETAPE_REQUEST_SENSE_CMD;
pc->c[4] = 20;
- pc->request_transfer = 18;
+ pc->request_transfer = 20;
pc->callback = &idetape_request_sense_callback;
}
@@ -1980,7 +2014,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
status.all = HWIF(drive)->INB(IDE_STATUS_REG);
if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) {
- if (HWIF(drive)->ide_dma_end(drive)) {
+ if (HWIF(drive)->ide_dma_end(drive) || status.b.check) {
/*
* A DMA error is sometimes expected. For example,
* if the tape is crossing a filemark during a
@@ -1992,8 +2026,18 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
* actually transferred (we can't receive that
* information from the DMA engine on most chipsets).
*/
+
+ /*
+ * On the contrary, a DMA error is never expected;
+ * it usually indicates a hardware error or abort.
+ * If the tape crosses a filemark during a READ
+ * command, it will issue an irq and position itself
+ * after the filemark (not before). Only a partial
+ * data transfer will occur, but no DMA error.
+ * (AS, 19 Apr 2001)
+ */
set_bit(PC_DMA_ERROR, &pc->flags);
- } else if (!status.b.check) {
+ } else {
pc->actually_transferred = pc->request_transfer;
idetape_update_buffers(pc);
}
@@ -2029,7 +2073,7 @@ static ide_startstop_t idetape_pc_intr (ide_drive_t *drive)
if (status.b.check || test_bit(PC_DMA_ERROR, &pc->flags)) { /* Error detected */
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 1)
- printk(KERN_INFO "ide-tape: %s: I/O error, ",
+ printk(KERN_INFO "ide-tape: %s: I/O error\n",
tape->name);
#endif /* IDETAPE_DEBUG_LOG */
if (pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) {
@@ -2195,6 +2239,10 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
BUG();
/* Set the interrupt routine */
ide_set_handler(drive, &idetape_pc_intr, IDETAPE_WAIT_CMD, NULL);
+#ifdef CONFIG_BLK_DEV_IDEDMA
+ if (test_bit(PC_DMA_IN_PROGRESS, &pc->flags)) /* Begin DMA, if necessary */
+ (void) (HWIF(drive)->ide_dma_begin(drive));
+#endif
/* Send the actual packet */
HWIF(drive)->atapi_output_bytes(drive, pc->c, 12);
return ide_started;
@@ -2223,8 +2271,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
/*
* We will "abort" retrying a packet command in case
* a legitimate error code was received (crossing a
- * filemark, or DMA error in the end of media, for
- * example).
+ * filemark, or end of the media, for example).
*/
if (!test_bit(PC_ABORT, &pc->flags)) {
if (!(pc->c[0] == IDETAPE_TEST_UNIT_READY_CMD &&
@@ -2249,7 +2296,7 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
}
#if IDETAPE_DEBUG_LOG
if (tape->debug_level >= 2)
- printk(KERN_INFO "ide-tape: Retry number - %d\n", pc->retries);
+ printk(KERN_INFO "ide-tape: Retry number - %d, cmd = %02X\n", pc->retries, pc->c[0]);
#endif /* IDETAPE_DEBUG_LOG */
pc->retries++;
@@ -2275,10 +2322,8 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape
OUT_BYTE(bcount.b.high, IDE_BCOUNTH_REG);
OUT_BYTE(bcount.b.low, IDE_BCOUNTL_REG);
OUT_BYTE(drive->select.all, IDE_SELECT_REG);
- if (dma_ok) { /* Begin DMA, if necessary */
+ if (dma_ok) /* Will begin DMA later */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
- (void) (HWIF(drive)->ide_dma_begin(drive));
- }
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
if (HWGROUP(drive)->handler != NULL) /* paranoia check */
BUG();
@@ -3069,7 +3114,7 @@ static void idetape_wait_for_request (ide_drive_t *drive, struct request *rq)
tape->waiting = &wait;
spin_unlock(&tape->spinlock);
wait_for_completion(&wait);
- rq->waiting = NULL;
+ /* The stage and its struct request have been deallocated */
tape->waiting = NULL;
spin_lock_irq(&tape->spinlock);
}
@@ -3333,11 +3378,15 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive)
if (tape->chrdev_direction != idetape_direction_read)
return 0;
+ cnt = tape->merge_stage_size / tape->tape_block_size;
+ if (test_and_clear_bit(IDETAPE_FILEMARK, &tape->flags))
+ ++cnt; /* Filemarks count as 1 sector */
tape->merge_stage_size = 0;
if (tape->merge_stage != NULL) {
__idetape_kfree_stage(tape->merge_stage);
tape->merge_stage = NULL;
}
+ clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
tape->chrdev_direction = idetape_direction_none;
if (tape->first_stage == NULL)
@@ -3349,9 +3398,14 @@ static int __idetape_discard_read_pipeline (ide_drive_t *drive)
idetape_wait_for_request(drive, tape->active_data_request);
spin_unlock_irqrestore(&tape->spinlock, flags);
- cnt = tape->nr_stages - tape->nr_pending_stages;
- while (tape->first_stage != NULL)
+ while (tape->first_stage != NULL) {
+ struct request *rq_ptr = &tape->first_stage->rq;
+
+ cnt += rq_ptr->nr_sectors - rq_ptr->current_nr_sectors;
+ if (rq_ptr->errors == IDETAPE_ERROR_FILEMARK)
+ ++cnt;
idetape_remove_stage_head(drive);
+ }
tape->nr_pending_stages = 0;
tape->max_stages = tape->min_pipeline;
return cnt;
@@ -3946,7 +4000,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
*/
bytes_read = idetape_queue_rw_tail(drive, IDETAPE_READ_RQ, 0, tape->merge_stage->bio);
if (bytes_read < 0) {
- kfree(tape->merge_stage);
+ __idetape_kfree_stage(tape->merge_stage);
tape->merge_stage = NULL;
tape->chrdev_direction = idetape_direction_none;
return bytes_read;
@@ -3959,7 +4013,7 @@ static int idetape_initiate_read (ide_drive_t *drive, int max_stages)
rq.sector = tape->first_frame_position;
rq.nr_sectors = rq.current_nr_sectors = blocks;
if (!test_bit(IDETAPE_PIPELINE_ERROR, &tape->flags) &&
- tape->nr_stages <= max_stages) {
+ tape->nr_stages < max_stages) {
new_stage = idetape_kmalloc_stage(tape);
while (new_stage != NULL) {
new_stage->rq = rq;
@@ -4069,6 +4123,12 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
#endif /* IDETAPE_DEBUG_LOG */
/*
+ * If we are at a filemark, return a read length of 0
+ */
+ if (test_bit(IDETAPE_FILEMARK, &tape->flags))
+ return 0;
+
+ /*
* Wait for the next logical block to be available at the head
* of the pipeline
*/
@@ -4097,14 +4157,7 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
}
if (rq_ptr->errors == IDETAPE_ERROR_EOD)
return 0;
- if (rq_ptr->errors == IDETAPE_ERROR_FILEMARK) {
- idetape_switch_buffers(tape, tape->first_stage);
- set_bit(IDETAPE_FILEMARK, &tape->flags);
-#if USE_IOTRACE
- IO_trace(IO_IDETAPE_FIFO, tape->pipeline_head, tape->buffer_head, tape->tape_head, tape->minor);
-#endif
- calculate_speeds(drive);
- } else {
+ else {
idetape_switch_buffers(tape, tape->first_stage);
if (rq_ptr->errors == IDETAPE_ERROR_GENERAL) {
#if ONSTREAM_DEBUG
@@ -4112,7 +4165,8 @@ static int idetape_add_chrdev_read_request (ide_drive_t *drive,int blocks)
printk(KERN_INFO "ide-tape: error detected, bytes_read %d\n", bytes_read);
#endif
}
- clear_bit(IDETAPE_FILEMARK, &tape->flags);
+ if (rq_ptr->errors == IDETAPE_ERROR_FILEMARK)
+ set_bit(IDETAPE_FILEMARK, &tape->flags);
spin_lock_irqsave(&tape->spinlock, flags);
idetape_remove_stage_head(drive);
spin_unlock_irqrestore(&tape->spinlock, flags);
@@ -4455,6 +4509,14 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c
tape->restart_speed_control_req = 1;
return retval;
}
+
+ if (mt_count == 0)
+ return 0;
+ if (MTBSF == mt_op || MTBSFM == mt_op) {
+ if (!tape->capabilities.sprev)
+ return -EIO;
+ mt_count = - mt_count;
+ }
if (tape->chrdev_direction == idetape_direction_read) {
/*
@@ -4462,28 +4524,36 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c
* filemarks.
*/
tape->merge_stage_size = 0;
- clear_bit(IDETAPE_FILEMARK, &tape->flags);
+ if (test_and_clear_bit(IDETAPE_FILEMARK, &tape->flags))
+ ++count;
while (tape->first_stage != NULL) {
- idetape_wait_first_stage(drive);
- if (tape->first_stage->rq.errors == IDETAPE_ERROR_FILEMARK)
- count++;
if (count == mt_count) {
- switch (mt_op) {
- case MTFSF:
- spin_lock_irqsave(&tape->spinlock, flags);
- idetape_remove_stage_head(drive);
- spin_unlock_irqrestore(&tape->spinlock, flags);
- case MTFSFM:
- return (0);
- default:
- break;
- }
+ if (mt_op == MTFSFM)
+ set_bit(IDETAPE_FILEMARK, &tape->flags);
+ return 0;
}
spin_lock_irqsave(&tape->spinlock, flags);
+ if (tape->first_stage == tape->active_stage) {
+ /*
+ * We have reached the active stage in the read pipeline.
+ * There is no point in allowing the drive to continue
+ * reading any farther, so we stop the pipeline.
+ *
+ * This section should be moved to a separate subroutine,
+ * because a similar function is performed in
+ * __idetape_discard_read_pipeline(), for example.
+ */
+ tape->next_stage = NULL;
+ spin_unlock_irqrestore(&tape->spinlock, flags);
+ idetape_wait_first_stage(drive);
+ tape->next_stage = tape->first_stage->next;
+ } else
+ spin_unlock_irqrestore(&tape->spinlock, flags);
+ if (tape->first_stage->rq.errors == IDETAPE_ERROR_FILEMARK)
+ ++count;
idetape_remove_stage_head(drive);
- spin_unlock_irqrestore(&tape->spinlock, flags);
}
- idetape_discard_read_pipeline(drive, 1);
+ idetape_discard_read_pipeline(drive, 0);
}
/*
@@ -4492,25 +4562,17 @@ static int idetape_space_over_filemarks (ide_drive_t *drive,short mt_op,int mt_c
*/
switch (mt_op) {
case MTFSF:
+ case MTBSF:
idetape_create_space_cmd(&pc,mt_count-count,IDETAPE_SPACE_OVER_FILEMARK);
return (idetape_queue_pc_tail(drive, &pc));
case MTFSFM:
- if (!tape->capabilities.sprev)
- return (-EIO);
- retval = idetape_space_over_filemarks(drive, MTFSF, mt_count-count);
- if (retval) return (retval);
- return (idetape_space_over_filemarks(drive, MTBSF, 1));
- case MTBSF:
- if (!tape->capabilities.sprev)
- return (-EIO);
- idetape_create_space_cmd(&pc,-(mt_count+count),IDETAPE_SPACE_OVER_FILEMARK);
- return (idetape_queue_pc_tail(drive, &pc));
case MTBSFM:
if (!tape->capabilities.sprev)
return (-EIO);
- retval = idetape_space_over_filemarks(drive, MTBSF, mt_count+count);
+ retval = idetape_space_over_filemarks(drive, MTFSF, mt_count-count);
if (retval) return (retval);
- return (idetape_space_over_filemarks(drive, MTFSF, 1));
+ count = (MTBSFM == mt_op ? 1 : -1);
+ return (idetape_space_over_filemarks(drive, MTFSF, count));
default:
printk(KERN_ERR "ide-tape: MTIO operation %d not supported\n",mt_op);
return (-EIO);
@@ -4861,7 +4923,7 @@ static ssize_t idetape_chrdev_write (struct file *file, const char *buf,
*/
retval = idetape_queue_rw_tail(drive, IDETAPE_WRITE_RQ, 0, tape->merge_stage->bio);
if (retval < 0) {
- kfree(tape->merge_stage);
+ __idetape_kfree_stage(tape->merge_stage);
tape->merge_stage = NULL;
tape->chrdev_direction = idetape_direction_none;
return retval;
@@ -5447,8 +5509,10 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name);
return -EBUSY;
}
- idetape_read_position(drive);
- clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
+ if (tape->onstream)
+ idetape_read_position(drive);
+ if (tape->chrdev_direction != idetape_direction_read)
+ clear_bit(IDETAPE_PIPELINE_ERROR, &tape->flags);
if (tape->chrdev_direction == idetape_direction_none) {
if (idetape_create_prevent_cmd(drive, &pc, 1)) {
@@ -5520,10 +5584,11 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp)
if (minor < 128)
(void) idetape_rewind_tape(drive);
if (tape->chrdev_direction == idetape_direction_none) {
- if (tape->door_locked != DOOR_EXPLICITLY_LOCKED) {
- if (idetape_create_prevent_cmd(drive, &pc, 0))
+ if (tape->door_locked == DOOR_LOCKED) {
+ if (idetape_create_prevent_cmd(drive, &pc, 0)) {
if (!idetape_queue_pc_tail(drive, &pc))
tape->door_locked = DOOR_UNLOCKED;
+ }
}
}
clear_bit(IDETAPE_BUSY, &tape->flags);
@@ -5556,34 +5621,34 @@ static int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id)
printk(KERN_INFO "ide-tape: Dumping ATAPI Identify Device tape parameters\n");
printk(KERN_INFO "ide-tape: Protocol Type: ");
switch (gcw.protocol) {
- case 0: case 1: printk(KERN_INFO "ATA\n");break;
- case 2: printk(KERN_INFO "ATAPI\n");break;
- case 3: printk(KERN_INFO "Reserved (Unknown to ide-tape)\n");break;
+ case 0: case 1: printk("ATA\n");break;
+ case 2: printk("ATAPI\n");break;
+ case 3: printk("Reserved (Unknown to ide-tape)\n");break;
}
printk(KERN_INFO "ide-tape: Device Type: %x - ",gcw.device_type);
switch (gcw.device_type) {
- case 0: printk(KERN_INFO "Direct-access Device\n");break;
- case 1: printk(KERN_INFO "Streaming Tape Device\n");break;
- case 2: case 3: case 4: printk(KERN_INFO "Reserved\n");break;
- case 5: printk(KERN_INFO "CD-ROM Device\n");break;
- case 6: printk(KERN_INFO "Reserved\n");
- case 7: printk(KERN_INFO "Optical memory Device\n");break;
- case 0x1f: printk(KERN_INFO "Unknown or no Device type\n");break;
- default: printk(KERN_INFO "Reserved\n");
+ case 0: printk("Direct-access Device\n");break;
+ case 1: printk("Streaming Tape Device\n");break;
+ case 2: case 3: case 4: printk("Reserved\n");break;
+ case 5: printk("CD-ROM Device\n");break;
+ case 6: printk("Reserved\n");
+ case 7: printk("Optical memory Device\n");break;
+ case 0x1f: printk("Unknown or no Device type\n");break;
+ default: printk("Reserved\n");
}
printk(KERN_INFO "ide-tape: Removable: %s",gcw.removable ? "Yes\n":"No\n");
printk(KERN_INFO "ide-tape: Command Packet DRQ Type: ");
switch (gcw.drq_type) {
- case 0: printk(KERN_INFO "Microprocessor DRQ\n");break;
- case 1: printk(KERN_INFO "Interrupt DRQ\n");break;
- case 2: printk(KERN_INFO "Accelerated DRQ\n");break;
- case 3: printk(KERN_INFO "Reserved\n");break;
+ case 0: printk("Microprocessor DRQ\n");break;
+ case 1: printk("Interrupt DRQ\n");break;
+ case 2: printk("Accelerated DRQ\n");break;
+ case 3: printk("Reserved\n");break;
}
printk(KERN_INFO "ide-tape: Command Packet Size: ");
switch (gcw.packet_size) {
- case 0: printk(KERN_INFO "12 bytes\n");break;
- case 1: printk(KERN_INFO "16 bytes\n");break;
- default: printk(KERN_INFO "Reserved\n");break;
+ case 0: printk("12 bytes\n");break;
+ case 1: printk("16 bytes\n");break;
+ default: printk("Reserved\n");break;
}
printk(KERN_INFO "ide-tape: Model: %.40s\n",id->model);
printk(KERN_INFO "ide-tape: Firmware Revision: %.8s\n",id->fw_rev);
@@ -5599,45 +5664,45 @@ static int idetape_identify_device (ide_drive_t *drive,struct hd_driveid *id)
printk(KERN_INFO "ide-tape: Single Word DMA supported modes: ");
for (i=0,mask=1;i<8;i++,mask=mask << 1) {
if (id->dma_1word & mask)
- printk(KERN_INFO "%d ",i);
+ printk("%d ",i);
if (id->dma_1word & (mask << 8))
- printk(KERN_INFO "(active) ");
+ printk("(active) ");
}
- printk(KERN_INFO "\n");
+ printk("\n");
printk(KERN_INFO "ide-tape: Multi Word DMA supported modes: ");
for (i=0,mask=1;i<8;i++,mask=mask << 1) {
if (id->dma_mword & mask)
- printk(KERN_INFO "%d ",i);
+ printk("%d ",i);
if (id->dma_mword & (mask << 8))
- printk(KERN_INFO "(active) ");
+ printk("(active) ");
}
- printk(KERN_INFO "\n");
+ printk("\n");
if (id->field_valid & 0x0002) {
printk(KERN_INFO "ide-tape: Enhanced PIO Modes: %s\n",
id->eide_pio_modes & 1 ? "Mode 3":"None");
printk(KERN_INFO "ide-tape: Minimum Multi-word DMA cycle per word: ");
if (id->eide_dma_min == 0)
- printk(KERN_INFO "Not supported\n");
+ printk("Not supported\n");
else
- printk(KERN_INFO "%d ns\n",id->eide_dma_min);
+ printk("%d ns\n",id->eide_dma_min);
printk(KERN_INFO "ide-tape: Manufacturer\'s Recommended Multi-word cycle: ");
if (id->eide_dma_time == 0)
- printk(KERN_INFO "Not supported\n");
+ printk("Not supported\n");
else
- printk(KERN_INFO "%d ns\n",id->eide_dma_time);
+ printk("%d ns\n",id->eide_dma_time);
printk(KERN_INFO "ide-tape: Minimum PIO cycle without IORDY: ");
if (id->eide_pio == 0)
- printk(KERN_INFO "Not supported\n");
+ printk("Not supported\n");
else
- printk(KERN_INFO "%d ns\n",id->eide_pio);
+ printk("%d ns\n",id->eide_pio);
printk(KERN_INFO "ide-tape: Minimum PIO cycle with IORDY: ");
if (id->eide_pio_iordy == 0)
- printk(KERN_INFO "Not supported\n");
+ printk("Not supported\n");
else
- printk(KERN_INFO "%d ns\n",id->eide_pio_iordy);
+ printk("%d ns\n",id->eide_pio_iordy);
} else
printk(KERN_INFO "ide-tape: According to the device, fields 64-70 are not valid.\n");
@@ -5946,9 +6011,9 @@ static void idetape_add_settings (ide_drive_t *drive)
* drive setting name read/write ioctl ioctl data type min max mul_factor div_factor data pointer set function
*/
ide_add_setting(drive, "buffer", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 2, &tape->capabilities.buffer_size, NULL);
- ide_add_setting(drive, "pipeline_min", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->min_pipeline, NULL);
- ide_add_setting(drive, "pipeline", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->max_stages, NULL);
- ide_add_setting(drive, "pipeline_max", SETTING_RW, -1, -1, TYPE_INT, 2, 0xffff, tape->stage_size / 1024, 1, &tape->max_pipeline, NULL);
+ ide_add_setting(drive, "pipeline_min", SETTING_RW, -1, -1, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->min_pipeline, NULL);
+ ide_add_setting(drive, "pipeline", SETTING_RW, -1, -1, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_stages, NULL);
+ ide_add_setting(drive, "pipeline_max", SETTING_RW, -1, -1, TYPE_INT, 1, 0xffff, tape->stage_size / 1024, 1, &tape->max_pipeline, NULL);
ide_add_setting(drive, "pipeline_used",SETTING_READ, -1, -1, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_stages, NULL);
ide_add_setting(drive, "pipeline_pending",SETTING_READ,-1, -1, TYPE_INT, 0, 0xffff, tape->stage_size / 1024, 1, &tape->nr_pending_stages, NULL);
ide_add_setting(drive, "speed", SETTING_READ, -1, -1, TYPE_SHORT, 0, 0xffff, 1, 1, &tape->capabilities.speed, NULL);
@@ -6063,8 +6128,11 @@ static void idetape_setup (ide_drive_t *drive, idetape_tape_t *tape, int minor)
si_meminfo(&si);
if (tape->max_stages * tape->stage_size > si.totalram * si.mem_unit / 10)
tape->max_stages = si.totalram * si.mem_unit / (10 * tape->stage_size);
- tape->min_pipeline = tape->max_stages;
- tape->max_pipeline = tape->max_stages * 2;
+ tape->max_stages = min(tape->max_stages, IDETAPE_MAX_PIPELINE_STAGES);
+ tape->min_pipeline = min(tape->max_stages, IDETAPE_MIN_PIPELINE_STAGES);
+ tape->max_pipeline = min(tape->max_stages * 2, IDETAPE_MAX_PIPELINE_STAGES);
+ if (tape->max_stages == 0)
+ tape->max_stages = tape->min_pipeline = tape->max_pipeline = 1;
t1 = (tape->stage_size * HZ) / (speed * 1000);
tmid = (tape->capabilities.buffer_size * 32 * HZ) / (speed * 125);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 0ae396abfcc1..a138e13d6b44 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1332,7 +1332,7 @@ int ata_attach(ide_drive_t *drive)
spin_lock(&drivers_lock);
list_for_each(p, &drivers) {
ide_driver_t *driver = list_entry(p, ide_driver_t, drivers);
- if (!try_inc_mod_count(driver->owner))
+ if (!try_module_get(driver->owner))
continue;
spin_unlock(&drivers_lock);
if (driver->attach(drive) == 0) {
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index b5e00b4b12b5..5433a0466ce9 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -1066,8 +1066,7 @@ static int ieee1394_get_chardev(int blocknum,
if(*file_ops == NULL)
goto out;
- /* don't need try_inc_mod_count if the driver is non-modular */
- if(*module && (try_inc_mod_count(*module) == 0))
+ if(!try_module_get(*module))
goto out;
/* success! */
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index ad595be2a0a6..4e01b76e1fcb 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -207,9 +207,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
printk(KERN_ERR "capi: can't alloc capiminor\n");
return 0;
}
-#ifdef _DEBUG_REFCOUNT
- printk(KERN_DEBUG "capiminor_alloc %d\n", GET_USE_COUNT(THIS_MODULE));
-#endif
+
memset(mp, 0, sizeof(struct capiminor));
mp->ap = ap;
mp->ncci = ncci;
@@ -252,9 +250,6 @@ static void capiminor_free(struct capiminor *mp)
capiminor_del_all_ack(mp);
kfree(mp);
MOD_DEC_USE_COUNT;
-#ifdef _DEBUG_REFCOUNT
- printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE));
-#endif
}
struct capiminor *capiminor_find(unsigned int minor)
@@ -980,9 +975,7 @@ static int capinc_tty_open(struct tty_struct * tty, struct file * file)
return -ENXIO;
tty->driver_data = (void *)mp;
-#ifdef _DEBUG_REFCOUNT
- printk(KERN_DEBUG "capi_tty_open %d\n", GET_USE_COUNT(THIS_MODULE));
-#endif
+
if (atomic_read(&mp->ttyopencount) == 0)
mp->tty = tty;
atomic_inc(&mp->ttyopencount);
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 337124784e9c..0e07e706a576 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -77,15 +77,9 @@ static struct work_struct tq_recv_notify;
static inline struct capi_ctr *
capi_ctr_get(struct capi_ctr *card)
{
- if (card->owner) {
- if (try_inc_mod_count(card->owner)) {
- DBG("MOD_COUNT INC");
- return card;
- } else
- return NULL;
- }
- DBG("MOD_COUNT INC");
- return card;
+ if (try_module_get(card->owner))
+ return card;
+ return NULL;
}
static inline void
diff --git a/drivers/isdn/eicon/eicon_mod.c b/drivers/isdn/eicon/eicon_mod.c
index 54edc7d3f470..4fd7dbcb6968 100644
--- a/drivers/isdn/eicon/eicon_mod.c
+++ b/drivers/isdn/eicon/eicon_mod.c
@@ -54,10 +54,6 @@ extern int do_ioctl(struct inode *pDivasInode, struct file *pDivasFile,
unsigned int command, unsigned long arg);
extern void eicon_pci_init_conf(eicon_card *card);
-#ifdef MODULE
-#define MOD_USE_COUNT (GET_USE_COUNT (&__this_module))
-#endif
-
#define EICON_CTRL_VERSION 2
ulong DebugVar;
@@ -370,12 +366,6 @@ eicon_command(eicon_card * card, isdn_ctrl * c)
DebugVar = a;
eicon_log(card, 1, "Eicon: Debug Value set to %ld\n", DebugVar);
return 0;
-#ifdef MODULE
- case EICON_IOCTL_FREEIT:
- while (MOD_USE_COUNT > 0) MOD_DEC_USE_COUNT;
- MOD_INC_USE_COUNT;
- return 0;
-#endif
case EICON_IOCTL_LOADPCI:
eicon_log(card, 1, "Eicon: Wrong version of load-utility,\n");
eicon_log(card, 1, "Eicon: re-compile eiconctrl !\n");
diff --git a/drivers/isdn/hardware/eicon/i4lididrv.c b/drivers/isdn/hardware/eicon/i4lididrv.c
index d086cdd17d00..38cf7c984607 100644
--- a/drivers/isdn/hardware/eicon/i4lididrv.c
+++ b/drivers/isdn/hardware/eicon/i4lididrv.c
@@ -40,10 +40,6 @@ static char *DRIVERRELEASE = "2.0";
static char *eicon_revision = "$Revision: 1.1.2.2 $";
extern char *eicon_idi_revision;
-#ifdef MODULE
-#define MOD_USE_COUNT (GET_USE_COUNT (&__this_module))
-#endif
-
#define EICON_CTRL_VERSION 2
ulong DebugVar;
@@ -507,12 +503,6 @@ eicon_command(eicon_card * card, isdn_ctrl * c)
DebugVar = a;
eicon_log(card, 1, "%s: Debug Value set to %ld\n", DRIVERLNAME, DebugVar);
return 0;
-#ifdef MODULE
- case EICON_IOCTL_FREEIT:
- while (MOD_USE_COUNT > 0) MOD_DEC_USE_COUNT;
- MOD_INC_USE_COUNT;
- return 0;
-#endif
case EICON_IOCTL_LOADPCI:
eicon_log(card, 1, "%s: Wrong version of load-utility,\n", DRIVERLNAME);
eicon_log(card, 1, "%s: re-compile eiconctrl !\n", DRIVERLNAME);
diff --git a/drivers/isdn/hisax/callc.c b/drivers/isdn/hisax/callc.c
index 4e366732644d..d2958c806c62 100644
--- a/drivers/isdn/hisax/callc.c
+++ b/drivers/isdn/hisax/callc.c
@@ -21,9 +21,6 @@
#include "hisax.h"
#include <linux/isdn/capicmd.h>
-#ifdef MODULE
-#define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
-#endif /* MODULE */
const char *lli_revision = "$Revision: 2.51.6.6 $";
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index 0936646dbc8d..bbe615f727be 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -396,39 +396,26 @@ static int adv717x_command(struct i2c_client *client, unsigned int cmd,
return 0;
}
-static void adv717x_inc_use(struct i2c_client *client)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void adv717x_dec_use(struct i2c_client *client)
-{
- MOD_DEC_USE_COUNT;
-}
-
-
/* ----------------------------------------------------------------------- */
static struct i2c_driver i2c_driver_adv7175 = {
+ .owner = THIS_MODULE,
.name = "adv7175", /* name */
.id = I2C_DRIVERID_ADV717x, /* ID */
.flags = I2C_DF_NOTIFY, //I2C_ADV7175, I2C_ADV7175 + 3,
.attach_adapter = adv717x_probe,
.detach_client = adv717x_detach,
.command = adv717x_command,
- .inc_use = &adv717x_inc_use,
- .dec_use = &adv717x_dec_use
};
static struct i2c_driver i2c_driver_adv7176 = {
+ .owner = THIS_MODULE,
.name = "adv7176", /* name */
.id = I2C_DRIVERID_ADV717x, /* ID */
.flags = I2C_DF_NOTIFY, //I2C_ADV7176, I2C_ADV7176 + 3,
.attach_adapter = adv717x_probe,
.detach_client = adv717x_detach,
.command = adv717x_command,
- .inc_use = &adv717x_inc_use,
- .dec_use = &adv717x_dec_use
};
static struct i2c_client client_template = {
diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bttv-if.c
index 08eff8c66cfa..5603d9ce59c2 100644
--- a/drivers/media/video/bttv-if.c
+++ b/drivers/media/video/bttv-if.c
@@ -194,16 +194,6 @@ static int bttv_bit_getsda(void *data)
return state;
}
-static void bttv_inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void bttv_dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-
static int attach_inform(struct i2c_client *client)
{
struct bttv *btv = (struct bttv*)client->adapter->data;
@@ -272,10 +262,9 @@ static struct i2c_algo_bit_data bttv_i2c_algo_template = {
};
static struct i2c_adapter bttv_i2c_adap_template = {
+ .owner = THIS_MODULE,
.name = "bt848",
.id = I2C_HW_B_BT848,
- .inc_use = bttv_inc_use,
- .dec_use = bttv_dec_use,
.client_register = attach_inform,
.client_unregister = detach_inform,
};
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index bcc26db53c6a..af042ec7b2ad 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3173,7 +3173,7 @@ static int cpia_open(struct inode *inode, struct file *file)
return -ENODEV;
}
- if (!try_inc_mod_count(cam->ops->owner))
+ if (!try_module_get(cam->ops->owner))
return -ENODEV;
down(&cam->busy_lock);
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index fbbe02a10faf..0e4d9b8d4b86 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -318,16 +318,6 @@ static u32 functionality(struct i2c_adapter *adap)
return I2C_FUNC_SMBUS_EMUL;
}
-static void inc_use(struct i2c_adapter *adap)
-{
- MOD_INC_USE_COUNT;
-}
-
-static void dec_use(struct i2c_adapter *adap)
-{
- MOD_DEC_USE_COUNT;
-}
-
static int attach_inform(struct i2c_client *client)
{
struct saa7134_dev *dev = client->adapter->algo_data;
@@ -346,11 +336,10 @@ static struct i2c_algorithm saa7134_algo = {
};
static struct i2c_adapter saa7134_adap_template = {
+ .owner = THIS_MODULE,
.name = "saa7134",
.id = I2C_ALGO_SAA7134,
.algo = &saa7134_algo,
- .inc_use = inc_use,
- .dec_use = dec_use,
.client_register = attach_inform,
};
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
index 62f1b96b0e78..e3ab127a6d3b 100644
--- a/drivers/media/video/tvmixer.c
+++ b/drivers/media/video/tvmixer.c
@@ -195,8 +195,9 @@ static int tvmixer_open(struct inode *inode, struct file *file)
/* lock bttv in memory while the mixer is in use */
file->private_data = mix;
- if (client->adapter->inc_use)
- client->adapter->inc_use(client->adapter);
+
+ if (!try_module_get(client->adapter->owner))
+ return -ENODEV;
return 0;
}
@@ -210,8 +211,7 @@ static int tvmixer_release(struct inode *inode, struct file *file)
return -ENODEV;
}
- if (client->adapter->dec_use)
- client->adapter->dec_use(client->adapter);
+ module_put(client->adapter->owner);
return 0;
}
diff --git a/drivers/mtd/chips/chipreg.c b/drivers/mtd/chips/chipreg.c
index efdd7ee41d34..b33292c88be6 100644
--- a/drivers/mtd/chips/chipreg.c
+++ b/drivers/mtd/chips/chipreg.c
@@ -44,7 +44,7 @@ static struct mtd_chip_driver *get_mtd_chip_driver (char *name)
break;
}
}
- if (ret && !try_inc_mod_count(ret->module)) {
+ if (ret && !try_module_get(ret->module)) {
/* Eep. Failed. */
ret = NULL;
}
diff --git a/drivers/net/defxx.h b/drivers/net/defxx.h
index dc88192bcd48..4fc9425dcbc8 100644
--- a/drivers/net/defxx.h
+++ b/drivers/net/defxx.h
@@ -1669,13 +1669,6 @@ typedef union
#define XMT_BUFF_K_SA 7 /* six byte source address */
#define XMT_BUFF_K_DATA 13 /* offset to start of packet data */
-/*
- * Macro evaluates to "value" aligned to "size" bytes. Make sure that
- * "size" is greater than 0 bytes.
- */
-
-#define ALIGN(value,size) ((value + (size - 1)) & ~(size - 1))
-
/* Macro for checking a "value" is within a specific range */
#define IN_RANGE(value,low,high) ((value >= low) && (value <= high))
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c
index a27737026547..09823085fa2d 100644
--- a/drivers/net/irda/sir_dev.c
+++ b/drivers/net/irda/sir_dev.c
@@ -466,13 +466,9 @@ static int sirdev_open(struct net_device *ndev)
if (!drv)
return -ENODEV;
- lock_kernel(); /* serialize with rmmod */
/* increase the reference count of the driver module before doing serious stuff */
- if (drv->owner && !try_inc_mod_count(drv->owner)) {
- unlock_kernel();
+ if (!try_module_get(drv->owner))
return -ESTALE;
- }
- unlock_kernel();
IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
diff --git a/drivers/net/irda/sir_dongle.c b/drivers/net/irda/sir_dongle.c
index cf7a17a002d3..b23cd3480519 100644
--- a/drivers/net/irda/sir_dongle.c
+++ b/drivers/net/irda/sir_dongle.c
@@ -95,13 +95,13 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
* 1) dongle driver was already unregistered - then we haven't found the
* requested dongle above and are already out here
* 2) the module is already marked deleted but the driver is still
- * registered - then the try_inc_mod_count() below will fail
- * 3) the try_inc_mod_count() below succeeds before the module is marked
+ * registered - then the try_module_get() below will fail
+ * 3) the try_module_get() below succeeds before the module is marked
* deleted - then sys_delete_module() fails and prevents the removal
* because the module is in use.
*/
- if (drv->owner && !try_inc_mod_count(drv->owner)) {
+ if (!try_module_get(drv->owner)) {
err = -ESTALE;
goto out_unlock; /* rmmod already pending */
}
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 8eedee623a04..5be431297f86 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -1734,7 +1734,7 @@ dasd_open(struct inode *inp, struct file *filp)
rc = 0;
if (atomic_inc_return(&device->open_count) == 1) {
- if (!try_inc_mod_count(device->discipline->owner)) {
+ if (!try_module_get(device->discipline->owner)) {
/* Discipline is currently unloaded! */
atomic_dec(&device->open_count);
rc = -ENODEV;
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index 9047d68fb20a..e570db2497bd 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -111,13 +111,10 @@ dasd_ioctl(struct inode *inp, struct file *filp,
ioctl = list_entry(l, dasd_ioctl_list_t, list);
if (ioctl->no == no) {
/* Found a matching ioctl. Call it. */
- if (ioctl->owner) {
- if (try_inc_mod_count(ioctl->owner) != 0)
- continue;
- rc = ioctl->handler(bdev, no, data);
- module_put(ioctl->owner);
- } else
- rc = ioctl->handler(bdev, no, data);
+ if (try_module_get(ioctl->owner) != 0)
+ continue;
+ rc = ioctl->handler(bdev, no, data);
+ module_put(ioctl->owner);
return rc;
}
}
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index af71fadf2f52..7da7493a6a63 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -837,7 +837,7 @@ tape_open(struct tape_device *device)
DBF_EVENT(6, "TAPE:dbusy\n");
rc = -EBUSY;
} else if (device->discipline != NULL &&
- !try_inc_mod_count(device->discipline->owner)) {
+ !try_module_get(device->discipline->owner)) {
DBF_EVENT(6, "TAPE:nodisc\n");
rc = -ENODEV;
} else {
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 4a30106757b6..69f6593b6072 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -1297,7 +1297,6 @@ Scsi_Host_Template aic7xxx_driver_template = {
*/
.max_sectors = 8192,
#endif
-#if defined CONFIG_HIGHIO
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
/* Assume RedHat Distribution with its different HIGHIO conventions. */
.can_dma_32 = 1,
@@ -1305,7 +1304,6 @@ Scsi_Host_Template aic7xxx_driver_template = {
#else
.highmem_io = 1,
#endif
-#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
.name = "aic7xxx",
.slave_alloc = ahc_linux_slave_alloc,
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
index 495367b66a6d..05b12228dc10 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
@@ -166,6 +166,9 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
+ } else {
+ ahc_pci_set_dma_mask(pdev, 0xffffffffULL);
+ ahc->platform_data->hw_dma_mask = 0xffffffffULL;
}
#endif
ahc->dev_softc = pci;
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 27bee295b157..f7c3379dafe3 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -16,15 +16,15 @@
Copyright 1992 - 2002 Kai Makisara / Willem Riede
email Kai.Makisara@metla.fi / osst@riede.org
- $Header: /home/cvsroot/Driver/osst.c,v 1.65 2001/11/11 20:38:56 riede Exp $
+ $Header: /home/cvsroot/Driver/osst.c,v 1.68 2002/12/23 16:33:36 riede Exp $
Microscopic alterations - Rik Ling, 2000/12/21
Last st.c sync: Tue Oct 15 22:01:04 2002 by makisara
Some small formal changes - aeb, 950809
*/
-static const char * cvsid = "$Id: osst.c,v 1.65 2001/11/11 20:38:56 riede Exp $";
-const char * osst_version = "0.99.0p5";
+static const char * cvsid = "$Id: osst.c,v 1.68 2002/12/23 16:33:36 riede Exp $";
+const char * osst_version = "0.99.0";
/* The "failure to reconnect" firmware bug */
#define OSST_FW_NEED_POLL_MIN 10601 /*(107A)*/
@@ -470,7 +470,7 @@ static void osst_init_aux(OS_Scsi_Tape * STp, int frame_type, int frame_seq_numb
*/
static int osst_verify_frame(OS_Scsi_Tape * STp, int frame_seq_number, int quiet)
{
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
os_aux_t * aux = STp->buffer->aux;
os_partition_t * par = &(aux->partition);
ST_partstat * STps = &(STp->ps[STp->partition]);
@@ -676,7 +676,7 @@ static int osst_wait_for_medium(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsi
long startwait = jiffies;
#if DEBUG
int dbg = debugging;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached onstream wait for medium\n", name);
#endif
@@ -748,7 +748,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
int result = 0;
int delay = OSST_WAIT_WRITE_COMPLETE;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached onstream flush drive buffer (write filemark)\n", name);
#endif
@@ -778,7 +778,7 @@ static int osst_flush_drive_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_wait_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int curr, int minlast, int to)
{
long startwait = jiffies;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#if DEBUG
char notyetprinted = 1;
#endif
@@ -841,7 +841,7 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo
int retval = 0;
#if DEBUG
os_aux_t * aux = STp->buffer->aux;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
/* TODO: Error handling */
@@ -888,10 +888,12 @@ static int osst_read_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int timeo
STp->first_frame_position++;
#if DEBUG
if (debugging) {
+ char sig[8]; int i;
+ for (i=0;i<4;i++)
+ sig[i] = aux->application_sig[i]<32?'^':aux->application_sig[i];
+ sig[4] = '\0';
printk(OSST_DEB_MSG
- "%s:D: AUX: %c%c%c%c UpdFrCt#%d Wpass#%d %s FrSeq#%d LogBlk#%d Qty=%d Sz=%d\n", name,
- aux->application_sig[0], aux->application_sig[1],
- aux->application_sig[2], aux->application_sig[3],
+ "%s:D: AUX: %s UpdFrCt#%d Wpass#%d %s FrSeq#%d LogBlk#%d Qty=%d Sz=%d\n", name, sig,
ntohl(aux->update_frame_cntr), ntohs(aux->partition.wrt_pass_cntr),
aux->frame_type==1?"EOD":aux->frame_type==2?"MARK":
aux->frame_type==8?"HEADR":aux->frame_type==0x80?"DATA":"FILL",
@@ -913,7 +915,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
unsigned char cmd[MAX_COMMAND_SIZE];
int retval = 0;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
if (STps->rw != ST_READING) { /* Initialize read operation */
@@ -947,7 +949,7 @@ static int osst_initiate_read(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int frame_seq_number, int quiet)
{
ST_partstat * STps = &(STp->ps[STp->partition]);
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int cnt = 0,
bad = 0,
past = 0,
@@ -1073,7 +1075,7 @@ static int osst_get_logical_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in
static int osst_seek_logical_blk(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int logical_blk_num)
{
ST_partstat * STps = &(STp->ps[STp->partition]);
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int retries = 0;
int frame_seq_estimate, ppos_estimate, move;
@@ -1183,7 +1185,7 @@ static int osst_get_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{
int sector;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG
"%s:D: Positioned at ppos %d, frame %d, lbn %d, file %d, blk %d, %cptr %d, eof %d\n",
@@ -1216,7 +1218,7 @@ static int osst_seek_sector(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int sect
offset = (sector & OSST_SECTOR_MASK) << OSST_SECTOR_SHIFT,
r;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Seeking sector %d in frame %d at offset %d\n",
name, sector, frame, offset);
@@ -1285,7 +1287,7 @@ static int osst_read_back_buffer_and_rewrite(OS_Scsi_Tape * STp, Scsi_Request **
- (nframes + pending - 1);
int logical_blk_num = ntohl(STp->buffer->aux->logical_blk_num)
- (nframes + pending - 1) * blks_per_frame;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
long startwait = jiffies;
#if DEBUG
int dbg = debugging;
@@ -1471,7 +1473,7 @@ static int osst_reposition_and_retry(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
{
unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int expected = 0;
int attempts = 1000 / skip;
int flag = 1;
@@ -1574,7 +1576,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
{
Scsi_Request * SRpnt = * aSRpnt;
ST_partstat * STps = & STp->ps[STp->partition];
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int retval = 0;
int rw_state;
unsigned int frame, skip;
@@ -1650,7 +1652,7 @@ static int osst_write_error_recovery(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
static int osst_space_over_filemarks_backward(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
int mt_op, int mt_count)
{
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int cnt;
int last_mark_ppos = -1;
@@ -1751,7 +1753,7 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque
{
int cnt = 0;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Reached space_over_filemarks_forward_slow %d %d\n", name, mt_op, mt_count);
#endif
@@ -1803,8 +1805,8 @@ static int osst_space_over_filemarks_forward_slow(OS_Scsi_Tape * STp, Scsi_Reque
static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt,
int mt_op, int mt_count)
{
- char *name = tape_name(STp);
- int cnt = 0,
+ char * name = tape_name(STp);
+ int cnt = 0,
next_mark_ppos = -1;
#if DEBUG
@@ -1954,8 +1956,8 @@ static int osst_space_over_filemarks_forward_fast(OS_Scsi_Tape * STp, Scsi_Reque
static void osst_set_retries(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int retries)
{
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request * SRpnt = * aSRpnt;
- char *name = tape_name(STp);
+ Scsi_Request * SRpnt = * aSRpnt;
+ char * name = tape_name(STp);
memset(cmd, 0, MAX_COMMAND_SIZE);
cmd[0] = MODE_SELECT;
@@ -1989,7 +1991,7 @@ static int osst_write_filemark(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
int this_mark_ppos = STp->first_frame_position;
int this_mark_lbn = STp->logical_blk_num;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
if (STp->raw) return 0;
@@ -2015,7 +2017,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{
int result;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
if (STp->raw) return 0;
@@ -2036,7 +2038,7 @@ static int osst_write_eod(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count)
{
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#if DEBUG
printk(OSST_DEB_MSG "%s:D: Reached onstream write filler group %d\n", name, where);
@@ -2061,7 +2063,7 @@ static int osst_write_filler(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int whe
static int __osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int where, int count)
{
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
int result;
#if DEBUG
@@ -2090,7 +2092,7 @@ static int osst_write_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int loc
{
os_header_t * header;
int result;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#if DEBUG
printk(OSST_DEB_MSG "%s:D: Writing tape header\n", name);
@@ -2175,7 +2177,7 @@ static int osst_reset_header(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int ppos)
{
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
os_header_t * header;
os_aux_t * aux;
char id_string[8];
@@ -2352,10 +2354,10 @@ static int __osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, in
static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{
- int position, ppos;
+ int position, ppos;
int first, last;
int valid = 0;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
position = osst_get_frame_position(STp, aSRpnt);
@@ -2408,14 +2410,14 @@ static int osst_analyze_headers(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
static int osst_verify_position(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt)
{
int frame_position = STp->first_frame_position;
- int frame_seq_numbr = STp->frame_seq_number;
+ int frame_seq_numbr = STp->frame_seq_number;
int logical_blk_num = STp->logical_blk_num;
- int halfway_frame = STp->frame_in_buffer;
- int read_pointer = STp->buffer->read_pointer;
+ int halfway_frame = STp->frame_in_buffer;
+ int read_pointer = STp->buffer->read_pointer;
int prev_mark_ppos = -1;
int actual_mark_ppos, i, n;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
printk(OSST_DEB_MSG "%s:D: Verify that the tape is really the one we think before writing\n", name);
#endif
@@ -2484,8 +2486,8 @@ static unsigned int osst_parse_firmware_rev (const char * str)
static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
{
unsigned char cmd[MAX_COMMAND_SIZE];
- char *name = tape_name(STp);
- Scsi_Request * SRpnt = * aSRpnt;
+ char * name = tape_name(STp);
+ Scsi_Request * SRpnt = * aSRpnt;
osst_mode_parameter_header_t * header;
osst_block_size_page_t * bs;
osst_capabilities_page_t * cp;
@@ -2655,7 +2657,7 @@ static int osst_configure_onstream(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
static int cross_eof(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, int forward)
{
int result;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#if DEBUG
if (debugging)
@@ -2692,7 +2694,7 @@ static int osst_get_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
char mybuf[24];
char * olddata = STp->buffer->b_data;
int oldsize = STp->buffer->buffer_size;
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
if (STp->ready != ST_READY) return (-EIO);
@@ -2765,8 +2767,8 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in
Scsi_Request * SRpnt;
ST_partstat * STps;
int result = 0;
- int pp = (ppos == 3000 && !skip)? 0 : ppos;
- char *name = tape_name(STp);
+ int pp = (ppos == 3000 && !skip)? 0 : ppos;
+ char * name = tape_name(STp);
if (STp->ready != ST_READY) return (-EIO);
@@ -2824,12 +2826,12 @@ static int osst_set_frame_position(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt, in
/* Flush the write buffer (never need to write if variable blocksize). */
static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
{
- int offset, transfer, blks = 0;
- int result = 0;
- unsigned char cmd[MAX_COMMAND_SIZE];
+ int offset, transfer, blks = 0;
+ int result = 0;
+ unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt = *aSRpnt;
- ST_partstat * STps;
- char *name = tape_name(STp);
+ ST_partstat * STps;
+ char * name = tape_name(STp);
if ((STp->buffer)->writing) {
if (SRpnt == (STp->buffer)->last_SRpnt)
@@ -2954,10 +2956,10 @@ static int osst_flush_write_buffer(OS_Scsi_Tape *STp, Scsi_Request ** aSRpnt)
seek_next is true. */
static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int seek_next)
{
- ST_partstat * STps;
- int backspace = 0, result = 0;
+ ST_partstat * STps;
+ int backspace = 0, result = 0;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
/*
@@ -3017,10 +3019,10 @@ static int osst_flush_buffer(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int see
static int osst_write_frame(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, int synchronous)
{
unsigned char cmd[MAX_COMMAND_SIZE];
- Scsi_Request * SRpnt;
+ Scsi_Request * SRpnt;
int blks;
#if DEBUG
- char *name = tape_name(STp);
+ char * name = tape_name(STp);
#endif
if ((!STp-> raw) && (STp->first_frame_position == 0xbae)) { /* _must_ preserve buffer! */
@@ -3139,16 +3141,16 @@ static void reset_state(OS_Scsi_Tape *STp)
/* Write command */
static ssize_t osst_write(struct file * filp, const char * buf, size_t count, loff_t *ppos)
{
- ssize_t total, retval = 0;
- ssize_t i, do_count, blks, transfer;
- int write_threshold;
- int doing_write = 0;
- const char *b_point;
+ ssize_t total, retval = 0;
+ ssize_t i, do_count, blks, transfer;
+ int write_threshold;
+ int doing_write = 0;
+ const char * b_point;
Scsi_Request * SRpnt = NULL;
- ST_mode * STm;
- ST_partstat * STps;
- OS_Scsi_Tape * STp = filp->private_data;
- char *name = tape_name(STp);
+ ST_mode * STm;
+ ST_partstat * STps;
+ OS_Scsi_Tape * STp = filp->private_data;
+ char * name = tape_name(STp);
if (down_interruptible(&STp->lock))
@@ -3468,14 +3470,14 @@ out:
/* Read command */
static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *ppos)
{
- ssize_t total, retval = 0;
- ssize_t i, transfer;
- int special;
- ST_mode * STm;
- ST_partstat * STps;
- Scsi_Request *SRpnt = NULL;
- OS_Scsi_Tape * STp = filp->private_data;
- char *name = tape_name(STp);
+ ssize_t total, retval = 0;
+ ssize_t i, transfer;
+ int special;
+ ST_mode * STm;
+ ST_partstat * STps;
+ Scsi_Request * SRpnt = NULL;
+ OS_Scsi_Tape * STp = filp->private_data;
+ char * name = tape_name(STp);
if (down_interruptible(&STp->lock))
@@ -3523,8 +3525,7 @@ static ssize_t osst_read(struct file * filp, char * buf, size_t count, loff_t *p
goto out;
}
- if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED &&
- !osst_int_ioctl(STp, &SRpnt, MTLOCK, 0))
+ if (STp->do_auto_lock && STp->door_locked == ST_UNLOCKED && !do_door_lock(STp, 1))
STp->door_locked = ST_LOCKED_AUTO;
STps = &(STp->ps[STp->partition]);
@@ -3683,10 +3684,10 @@ static void osst_log_options(OS_Scsi_Tape *STp, ST_mode *STm, char *name)
static int osst_set_options(OS_Scsi_Tape *STp, long options)
{
- int value;
- long code;
- ST_mode *STm;
- char *name = tape_name(STp);
+ int value;
+ long code;
+ ST_mode * STm;
+ char * name = tape_name(STp);
STm = &(STp->modes[STp->current_mode]);
if (!STm->defined) {
@@ -3839,16 +3840,16 @@ static int osst_set_options(OS_Scsi_Tape *STp, long options)
/* Internal ioctl function */
static int osst_int_ioctl(OS_Scsi_Tape * STp, Scsi_Request ** aSRpnt, unsigned int cmd_in, unsigned long arg)
{
- int timeout;
- long ltmp;
- int i, ioctl_result;
- int chg_eof = TRUE;
- unsigned char cmd[MAX_COMMAND_SIZE];
+ int timeout;
+ long ltmp;
+ int i, ioctl_result;
+ int chg_eof = TRUE;
+ unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt = * aSRpnt;
- ST_partstat * STps;
- int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num;
- int datalen = 0, direction = SCSI_DATA_NONE;
- char *name = tape_name(STp);
+ ST_partstat * STps;
+ int fileno, blkno, at_sm, frame_seq_numbr, logical_blk_num;
+ int datalen = 0, direction = SCSI_DATA_NONE;
+ char * name = tape_name(STp);
if (STp->ready != ST_READY && cmd_in != MTLOAD) {
if (STp->ready == ST_NO_TAPE)
@@ -4208,15 +4209,15 @@ os_bypass:
static int os_scsi_tape_open(struct inode * inode, struct file * filp)
{
unsigned short flags;
- int i, b_size, new_session = FALSE, retval = 0;
- unsigned char cmd[MAX_COMMAND_SIZE];
+ int i, b_size, new_session = FALSE, retval = 0;
+ unsigned char cmd[MAX_COMMAND_SIZE];
Scsi_Request * SRpnt;
OS_Scsi_Tape * STp;
- ST_mode * STm;
- ST_partstat * STps;
- char *name;
- int dev = TAPE_NR(inode->i_rdev);
- int mode = TAPE_MODE(inode->i_rdev);
+ ST_mode * STm;
+ ST_partstat * STps;
+ char * name;
+ int dev = TAPE_NR(inode->i_rdev);
+ int mode = TAPE_MODE(inode->i_rdev);
write_lock(&os_scsi_tapes_lock);
if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
@@ -4267,44 +4268,32 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
STp->raw = TAPE_IS_RAW(inode->i_rdev);
if (STp->raw)
STp->header_ok = 0;
-#if 0
- /* Allocate a buffer for this user */
- need_dma_buffer = STp->restr_dma;
- for (i=0; i < osst_nbr_buffers; i++)
- if (!osst_buffers[i]->in_use &&
- (!need_dma_buffer || osst_buffers[i]->dma))
- break;
- if (i >= osst_nbr_buffers) {
- STp->buffer = new_tape_buffer(FALSE, need_dma_buffer);
- if (STp->buffer == NULL) {
- printk(KERN_WARNING "%s:W: Can't allocate tape buffer.\n", name);
- retval = (-EBUSY);
- goto err_out;
- }
- }
- else
- STp->buffer = osst_buffers[i];
-#endif /* now pre_allocated */
+
/* Allocate data segments for this device's tape buffer */
if (!enlarge_buffer(STp->buffer, STp->restr_dma)) {
printk(KERN_ERR "%s:E: Unable to allocate memory segments for tape buffer.\n", name);
retval = (-EOVERFLOW);
goto err_out;
}
- (STp->buffer)->writing = 0;
- (STp->buffer)->syscall_result = 0;
-#if 0
- (STp->buffer)->use_sg = STp->device->host->sg_tablesize;
-
- /* Compute the usable buffer size for this SCSI adapter */
- if (!(STp->buffer)->use_sg)
- (STp->buffer)->buffer_size = (STp->buffer)->sg[0].length;
- else {
- for (i=0, (STp->buffer)->buffer_size = 0; i < (STp->buffer)->use_sg &&
- i < (STp->buffer)->sg_segs; i++)
- (STp->buffer)->buffer_size += (STp->buffer)->sg[i].length;
- }
+ if (STp->buffer->buffer_size >= OS_FRAME_SIZE) {
+ for (i = 0, b_size = 0;
+ (i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE);
+ b_size += STp->buffer->sg[i++].length);
+ STp->buffer->aux = (os_aux_t *) (page_address(STp->buffer->sg[i].page) + OS_DATA_SIZE - b_size);
+#if DEBUG
+ printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name,
+ STp->buffer->b_data, page_address(STp->buffer->sg[0].page));
+ printk(OSST_DEB_MSG "%s:D: AUX points to %p in segment %d at %p\n", name,
+ STp->buffer->aux, i, page_address(STp->buffer->sg[i].page));
#endif
+ } else {
+ STp->buffer->aux = NULL; /* this had better never happen! */
+ printk(KERN_NOTICE "%s:A: Framesize %d too large for buffer.\n", name, OS_FRAME_SIZE);
+ retval = (-EIO);
+ goto err_out;
+ }
+ STp->buffer->writing = 0;
+ STp->buffer->syscall_result = 0;
STp->dirty = 0;
for (i=0; i < ST_NBR_PARTITIONS; i++) {
STps = &(STp->ps[i]);
@@ -4410,7 +4399,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
i = STp->first_frame_position;
if (STp->header_ok && i == osst_get_frame_position(STp, &SRpnt)) {
if (STp->door_locked == ST_UNLOCKED) {
- if (osst_int_ioctl(STp, &SRpnt, MTLOCK, 0))
+ if (do_door_lock(STp, 1))
printk(KERN_INFO "%s:I: Can't lock drive door\n", name);
else
STp->door_locked = ST_LOCKED_AUTO;
@@ -4512,24 +4501,6 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
osst_configure_onstream(STp, &SRpnt);
- if (STp->buffer->buffer_size >= OS_FRAME_SIZE) {
- for (i = 0, b_size = 0;
- (i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE);
- b_size += STp->buffer->sg[i++].length);
- STp->buffer->aux = (os_aux_t *) (page_address(STp->buffer->sg[i].page) + OS_DATA_SIZE - b_size);
-#if DEBUG
- printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name,
- STp->buffer->b_data, page_address(STp->buffer->sg[0].page));
- printk(OSST_DEB_MSG "%s:D: AUX points to %p in segment %d at %p\n", name,
- STp->buffer->aux, i, page_address(STp->buffer->sg[i].page));
-#endif
- } else {
- STp->buffer->aux = NULL; /* this had better never happen! */
- printk(KERN_NOTICE "%s:A: Framesize %d too large for buffer.\n", name, OS_FRAME_SIZE);
- retval = (-EIO);
- goto err_out;
- }
-
STp->block_size = STp->raw ? OS_FRAME_SIZE : (
(STm->default_blksize > 0) ? STm->default_blksize : OS_DATA_SIZE);
STp->buffer->buffer_blocks = STp->raw ? 1 : OS_DATA_SIZE / STp->block_size;
@@ -4569,7 +4540,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
* properly position the tape and check the ADR headers
*/
if (STp->door_locked == ST_UNLOCKED) {
- if (osst_int_ioctl(STp, &SRpnt, MTLOCK, 0))
+ if (do_door_lock(STp, 1))
printk(KERN_INFO "%s:I: Can't lock drive door\n", name);
else
STp->door_locked = ST_LOCKED_AUTO;
@@ -4597,12 +4568,12 @@ err_out:
/* Flush the tape buffer before close */
static int os_scsi_tape_flush(struct file * filp)
{
- int result = 0, result2;
- OS_Scsi_Tape * STp = filp->private_data;
- ST_mode * STm = &(STp->modes[STp->current_mode]);
- ST_partstat * STps = &(STp->ps[STp->partition]);
- Scsi_Request *SRpnt = NULL;
- char *name = tape_name(STp);
+ int result = 0, result2;
+ OS_Scsi_Tape * STp = filp->private_data;
+ ST_mode * STm = &(STp->modes[STp->current_mode]);
+ ST_partstat * STps = &(STp->ps[STp->partition]);
+ Scsi_Request * SRpnt = NULL;
+ char * name = tape_name(STp);
if (file_count(filp) > 1)
return 0;
@@ -4727,13 +4698,13 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
static int osst_ioctl(struct inode * inode,struct file * file,
unsigned int cmd_in, unsigned long arg)
{
- int i, cmd_nr, cmd_type, retval = 0;
- unsigned int blk;
- ST_mode *STm;
- ST_partstat *STps;
- Scsi_Request *SRpnt = NULL;
- OS_Scsi_Tape *STp = file->private_data;
- char *name = tape_name(STp);
+ int i, cmd_nr, cmd_type, retval = 0;
+ unsigned int blk;
+ ST_mode * STm;
+ ST_partstat * STps;
+ Scsi_Request * SRpnt = NULL;
+ OS_Scsi_Tape * STp = file->private_data;
+ char * name = tape_name(STp);
if (down_interruptible(&STp->lock))
return -ERESTARTSYS;
@@ -4813,6 +4784,8 @@ static int osst_ioctl(struct inode * inode,struct file * file,
i = mtc.mt_op == MTREW || mtc.mt_op == MTOFFL ||
mtc.mt_op == MTRETEN || mtc.mt_op == MTEOM ||
mtc.mt_op == MTLOCK || mtc.mt_op == MTLOAD ||
+ mtc.mt_op == MTFSF || mtc.mt_op == MTFSFM ||
+ mtc.mt_op == MTBSF || mtc.mt_op == MTBSFM ||
mtc.mt_op == MTCOMPRESSION;
}
i = osst_flush_buffer(STp, &SRpnt, i);
@@ -5123,8 +5096,9 @@ static int enlarge_buffer(OSST_buffer *STbuffer, int need_dma)
"osst :D: Expanded tape buffer (%d bytes, %d->%d segments, dma: %d, at: %p).\n",
got, STbuffer->orig_sg_segs, STbuffer->sg_segs, need_dma, STbuffer->b_data);
printk(OSST_DEB_MSG
- "osst :D: segment sizes: first %d, last %d bytes.\n",
- STbuffer->sg[0].length, STbuffer->sg[segs-1].length);
+ "osst :D: segment sizes: first %d at %p, last %d bytes at %p.\n",
+ STbuffer->sg[0].length, page_address(STbuffer->sg[0].page),
+ STbuffer->sg[segs-1].length, page_address(STbuffer->sg[segs-1].page));
}
#endif
@@ -5410,12 +5384,12 @@ static struct osst_support_data support_list[] = {
static int osst_attach(Scsi_Device * SDp)
{
- OS_Scsi_Tape * tpnt;
- ST_mode * STm;
- ST_partstat * STps;
- OSST_buffer *buffer;
- struct gendisk *drive;
- int i, mode, dev_num;
+ OS_Scsi_Tape * tpnt;
+ ST_mode * STm;
+ ST_partstat * STps;
+ OSST_buffer * buffer;
+ struct gendisk * drive;
+ int i, mode, dev_num;
if (SDp->type != TYPE_TAPE || !osst_supports(SDp))
return 1;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index b3acfcffc73b..1449db800808 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -172,8 +172,7 @@ void scsi_times_out(Scsi_Cmnd *scmd)
* see whether the host or the device is offline.
*
* Return value:
- * FALSE when dev was taken offline by error recovery. TRUE OK to
- * proceed.
+ * 0 when dev was taken offline by error recovery. 1 OK to proceed.
**/
int scsi_block_when_processing_errors(Scsi_Device *sdev)
{
@@ -1157,7 +1156,7 @@ static void scsi_eh_offline_sdevs(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
if (scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_TIMEOUT))
scmd->result |= (DRIVER_TIMEOUT << 24);
- scmd->device->online = FALSE;
+ scmd->device->online = 0;
scsi_eh_finish_cmd(scmd, shost);
}
return;
@@ -1222,7 +1221,7 @@ int scsi_decide_disposition(Scsi_Cmnd *scmd)
* if the device is offline, then we clearly just pass the result back
* up to the top level.
*/
- if (scmd->device->online == FALSE) {
+ if (!scmd->device->online) {
SCSI_LOG_ERROR_RECOVERY(5, printk("%s: device offline - report"
" as SUCCESS\n",
__FUNCTION__));
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 475e58db7ace..d3b5bc941760 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1060,7 +1060,7 @@ void scsi_request_fn(request_queue_t * q)
*/
void scsi_block_requests(struct Scsi_Host * SHpnt)
{
- SHpnt->host_self_blocked = TRUE;
+ SHpnt->host_self_blocked = 1;
}
/*
@@ -1087,7 +1087,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
{
Scsi_Device *SDloop;
- SHpnt->host_self_blocked = FALSE;
+ SHpnt->host_self_blocked = 0;
/* Now that we are unblocked, try to start the queues. */
list_for_each_entry(SDloop, &SHpnt->my_devices, siblings)
scsi_queue_next_request(SDloop->request_queue, NULL);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b5276bdc69b6..2ce2cb32ee76 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -537,9 +537,20 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
return sd_hdio_getgeo(bdev, (struct hd_geometry *)arg);
}
- error = scsi_cmd_ioctl(bdev, cmd, arg);
- if (error != -ENOTTY)
- return error;
+ /*
+ * Send SCSI addressing ioctls directly to mid level, send other
+ * ioctls to block level and then onto mid level if they can't be
+ * resolved.
+ */
+ switch (cmd) {
+ case SCSI_IOCTL_GET_IDLUN:
+ case SCSI_IOCTL_GET_BUS_NUMBER:
+ return scsi_ioctl(sdp, cmd, (void *)arg);
+ default:
+ error = scsi_cmd_ioctl(bdev, cmd, arg);
+ if (error != -ENOTTY)
+ return error;
+ }
return scsi_ioctl(sdp, cmd, (void *)arg);
}
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 780d516c291d..0de2e7c68206 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -434,6 +434,17 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
unsigned long arg)
{
struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk);
+ struct scsi_device *sdev = cd->device;
+
+ /*
+ * Send SCSI addressing ioctls directly to mid level, send other
+ * ioctls to cdrom/block level.
+ */
+ switch (cmd) {
+ case SCSI_IOCTL_GET_IDLUN:
+ case SCSI_IOCTL_GET_BUS_NUMBER:
+ return scsi_ioctl(sdev, cmd, (void *)arg);
+ }
return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
}
diff --git a/drivers/scsi/sr_vendor.c b/drivers/scsi/sr_vendor.c
index 76a701bb4502..690d8feafe6e 100644
--- a/drivers/scsi/sr_vendor.c
+++ b/drivers/scsi/sr_vendor.c
@@ -37,6 +37,7 @@
#include <linux/config.h>
#include <linux/errno.h>
#include <linux/string.h>
+#include <linux/bcd.h>
#include <linux/blk.h>
#include "scsi.h"
@@ -151,8 +152,6 @@ int sr_set_blocklength(Scsi_CD *cd, int blocklength)
/* This function gets called after a media change. Checks if the CD is
multisession, asks for offset etc. */
-#define BCD_TO_BIN(x) ((((int)x & 0xf0) >> 4)*10 + ((int)x & 0x0f))
-
int sr_cd_check(struct cdrom_device_info *cdi)
{
Scsi_CD *cd = cdi->handle;
@@ -223,9 +222,9 @@ int sr_cd_check(struct cdrom_device_info *cdi)
no_multi = 1;
break;
}
- min = BCD_TO_BIN(buffer[15]);
- sec = BCD_TO_BIN(buffer[16]);
- frame = BCD_TO_BIN(buffer[17]);
+ min = BCD2BIN(buffer[15]);
+ sec = BCD2BIN(buffer[16]);
+ frame = BCD2BIN(buffer[17]);
sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame;
break;
}
@@ -252,9 +251,9 @@ int sr_cd_check(struct cdrom_device_info *cdi)
}
if (rc != 0)
break;
- min = BCD_TO_BIN(buffer[1]);
- sec = BCD_TO_BIN(buffer[2]);
- frame = BCD_TO_BIN(buffer[3]);
+ min = BCD2BIN(buffer[1]);
+ sec = BCD2BIN(buffer[2]);
+ frame = BCD2BIN(buffer[3]);
sector = min * CD_SECS * CD_FRAMES + sec * CD_FRAMES + frame;
if (sector)
sector -= CD_MSF_OFFSET;
diff --git a/drivers/serial/core.c b/drivers/serial/core.c
index 4e4c736318bb..22d42e3b18e9 100644
--- a/drivers/serial/core.c
+++ b/drivers/serial/core.c
@@ -1584,7 +1584,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
* is about to be unloaded). Therefore, it is safe to set
* tty->driver_data to be NULL, so uart_close() doesn't bite us.
*/
- if (!try_inc_mod_count(drv->owner)) {
+ if (!try_module_get(drv->owner)) {
tty->driver_data = NULL;
goto fail;
}
@@ -2096,7 +2096,7 @@ __uart_register_port(struct uart_driver *drv, struct uart_state *state,
* Register the port whether it's detected or not. This allows
* setserial to be used to alter this ports parameters.
*/
- tty_register_devfs(drv->tty_driver, 0, drv->minor + port->line);
+ tty_register_device(drv->tty_driver, drv->minor + port->line);
if (port->type != PORT_UNKNOWN) {
unsigned long flags;
@@ -2153,7 +2153,7 @@ __uart_unregister_port(struct uart_driver *drv, struct uart_state *state)
/*
* Remove the devices from devfs
*/
- tty_unregister_devfs(drv->tty_driver, drv->minor + port->line);
+ tty_unregister_device(drv->tty_driver, drv->minor + port->line);
/*
* Free the port IO and memory resources, if any.
diff --git a/drivers/sgi/char/ds1286.c b/drivers/sgi/char/ds1286.c
index ae11cb96484b..d98e2a63ec63 100644
--- a/drivers/sgi/char/ds1286.c
+++ b/drivers/sgi/char/ds1286.c
@@ -36,6 +36,7 @@
#include <linux/poll.h>
#include <linux/rtc.h>
#include <linux/spinlock.h>
+#include <linux/bcd.h>
#include <asm/ds1286.h>
#include <asm/io.h>
diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c
index 70b494f4df48..6ffa6a963d3a 100644
--- a/drivers/tc/zs.c
+++ b/drivers/tc/zs.c
@@ -1971,9 +1971,9 @@ int __init zs_init(void)
printk("ttyS%02d at 0x%08x (irq = %d)", info->line,
info->port, info->irq);
printk(" is a Z85C30 SCC\n");
- tty_register_devfs(&serial_driver, 0,
+ tty_register_device(&serial_driver,
serial_driver.minor_start + info->line);
- tty_register_devfs(&callout_driver, 0,
+ tty_register_device(&callout_driver,
callout_driver.minor_start + info->line);
}
diff --git a/drivers/usb/class/bluetty.c b/drivers/usb/class/bluetty.c
index cf977e5d7f8f..628ae2e50f21 100644
--- a/drivers/usb/class/bluetty.c
+++ b/drivers/usb/class/bluetty.c
@@ -1201,7 +1201,7 @@ static int usb_bluetooth_probe (struct usb_interface *intf,
bluetooth, endpoint->bInterval);
/* initialize the devfs nodes for this device and let the user know what bluetooths we are bound to */
- tty_register_devfs (&bluetooth_tty_driver, 0, minor);
+ tty_register_device (&bluetooth_tty_driver, minor);
info("Bluetooth converter now attached to ttyUB%d (or usb/ttub/%d for devfs)", minor, minor);
bluetooth_table[minor] = bluetooth;
@@ -1267,7 +1267,7 @@ static void usb_bluetooth_disconnect(struct usb_interface *intf)
if (bluetooth->interrupt_in_buffer)
kfree (bluetooth->interrupt_in_buffer);
- tty_unregister_devfs (&bluetooth_tty_driver, bluetooth->minor);
+ tty_unregister_device (&bluetooth_tty_driver, bluetooth->minor);
for (i = 0; i < NUM_BULK_URBS; ++i) {
if (bluetooth->write_urb_pool[i]) {
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d9a98785a569..9df95d543407 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -361,7 +361,7 @@ static void acm_tty_close(struct tty_struct *tty, struct file *filp)
usb_unlink_urb(acm->writeurb);
usb_unlink_urb(acm->readurb);
} else {
- tty_unregister_devfs(&acm_tty_driver, acm->minor);
+ tty_unregister_device(&acm_tty_driver, acm->minor);
acm_table[acm->minor] = NULL;
usb_free_urb(acm->ctrlurb);
usb_free_urb(acm->readurb);
@@ -649,7 +649,7 @@ static int acm_probe (struct usb_interface *intf,
usb_driver_claim_interface(&acm_driver, acm->iface + 0, acm);
usb_driver_claim_interface(&acm_driver, acm->iface + 1, acm);
- tty_register_devfs(&acm_tty_driver, 0, minor);
+ tty_register_device(&acm_tty_driver, minor);
acm_table[minor] = acm;
usb_set_intfdata (intf, acm);
@@ -681,7 +681,7 @@ static void acm_disconnect(struct usb_interface *intf)
usb_driver_release_interface(&acm_driver, acm->iface + 1);
if (!acm->used) {
- tty_unregister_devfs(&acm_tty_driver, acm->minor);
+ tty_unregister_device(&acm_tty_driver, acm->minor);
acm_table[acm->minor] = NULL;
usb_free_urb(acm->ctrlurb);
usb_free_urb(acm->readurb);
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index fee75805b1c9..dbc09ec31dd5 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -78,7 +78,7 @@ static int usb_serial_device_probe (struct device *dev)
minor = port->number;
- tty_register_devfs (&usb_serial_tty_driver, 0, minor);
+ tty_register_device (&usb_serial_tty_driver, minor);
dev_info(*dev, "%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)\n",
driver->name, minor, minor);
@@ -110,7 +110,7 @@ static int usb_serial_device_remove (struct device *dev)
}
exit:
minor = port->number;
- tty_unregister_devfs (&usb_serial_tty_driver, minor);
+ tty_unregister_device (&usb_serial_tty_driver, minor);
dev_info(*dev, "%s converter now disconnected from ttyUSB%d\n",
driver->name, minor);
@@ -128,6 +128,7 @@ int usb_serial_bus_register(struct usb_serial_device_type *device)
device->driver.bus = &usb_serial_bus_type;
device->driver.probe = usb_serial_device_probe;
device->driver.remove = usb_serial_device_remove;
+ device->driver.devclass = &tty_devclass;
retval = driver_register(&device->driver);
diff --git a/drivers/video/console/fonts.c b/drivers/video/console/fonts.c
index 54eda88e89de..39e0c3d2775d 100644
--- a/drivers/video/console/fonts.c
+++ b/drivers/video/console/fonts.c
@@ -130,9 +130,6 @@ struct font_desc *get_default_font(int xres, int yres)
return g;
}
-int init_module(void) { return 0; };
-void cleanup_module(void) {};
-
EXPORT_SYMBOL(fonts);
EXPORT_SYMBOL(find_font);
EXPORT_SYMBOL(get_default_font);
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c
index f984722caa89..116c4e3fbefb 100644
--- a/drivers/video/matrox/i2c-matroxfb.c
+++ b/drivers/video/matrox/i2c-matroxfb.c
@@ -87,19 +87,10 @@ static int matroxfb_gpio_getscl(void* data) {
return (matroxfb_read_gpio(b->minfo) & b->mask.clock) ? 1 : 0;
}
-static void matroxfb_dh_inc_use(struct i2c_adapter* dummy) {
- MOD_INC_USE_COUNT;
-}
-
-static void matroxfb_dh_dec_use(struct i2c_adapter* dummy) {
- MOD_DEC_USE_COUNT;
-}
-
static struct i2c_adapter matrox_i2c_adapter_template =
{
+ .owner = THIS_MODULE,
.id = I2C_HW_B_G400,
- .inc_use = matroxfb_dh_inc_use,
- .dec_use = matroxfb_dh_dec_use,
};
static struct i2c_algo_bit_data matrox_i2c_algo_template =
diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c
index 02bc8d68378f..4f2c23038bf4 100644
--- a/drivers/video/matrox/matroxfb_maven.c
+++ b/drivers/video/matrox/matroxfb_maven.c
@@ -945,14 +945,6 @@ static unsigned short normal_i2c[] = { MAVEN_I2CID, I2C_CLIENT_END };
static unsigned short normal_i2c_range[] = { MAVEN_I2CID, MAVEN_I2CID, I2C_CLIENT_END };
I2C_CLIENT_INSMOD;
-static void maven_inc_use(struct i2c_client* clnt) {
- MOD_INC_USE_COUNT;
-}
-
-static void maven_dec_use(struct i2c_client* clnt) {
- MOD_DEC_USE_COUNT;
-}
-
static struct i2c_driver maven_driver;
static int maven_detect_client(struct i2c_adapter* adapter, int address, unsigned short flags,
@@ -1016,17 +1008,13 @@ static int maven_command(struct i2c_client* client, unsigned int cmd, void* arg)
return -ENOIOCTLCMD; /* or -EINVAL, depends on who will call this */
}
-static int maven_driver_registered = 0;
-
static struct i2c_driver maven_driver={
- "maven",
- I2C_DRIVERID_MGATVO,
- I2C_DF_NOTIFY,
- maven_attach_adapter,
- maven_detach_client,
- maven_command,
- maven_inc_use,
- maven_dec_use
+ .owner = THIS_MODULE,
+ .name = "maven",
+ .id = I2C_DRIVERID_MGATVO,
+ .flags = I2C_DF_NOTIFY,
+ .attach_adapter = maven_attach_adapter,
+ .detach_client = maven_detach_client,
};
/* ************************** */
@@ -1039,13 +1027,11 @@ static int matroxfb_maven_init(void) {
printk(KERN_ERR "maven: Maven driver failed to register (%d).\n", err);
return err;
}
- maven_driver_registered = 1;
return 0;
}
static void matroxfb_maven_exit(void) {
- if (maven_driver_registered)
- i2c_del_driver(&maven_driver);
+ i2c_del_driver(&maven_driver);
}
MODULE_AUTHOR("(c) 1999-2002 Petr Vandrovec <vandrove@vc.cvut.cz>");
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index 186dc63d327b..b4cbba51d30e 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -1874,7 +1874,7 @@ static struct file_operations *devfs_get_ops (devfs_handle_t de)
return NULL;
owner = ops->owner;
read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */
- if ( (de->next == de) || !try_inc_mod_count (owner) )
+ if ( (de->next == de) || !try_module_get (owner) )
{ /* Entry is already unhooked or module is unloading */
read_unlock (&de->parent->u.dir.lock);
return NULL;
diff --git a/fs/dquot.c b/fs/dquot.c
index 8781f7201a87..4d8ea00be1f9 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -103,7 +103,7 @@ static struct quota_format_type *find_quota_format(int id)
lock_kernel();
for (actqf = quota_formats; actqf && actqf->qf_fmt_id != id; actqf = actqf->qf_next);
- if (actqf && !try_inc_mod_count(actqf->qf_owner))
+ if (actqf && !try_module_get:(actqf->qf_owner))
actqf = NULL;
unlock_kernel();
return actqf;
diff --git a/fs/exec.c b/fs/exec.c
index 901b8e12388f..8f0b41fd3a28 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -142,7 +142,7 @@ asmlinkage long sys_uselib(const char * library)
for (fmt = formats ; fmt ; fmt = fmt->next) {
if (!fmt->load_shlib)
continue;
- if (!try_inc_mod_count(fmt->module))
+ if (!try_module_get(fmt->module))
continue;
read_unlock(&binfmt_lock);
error = fmt->load_shlib(file);
@@ -971,7 +971,7 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
int (*fn)(struct linux_binprm *, struct pt_regs *) = fmt->load_binary;
if (!fn)
continue;
- if (!try_inc_mod_count(fmt->module))
+ if (!try_module_get(fmt->module))
continue;
read_unlock(&binfmt_lock);
retval = fn(bprm, regs);
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 1abe62f73a62..4a3e6315f9a9 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -576,8 +576,10 @@ int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
(hinfo.minor_hash < start_minor_hash)))
continue;
if ((err = ext3_htree_store_dirent(dir_file,
- hinfo.hash, hinfo.minor_hash, de)) != 0)
+ hinfo.hash, hinfo.minor_hash, de)) != 0) {
+ brelse(bh);
goto errout;
+ }
count++;
}
brelse (bh);
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 223305689d30..824b04137c3a 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -20,7 +20,7 @@
* We can access the fields of list element if:
* 1) spinlock is held or
* 2) we hold the reference to the module.
- * The latter can be guaranteed by call of try_inc_mod_count(); if it
+ * The latter can be guaranteed by call of try_module_get(); if it
* returned 0 we must skip the element, otherwise we got the reference.
* Once the reference is obtained we can drop the spinlock.
*/
@@ -153,8 +153,8 @@ static int fs_name(unsigned int index, char * buf)
read_lock(&file_systems_lock);
for (tmp = file_systems; tmp; tmp = tmp->next, index--)
- if (index <= 0 && try_inc_mod_count(tmp->owner))
- break;
+ if (index <= 0 && try_module_get(tmp->owner))
+ break;
read_unlock(&file_systems_lock);
if (!tmp)
return -EINVAL;
@@ -224,13 +224,13 @@ struct file_system_type *get_fs_type(const char *name)
read_lock(&file_systems_lock);
fs = *(find_filesystem(name));
- if (fs && !try_inc_mod_count(fs->owner))
+ if (fs && !try_module_get(fs->owner))
fs = NULL;
read_unlock(&file_systems_lock);
if (!fs && (request_module(name) == 0)) {
read_lock(&file_systems_lock);
fs = *(find_filesystem(name));
- if (fs && !try_inc_mod_count(fs->owner))
+ if (fs && !try_module_get(fs->owner))
fs = NULL;
read_unlock(&file_systems_lock);
}
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 3ea711688341..99c26613525c 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -205,9 +205,9 @@ static struct nls_table *find_nls(char *charset)
struct nls_table *nls;
spin_lock(&nls_lock);
for (nls = tables; nls; nls = nls->next)
- if (! strcmp(nls->charset, charset))
+ if (!strcmp(nls->charset, charset))
break;
- if (nls && !try_inc_mod_count(nls->owner))
+ if (nls && !try_module_get(nls->owner))
nls = NULL;
spin_unlock(&nls_lock);
return nls;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 29cd0cb68f92..fff23ee7ca2b 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -158,7 +158,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
len = sprintf(page,
"MemTotal: %8lu kB\n"
"MemFree: %8lu kB\n"
- "MemShared: %8lu kB\n"
"Buffers: %8lu kB\n"
"Cached: %8lu kB\n"
"SwapCached: %8lu kB\n"
@@ -179,7 +178,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
"ReverseMaps: %8lu\n",
K(i.totalram),
K(i.freeram),
- K(i.sharedram),
K(i.bufferram),
K(ps.nr_pagecache-total_swapcache_pages-i.bufferram),
K(total_swapcache_pages),
diff --git a/include/asm-alpha/unistd.h b/include/asm-alpha/unistd.h
index da926dbabc93..0afd0b632d80 100644
--- a/include/asm-alpha/unistd.h
+++ b/include/asm-alpha/unistd.h
@@ -340,8 +340,6 @@
#define __NR_io_getevents 400
#define __NR_io_submit 401
#define __NR_io_cancel 402
-#define __NR_alloc_hugepages 403
-#define __NR_free_hugepages 404
#define __NR_exit_group 405
#define __NR_lookup_dcookie 406
#define __NR_sys_epoll_create 407
diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h
index a500b9c08b8b..feb175ee806b 100644
--- a/include/asm-arm/arch-ebsa285/time.h
+++ b/include/asm-arm/arch-ebsa285/time.h
@@ -18,6 +18,7 @@
#define RTC_ALWAYS_BCD 0
#include <linux/mc146818rtc.h>
+#include <linux/bcd.h>
#include <asm/hardware/dec21285.h>
#include <asm/leds.h>
diff --git a/include/asm-cris/rtc.h b/include/asm-cris/rtc.h
index 239b1bb22839..72ff33a48a8d 100644
--- a/include/asm-cris/rtc.h
+++ b/include/asm-cris/rtc.h
@@ -39,11 +39,6 @@
#define RTC_INIT() (-1)
#endif
-/* conversions to and from the stupid RTC internal format */
-
-#define BCD_TO_BIN(x) x = (((x & 0xf0) >> 3) * 5 + (x & 0xf))
-#define BIN_TO_BCD(x) x = (x % 10) | ((x / 10) << 4)
-
/*
* The struct used to pass data via the following ioctl. Similar to the
* struct tm in <time.h>, but it needs to be here so that the kernel
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index ebdeefd49822..845641b06b0c 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -16,6 +16,7 @@
#include <linux/mc146818rtc.h>
#include <linux/rtc.h>
+#include <linux/bcd.h>
#define RTC_PIE 0x40 /* periodic interrupt enable */
#define RTC_AIE 0x20 /* alarm interrupt enable */
diff --git a/include/asm-i386/hw_irq.h b/include/asm-i386/hw_irq.h
index 035a6af03c63..70011938c229 100644
--- a/include/asm-i386/hw_irq.h
+++ b/include/asm-i386/hw_irq.h
@@ -131,7 +131,7 @@ static inline int unregister_profile_notifier(struct notifier_block * nb)
#endif /* CONFIG_PROFILING */
-#if defined(CONFIG_SMP) && !defined(CONFIG_VOYAGER) /*more of this file should probably be ifdefed SMP */
+#ifdef CONFIG_X86_IO_APIC /*more of this file should probably be ifdefed SMP */
static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i) {
if (IO_APIC_IRQ(i))
send_IPI_self(IO_APIC_VECTOR(i));
diff --git a/include/asm-i386/mach-numaq/mach_mpparse.h b/include/asm-i386/mach-numaq/mach_mpparse.h
index f15b7b9ae1e8..ddda81a724a8 100644
--- a/include/asm-i386/mach-numaq/mach_mpparse.h
+++ b/include/asm-i386/mach-numaq/mach_mpparse.h
@@ -1,6 +1,9 @@
#ifndef __ASM_MACH_MPPARSE_H
#define __ASM_MACH_MPPARSE_H
+static void __init smp_read_mpc_oem(struct mp_config_oemtable *oemtable,
+ unsigned short oemsize);
+
static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
struct mpc_config_translation *translation)
{
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index a63f48ca8e3a..fb5a97ec22f5 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -255,8 +255,6 @@
#define __NR_io_getevents 247
#define __NR_io_submit 248
#define __NR_io_cancel 249
-#define __NR_alloc_hugepages 250
-#define __NR_free_hugepages 251
#define __NR_exit_group 252
#define __NR_lookup_dcookie 253
#define __NR_epoll_create 254
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index d09f11cb14ec..e621c5c08b94 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -234,9 +234,6 @@ extern void ia64_load_extra (struct task_struct *task);
#ifdef CONFIG_SMP
-/* Return true if this CPU can call the console drivers in printk() */
-#define arch_consoles_callable() (cpu_online_map & (1UL << smp_processor_id()))
-
/*
* In the SMP case, we save the fph state when context-switching
* away from a thread that modified fph. This way, when the thread
diff --git a/include/asm-ia64/unistd.h b/include/asm-ia64/unistd.h
index ea993f51f702..579b4f0d22d2 100644
--- a/include/asm-ia64/unistd.h
+++ b/include/asm-ia64/unistd.h
@@ -223,8 +223,8 @@
#define __NR_sched_setaffinity 1231
#define __NR_sched_getaffinity 1232
#define __NR_set_tid_address 1233
-#define __NR_alloc_hugepages 1234
-#define __NR_free_hugepages 1235
+/* #define __NR_alloc_hugepages 1234 reusable */
+/* #define __NR_free_hugepages 1235 reusable */
#define __NR_exit_group 1236
#define __NR_lookup_dcookie 1237
#define __NR_io_setup 1238
diff --git a/include/asm-mips/ds1286.h b/include/asm-mips/ds1286.h
index 2d60fb89d328..92686b110dc9 100644
--- a/include/asm-mips/ds1286.h
+++ b/include/asm-mips/ds1286.h
@@ -57,15 +57,4 @@
#define RTC_IPSW 0x40
#define RTC_TE 0x80
-/*
- * Conversion between binary and BCD.
- */
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
#endif /* _ASM_DS1286_h */
diff --git a/include/asm-mips64/ds1286.h b/include/asm-mips64/ds1286.h
index 5280850b374a..56af9b10d01b 100644
--- a/include/asm-mips64/ds1286.h
+++ b/include/asm-mips64/ds1286.h
@@ -56,15 +56,4 @@
#define RTC_IPSW 0x40
#define RTC_TE 0x80
-/*
- * Conversion between binary and BCD.
- */
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
#endif /* _ASM_DS1286_h */
diff --git a/include/asm-mips64/m48t35.h b/include/asm-mips64/m48t35.h
index 113760397957..865ec0c379e3 100644
--- a/include/asm-mips64/m48t35.h
+++ b/include/asm-mips64/m48t35.h
@@ -21,12 +21,4 @@ struct m48t35_rtc {
#define M48T35_RTC_STOPPED 0x80
#define M48T35_RTC_READ 0x40
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(x) ((x)=((x)&15) + ((x)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(x) ((x)=(((x)/10)<<4) + (x)%10)
-#endif
-
#endif
diff --git a/include/asm-ppc/m48t35.h b/include/asm-ppc/m48t35.h
index 86b8be5987a8..97d2129f8d53 100644
--- a/include/asm-ppc/m48t35.h
+++ b/include/asm-ppc/m48t35.h
@@ -74,13 +74,4 @@
#define M48T35_RTC_READ 0x40
-/* read/write conversions */
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(x) ((x)=((x)&15) + ((x)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(x) ((x)=(((x)/10)<<4) + (x)%10)
-#endif
-
#endif
diff --git a/include/asm-ppc/mk48t59.h b/include/asm-ppc/mk48t59.h
index 4700fcdc824c..6a0ed6fc2d56 100644
--- a/include/asm-ppc/mk48t59.h
+++ b/include/asm-ppc/mk48t59.h
@@ -24,12 +24,4 @@
#define MK48T59_RTC_CONTROLB 0x1FF9
#define MK48T59_RTC_CB_STOP 0x80
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
#endif /* _PPC_MK48T59_H */
diff --git a/include/asm-ppc/nvram.h b/include/asm-ppc/nvram.h
index 7f6fc08b1868..47e4dfc74a77 100644
--- a/include/asm-ppc/nvram.h
+++ b/include/asm-ppc/nvram.h
@@ -23,14 +23,6 @@
#define MOTO_RTC_CONTROLA 0x1FF8
#define MOTO_RTC_CONTROLB 0x1FF9
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
/* PowerMac specific nvram stuffs */
enum {
diff --git a/include/asm-ppc/todc.h b/include/asm-ppc/todc.h
index 9b4d58e9efeb..3f72c47e09bf 100644
--- a/include/asm-ppc/todc.h
+++ b/include/asm-ppc/todc.h
@@ -355,14 +355,6 @@ typedef struct {
todc_info->flags = clock_type ##_FLAGS; \
}
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
extern todc_info_t *todc_info;
unsigned char todc_direct_read_val(int addr);
diff --git a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
index 6f0aa11ab681..b3d115b7961b 100644
--- a/include/asm-ppc/unistd.h
+++ b/include/asm-ppc/unistd.h
@@ -236,8 +236,6 @@
#define __NR_io_getevents 229
#define __NR_io_submit 230
#define __NR_io_cancel 231
-#define __NR_alloc_hugepages 232
-#define __NR_free_hugepages 233
#define __NR_exit_group 234
#define __NR_lookup_dcookie 235
#define __NR_epoll_create 236
diff --git a/include/asm-ppc64/nvram.h b/include/asm-ppc64/nvram.h
index 46ef2c3106d3..1c304357c223 100644
--- a/include/asm-ppc64/nvram.h
+++ b/include/asm-ppc64/nvram.h
@@ -28,12 +28,4 @@
#define MOTO_RTC_CONTROLA 0x1FF8
#define MOTO_RTC_CONTROLB 0x1FF9
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
#endif /* _PPC64_NVRAM_H */
diff --git a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
index 93a6f0176353..f022daa23e38 100644
--- a/include/asm-ppc64/unistd.h
+++ b/include/asm-ppc64/unistd.h
@@ -242,8 +242,6 @@
#define __NR_io_getevents 229
#define __NR_io_submit 230
#define __NR_io_cancel 231
-#define __NR_alloc_hugepages 232
-#define __NR_free_hugepages 233
#define __NR_exit_group 234
#define __NR_lookup_dcookie 235
#define __NR_sys_epoll_create 236
diff --git a/include/asm-sparc/unistd.h b/include/asm-sparc/unistd.h
index dc2de889a3b5..b778e356823c 100644
--- a/include/asm-sparc/unistd.h
+++ b/include/asm-sparc/unistd.h
@@ -250,8 +250,6 @@
#define __NR_time 231 /* Linux Specific */
/* #define __NR_oldstat 232 Linux Specific */
#define __NR_stime 233 /* Linux Specific */
-#define __NR_alloc_hugepages 234 /* Linux Specific */
-#define __NR_free_hugepages 235 /* Linux Specific */
#define __NR__llseek 236 /* Linux Specific */
#define __NR_mlock 237
#define __NR_munlock 238
diff --git a/include/asm-x86_64/ia32_unistd.h b/include/asm-x86_64/ia32_unistd.h
index 110e55509c9b..45b50bf2679c 100644
--- a/include/asm-x86_64/ia32_unistd.h
+++ b/include/asm-x86_64/ia32_unistd.h
@@ -257,8 +257,6 @@
#define __NR_ia32_io_getevents 247
#define __NR_ia32_io_submit 248
#define __NR_ia32_io_cancel 249
-#define __NR_ia32_alloc_hugepages 250
-#define __NR_ia32_free_hugepages 251
#define __NR_ia32_exit_group 252
#define __NR_ia32_lookup_dcookie 253
#define __NR_ia32_sys_epoll_create 254
diff --git a/include/linux/bcd.h b/include/linux/bcd.h
new file mode 100644
index 000000000000..c545308125b0
--- /dev/null
+++ b/include/linux/bcd.h
@@ -0,0 +1,20 @@
+/* Permission is hereby granted to copy, modify and redistribute this code
+ * in terms of the GNU Library General Public License, Version 2 or later,
+ * at your option.
+ */
+
+/* macros to translate to/from binary and binary-coded decimal (frequently
+ * found in RTC chips).
+ */
+
+#ifndef _BCD_H
+#define _BCD_H
+
+#define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10)
+#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
+
+/* backwards compat */
+#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
+#define BIN_TO_BCD(val) ((val)=BIN2BCD(val))
+
+#endif /* _BCD_H */
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 95faa6ec3aa7..3db3832f35cb 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -1,11 +1,10 @@
#ifndef __LINUX_CACHE_H
#define __LINUX_CACHE_H
+#include <linux/kernel.h>
#include <linux/config.h>
#include <asm/cache.h>
-#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
-
#ifndef L1_CACHE_ALIGN
#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index e93501c7a0b8..ab2890b619d0 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -104,27 +104,14 @@ static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mu
/*********************************************************************
- * DYNAMIC CPUFREQ INTERFACE *
- *********************************************************************/
-#ifdef CONFIG_CPU_FREQ_DYNAMIC
-/* TBD */
-#endif /* CONFIG_CPU_FREQ_DYNAMIC */
-
-
-/*********************************************************************
* CPUFREQ DRIVER INTERFACE *
*********************************************************************/
-typedef int (*cpufreq_policy_t) (struct cpufreq_policy *policy);
-
struct cpufreq_driver {
/* needed by all drivers */
- cpufreq_policy_t verify;
- cpufreq_policy_t setpolicy;
+ int (*verify) (struct cpufreq_policy *policy);
+ int (*setpolicy) (struct cpufreq_policy *policy);
struct cpufreq_policy *policy;
-#ifdef CONFIG_CPU_FREQ_DYNAMIC
- /* TBD */
-#endif
/* 2.4. compatible API */
#ifdef CONFIG_CPU_FREQ_24_API
unsigned int cpu_cur_freq[NR_CPUS];
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6c3188b991e6..3fa13b80747d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -982,15 +982,9 @@ struct super_block *get_sb_pseudo(struct file_system_type *, char *,
/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
#define fops_get(fops) \
- (((fops) && (fops)->owner) \
- ? (try_inc_mod_count((fops)->owner) ? (fops) : NULL) \
- : (fops))
-
+ (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
#define fops_put(fops) \
-do { \
- if ((fops) && (fops)->owner) \
- module_put((fops)->owner); \
-} while(0)
+ do { if (fops) module_put((fops)->owner); } while(0)
extern int register_filesystem(struct file_system_type *);
extern int unregister_filesystem(struct file_system_type *);
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h
index 9598d2cbf718..fea550f163d9 100644
--- a/include/linux/i2c-algo-bit.h
+++ b/include/linux/i2c-algo-bit.h
@@ -42,9 +42,10 @@ struct i2c_algo_bit_data {
int (*getscl) (void *data);
/* local settings */
- int udelay;
- int mdelay;
- int timeout;
+ int udelay; /* half-clock-cycle time in microsecs */
+ /* i.e. clock is (500 / udelay) KHz */
+ int mdelay; /* in millisecs, unused */
+ int timeout; /* in jiffies */
};
#define I2C_BIT_ADAP_MAX 16
diff --git a/include/linux/i2c-elektor.h b/include/linux/i2c-elektor.h
deleted file mode 100644
index 7c9213175892..000000000000
--- a/include/linux/i2c-elektor.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ------------------------------------------------------------------------- */
-/* i2c-elektor.c i2c-hw access for PCF8584 style isa bus adaptes */
-/* ------------------------------------------------------------------------- */
-/* Copyright (C) 1995-97 Simon G. Vogl
- 1998-99 Hans Berglund
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/* ------------------------------------------------------------------------- */
-
-/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
- Frodo Looijaard <frodol@dds.nl> */
-
-/* $Id: i2c-elektor.h,v 1.5 2001/06/05 01:46:33 mds Exp $ */
-
-#ifndef I2C_PCF_ELEKTOR_H
-#define I2C_PCF_ELEKTOR_H 1
-
-/*
- * This struct contains the hw-dependent functions of PCF8584 adapters to
- * manipulate the registers, and to init any hw-specific features.
- * vdovikin: removed: this module in real supports only one device,
- * due to missing arguments in some functions, called from the algo-pcf module.
- * Sometimes it's need to be rewriten -
- * but for now just remove this for simpler reading */
-
-/*
-struct i2c_pcf_isa {
- int pi_base;
- int pi_irq;
- int pi_clock;
- int pi_own;
-};
-*/
-
-#endif /* PCF_ELEKTOR_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 2b6394004ea1..0061776f0402 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -145,6 +145,8 @@
#define I2C_DRIVERID_LM92 1033
#define I2C_DRIVERID_VT8231 1034
#define I2C_DRIVERID_SMARTBATT 1035
+#define I2C_DRIVERID_BMCSENSORS 1036
+#define I2C_DRIVERID_FS451 1037
/*
* ---- Adapter types ----------------------------------------------------
@@ -164,6 +166,8 @@
#define I2C_ALGO_IIC 0x080000 /* ITE IIC bus */
#define I2C_ALGO_SAA7134 0x090000
#define I2C_ALGO_MPC824X 0x0a0000 /* Motorola 8240 / 8245 */
+#define I2C_ALGO_IPMI 0x0b0000 /* IPMI dummy adapter */
+#define I2C_ALGO_IPMB 0x0c0000 /* IPMB adapter */
#define I2C_ALGO_EC 0x100000 /* ACPI embedded controller */
#define I2C_ALGO_MPC8XX 0x110000 /* MPC8xx PowerPC I2C algorithm */
@@ -196,6 +200,7 @@
#define I2C_HW_B_VOO 0x0b /* 3dfx Voodoo 3 / Banshee */
#define I2C_HW_B_PPORT 0x0c /* Primitive parallel port adapter */
#define I2C_HW_B_SAVG 0x0d /* Savage 4 */
+#define I2C_HW_B_SCX200 0x0e /* Nat'l Semi SCx200 I2C */
#define I2C_HW_B_RIVA 0x10 /* Riva based graphics cards */
#define I2C_HW_B_IOC 0x11 /* IOC bit-wiggling */
#define I2C_HW_B_TSUNA 0x12 /* DEC Tsunami chipset */
@@ -234,8 +239,15 @@
#define I2C_HW_SMBUS_SIS630 0x08
#define I2C_HW_SMBUS_SIS645 0x09
#define I2C_HW_SMBUS_AMD8111 0x0a
+#define I2C_HW_SMBUS_SCX200 0x0b
/* --- ISA pseudo-adapter */
#define I2C_HW_ISA 0x00
+/* --- IPMI pseudo-adapter */
+#define I2C_HW_IPMI 0x00
+
+/* --- IPMB adapter */
+#define I2C_HW_IPMB 0x00
+
#endif /* I2C_ID_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index ab69e01bc8c3..765a95af3a4e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -132,6 +132,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
*/
struct i2c_driver {
+ struct module *owner;
char name[32];
int id;
unsigned int flags; /* div., see below */
@@ -155,18 +156,6 @@ struct i2c_driver {
* with the device.
*/
int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
-
- /* These two are mainly used for bookkeeping & dynamic unloading of
- * kernel modules. inc_use tells the driver that a client is being
- * used by another module & that it should increase its ref. counter.
- * dec_use is the inverse operation.
- * NB: Make sure you have no circular dependencies, or else you get a
- * deadlock when trying to unload the modules.
- * You should use the i2c_{inc,dec}_use_client functions instead of
- * calling this function directly.
- */
- void (*inc_use)(struct i2c_client *client);
- void (*dec_use)(struct i2c_client *client);
};
/*
@@ -232,16 +221,13 @@ struct proc_dir_entry;
* with the access algorithms necessary to access it.
*/
struct i2c_adapter {
+ struct module *owner;
char name[32]; /* some useful name to identify the adapter */
unsigned int id;/* == is algo->id | hwdep.struct->id, */
/* for registered values see below */
struct i2c_algorithm *algo;/* the algorithm to access the bus */
void *algo_data;
- /* --- These may be NULL, but should increase the module use count */
- void (*inc_use)(struct i2c_adapter *);
- void (*dec_use)(struct i2c_adapter *);
-
/* --- administration stuff. */
int (*client_register)(struct i2c_client *);
int (*client_unregister)(struct i2c_client *);
@@ -319,12 +305,6 @@ extern int i2c_del_driver(struct i2c_driver *);
extern int i2c_attach_client(struct i2c_client *);
extern int i2c_detach_client(struct i2c_client *);
-/* Only call these if you grab a resource that makes unloading the
- client and the adapter it is on completely impossible. Like when a
- /proc directory is entered. */
-extern void i2c_inc_use_client(struct i2c_client *);
-extern void i2c_dec_use_client(struct i2c_client *);
-
/* New function: This is to get an i2c_client-struct for controlling the
client either by using i2c_control-function or having the
client-module export functions that can be used with the i2c_client
@@ -387,6 +367,8 @@ struct i2c_msg {
#define I2C_M_RD 0x01
#define I2C_M_NOSTART 0x4000
#define I2C_M_REV_DIR_ADDR 0x2000
+#define I2C_M_IGNORE_NAK 0x1000
+#define I2C_M_NO_RD_ACK 0x0800
short len; /* msg length */
char *buf; /* pointer to msg data */
};
@@ -395,7 +377,7 @@ struct i2c_msg {
#define I2C_FUNC_I2C 0x00000001
#define I2C_FUNC_10BIT_ADDR 0x00000002
-#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART} */
+#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_READ_WORD_DATA_PEC 0x00000800 /* SMBus 2.0 */
#define I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC 0x00001000 /* SMBus 2.0 */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f3cadd9416ad..9cb6277f5b86 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -28,6 +28,7 @@
#define STACK_MAGIC 0xdeadbeef
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be taken immediately */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 2ec35699a8e8..cde7dbae375e 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -87,15 +87,4 @@ extern spinlock_t rtc_lock; /* serialize CMOS RAM access */
# define RTC_VRT 0x80 /* valid RAM and time */
/**********************************************************************/
-/* example: !(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY)
- * determines if the following two #defines are needed
- */
-#ifndef BCD_TO_BIN
-#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
-#endif
-
-#ifndef BIN_TO_BCD
-#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
-#endif
-
#endif /* _MC146818RTC_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index df49cb472866..70177c796b12 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -41,6 +41,9 @@ extern int page_cluster;
* per VM-area/task. A VM area is any part of the process virtual memory
* space that has a special rule for the page-fault handlers (ie a shared
* library, the executable area etc).
+ *
+ * This structure is exactly 64 bytes on ia32. Please think very, very hard
+ * before adding anything to it.
*/
struct vm_area_struct {
struct mm_struct * vm_mm; /* The address space we belong to. */
diff --git a/include/linux/module.h b/include/linux/module.h
index 3a411c8c6575..8e1954a89913 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -285,7 +285,9 @@ static inline const char *module_address_lookup(unsigned long addr,
}
#endif /* CONFIG_MODULES */
-#if defined(MODULE) && defined(KBUILD_MODNAME)
+#ifdef MODULE
+extern struct module __this_module;
+#ifdef KBUILD_MODNAME
/* We make the linker do some of the work. */
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
@@ -296,7 +298,8 @@ __attribute__((section(".gnu.linkonce.this_module"))) = {
.exit = cleanup_module,
#endif
};
-#endif /* MODULE && KBUILD_MODNAME */
+#endif /* KBUILD_MODNAME */
+#endif /* MODULE */
/* For archs to search exception tables */
extern struct list_head extables;
@@ -354,7 +357,6 @@ static inline void __deprecated _MOD_INC_USE_COUNT(struct module *module)
_MOD_INC_USE_COUNT(THIS_MODULE)
#define MOD_DEC_USE_COUNT \
__MOD_DEC_USE_COUNT(THIS_MODULE)
-#define try_inc_mod_count(mod) try_module_get(mod)
#define EXPORT_NO_SYMBOLS
extern int module_dummy_usage;
#define GET_USE_COUNT(module) (module_dummy_usage)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 52d38241e91e..503a715fe014 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -215,10 +215,8 @@ static inline struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num)
struct mtd_info *ret;
ret = __get_mtd_device(mtd, num);
-
- if (ret && ret->module && !try_inc_mod_count(ret->module))
+ if (ret && !try_module_get(ret->module))
return NULL;
-
return ret;
}
@@ -227,7 +225,6 @@ static inline void put_mtd_device(struct mtd_info *mtd)
module_put(mtd->module);
}
-
struct mtd_notifier {
void (*add)(struct mtd_info *mtd);
void (*remove)(struct mtd_info *mtd);
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index a79d04de4fd5..74c3d9786874 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -1,10 +1,71 @@
#ifndef __LINUX_PERCPU_H
#define __LINUX_PERCPU_H
#include <linux/spinlock.h> /* For preempt_disable() */
+#include <linux/slab.h> /* For kmalloc_percpu() */
#include <asm/percpu.h>
/* Must be an lvalue. */
#define get_cpu_var(var) (*({ preempt_disable(); &__get_cpu_var(var); }))
#define put_cpu_var(var) preempt_enable()
+#ifdef CONFIG_SMP
+
+struct percpu_data {
+ void *ptrs[NR_CPUS];
+ void *blkp;
+};
+
+/*
+ * Use this to get to a cpu's version of the per-cpu object allocated using
+ * kmalloc_percpu. If you want to get "this cpu's version", maybe you want
+ * to use get_cpu_ptr...
+ */
+#define per_cpu_ptr(ptr, cpu) \
+({ \
+ struct percpu_data *__p = (struct percpu_data *)~(unsigned long)(ptr); \
+ (__typeof__(ptr))__p->ptrs[(cpu)]; \
+})
+
+extern void *kmalloc_percpu(size_t size, int flags);
+extern void kfree_percpu(const void *);
+extern void kmalloc_percpu_init(void);
+
+#else /* CONFIG_SMP */
+
+#define per_cpu_ptr(ptr, cpu) (ptr)
+
+static inline void *kmalloc_percpu(size_t size, int flags)
+{
+ return(kmalloc(size, flags));
+}
+static inline void kfree_percpu(const void *ptr)
+{
+ kfree(ptr);
+}
+static inline void kmalloc_percpu_init(void) { }
+
+#endif /* CONFIG_SMP */
+
+/*
+ * Use these with kmalloc_percpu. If
+ * 1. You want to operate on memory allocated by kmalloc_percpu (dereference
+ * and read/modify/write) AND
+ * 2. You want "this cpu's version" of the object AND
+ * 3. You want to do this safely since:
+ * a. On multiprocessors, you don't want to switch between cpus after
+ * you've read the current processor id due to preemption -- this would
+ * take away the implicit advantage to not have any kind of traditional
+ * serialization for per-cpu data
+ * b. On uniprocessors, you don't want another kernel thread messing
+ * up with the same per-cpu data due to preemption
+ *
+ * So, Use get_cpu_ptr to disable preemption and get pointer to the
+ * local cpu version of the per-cpu object. Use put_cpu_ptr to enable
+ * preemption. Operations on per-cpu data between get_ and put_ is
+ * then considered to be safe. And ofcourse, "Thou shalt not sleep between
+ * get_cpu_ptr and put_cpu_ptr"
+ */
+#define get_cpu_ptr(ptr) per_cpu_ptr(ptr, get_cpu())
+#define put_cpu_ptr(ptr) put_cpu()
+
#endif /* __LINUX_PERCPU_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 7c3bbfc255ed..9545a1957089 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -343,7 +343,6 @@ struct task_struct {
unsigned long start_time;
/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
- int swappable:1;
/* process credentials */
uid_t uid,euid,suid,fsuid;
gid_t gid,egid,sgid,fsgid;
diff --git a/include/linux/sensors.h b/include/linux/sensors.h
deleted file mode 100644
index 31998faab1e6..000000000000
--- a/include/linux/sensors.h
+++ /dev/null
@@ -1,690 +0,0 @@
-/*
- sensors.h - Part of lm_sensors, Linux kernel modules for hardware
- monitoring
- Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef SENSORS_NSENSORS_H
-#define SENSORS_NSENSORS_H
-
-#define LM_DATE "20020915"
-#define LM_VERSION "2.6.5"
-
-#include <linux/i2c-proc.h>
-
-#define LM78_SYSCTL_IN0 1000 /* Volts * 100 */
-#define LM78_SYSCTL_IN1 1001
-#define LM78_SYSCTL_IN2 1002
-#define LM78_SYSCTL_IN3 1003
-#define LM78_SYSCTL_IN4 1004
-#define LM78_SYSCTL_IN5 1005
-#define LM78_SYSCTL_IN6 1006
-#define LM78_SYSCTL_FAN1 1101 /* Rotations/min */
-#define LM78_SYSCTL_FAN2 1102
-#define LM78_SYSCTL_FAN3 1103
-#define LM78_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
-#define LM78_SYSCTL_VID 1300 /* Volts * 100 */
-#define LM78_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define LM78_SYSCTL_ALARMS 2001 /* bitvector */
-
-#define LM78_ALARM_IN0 0x0001
-#define LM78_ALARM_IN1 0x0002
-#define LM78_ALARM_IN2 0x0004
-#define LM78_ALARM_IN3 0x0008
-#define LM78_ALARM_IN4 0x0100
-#define LM78_ALARM_IN5 0x0200
-#define LM78_ALARM_IN6 0x0400
-#define LM78_ALARM_FAN1 0x0040
-#define LM78_ALARM_FAN2 0x0080
-#define LM78_ALARM_FAN3 0x0800
-#define LM78_ALARM_TEMP 0x0010
-#define LM78_ALARM_BTI 0x0020
-#define LM78_ALARM_CHAS 0x1000
-#define LM78_ALARM_FIFO 0x2000
-#define LM78_ALARM_SMI_IN 0x4000
-
-#define W83781D_SYSCTL_IN0 1000 /* Volts * 100 */
-#define W83781D_SYSCTL_IN1 1001
-#define W83781D_SYSCTL_IN2 1002
-#define W83781D_SYSCTL_IN3 1003
-#define W83781D_SYSCTL_IN4 1004
-#define W83781D_SYSCTL_IN5 1005
-#define W83781D_SYSCTL_IN6 1006
-#define W83781D_SYSCTL_IN7 1007
-#define W83781D_SYSCTL_IN8 1008
-#define W83781D_SYSCTL_FAN1 1101 /* Rotations/min */
-#define W83781D_SYSCTL_FAN2 1102
-#define W83781D_SYSCTL_FAN3 1103
-#define W83781D_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
-#define W83781D_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
-#define W83781D_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
-#define W83781D_SYSCTL_VID 1300 /* Volts * 1000 */
-#define W83781D_SYSCTL_VRM 1301
-#define W83781D_SYSCTL_PWM1 1401
-#define W83781D_SYSCTL_PWM2 1402
-#define W83781D_SYSCTL_PWM3 1403
-#define W83781D_SYSCTL_PWM4 1404
-#define W83781D_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */
-#define W83781D_SYSCTL_SENS2 1502
-#define W83781D_SYSCTL_SENS3 1503
-#define W83781D_SYSCTL_RT1 1601 /* 32-entry table */
-#define W83781D_SYSCTL_RT2 1602 /* 32-entry table */
-#define W83781D_SYSCTL_RT3 1603 /* 32-entry table */
-#define W83781D_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define W83781D_SYSCTL_ALARMS 2001 /* bitvector */
-#define W83781D_SYSCTL_BEEP 2002 /* bitvector */
-
-#define W83781D_ALARM_IN0 0x0001
-#define W83781D_ALARM_IN1 0x0002
-#define W83781D_ALARM_IN2 0x0004
-#define W83781D_ALARM_IN3 0x0008
-#define W83781D_ALARM_IN4 0x0100
-#define W83781D_ALARM_IN5 0x0200
-#define W83781D_ALARM_IN6 0x0400
-#define W83782D_ALARM_IN7 0x10000
-#define W83782D_ALARM_IN8 0x20000
-#define W83781D_ALARM_FAN1 0x0040
-#define W83781D_ALARM_FAN2 0x0080
-#define W83781D_ALARM_FAN3 0x0800
-#define W83781D_ALARM_TEMP1 0x0010
-#define W83781D_ALARM_TEMP23 0x0020 /* 781D only */
-#define W83781D_ALARM_TEMP2 0x0020 /* 782D/783S */
-#define W83781D_ALARM_TEMP3 0x2000 /* 782D only */
-#define W83781D_ALARM_CHAS 0x1000
-
-#define LM75_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
-
-#define ADM1021_SYSCTL_TEMP 1200
-#define ADM1021_SYSCTL_REMOTE_TEMP 1201
-#define ADM1021_SYSCTL_DIE_CODE 1202
-#define ADM1021_SYSCTL_ALARMS 1203
-
-#define ADM1021_ALARM_TEMP_HIGH 0x40
-#define ADM1021_ALARM_TEMP_LOW 0x20
-#define ADM1021_ALARM_RTEMP_HIGH 0x10
-#define ADM1021_ALARM_RTEMP_LOW 0x08
-#define ADM1021_ALARM_RTEMP_NA 0x04
-
-#define GL518_SYSCTL_VDD 1000 /* Volts * 100 */
-#define GL518_SYSCTL_VIN1 1001
-#define GL518_SYSCTL_VIN2 1002
-#define GL518_SYSCTL_VIN3 1003
-#define GL518_SYSCTL_FAN1 1101 /* RPM */
-#define GL518_SYSCTL_FAN2 1102
-#define GL518_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
-#define GL518_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define GL518_SYSCTL_ALARMS 2001 /* bitvector */
-#define GL518_SYSCTL_BEEP 2002 /* bitvector */
-#define GL518_SYSCTL_FAN1OFF 2003
-#define GL518_SYSCTL_ITERATE 2004
-
-#define GL518_ALARM_VDD 0x01
-#define GL518_ALARM_VIN1 0x02
-#define GL518_ALARM_VIN2 0x04
-#define GL518_ALARM_VIN3 0x08
-#define GL518_ALARM_TEMP 0x10
-#define GL518_ALARM_FAN1 0x20
-#define GL518_ALARM_FAN2 0x40
-
-#define GL520_SYSCTL_VDD 1000 /* Volts * 100 */
-#define GL520_SYSCTL_VIN1 1001
-#define GL520_SYSCTL_VIN2 1002
-#define GL520_SYSCTL_VIN3 1003
-#define GL520_SYSCTL_VIN4 1004
-#define GL520_SYSCTL_FAN1 1101 /* RPM */
-#define GL520_SYSCTL_FAN2 1102
-#define GL520_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
-#define GL520_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
-#define GL520_SYSCTL_VID 1300
-#define GL520_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define GL520_SYSCTL_ALARMS 2001 /* bitvector */
-#define GL520_SYSCTL_BEEP 2002 /* bitvector */
-#define GL520_SYSCTL_FAN1OFF 2003
-#define GL520_SYSCTL_CONFIG 2004
-
-#define GL520_ALARM_VDD 0x01
-#define GL520_ALARM_VIN1 0x02
-#define GL520_ALARM_VIN2 0x04
-#define GL520_ALARM_VIN3 0x08
-#define GL520_ALARM_TEMP1 0x10
-#define GL520_ALARM_FAN1 0x20
-#define GL520_ALARM_FAN2 0x40
-#define GL520_ALARM_TEMP2 0x80
-#define GL520_ALARM_VIN4 0x80
-
-#define EEPROM_SYSCTL1 1000
-#define EEPROM_SYSCTL2 1001
-#define EEPROM_SYSCTL3 1002
-#define EEPROM_SYSCTL4 1003
-#define EEPROM_SYSCTL5 1004
-#define EEPROM_SYSCTL6 1005
-#define EEPROM_SYSCTL7 1006
-#define EEPROM_SYSCTL8 1007
-#define EEPROM_SYSCTL9 1008
-#define EEPROM_SYSCTL10 1009
-#define EEPROM_SYSCTL11 1010
-#define EEPROM_SYSCTL12 1011
-#define EEPROM_SYSCTL13 1012
-#define EEPROM_SYSCTL14 1013
-#define EEPROM_SYSCTL15 1014
-#define EEPROM_SYSCTL16 1015
-
-#define LM80_SYSCTL_IN0 1000 /* Volts * 100 */
-#define LM80_SYSCTL_IN1 1001
-#define LM80_SYSCTL_IN2 1002
-#define LM80_SYSCTL_IN3 1003
-#define LM80_SYSCTL_IN4 1004
-#define LM80_SYSCTL_IN5 1005
-#define LM80_SYSCTL_IN6 1006
-#define LM80_SYSCTL_FAN1 1101 /* Rotations/min */
-#define LM80_SYSCTL_FAN2 1102
-#define LM80_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
-#define LM80_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define LM80_SYSCTL_ALARMS 2001 /* bitvector */
-
-#define ADM9240_SYSCTL_IN0 1000 /* Volts * 100 */
-#define ADM9240_SYSCTL_IN1 1001
-#define ADM9240_SYSCTL_IN2 1002
-#define ADM9240_SYSCTL_IN3 1003
-#define ADM9240_SYSCTL_IN4 1004
-#define ADM9240_SYSCTL_IN5 1005
-#define ADM9240_SYSCTL_FAN1 1101 /* Rotations/min */
-#define ADM9240_SYSCTL_FAN2 1102
-#define ADM9240_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
-#define ADM9240_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define ADM9240_SYSCTL_ALARMS 2001 /* bitvector */
-#define ADM9240_SYSCTL_ANALOG_OUT 2002
-#define ADM9240_SYSCTL_VID 2003
-
-#define ADM9240_ALARM_IN0 0x0001
-#define ADM9240_ALARM_IN1 0x0002
-#define ADM9240_ALARM_IN2 0x0004
-#define ADM9240_ALARM_IN3 0x0008
-#define ADM9240_ALARM_IN4 0x0100
-#define ADM9240_ALARM_IN5 0x0200
-#define ADM9240_ALARM_FAN1 0x0040
-#define ADM9240_ALARM_FAN2 0x0080
-#define ADM9240_ALARM_TEMP 0x0010
-#define ADM9240_ALARM_CHAS 0x1000
-
-#define ADM1024_SYSCTL_IN0 1000 /* Volts * 100 */
-#define ADM1024_SYSCTL_IN1 1001
-#define ADM1024_SYSCTL_IN2 1002
-#define ADM1024_SYSCTL_IN3 1003
-#define ADM1024_SYSCTL_IN4 1004
-#define ADM1024_SYSCTL_IN5 1005
-#define ADM1024_SYSCTL_FAN1 1101 /* Rotations/min */
-#define ADM1024_SYSCTL_FAN2 1102
-#define ADM1024_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
-#define ADM1024_SYSCTL_TEMP1 1290 /* Degrees Celcius */
-#define ADM1024_SYSCTL_TEMP2 1295 /* Degrees Celcius */
-#define ADM1024_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define ADM1024_SYSCTL_ALARMS 2001 /* bitvector */
-#define ADM1024_SYSCTL_ANALOG_OUT 2002
-#define ADM1024_SYSCTL_VID 2003
-
-#define ADM1024_ALARM_IN0 0x0001
-#define ADM1024_ALARM_IN1 0x0002
-#define ADM1024_ALARM_IN2 0x0004
-#define ADM1024_ALARM_IN3 0x0008
-#define ADM1024_ALARM_IN4 0x0100
-#define ADM1024_ALARM_IN5 0x0200
-#define ADM1024_ALARM_FAN1 0x0040
-#define ADM1024_ALARM_FAN2 0x0080
-#define ADM1024_ALARM_TEMP 0x0010
-#define ADM1024_ALARM_TEMP1 0x0020
-#define ADM1024_ALARM_TEMP2 0x0001
-#define ADM1024_ALARM_CHAS 0x1000
-
-#define ADM1025_SYSCTL_IN0 1000 /* Volts * 100 */
-#define ADM1025_SYSCTL_IN1 1001
-#define ADM1025_SYSCTL_IN2 1002
-#define ADM1025_SYSCTL_IN3 1003
-#define ADM1025_SYSCTL_IN4 1004
-#define ADM1025_SYSCTL_IN5 1005
-#define ADM1025_SYSCTL_RTEMP 1251
-#define ADM1025_SYSCTL_TEMP 1250 /* Degrees Celcius * 100 */
-#define ADM1025_SYSCTL_ALARMS 2001 /* bitvector */
-#define ADM1025_SYSCTL_ANALOG_OUT 2002
-#define ADM1025_SYSCTL_VID 2003
-#define ADM1025_SYSCTL_VRM 2004
-
-#define ADM1025_ALARM_IN0 0x0001
-#define ADM1025_ALARM_IN1 0x0002
-#define ADM1025_ALARM_IN2 0x0004
-#define ADM1025_ALARM_IN3 0x0008
-#define ADM1025_ALARM_IN4 0x0100
-#define ADM1025_ALARM_IN5 0x0200
-#define ADM1025_ALARM_RTEMP 0x0020
-#define ADM1025_ALARM_TEMP 0x0010
-
-#define LTC1710_SYSCTL_SWITCH_1 1000
-#define LTC1710_SYSCTL_SWITCH_2 1001
-
-#define LM80_ALARM_IN0 0x0001
-#define LM80_ALARM_IN1 0x0002
-#define LM80_ALARM_IN2 0x0004
-#define LM80_ALARM_IN3 0x0008
-#define LM80_ALARM_IN4 0x0010
-#define LM80_ALARM_IN5 0x0020
-#define LM80_ALARM_IN6 0x0040
-#define LM80_ALARM_FAN1 0x0400
-#define LM80_ALARM_FAN2 0x0800
-#define LM80_ALARM_TEMP_HOT 0x0100
-#define LM80_ALARM_TEMP_OS 0x2000
-#define LM80_ALARM_CHAS 0x1000
-#define LM80_ALARM_BTI 0x0200
-#define LM80_ALARM_INT_IN 0x0080
-
-#define MAXI_SYSCTL_FAN1 1101 /* Rotations/min */
-#define MAXI_SYSCTL_FAN2 1102 /* Rotations/min */
-#define MAXI_SYSCTL_FAN3 1103 /* Rotations/min */
-#define MAXI_SYSCTL_FAN4 1104 /* Rotations/min */
-#define MAXI_SYSCTL_TEMP1 1201 /* Degrees Celcius */
-#define MAXI_SYSCTL_TEMP2 1202 /* Degrees Celcius */
-#define MAXI_SYSCTL_TEMP3 1203 /* Degrees Celcius */
-#define MAXI_SYSCTL_TEMP4 1204 /* Degrees Celcius */
-#define MAXI_SYSCTL_TEMP5 1205 /* Degrees Celcius */
-#define MAXI_SYSCTL_TEMP6 1206 /* Degrees Celcius */
-#define MAXI_SYSCTL_PLL 1301 /* MHz */
-#define MAXI_SYSCTL_VID1 1401 /* Volts / 6.337, for nba just Volts */
-#define MAXI_SYSCTL_VID2 1402 /* Volts */
-#define MAXI_SYSCTL_VID3 1403 /* Volts */
-#define MAXI_SYSCTL_VID4 1404 /* Volts */
-#define MAXI_SYSCTL_VID5 1405 /* Volts */
-#define MAXI_SYSCTL_LCD1 1501 /* Line 1 of LCD */
-#define MAXI_SYSCTL_LCD2 1502 /* Line 2 of LCD */
-#define MAXI_SYSCTL_LCD3 1503 /* Line 3 of LCD */
-#define MAXI_SYSCTL_LCD4 1504 /* Line 4 of LCD */
-#define MAXI_SYSCTL_ALARMS 2001 /* Bitvector (see below) */
-
-#define MAXI_ALARM_VID4 0x0001
-#define MAXI_ALARM_TEMP2 0x0002
-#define MAXI_ALARM_VID1 0x0004
-#define MAXI_ALARM_VID2 0x0008
-#define MAXI_ALARM_VID3 0x0010
-#define MAXI_ALARM_PLL 0x0080
-#define MAXI_ALARM_TEMP4 0x0100
-#define MAXI_ALARM_TEMP5 0x0200
-#define MAXI_ALARM_FAN1 0x1000
-#define MAXI_ALARM_FAN2 0x2000
-#define MAXI_ALARM_FAN3 0x4000
-
-#define MAXI_ALARM_FAN 0x0100 /* To be used with MaxiLife'99 */
-#define MAXI_ALARM_VID 0x0200 /* The MSB specifies which sensor */
-#define MAXI_ALARM_TEMP 0x0400 /* in the alarm group failed, i.e.: */
-#define MAXI_ALARM_VADD 0x0800 /* 0x0402 = TEMP2 failed = CPU2 temp */
-
-#define SIS5595_SYSCTL_IN0 1000 /* Volts * 100 */
-#define SIS5595_SYSCTL_IN1 1001
-#define SIS5595_SYSCTL_IN2 1002
-#define SIS5595_SYSCTL_IN3 1003
-#define SIS5595_SYSCTL_IN4 1004
-#define SIS5595_SYSCTL_FAN1 1101 /* Rotations/min */
-#define SIS5595_SYSCTL_FAN2 1102
-#define SIS5595_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
-#define SIS5595_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define SIS5595_SYSCTL_ALARMS 2001 /* bitvector */
-
-#define SIS5595_ALARM_IN0 0x01
-#define SIS5595_ALARM_IN1 0x02
-#define SIS5595_ALARM_IN2 0x04
-#define SIS5595_ALARM_IN3 0x08
-#define SIS5595_ALARM_BTI 0x20
-#define SIS5595_ALARM_FAN1 0x40
-#define SIS5595_ALARM_FAN2 0x80
-#define SIS5595_ALARM_IN4 0x8000
-#define SIS5595_ALARM_TEMP 0x8000
-
-#define VIA686A_SYSCTL_IN0 1000
-#define VIA686A_SYSCTL_IN1 1001
-#define VIA686A_SYSCTL_IN2 1002
-#define VIA686A_SYSCTL_IN3 1003
-#define VIA686A_SYSCTL_IN4 1004
-#define VIA686A_SYSCTL_FAN1 1101
-#define VIA686A_SYSCTL_FAN2 1102
-#define VIA686A_SYSCTL_TEMP 1200
-#define VIA686A_SYSCTL_TEMP2 1201
-#define VIA686A_SYSCTL_TEMP3 1202
-#define VIA686A_SYSCTL_FAN_DIV 2000
-#define VIA686A_SYSCTL_ALARMS 2001
-
-#define VIA686A_ALARM_IN0 0x01
-#define VIA686A_ALARM_IN1 0x02
-#define VIA686A_ALARM_IN2 0x04
-#define VIA686A_ALARM_IN3 0x08
-#define VIA686A_ALARM_TEMP 0x10
-#define VIA686A_ALARM_FAN1 0x40
-#define VIA686A_ALARM_FAN2 0x80
-#define VIA686A_ALARM_IN4 0x100
-#define VIA686A_ALARM_TEMP2 0x800
-#define VIA686A_ALARM_CHAS 0x1000
-#define VIA686A_ALARM_TEMP3 0x8000
-
-#define ICSPLL_SYSCTL1 1000
-
-#define BT869_SYSCTL_STATUS 1000
-#define BT869_SYSCTL_NTSC 1001
-#define BT869_SYSCTL_HALF 1002
-#define BT869_SYSCTL_RES 1003
-#define BT869_SYSCTL_COLORBARS 1004
-#define BT869_SYSCTL_DEPTH 1005
-#define BT869_SYSCTL_SVIDEO 1006
-
-#define MATORB_SYSCTL_DISP 1000
-
-#define THMC50_SYSCTL_TEMP 1200 /* Degrees Celcius */
-#define THMC50_SYSCTL_REMOTE_TEMP 1201 /* Degrees Celcius */
-#define THMC50_SYSCTL_INTER 1202
-#define THMC50_SYSCTL_INTER_MASK 1203
-#define THMC50_SYSCTL_DIE_CODE 1204
-#define THMC50_SYSCTL_ANALOG_OUT 1205
-
-#define DDCMON_SYSCTL_ID 1010
-#define DDCMON_SYSCTL_SIZE 1011
-#define DDCMON_SYSCTL_SYNC 1012
-#define DDCMON_SYSCTL_TIMINGS 1013
-#define DDCMON_SYSCTL_SERIAL 1014
-
-#define LM87_SYSCTL_IN0 1000 /* Volts * 100 */
-#define LM87_SYSCTL_IN1 1001
-#define LM87_SYSCTL_IN2 1002
-#define LM87_SYSCTL_IN3 1003
-#define LM87_SYSCTL_IN4 1004
-#define LM87_SYSCTL_IN5 1005
-#define LM87_SYSCTL_AIN1 1006
-#define LM87_SYSCTL_AIN2 1007
-#define LM87_SYSCTL_FAN1 1102
-#define LM87_SYSCTL_FAN2 1103
-#define LM87_SYSCTL_TEMP1 1250 /* Degrees Celcius * 100 */
-#define LM87_SYSCTL_TEMP2 1251 /* Degrees Celcius * 100 */
-#define LM87_SYSCTL_TEMP3 1252 /* Degrees Celcius * 100 */
-#define LM87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define LM87_SYSCTL_ALARMS 2001 /* bitvector */
-#define LM87_SYSCTL_ANALOG_OUT 2002
-#define LM87_SYSCTL_VID 2003
-#define LM87_SYSCTL_VRM 2004
-
-#define LM87_ALARM_IN0 0x0001
-#define LM87_ALARM_IN1 0x0002
-#define LM87_ALARM_IN2 0x0004
-#define LM87_ALARM_IN3 0x0008
-#define LM87_ALARM_TEMP1 0x0010
-#define LM87_ALARM_TEMP2 0x0020
-#define LM87_ALARM_TEMP3 0x0020 /* same?? */
-#define LM87_ALARM_FAN1 0x0040
-#define LM87_ALARM_FAN2 0x0080
-#define LM87_ALARM_IN4 0x0100
-#define LM87_ALARM_IN5 0x0200
-#define LM87_ALARM_RESERVED1 0x0400
-#define LM87_ALARM_RESERVED2 0x0800
-#define LM87_ALARM_CHAS 0x1000
-#define LM87_ALARM_THERM_SIG 0x2000
-#define LM87_ALARM_TEMP2_FAULT 0x4000
-#define LM87_ALARM_TEMP3_FAULT 0x08000
-
-#define PCF8574_SYSCTL_READ 1000
-#define PCF8574_SYSCTL_WRITE 1001
-
-#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */
-#define MTP008_SYSCTL_IN1 1001
-#define MTP008_SYSCTL_IN2 1002
-#define MTP008_SYSCTL_IN3 1003
-#define MTP008_SYSCTL_IN4 1004
-#define MTP008_SYSCTL_IN5 1005
-#define MTP008_SYSCTL_IN6 1006
-#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */
-#define MTP008_SYSCTL_FAN2 1102
-#define MTP008_SYSCTL_FAN3 1103
-#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
-#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
-#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
-#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */
-#define MTP008_SYSCTL_PWM1 1401
-#define MTP008_SYSCTL_PWM2 1402
-#define MTP008_SYSCTL_PWM3 1403
-#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */
-#define MTP008_SYSCTL_SENS2 1502
-#define MTP008_SYSCTL_SENS3 1503
-#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */
-#define MTP008_SYSCTL_BEEP 2002 /* bitvector */
-
-#define MTP008_ALARM_IN0 0x0001
-#define MTP008_ALARM_IN1 0x0002
-#define MTP008_ALARM_IN2 0x0004
-#define MTP008_ALARM_IN3 0x0008
-#define MTP008_ALARM_IN4 0x0100
-#define MTP008_ALARM_IN5 0x0200
-#define MTP008_ALARM_IN6 0x0400
-#define MTP008_ALARM_FAN1 0x0040
-#define MTP008_ALARM_FAN2 0x0080
-#define MTP008_ALARM_FAN3 0x0800
-#define MTP008_ALARM_TEMP1 0x0010
-#define MTP008_ALARM_TEMP2 0x0100
-#define MTP008_ALARM_TEMP3 0x0200
-
-#define DS1621_SYSCTL_TEMP 1200 /* Degrees Celcius * 10 */
-#define DS1621_SYSCTL_ALARMS 2001 /* bitvector */
-#define DS1621_ALARM_TEMP_HIGH 0x40
-#define DS1621_ALARM_TEMP_LOW 0x20
-#define DS1621_SYSCTL_ENABLE 2002
-#define DS1621_SYSCTL_CONTINUOUS 2003
-#define DS1621_SYSCTL_POLARITY 2004
-
-#define IT87_SYSCTL_IN0 1000 /* Volts * 100 */
-#define IT87_SYSCTL_IN1 1001
-#define IT87_SYSCTL_IN2 1002
-#define IT87_SYSCTL_IN3 1003
-#define IT87_SYSCTL_IN4 1004
-#define IT87_SYSCTL_IN5 1005
-#define IT87_SYSCTL_IN6 1006
-#define IT87_SYSCTL_IN7 1007
-#define IT87_SYSCTL_IN8 1008
-#define IT87_SYSCTL_FAN1 1101 /* Rotations/min */
-#define IT87_SYSCTL_FAN2 1102
-#define IT87_SYSCTL_FAN3 1103
-#define IT87_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */
-#define IT87_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */
-#define IT87_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */
-#define IT87_SYSCTL_VID 1300 /* Volts * 100 */
-#define IT87_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define IT87_SYSCTL_ALARMS 2004 /* bitvector */
-
-#define IT87_ALARM_IN0 0x000100
-#define IT87_ALARM_IN1 0x000200
-#define IT87_ALARM_IN2 0x000400
-#define IT87_ALARM_IN3 0x000800
-#define IT87_ALARM_IN4 0x001000
-#define IT87_ALARM_IN5 0x002000
-#define IT87_ALARM_IN6 0x004000
-#define IT87_ALARM_IN7 0x008000
-#define IT87_ALARM_FAN1 0x0001
-#define IT87_ALARM_FAN2 0x0002
-#define IT87_ALARM_FAN3 0x0004
-#define IT87_ALARM_TEMP1 0x00010000
-#define IT87_ALARM_TEMP2 0x00020000
-#define IT87_ALARM_TEMP3 0x00040000
-
-#define FSCPOS_SYSCTL_VOLT0 1000 /* 12 volt supply */
-#define FSCPOS_SYSCTL_VOLT1 1001 /* 5 volt supply */
-#define FSCPOS_SYSCTL_VOLT2 1002 /* batterie voltage*/
-#define FSCPOS_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */
-#define FSCPOS_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */
-#define FSCPOS_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */
-#define FSCPOS_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */
-#define FSCPOS_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */
-#define FSCPOS_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */
-#define FSCPOS_SYSCTL_REV 2000 /* Revision */
-#define FSCPOS_SYSCTL_EVENT 2001 /* global event status */
-#define FSCPOS_SYSCTL_CONTROL 2002 /* global control byte */
-#define FSCPOS_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */
-
-#define FSCSCY_SYSCTL_VOLT0 1000 /* 12 volt supply */
-#define FSCSCY_SYSCTL_VOLT1 1001 /* 5 volt supply */
-#define FSCSCY_SYSCTL_VOLT2 1002 /* batterie voltage*/
-#define FSCSCY_SYSCTL_FAN0 1101 /* state, min, ripple, actual value fan 0 */
-#define FSCSCY_SYSCTL_FAN1 1102 /* state, min, ripple, actual value fan 1 */
-#define FSCSCY_SYSCTL_FAN2 1103 /* state, min, ripple, actual value fan 2 */
-#define FSCSCY_SYSCTL_FAN3 1104 /* state, min, ripple, actual value fan 3 */
-#define FSCSCY_SYSCTL_FAN4 1105 /* state, min, ripple, actual value fan 4 */
-#define FSCSCY_SYSCTL_FAN5 1106 /* state, min, ripple, actual value fan 5 */
-#define FSCSCY_SYSCTL_TEMP0 1201 /* state and value of sensor 0, cpu die */
-#define FSCSCY_SYSCTL_TEMP1 1202 /* state and value of sensor 1, motherboard */
-#define FSCSCY_SYSCTL_TEMP2 1203 /* state and value of sensor 2, chassis */
-#define FSCSCY_SYSCTL_TEMP3 1204 /* state and value of sensor 3, chassis */
-#define FSCSCY_SYSCTL_REV 2000 /* Revision */
-#define FSCSCY_SYSCTL_EVENT 2001 /* global event status */
-#define FSCSCY_SYSCTL_CONTROL 2002 /* global control byte */
-#define FSCSCY_SYSCTL_WDOG 2003 /* state, min, ripple, actual value fan 2 */
-#define FSCSCY_SYSCTL_PCILOAD 2004 /* PCILoad value */
-#define FSCSCY_SYSCTL_INTRUSION 2005 /* state, control for intrusion sensor */
-
-#define PCF8591_SYSCTL_AIN_CONF 1000 /* Analog input configuration */
-#define PCF8591_SYSCTL_CH0 1001 /* Input channel 1 */
-#define PCF8591_SYSCTL_CH1 1002 /* Input channel 2 */
-#define PCF8591_SYSCTL_CH2 1003 /* Input channel 3 */
-#define PCF8591_SYSCTL_CH3 1004 /* Input channel 4 */
-#define PCF8591_SYSCTL_AOUT_ENABLE 1005 /* Analog output enable flag */
-#define PCF8591_SYSCTL_AOUT 1006 /* Analog output */
-
-#define ARP_SYSCTL1 1000
-#define ARP_SYSCTL2 1001
-#define ARP_SYSCTL3 1002
-#define ARP_SYSCTL4 1003
-#define ARP_SYSCTL5 1004
-#define ARP_SYSCTL6 1005
-#define ARP_SYSCTL7 1006
-#define ARP_SYSCTL8 1007
-
-#define SMSC47M1_SYSCTL_FAN1 1101 /* Rotations/min */
-#define SMSC47M1_SYSCTL_FAN2 1102
-#define SMSC47M1_SYSCTL_PWM1 1401
-#define SMSC47M1_SYSCTL_PWM2 1402
-#define SMSC47M1_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */
-#define SMSC47M1_SYSCTL_ALARMS 2004 /* bitvector */
-
-#define SMSC47M1_ALARM_FAN1 0x0001
-#define SMSC47M1_ALARM_FAN2 0x0002
-
-#define VT1211_SYSCTL_IN0 1000
-#define VT1211_SYSCTL_IN1 1001
-#define VT1211_SYSCTL_IN2 1002
-#define VT1211_SYSCTL_IN3 1003
-#define VT1211_SYSCTL_IN4 1004
-#define VT1211_SYSCTL_IN5 1005
-#define VT1211_SYSCTL_IN6 1006
-#define VT1211_SYSCTL_FAN1 1101
-#define VT1211_SYSCTL_FAN2 1102
-#define VT1211_SYSCTL_TEMP 1200
-#define VT1211_SYSCTL_TEMP2 1201
-#define VT1211_SYSCTL_TEMP3 1202
-#define VT1211_SYSCTL_TEMP4 1203
-#define VT1211_SYSCTL_TEMP5 1204
-#define VT1211_SYSCTL_TEMP6 1205
-#define VT1211_SYSCTL_TEMP7 1206
-#define VT1211_SYSCTL_VID 1300
-#define VT1211_SYSCTL_PWM1 1401
-#define VT1211_SYSCTL_PWM2 1402
-#define VT1211_SYSCTL_VRM 1600
-#define VT1211_SYSCTL_UCH 1700
-#define VT1211_SYSCTL_FAN_DIV 2000
-#define VT1211_SYSCTL_ALARMS 2001
-
-#define VT1211_ALARM_IN1 0x01
-#define VT1211_ALARM_IN2 0x02
-#define VT1211_ALARM_IN5 0x04
-#define VT1211_ALARM_IN3 0x08
-#define VT1211_ALARM_TEMP 0x10
-#define VT1211_ALARM_FAN1 0x40
-#define VT1211_ALARM_FAN2 0x80
-#define VT1211_ALARM_IN4 0x100
-#define VT1211_ALARM_IN6 0x200
-#define VT1211_ALARM_TEMP2 0x800
-#define VT1211_ALARM_CHAS 0x1000
-#define VT1211_ALARM_TEMP3 0x8000
-/* duplicates */
-#define VT1211_ALARM_IN0 VT1211_ALARM_TEMP
-#define VT1211_ALARM_TEMP4 VT1211_ALARM_IN1
-#define VT1211_ALARM_TEMP5 VT1211_ALARM_IN2
-#define VT1211_ALARM_TEMP6 VT1211_ALARM_IN3
-#define VT1211_ALARM_TEMP7 VT1211_ALARM_IN4
-
-#define LM92_SYSCTL_ALARMS 2001 /* high, low, critical */
-#define LM92_SYSCTL_TEMP 1200 /* high, low, critical, hysterisis, input */
-
-#define LM92_ALARM_TEMP_HIGH 0x01
-#define LM92_ALARM_TEMP_LOW 0x02
-#define LM92_ALARM_TEMP_CRIT 0x04
-#define LM92_TEMP_HIGH 0x08
-#define LM92_TEMP_LOW 0x10
-#define LM92_TEMP_CRIT 0x20
-#define LM92_TEMP_HYST 0x40
-#define LM92_TEMP_INPUT 0x80
-
-#define VT8231_SYSCTL_IN0 1000
-#define VT8231_SYSCTL_IN1 1001
-#define VT8231_SYSCTL_IN2 1002
-#define VT8231_SYSCTL_IN3 1003
-#define VT8231_SYSCTL_IN4 1004
-#define VT8231_SYSCTL_IN5 1005
-#define VT8231_SYSCTL_IN6 1006
-#define VT8231_SYSCTL_FAN1 1101
-#define VT8231_SYSCTL_FAN2 1102
-#define VT8231_SYSCTL_TEMP 1200
-#define VT8231_SYSCTL_TEMP2 1201
-#define VT8231_SYSCTL_TEMP3 1202
-#define VT8231_SYSCTL_TEMP4 1203
-#define VT8231_SYSCTL_TEMP5 1204
-#define VT8231_SYSCTL_TEMP6 1205
-#define VT8231_SYSCTL_TEMP7 1206
-#define VT8231_SYSCTL_VID 1300
-#define VT8231_SYSCTL_PWM1 1401
-#define VT8231_SYSCTL_PWM2 1402
-#define VT8231_SYSCTL_VRM 1600
-#define VT8231_SYSCTL_UCH 1700
-#define VT8231_SYSCTL_FAN_DIV 2000
-#define VT8231_SYSCTL_ALARMS 2001
-
-#define VT8231_ALARM_IN1 0x01
-#define VT8231_ALARM_IN2 0x02
-#define VT8231_ALARM_IN5 0x04
-#define VT8231_ALARM_IN3 0x08
-#define VT8231_ALARM_TEMP 0x10
-#define VT8231_ALARM_FAN1 0x40
-#define VT8231_ALARM_FAN2 0x80
-#define VT8231_ALARM_IN4 0x100
-#define VT8231_ALARM_IN6 0x200
-#define VT8231_ALARM_TEMP2 0x800
-#define VT8231_ALARM_CHAS 0x1000
-#define VT8231_ALARM_TEMP3 0x8000
-/* duplicates */
-#define VT8231_ALARM_IN0 VT8231_ALARM_TEMP
-#define VT8231_ALARM_TEMP4 VT8231_ALARM_IN1
-#define VT8231_ALARM_TEMP5 VT8231_ALARM_IN2
-#define VT8231_ALARM_TEMP6 VT8231_ALARM_IN3
-#define VT8231_ALARM_TEMP7 VT8231_ALARM_IN4
-
-#define SMARTBATT_SYSCTL_I 1001
-#define SMARTBATT_SYSCTL_V 1002
-#define SMARTBATT_SYSCTL_TEMP 1003
-#define SMARTBATT_SYSCTL_TIME 1004
-#define SMARTBATT_SYSCTL_ALARMS 1005
-#define SMARTBATT_SYSCTL_CHARGE 1006
-
-
-#endif /* def SENSORS_SENSORS_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 7a1e22b170c2..8243c6bec130 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -78,6 +78,13 @@ extern int register_cpu_notifier(struct notifier_block *nb);
extern void unregister_cpu_notifier(struct notifier_block *nb);
int cpu_up(unsigned int cpu);
+
+/*
+ * Mark the boot cpu "online" so that it can call console drivers in
+ * printk() and can access its per-cpu storage.
+ */
+void smp_prepare_boot_cpu(void);
+
#else /* !SMP */
/*
@@ -94,7 +101,8 @@ static inline void smp_send_reschedule_all(void) { }
#define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; })
#define num_online_cpus() 1
#define num_booting_cpus() 1
-#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
+#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; })
+#define smp_prepare_boot_cpu() do {} while (0)
struct notifier_block;
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a481f80034fa..80b4a657b49c 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -46,6 +46,9 @@ struct suspend_header {
/* mm/vmscan.c */
extern int shrink_mem(void);
+/* mm/page_alloc.c */
+extern void drain_local_pages(void);
+
/* kernel/suspend.c */
extern void software_suspend(void);
extern void software_resume(void);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 11b82d2c98ae..ad3149de8631 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -379,9 +379,8 @@ extern void start_tty(struct tty_struct * tty);
extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
-extern void tty_register_devfs (struct tty_driver *driver, unsigned int flags,
- unsigned minor);
-extern void tty_unregister_devfs (struct tty_driver *driver, unsigned minor);
+extern void tty_register_device(struct tty_driver *driver, unsigned minor);
+extern void tty_unregister_device(struct tty_driver *driver, unsigned minor);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
extern void tty_write_message(struct tty_struct *tty, char *msg);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 806216e30a26..ad5638bbd4ed 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -227,4 +227,6 @@ extern struct list_head tty_drivers;
#define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_CALLOUT 2
+extern struct device_class tty_devclass;
+
#endif /* #ifdef _LINUX_TTY_DRIVER_H */
diff --git a/init/main.c b/init/main.c
index 6770292ed29a..b07fac4e9f02 100644
--- a/init/main.c
+++ b/init/main.c
@@ -377,6 +377,13 @@ asmlinkage void __init start_kernel(void)
printk(linux_banner);
setup_arch(&command_line);
setup_per_cpu_areas();
+
+ /*
+ * Mark the boot cpu "online" so that it can call console drivers in
+ * printk() and can access its per-cpu storage.
+ */
+ smp_prepare_boot_cpu();
+
build_all_zonelists();
page_alloc_init();
printk("Kernel command line: %s\n", saved_command_line);
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index c8208fb2191a..5dff6da1a73f 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -365,7 +365,7 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
{
struct cpufreq_policy policy;
down(&cpufreq_driver_sem);
- if (!cpufreq_driver || !cpu_max_freq) {
+ if (!cpufreq_driver || !freq || (cpu > NR_CPUS)) {
up(&cpufreq_driver_sem);
return -EINVAL;
}
@@ -377,7 +377,20 @@ int cpufreq_set(unsigned int freq, unsigned int cpu)
up(&cpufreq_driver_sem);
- return cpufreq_set_policy(&policy);
+ if (policy.cpu == CPUFREQ_ALL_CPUS)
+ {
+ unsigned int i;
+ unsigned int ret = 0;
+ for (i=0; i<NR_CPUS; i++)
+ {
+ policy.cpu = i;
+ if (cpu_online(i))
+ ret |= cpufreq_set_policy(&policy);
+ }
+ return ret;
+ }
+ else
+ return cpufreq_set_policy(&policy);
}
EXPORT_SYMBOL_GPL(cpufreq_set);
@@ -842,7 +855,6 @@ EXPORT_SYMBOL(cpufreq_get_policy);
*/
int cpufreq_set_policy(struct cpufreq_policy *policy)
{
- unsigned int i;
int ret;
down(&cpufreq_driver_sem);
@@ -889,24 +901,12 @@ int cpufreq_set_policy(struct cpufreq_policy *policy)
up(&cpufreq_notifier_sem);
- if (policy->cpu == CPUFREQ_ALL_CPUS) {
- for (i=0;i<NR_CPUS;i++) {
- cpufreq_driver->policy[i].min = policy->min;
- cpufreq_driver->policy[i].max = policy->max;
- cpufreq_driver->policy[i].policy = policy->policy;
- }
- } else {
- cpufreq_driver->policy[policy->cpu].min = policy->min;
- cpufreq_driver->policy[policy->cpu].max = policy->max;
- cpufreq_driver->policy[policy->cpu].policy = policy->policy;
- }
+ cpufreq_driver->policy[policy->cpu].min = policy->min;
+ cpufreq_driver->policy[policy->cpu].max = policy->max;
+ cpufreq_driver->policy[policy->cpu].policy = policy->policy;
#ifdef CONFIG_CPU_FREQ_24_API
- if (policy->cpu == CPUFREQ_ALL_CPUS) {
- for (i=0;i<NR_CPUS;i++)
- cpu_cur_freq[i] = policy->max;
- } else
- cpu_cur_freq[policy->cpu] = policy->max;
+ cpu_cur_freq[policy->cpu] = policy->max;
#endif
ret = cpufreq_driver->setpolicy(policy);
@@ -920,15 +920,6 @@ EXPORT_SYMBOL(cpufreq_set_policy);
/*********************************************************************
- * DYNAMIC CPUFREQ SWITCHING *
- *********************************************************************/
-#ifdef CONFIG_CPU_FREQ_DYNAMIC
-/* TBD */
-#endif /* CONFIG_CPU_FREQ_DYNAMIC */
-
-
-
-/*********************************************************************
* EXTERNALLY AFFECTING FREQUENCY CHANGES *
*********************************************************************/
@@ -967,12 +958,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs);
#ifdef CONFIG_CPU_FREQ_24_API
- if (freqs->cpu == CPUFREQ_ALL_CPUS) {
- int i;
- for (i=0;i<NR_CPUS;i++)
- cpu_cur_freq[i] = freqs->new;
- } else
- cpu_cur_freq[freqs->cpu] = freqs->new;
+ cpu_cur_freq[freqs->cpu] = freqs->new;
#endif
break;
}
diff --git a/kernel/exec_domain.c b/kernel/exec_domain.c
index 162a5c23e606..5d53353d57b0 100644
--- a/kernel/exec_domain.c
+++ b/kernel/exec_domain.c
@@ -82,7 +82,7 @@ lookup_exec_domain(u_long personality)
read_lock(&exec_domains_lock);
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
- if (try_inc_mod_count(ep->module))
+ if (try_module_get(ep->module))
goto out;
}
@@ -97,7 +97,7 @@ lookup_exec_domain(u_long personality)
for (ep = exec_domains; ep; ep = ep->next) {
if (pers >= ep->pers_low && pers <= ep->pers_high)
- if (try_inc_mod_count(ep->module))
+ if (try_module_get(ep->module))
goto out;
}
#endif
diff --git a/kernel/fork.c b/kernel/fork.c
index 6f7298827344..60d6d54142c6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -757,7 +757,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->thread_info->preempt_count = 1;
#endif
p->did_exec = 0;
- p->swappable = 0;
p->state = TASK_UNINTERRUPTIBLE;
copy_flags(clone_flags, p);
@@ -841,7 +840,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
p->parent_exec_id = p->self_exec_id;
/* ok, now we should be set up.. */
- p->swappable = 1;
if (clone_flags & CLONE_DETACHED)
p->exit_signal = -1;
else
@@ -1078,7 +1076,7 @@ void __init proc_caches_init(void)
vm_area_cachep = kmem_cache_create("vm_area_struct",
sizeof(struct vm_area_struct), 0,
- SLAB_HWCACHE_ALIGN, NULL, NULL);
+ 0, NULL, NULL);
if(!vm_area_cachep)
panic("vma_init: Cannot alloc vm_area_struct SLAB cache");
diff --git a/kernel/intermodule.c b/kernel/intermodule.c
index 9228ca4fe035..5171df7d70fb 100644
--- a/kernel/intermodule.c
+++ b/kernel/intermodule.c
@@ -123,7 +123,7 @@ const void *inter_module_get(const char *im_name)
list_for_each(tmp, &ime_list) {
ime = list_entry(tmp, struct inter_module_entry, list);
if (strcmp(ime->im_name, im_name) == 0) {
- if (try_inc_mod_count(ime->owner))
+ if (try_module_get(ime->owner))
result = ime->userdata;
break;
}
diff --git a/kernel/ksyms.c b/kernel/ksyms.c
index cd49778dd1f3..414ab402325e 100644
--- a/kernel/ksyms.c
+++ b/kernel/ksyms.c
@@ -98,6 +98,10 @@ EXPORT_SYMBOL(set_shrinker);
EXPORT_SYMBOL(remove_shrinker);
EXPORT_SYMBOL(kmalloc);
EXPORT_SYMBOL(kfree);
+#ifdef CONFIG_SMP
+EXPORT_SYMBOL(kmalloc_percpu);
+EXPORT_SYMBOL(kfree_percpu);
+#endif
EXPORT_SYMBOL(vfree);
EXPORT_SYMBOL(__vmalloc);
EXPORT_SYMBOL(vmalloc);
diff --git a/kernel/module.c b/kernel/module.c
index 4b789cf97f5d..6d2e66e9bf37 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -569,24 +569,19 @@ static int param_set_byte(const char *val, struct kernel_param *kp)
return 0;
}
-static int param_string(const char *name, const char *val,
- unsigned int min, unsigned int max,
- char *dest)
+/* Bounds checking done below */
+static int obsparm_copy_string(const char *val, struct kernel_param *kp)
{
- if (strlen(val) < min || strlen(val) > max) {
- printk(KERN_ERR
- "Parameter %s length must be %u-%u characters\n",
- name, min, max);
- return -EINVAL;
- }
- strcpy(dest, val);
+ strcpy(kp->arg, val);
return 0;
}
extern int set_obsolete(const char *val, struct kernel_param *kp)
{
unsigned int min, max;
- char *p, *endp;
+ unsigned int size, maxsize;
+ char *endp;
+ const char *p;
struct obsolete_modparm *obsparm = kp->arg;
if (!val) {
@@ -618,10 +613,32 @@ extern int set_obsolete(const char *val, struct kernel_param *kp)
return param_array(kp->name, val, min, max, obsparm->addr,
sizeof(long), param_set_long);
case 's':
- return param_string(kp->name, val, min, max, obsparm->addr);
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ sizeof(char *), param_set_charp);
+
+ case 'c':
+ /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars,
+ and the decl is "char xxx[5][50];" */
+ p = endp+1;
+ maxsize = simple_strtol(p, &endp, 10);
+ /* We check lengths here (yes, this is a hack). */
+ p = val;
+ while (p[size = strcspn(p, ",")]) {
+ if (size >= maxsize)
+ goto oversize;
+ p += size+1;
+ }
+ if (size >= maxsize)
+ goto oversize;
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ maxsize, obsparm_copy_string);
}
printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
return -EINVAL;
+ oversize:
+ printk(KERN_ERR
+ "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize);
+ return -EINVAL;
}
static int obsolete_params(const char *name,
diff --git a/kernel/params.c b/kernel/params.c
index 5c5e9b3c23fe..0e9938a6bf23 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -233,6 +233,7 @@ int param_array(const char *name,
int ret;
unsigned int count = 0;
struct kernel_param kp;
+ char save;
/* Get the name right for errors. */
kp.name = name;
@@ -247,7 +248,6 @@ int param_array(const char *name,
/* We expect a comma-separated list of values. */
do {
int len;
- char save;
if (count > max) {
printk(KERN_ERR "%s: can only take %i arguments\n",
@@ -256,18 +256,17 @@ int param_array(const char *name,
}
len = strcspn(val, ",");
- /* Temporarily nul-terminate and parse */
+ /* nul-terminate and parse */
save = val[len];
((char *)val)[len] = '\0';
ret = set(val, &kp);
- ((char *)val)[len] = save;
if (ret != 0)
return ret;
kp.arg += elemsize;
val += len+1;
count++;
- } while (val[-1] == ',');
+ } while (save == ',');
if (count < min) {
printk(KERN_ERR "%s: needs at least %i arguments\n",
diff --git a/kernel/printk.c b/kernel/printk.c
index bb1bcb0d723f..ffe724fabc0e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -27,6 +27,7 @@
#include <linux/interrupt.h> /* For in_interrupt() */
#include <linux/config.h>
#include <linux/delay.h>
+#include <linux/smp.h>
#include <asm/uaccess.h>
@@ -42,10 +43,6 @@
#define LOG_BUF_MASK (LOG_BUF_LEN-1)
-#ifndef arch_consoles_callable
-#define arch_consoles_callable() (1)
-#endif
-
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */
@@ -447,10 +444,12 @@ asmlinkage int printk(const char *fmt, ...)
log_level_unknown = 1;
}
- if (!arch_consoles_callable()) {
+ if (!cpu_online(smp_processor_id())) {
/*
- * On some architectures, the consoles are not usable
- * on secondary CPUs early in the boot process.
+ * Some console drivers may assume that per-cpu resources have
+ * been allocated. So don't allow them to be called by this
+ * CPU until it is officially up. We shouldn't be calling into
+ * random console drivers on a CPU which doesn't exist yet..
*/
spin_unlock_irqrestore(&logbuf_lock, flags);
goto out;
@@ -638,7 +637,8 @@ void register_console(struct console * console)
}
if (console->flags & CON_PRINTBUFFER) {
/*
- * release_console_sem() will print out the buffered messages for us.
+ * release_console_sem() will print out the buffered messages
+ * for us.
*/
spin_lock_irqsave(&logbuf_lock, flags);
con_start = log_start;
diff --git a/lib/Makefile b/lib/Makefile
index db150fb01601..d9b12140d830 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -31,3 +31,11 @@ include $(TOPDIR)/drivers/net/Makefile.lib
include $(TOPDIR)/drivers/usb/class/Makefile.lib
include $(TOPDIR)/fs/Makefile.lib
include $(TOPDIR)/net/bluetooth/bnep/Makefile.lib
+
+host-progs := gen_crc32table
+clean-files := crc32table.h
+
+$(obj)/crc32.o: $(obj)/crc32table.h
+
+$(obj)/crc32table.h: $(obj)/gen_crc32table
+ ./$< > $@
diff --git a/lib/crc32.c b/lib/crc32.c
index ef9f5caefe87..47a142688b1d 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -22,6 +22,15 @@
#include <linux/slab.h>
#include <linux/init.h>
#include <asm/atomic.h>
+#include "crc32defs.h"
+#if CRC_LE_BITS == 8
+#define tole(x) __constant_cpu_to_le32(x)
+#define tobe(x) __constant_cpu_to_be32(x)
+#else
+#define tole(x) (x)
+#define tobe(x) (x)
+#endif
+#include "crc32table.h"
#if __GNUC__ >= 3 /* 2.x has "attribute", but only 3.0 has "pure */
#define attribute(x) __attribute__(x)
@@ -40,35 +49,12 @@ MODULE_AUTHOR("Matt Domsch <Matt_Domsch@dell.com>");
MODULE_DESCRIPTION("Ethernet CRC32 calculations");
MODULE_LICENSE("GPL and additional rights");
-
-/*
- * There are multiple 16-bit CRC polynomials in common use, but this is
- * *the* standard CRC-32 polynomial, first popularized by Ethernet.
- * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
- */
-#define CRCPOLY_LE 0xedb88320
-#define CRCPOLY_BE 0x04c11db7
-
-/* How many bits at a time to use. Requires a table of 4<<CRC_xx_BITS bytes. */
-/* For less performance-sensitive, use 4 */
-#define CRC_LE_BITS 8
-#define CRC_BE_BITS 8
-
-/*
- * Little-endian CRC computation. Used with serial bit streams sent
- * lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC.
- */
-#if CRC_LE_BITS > 8 || CRC_LE_BITS < 1 || CRC_LE_BITS & CRC_LE_BITS-1
-# error CRC_LE_BITS must be a power of 2 between 1 and 8
-#endif
-
#if CRC_LE_BITS == 1
/*
* In fact, the table-based code will work in this case, but it can be
* simplified by inlining the table in ?: form.
*/
-#define crc32init_le()
-#define crc32cleanup_le()
+
/**
* crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
* @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for
@@ -89,42 +75,6 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len)
}
#else /* Table-based approach */
-static u32 *crc32table_le;
-/**
- * crc32init_le() - allocate and initialize LE table data
- *
- * crc is the crc of the byte i; other entries are filled in based on the
- * fact that crctable[i^j] = crctable[i] ^ crctable[j].
- *
- */
-static int __init crc32init_le(void)
-{
- unsigned i, j;
- u32 crc = 1;
-
- crc32table_le =
- kmalloc((1 << CRC_LE_BITS) * sizeof(u32), GFP_KERNEL);
- if (!crc32table_le)
- return 1;
- crc32table_le[0] = 0;
-
- for (i = 1 << (CRC_LE_BITS - 1); i; i >>= 1) {
- crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
- for (j = 0; j < 1 << CRC_LE_BITS; j += 2 * i)
- crc32table_le[i + j] = crc ^ crc32table_le[j];
- }
- return 0;
-}
-
-/**
- * crc32cleanup_le(): free LE table data
- */
-static void __exit crc32cleanup_le(void)
-{
- if (crc32table_le) kfree(crc32table_le);
- crc32table_le = NULL;
-}
-
/**
* crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
* @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for
@@ -135,40 +85,82 @@ static void __exit crc32cleanup_le(void)
*/
u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len)
{
- while (len--) {
# if CRC_LE_BITS == 8
- crc = (crc >> 8) ^ crc32table_le[(crc ^ *p++) & 255];
+ const u32 *b =(u32 *)p;
+ const u32 *e;
+ /* load data 32 bits wide, xor data 32 bits wide. */
+
+ crc = __cpu_to_le32(crc);
+ /* Align it */
+ for ( ; ((u32)b)&3 && len ; len--){
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_le[ (crc ^ *((u8 *)b)++) & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_le[ crc>>24 ^ *((u8 *)b)++ ];
+# endif
+ }
+ e = (u32 *) ( (u8 *)b + (len & ~7));
+ while (b < e) {
+ crc ^= *b++;
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+# endif
+ crc ^= *b++;
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_le[ crc & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_le[ crc >> 24 ];
+# endif
+ }
+ /* And the last few bytes */
+ e = (u32 *)((u8 *)b + (len & 7));
+ while (b < e){
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_le[ (crc ^ *((u8 *)b)++) & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_le[ crc>>24 ^ *((u8 *)b)++ ];
+# endif
+ }
+ return __le32_to_cpu(crc) ;
# elif CRC_LE_BITS == 4
+ while (len--) {
crc ^= *p++;
crc = (crc >> 4) ^ crc32table_le[crc & 15];
crc = (crc >> 4) ^ crc32table_le[crc & 15];
+ }
+ return crc;
# elif CRC_LE_BITS == 2
+ while (len--) {
crc ^= *p++;
crc = (crc >> 2) ^ crc32table_le[crc & 3];
crc = (crc >> 2) ^ crc32table_le[crc & 3];
crc = (crc >> 2) ^ crc32table_le[crc & 3];
crc = (crc >> 2) ^ crc32table_le[crc & 3];
-# endif
}
return crc;
+# endif
}
#endif
-/*
- * Big-endian CRC computation. Used with serial bit streams sent
- * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC.
- */
-#if CRC_BE_BITS > 8 || CRC_BE_BITS < 1 || CRC_BE_BITS & CRC_BE_BITS-1
-# error CRC_BE_BITS must be a power of 2 between 1 and 8
-#endif
-
#if CRC_BE_BITS == 1
/*
* In fact, the table-based code will work in this case, but it can be
* simplified by inlining the table in ?: form.
*/
-#define crc32init_be()
-#define crc32cleanup_be()
/**
* crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32
@@ -192,40 +184,6 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len)
}
#else /* Table-based approach */
-static u32 *crc32table_be;
-
-/**
- * crc32init_be() - allocate and initialize BE table data
- */
-static int __init crc32init_be(void)
-{
- unsigned i, j;
- u32 crc = 0x80000000;
-
- crc32table_be =
- kmalloc((1 << CRC_BE_BITS) * sizeof(u32), GFP_KERNEL);
- if (!crc32table_be)
- return 1;
- crc32table_be[0] = 0;
-
- for (i = 1; i < 1 << CRC_BE_BITS; i <<= 1) {
- crc = (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : 0);
- for (j = 0; j < i; j++)
- crc32table_be[i + j] = crc ^ crc32table_be[j];
- }
- return 0;
-}
-
-/**
- * crc32cleanup_be(): free BE table data
- */
-static void __exit crc32cleanup_be(void)
-{
- if (crc32table_be) kfree(crc32table_be);
- crc32table_be = NULL;
-}
-
-
/**
* crc32_be() - Calculate bitwise big-endian Ethernet AUTODIN II CRC32
* @crc - seed value for computation. ~0 for Ethernet, sometimes 0 for
@@ -236,25 +194,80 @@ static void __exit crc32cleanup_be(void)
*/
u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len)
{
- while (len--) {
# if CRC_BE_BITS == 8
- crc = (crc << 8) ^ crc32table_be[(crc >> 24) ^ *p++];
+ const u32 *b =(u32 *)p;
+ const u32 *e;
+ /* load data 32 bits wide, xor data 32 bits wide. */
+
+ crc = __cpu_to_be32(crc);
+ /* Align it */
+ for ( ; ((u32)b)&3 && len ; len--){
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_be[ (crc ^ *((u8 *)b)++) & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_be[ crc>>24 ^ *((u8 *)b)++ ];
+# endif
+ }
+ e = (u32 *) ( (u8 *)b + (len & ~7));
+ while (b < e) {
+ crc ^= *b++;
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+# endif
+ crc ^= *b++;
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+ crc = (crc>>8) ^ crc32table_be[ crc & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+ crc = (crc<<8) ^ crc32table_be[ crc >> 24 ];
+# endif
+ }
+ /* And the last few bytes */
+ e = (u32 *)((u8 *)b + (len & 7));
+ while (b < e){
+# ifdef __LITTLE_ENDIAN
+ crc = (crc>>8) ^ crc32table_be[ (crc ^ *((u8 *)b)++) & 0xff ];
+# else
+ crc = (crc<<8) ^ crc32table_be[ crc>>24 ^ *((u8 *)b)++ ];
+# endif
+ }
+ return __be32_to_cpu(crc) ;
# elif CRC_BE_BITS == 4
+ while (len--) {
crc ^= *p++ << 24;
crc = (crc << 4) ^ crc32table_be[crc >> 28];
crc = (crc << 4) ^ crc32table_be[crc >> 28];
+ }
+ return crc;
# elif CRC_BE_BITS == 2
+ while (len--) {
crc ^= *p++ << 24;
crc = (crc << 2) ^ crc32table_be[crc >> 30];
crc = (crc << 2) ^ crc32table_be[crc >> 30];
crc = (crc << 2) ^ crc32table_be[crc >> 30];
crc = (crc << 2) ^ crc32table_be[crc >> 30];
-# endif
}
return crc;
+# endif
}
#endif
+EXPORT_SYMBOL(crc32_le);
+EXPORT_SYMBOL(crc32_be);
+
/*
* A brief CRC tutorial.
*
@@ -508,9 +521,6 @@ int main(void)
int i, j;
u32 crc1, crc2, crc3;
- crc32init_le();
- crc32init_be();
-
for (i = 0; i <= SIZE; i++) {
printf("\rTesting length %d...", i);
fflush(stdout);
@@ -532,40 +542,3 @@ int main(void)
}
#endif /* UNITTEST */
-
-/**
- * init_crc32(): generates CRC32 tables
- *
- * On successful initialization, use count is increased.
- * This guarantees that the library functions will stay resident
- * in memory, and prevents someone from 'rmmod crc32' while
- * a driver that needs it is still loaded.
- * This also greatly simplifies drivers, as there's no need
- * to call an initialization/cleanup function from each driver.
- * Since crc32.o is a library module, there's no requirement
- * that the user can unload it.
- */
-static int __init init_crc32(void)
-{
- int rc1, rc2, rc;
- rc1 = crc32init_le();
- rc2 = crc32init_be();
- rc = rc1 || rc2;
- if (!rc) MOD_INC_USE_COUNT;
- return rc;
-}
-
-/**
- * cleanup_crc32(): frees crc32 data when no longer needed
- */
-static void __exit cleanup_crc32(void)
-{
- crc32cleanup_le();
- crc32cleanup_be();
-}
-
-fs_initcall(init_crc32);
-module_exit(cleanup_crc32);
-
-EXPORT_SYMBOL(crc32_le);
-EXPORT_SYMBOL(crc32_be);
diff --git a/lib/crc32defs.h b/lib/crc32defs.h
new file mode 100644
index 000000000000..bdf55ce42edc
--- /dev/null
+++ b/lib/crc32defs.h
@@ -0,0 +1,28 @@
+/*
+ * There are multiple 16-bit CRC polynomials in common use, but this is
+ * *the* standard CRC-32 polynomial, first popularized by Ethernet.
+ * x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x^1+x^0
+ */
+#define CRCPOLY_LE 0xedb88320
+#define CRCPOLY_BE 0x04c11db7
+
+/* How many bits at a time to use. Requires a table of 4<<CRC_xx_BITS bytes. */
+/* For less performance-sensitive, use 4 */
+#define CRC_LE_BITS 8
+#define CRC_BE_BITS 8
+
+/*
+ * Little-endian CRC computation. Used with serial bit streams sent
+ * lsbit-first. Be sure to use cpu_to_le32() to append the computed CRC.
+ */
+#if CRC_LE_BITS > 8 || CRC_LE_BITS < 1 || CRC_LE_BITS & CRC_LE_BITS-1
+# error CRC_LE_BITS must be a power of 2 between 1 and 8
+#endif
+
+/*
+ * Big-endian CRC computation. Used with serial bit streams sent
+ * msbit-first. Be sure to use cpu_to_be32() to append the computed CRC.
+ */
+#if CRC_BE_BITS > 8 || CRC_BE_BITS < 1 || CRC_BE_BITS & CRC_BE_BITS-1
+# error CRC_BE_BITS must be a power of 2 between 1 and 8
+#endif
diff --git a/lib/gen_crc32table.c b/lib/gen_crc32table.c
new file mode 100644
index 000000000000..8d940175c595
--- /dev/null
+++ b/lib/gen_crc32table.c
@@ -0,0 +1,82 @@
+#include <stdio.h>
+#include "crc32defs.h"
+#include <sys/types.h>
+
+#define ENTRIES_PER_LINE 4
+
+#define LE_TABLE_SIZE (1 << CRC_LE_BITS)
+#define BE_TABLE_SIZE (1 << CRC_BE_BITS)
+
+static u_int32_t crc32table_le[LE_TABLE_SIZE];
+static u_int32_t crc32table_be[BE_TABLE_SIZE];
+
+/**
+ * crc32init_le() - allocate and initialize LE table data
+ *
+ * crc is the crc of the byte i; other entries are filled in based on the
+ * fact that crctable[i^j] = crctable[i] ^ crctable[j].
+ *
+ */
+static void crc32init_le(void)
+{
+ unsigned i, j;
+ u_int32_t crc = 1;
+
+ crc32table_le[0] = 0;
+
+ for (i = 1 << (CRC_LE_BITS - 1); i; i >>= 1) {
+ crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
+ for (j = 0; j < LE_TABLE_SIZE; j += 2 * i)
+ crc32table_le[i + j] = crc ^ crc32table_le[j];
+ }
+}
+
+/**
+ * crc32init_be() - allocate and initialize BE table data
+ */
+static void crc32init_be(void)
+{
+ unsigned i, j;
+ u_int32_t crc = 0x80000000;
+
+ crc32table_be[0] = 0;
+
+ for (i = 1; i < BE_TABLE_SIZE; i <<= 1) {
+ crc = (crc << 1) ^ ((crc & 0x80000000) ? CRCPOLY_BE : 0);
+ for (j = 0; j < i; j++)
+ crc32table_be[i + j] = crc ^ crc32table_be[j];
+ }
+}
+
+static void output_table(u_int32_t table[], int len, char *trans)
+{
+ int i;
+
+ for (i = 0; i < len - 1; i++) {
+ if (i % ENTRIES_PER_LINE == 0)
+ printf("\n");
+ printf("%s(0x%8.8xL), ", trans, table[i]);
+ }
+ printf("%s(0x%8.8xL)\n", trans, table[len - 1]);
+}
+
+int main(int argc, char** argv)
+{
+ printf("/* this file is generated - do not edit */\n\n");
+
+ if (CRC_LE_BITS > 1) {
+ crc32init_le();
+ printf("static const u32 crc32table_le[] = {");
+ output_table(crc32table_le, LE_TABLE_SIZE, "tole");
+ printf("};\n");
+ }
+
+ if (CRC_BE_BITS > 1) {
+ crc32init_be();
+ printf("static const u32 crc32table_be[] = {");
+ output_table(crc32table_be, BE_TABLE_SIZE, "tobe");
+ printf("};\n");
+ }
+
+ return 0;
+}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7de787fd57d9..1c8015736d61 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -350,6 +350,31 @@ int is_head_of_free_region(struct page *page)
spin_unlock_irqrestore(&zone->lock, flags);
return 0;
}
+
+/*
+ * Spill all of this CPU's per-cpu pages back into the buddy allocator.
+ */
+void drain_local_pages(void)
+{
+ unsigned long flags;
+ struct zone *zone;
+ int i;
+
+ local_irq_save(flags);
+ for_each_zone(zone) {
+ struct per_cpu_pageset *pset;
+
+ pset = &zone->pageset[smp_processor_id()];
+ for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
+ struct per_cpu_pages *pcp;
+
+ pcp = &pset->pcp[i];
+ pcp->count -= free_pages_bulk(zone, pcp->count,
+ &pcp->list, 0);
+ }
+ }
+ local_irq_restore(flags);
+}
#endif /* CONFIG_SOFTWARE_SUSPEND */
/*
diff --git a/mm/slab.c b/mm/slab.c
index 0b30ca1afeaa..c0fed9f01b4c 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1303,9 +1303,6 @@ static void cache_init_objs (kmem_cache_t * cachep,
static void kmem_flagcheck(kmem_cache_t *cachep, int flags)
{
- if (flags & __GFP_WAIT)
- might_sleep();
-
if (flags & SLAB_DMA) {
if (!(cachep->gfpflags & GFP_DMA))
BUG();
@@ -1595,14 +1592,19 @@ must_grow:
return ac_entry(ac)[--ac->avail];
}
-static inline void cache_alloc_debugcheck_before(kmem_cache_t *cachep, int flags)
+static inline void
+cache_alloc_debugcheck_before(kmem_cache_t *cachep, int flags)
{
+ if (flags & __GFP_WAIT)
+ might_sleep();
#if DEBUG
kmem_flagcheck(cachep, flags);
#endif
}
-static inline void *cache_alloc_debugcheck_after (kmem_cache_t *cachep, unsigned long flags, void *objp)
+static inline void *
+cache_alloc_debugcheck_after(kmem_cache_t *cachep,
+ unsigned long flags, void *objp)
{
#if DEBUG
if (!objp)
@@ -1826,6 +1828,54 @@ void * kmalloc (size_t size, int flags)
return NULL;
}
+#ifdef CONFIG_SMP
+/**
+ * kmalloc_percpu - allocate one copy of the object for every present
+ * cpu in the system.
+ * Objects should be dereferenced using per_cpu_ptr/get_cpu_ptr
+ * macros only.
+ *
+ * @size: how many bytes of memory are required.
+ * @flags: the type of memory to allocate.
+ * The @flags argument may be one of:
+ *
+ * %GFP_USER - Allocate memory on behalf of user. May sleep.
+ *
+ * %GFP_KERNEL - Allocate normal kernel ram. May sleep.
+ *
+ * %GFP_ATOMIC - Allocation will not sleep. Use inside interrupt handlers.
+ */
+void *
+kmalloc_percpu(size_t size, int flags)
+{
+ int i;
+ struct percpu_data *pdata = kmalloc(sizeof (*pdata), flags);
+
+ if (!pdata)
+ return NULL;
+
+ for (i = 0; i < NR_CPUS; i++) {
+ if (!cpu_possible(i))
+ continue;
+ pdata->ptrs[i] = kmalloc(size, flags);
+ if (!pdata->ptrs[i])
+ goto unwind_oom;
+ }
+
+ /* Catch derefs w/o wrappers */
+ return (void *) (~(unsigned long) pdata);
+
+unwind_oom:
+ while (--i >= 0) {
+ if (!cpu_possible(i))
+ continue;
+ kfree(pdata->ptrs[i]);
+ }
+ kfree(pdata);
+ return NULL;
+}
+#endif
+
/**
* kmem_cache_free - Deallocate an object
* @cachep: The cache the allocation was from.
@@ -1864,6 +1914,28 @@ void kfree (const void *objp)
local_irq_restore(flags);
}
+#ifdef CONFIG_SMP
+/**
+ * kfree_percpu - free previously allocated percpu memory
+ * @objp: pointer returned by kmalloc_percpu.
+ *
+ * Don't free memory not originally allocated by kmalloc_percpu()
+ * The complemented objp is to check for that.
+ */
+void
+kfree_percpu(const void *objp)
+{
+ int i;
+ struct percpu_data *p = (struct percpu_data *) (~(unsigned long) objp);
+
+ for (i = 0; i < NR_CPUS; i++) {
+ if (!cpu_possible(i))
+ continue;
+ kfree(p->ptrs[i]);
+ }
+}
+#endif
+
unsigned int kmem_cache_size(kmem_cache_t *cachep)
{
#if DEBUG
diff --git a/net/core/dev.c b/net/core/dev.c
index 97e772ff5f82..72f606980694 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -697,7 +697,7 @@ int dev_open(struct net_device *dev)
/*
* Call device private open method
*/
- if (try_inc_mod_count(dev->owner)) {
+ if (try_module_get(dev->owner)) {
set_bit(__LINK_STATE_START, &dev->state);
if (dev->open) {
ret = dev->open(dev);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index be694e083888..d1d7cf33713a 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -275,11 +275,8 @@ static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
static void rt_cache_seq_stop(struct seq_file *seq, void *v)
{
- if (v && v != (void *)1) {
- struct rt_cache_iter_state *st = seq->private;
-
+ if (v && v != (void *)1)
rcu_read_unlock();
- }
}
static int rt_cache_seq_show(struct seq_file *seq, void *v)
diff --git a/net/ipv4/xfrm_policy.c b/net/ipv4/xfrm_policy.c
index fe30556f78d6..f2c15d116118 100644
--- a/net/ipv4/xfrm_policy.c
+++ b/net/ipv4/xfrm_policy.c
@@ -192,7 +192,7 @@ struct xfrm_type *xfrm_get_type(u8 proto)
read_lock(&xfrm_type_lock);
type = xfrm_type_map[proto];
- if (type && !try_inc_mod_count(type->owner))
+ if (type && !try_module_get(type->owner))
type = NULL;
read_unlock(&xfrm_type_lock);
return type;
diff --git a/net/rxrpc/krxsecd.c b/net/rxrpc/krxsecd.c
index 0e50f85416d6..4e35bd351412 100644
--- a/net/rxrpc/krxsecd.c
+++ b/net/rxrpc/krxsecd.c
@@ -233,7 +233,7 @@ void rxrpc_krxsecd_process_incoming_call(struct rxrpc_message *msg)
spin_lock(&trans->lock);
list_for_each(_p,&trans->services) {
srv = list_entry(_p,struct rxrpc_service,link);
- if (srv->service_id==sid && try_inc_mod_count(srv->owner)) {
+ if (srv->service_id==sid && try_module_get(srv->owner)) {
/* found a match (made sure it won't vanish) */
_debug("found service '%s'",srv->name);
call->owner = srv->owner;
diff --git a/sound/core/control.c b/sound/core/control.c
index 7de5256c19fc..85a0a656c5b8 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -61,7 +61,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
err = -ENODEV;
goto __error1;
}
- if (!try_inc_mod_count(card->module)) {
+ if (!try_module_get(card->module)) {
err = -EFAULT;
goto __error2;
}
diff --git a/sound/core/info.c b/sound/core/info.c
index 0ae2541810a6..45bf36503596 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -296,7 +296,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
#ifdef LINUX_2_2
MOD_INC_USE_COUNT;
#endif
- if (entry->module && !try_inc_mod_count(entry->module)) {
+ if (!try_module_get(entry->module)) {
err = -EFAULT;
goto __error1;
}
diff --git a/sound/core/init.c b/sound/core/init.c
index 10768c6f2898..bc320cb1d2bd 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -294,17 +294,14 @@ static void snd_card_free_thread(void * __card)
snd_card_t *card = __card;
struct module * module;
- if (!try_inc_mod_count(module = card->module)) {
+ if (!try_module_get(module = card->module)) {
snd_printk(KERN_ERR "unable to lock toplevel module for card %i in free thread\n", card->number);
module = NULL;
}
wait_event(card->shutdown_sleep, card->files == NULL);
-
snd_card_free(card);
-
- if (module)
- __MOD_DEC_USE_COUNT(module);
+ module_put(module);
}
/**
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 088bf5ea33c1..c4c6d4d3ff59 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -59,7 +59,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
#ifdef LINUX_2_2
MOD_INC_USE_COUNT;
#endif
- if (!try_inc_mod_count(card->module)) {
+ if (!try_module_get(card->module)) {
kfree(fmixer);
#ifdef LINUX_2_2
MOD_DEC_USE_COUNT;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 4febec2769c2..4c7d5c33f134 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1551,7 +1551,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
err = snd_card_file_add(pcm->card, file);
if (err < 0)
goto __error1;
- if (!try_inc_mod_count(pcm->card->module)) {
+ if (!try_module_get(pcm->card->module)) {
err = -EFAULT;
goto __error2;
}
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 57f2a9c0f4a2..405fe698896e 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1791,7 +1791,7 @@ int snd_pcm_open(struct inode *inode, struct file *file)
err = snd_card_file_add(pcm->card, file);
if (err < 0)
goto __error1;
- if (!try_inc_mod_count(pcm->card->module)) {
+ if (!try_module_get(pcm->card->module)) {
err = -EFAULT;
goto __error2;
}
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index a03924780f93..301445309d17 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -189,7 +189,7 @@ int snd_rawmidi_kernel_open(int cardnum, int device, int subdevice,
err = -ENODEV;
goto __error1;
}
- if (!try_inc_mod_count(rmidi->card->module)) {
+ if (!try_module_get(rmidi->card->module)) {
err = -EFAULT;
goto __error1;
}
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 837ef15abb69..af140edbdead 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -234,7 +234,7 @@ snd_seq_oss_synth_setup(seq_oss_devinfo_t *dp)
else
info->arg.event_passing = SNDRV_SEQ_OSS_PASS_EVENTS;
info->opened = 0;
- if (!try_inc_mod_count(rec->oper.owner)) {
+ if (!try_module_get(rec->oper.owner)) {
snd_use_lock_free(&rec->use_lock);
continue;
}
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 14943f8fecb8..d6654a1ab336 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -401,7 +401,7 @@ static int subscribe_port(client_t *client, client_port_t *port, port_subs_info_
{
int err = 0;
- if (!try_inc_mod_count(port->owner))
+ if (!try_module_get(port->owner))
return -EFAULT;
grp->count++;
if (grp->open && (port->callback_all || grp->count == 1)) {
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index 0719b6ad0ee8..c493a659d3f5 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -282,7 +282,7 @@ static int snd_virmidi_subscribe(void *private_data, snd_seq_port_subscribe_t *i
snd_virmidi_dev_t *rdev;
rdev = snd_magic_cast(snd_virmidi_dev_t, private_data, return -EINVAL);
- if (!try_inc_mod_count(rdev->card->module))
+ if (!try_module_get(rdev->card->module))
return -EFAULT;
rdev->flags |= SNDRV_VIRMIDI_SUBSCRIBE;
return 0;
@@ -310,7 +310,7 @@ static int snd_virmidi_use(void *private_data, snd_seq_port_subscribe_t *info)
snd_virmidi_dev_t *rdev;
rdev = snd_magic_cast(snd_virmidi_dev_t, private_data, return -EINVAL);
- if (!try_inc_mod_count(rdev->card->module))
+ if (!try_module_get(rdev->card->module))
return -EFAULT;
rdev->flags |= SNDRV_VIRMIDI_USE;
return 0;
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 1b571b00728d..b386bdeb48c8 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -102,7 +102,7 @@ static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *ti
timeri->in_use = (atomic_t)ATOMIC_INIT(0);
timeri->timer = timer;
- if (timer && timer->card && !try_inc_mod_count(timer->card->module)) {
+ if (timer && timer->card && !try_module_get(timer->card->module)) {
kfree(timeri->owner);
kfree(timeri);
return NULL;
diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c
index c622456c6136..c1f8429679f3 100644
--- a/sound/drivers/opl3/opl3_seq.c
+++ b/sound/drivers/opl3/opl3_seq.c
@@ -37,7 +37,7 @@ MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums.");
int snd_opl3_synth_use_inc(opl3_t * opl3)
{
- if (!try_inc_mod_count(opl3->card->module))
+ if (!try_module_get(opl3->card->module))
return -EFAULT;
return 0;
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index a3473afd0118..7a9adec95248 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -42,7 +42,7 @@ static int snd_gus_init_dma_irq(snd_gus_card_t * gus, int latches);
int snd_gus_use_inc(snd_gus_card_t * gus)
{
MOD_INC_USE_COUNT;
- if (!try_inc_mod_count(gus->card->module)) {
+ if (!try_module_get(gus->card->module)) {
MOD_DEC_USE_COUNT;
return 0;
}
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index 817b6d807a86..a9de8cb5dff2 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -145,7 +145,7 @@ snd_wavefront_fx_open (snd_hwdep_t *hw, struct file *file)
{
MOD_INC_USE_COUNT;
- if (!try_inc_mod_count(hw->card->module)) {
+ if (!try_module_get(hw->card->module)) {
MOD_DEC_USE_COUNT;
return -EFAULT;
}
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index f3e26ef9473f..88b88d23c3fd 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1604,7 +1604,7 @@ snd_wavefront_synth_open (snd_hwdep_t *hw, struct file *file)
{
MOD_INC_USE_COUNT;
- if (!try_inc_mod_count(hw->card->module)) {
+ if (!try_module_get(hw->card->module)) {
MOD_DEC_USE_COUNT;
return -EFAULT;
}
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 0dd6ef8c376c..a06961482fa5 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -274,9 +274,9 @@ int
snd_emux_inc_count(snd_emux_t *emu)
{
emu->used++;
- if (!try_inc_mod_count(emu->ops.owner))
+ if (!try_module_get(emu->ops.owner))
goto __error;
- if (!try_inc_mod_count(emu->card->module)) {
+ if (!try_module_get(emu->card->module)) {
module_put(emu->ops.owner);
__error:
emu->used--;