]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge branch 'next-samsung' of git://git.fluff.org/bjdooks/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2011 17:06:54 +0000 (10:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2011 17:06:54 +0000 (10:06 -0700)
* 'next-samsung' of git://git.fluff.org/bjdooks/linux:
  ARM: H1940/RX1950: Change default LED triggers
  ARM: S3C2442: RX1950: Add support for LED blinking
  ARM: S3C2442: RX1950: Retain LEDs state in suspend
  ARM: S3C2410: H1940: Fix lcd_power_set function
  ARM: S3C2410: H1940: Add battery support
  ARM: S3C2410: H1940: Use leds-gpio driver for LEDs managing
  ARM: S3C2410: H1940: Make h1940-bluetooth.c compile again
  ARM: S3C2410: H1940: Add keys device

331 files changed:
Documentation/ABI/testing/pstore
Documentation/ABI/testing/sysfs-fs-pstore [deleted file]
Documentation/devicetree/bindings/hwmon/ads1015.txt [new file with mode: 0644]
Documentation/devicetree/bindings/open-pic.txt [new file with mode: 0644]
Documentation/feature-removal-schedule.txt
Documentation/filesystems/xfs-delayed-logging-design.txt
Documentation/hwmon/ads1015 [new file with mode: 0644]
Documentation/hwmon/lm75
Documentation/hwmon/sch5627 [new file with mode: 0644]
Documentation/hwmon/w83795 [new file with mode: 0644]
Documentation/i2c/busses/i2c-diolan-u2c [new file with mode: 0644]
Documentation/i2c/busses/i2c-i801
Documentation/i2c/instantiating-devices
Documentation/i2c/upgrading-clients
Documentation/kbuild/kbuild.txt
Documentation/laptops/hpfall.c [moved from Documentation/hwmon/hpfall.c with 100% similarity]
Documentation/misc-devices/lis3lv02d [moved from Documentation/hwmon/lis3lv02d with 96% similarity]
Documentation/video4linux/Zoran
MAINTAINERS
Makefile
arch/arm/boot/compressed/Makefile
arch/arm/mach-mmp/include/mach/mmp2.h
arch/arm/mach-mmp/include/mach/pxa168.h
arch/arm/mach-mmp/include/mach/pxa910.h
arch/arm/mach-pxa/balloon3.c
arch/arm/mach-pxa/cm-x300.c
arch/arm/mach-pxa/colibri-evalboard.c
arch/arm/mach-pxa/colibri-pxa270-income.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/csb726.c
arch/arm/mach-pxa/devices.c
arch/arm/mach-pxa/em-x270.c
arch/arm/mach-pxa/ezx.c
arch/arm/mach-pxa/hx4700.c
arch/arm/mach-pxa/littleton.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-pxa/mioa701.c
arch/arm/mach-pxa/mxm8x10.c
arch/arm/mach-pxa/palm27x.c
arch/arm/mach-pxa/pcm990-baseboard.c
arch/arm/mach-pxa/poodle.c
arch/arm/mach-pxa/pxa27x.c
arch/arm/mach-pxa/pxa3xx.c
arch/arm/mach-pxa/pxa95x.c
arch/arm/mach-pxa/raumfeld.c
arch/arm/mach-pxa/saar.c
arch/arm/mach-pxa/saarb.c
arch/arm/mach-pxa/spitz.c
arch/arm/mach-pxa/stargate2.c
arch/arm/mach-pxa/tavorevb3.c
arch/arm/mach-pxa/tosa.c
arch/arm/mach-pxa/trizeps4.c
arch/arm/mach-pxa/viper.c
arch/arm/mach-pxa/vpac270.c
arch/arm/mach-pxa/xcep.c
arch/arm/mach-pxa/z2.c
arch/arm/mach-pxa/zeus.c
arch/arm/mach-pxa/zylonite_pxa300.c
arch/arm/vfp/Makefile
arch/h8300/boot/compressed/Makefile
arch/ia64/kvm/Makefile
arch/ia64/sn/kernel/Makefile
arch/ia64/sn/kernel/sn2/Makefile
arch/ia64/sn/pci/Makefile
arch/ia64/sn/pci/pcibr/Makefile
arch/ia64/uv/kernel/Makefile
arch/microblaze/kernel/cpu/Makefile
arch/mips/Makefile
arch/mips/bcm63xx/boards/Makefile
arch/mips/fw/arc/Makefile
arch/mips/jz4740/Makefile
arch/mips/oprofile/Makefile
arch/mips/pmc-sierra/yosemite/Makefile
arch/mips/powertv/Makefile
arch/mips/powertv/asic/Makefile
arch/mips/powertv/pci/Makefile
arch/parisc/Kconfig
arch/parisc/include/asm/cacheflush.h
arch/parisc/include/asm/irq.h
arch/parisc/include/asm/pgtable.h
arch/parisc/kernel/cache.c
arch/parisc/kernel/entry.S
arch/parisc/kernel/irq.c
arch/parisc/kernel/pacache.S
arch/powerpc/include/asm/mpic.h
arch/powerpc/include/asm/ptrace.h
arch/powerpc/kernel/pci_dn.c
arch/powerpc/kernel/ptrace.c
arch/powerpc/sysdev/mpic.c
arch/s390/boot/Makefile
arch/s390/kvm/Makefile
arch/s390/math-emu/Makefile
arch/sparc/include/asm/irq_32.h
arch/sparc/include/asm/irq_64.h
arch/sparc/include/asm/unistd.h
arch/sparc/kernel/of_device_common.c
arch/sparc/kernel/systbls_32.S
arch/sparc/kernel/systbls_64.S
arch/tile/lib/atomic_32.c
arch/um/sys-ppc/Makefile
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/unistd_32.h
arch/x86/include/asm/unistd_64.h
arch/x86/kernel/syscall_table_32.S
arch/xtensa/boot/Makefile
arch/xtensa/boot/lib/Makefile
drivers/char/mwave/Makefile
drivers/char/mwave/README
drivers/dma/Makefile
drivers/firewire/Kconfig
drivers/firewire/core-card.c
drivers/firewire/core-cdev.c
drivers/firewire/core-device.c
drivers/firewire/core-iso.c
drivers/firewire/core-topology.c
drivers/firewire/ohci.c
drivers/firewire/sbp2.c
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/abituguru.c
drivers/hwmon/abituguru3.c
drivers/hwmon/ads1015.c [new file with mode: 0644]
drivers/hwmon/lm75.c
drivers/hwmon/sch5627.c [new file with mode: 0644]
drivers/hwmon/sht15.c
drivers/i2c/Makefile
drivers/i2c/busses/Kconfig
drivers/i2c/busses/Makefile
drivers/i2c/busses/i2c-diolan-u2c.c [new file with mode: 0644]
drivers/i2c/busses/i2c-eg20t.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-mxs.c
drivers/i2c/busses/i2c-pxa-pci.c [new file with mode: 0644]
drivers/i2c/busses/i2c-pxa.c
drivers/i2c/i2c-boardinfo.c
drivers/i2c/i2c-core.c
drivers/i2c/i2c-dev.c
drivers/ide/Makefile
drivers/ieee802154/Makefile
drivers/isdn/hisax/Makefile
drivers/memstick/Makefile
drivers/memstick/core/Makefile
drivers/memstick/host/Makefile
drivers/message/fusion/Makefile
drivers/misc/Kconfig
drivers/misc/Makefile
drivers/misc/cb710/Makefile
drivers/misc/lis3lv02d/Kconfig [new file with mode: 0644]
drivers/misc/lis3lv02d/Makefile [new file with mode: 0644]
drivers/misc/lis3lv02d/lis3lv02d.c [moved from drivers/hwmon/lis3lv02d.c with 99% similarity]
drivers/misc/lis3lv02d/lis3lv02d.h [moved from drivers/hwmon/lis3lv02d.h with 100% similarity]
drivers/misc/lis3lv02d/lis3lv02d_i2c.c [moved from drivers/hwmon/lis3lv02d_i2c.c with 99% similarity]
drivers/misc/lis3lv02d/lis3lv02d_spi.c [moved from drivers/hwmon/lis3lv02d_spi.c with 100% similarity]
drivers/misc/sgi-gru/Makefile
drivers/net/bonding/bond_main.c
drivers/net/caif/Makefile
drivers/net/can/c_can/c_can.c
drivers/net/ftmac100.c
drivers/net/gianfar.c
drivers/net/gianfar.h
drivers/net/macvlan.c
drivers/net/niu.c
drivers/net/r8169.c
drivers/net/skfp/Makefile
drivers/net/veth.c
drivers/net/wan/lmc/Makefile
drivers/net/wireless/hostap/hostap_config.h
drivers/net/wireless/zd1211rw/Makefile
drivers/parisc/dino.c
drivers/parisc/eisa.c
drivers/parisc/gsc.c
drivers/parisc/iosapic.c
drivers/parisc/superio.c
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/hp_accel.c [moved from drivers/hwmon/hp_accel.c with 99% similarity]
drivers/pps/clients/Makefile
drivers/rapidio/Makefile
drivers/rapidio/switches/Makefile
drivers/rtc/Makefile
drivers/scsi/aacraid/Makefile
drivers/scsi/aic94xx/Makefile
drivers/scsi/libsas/Makefile
drivers/scsi/lpfc/Makefile
drivers/scsi/mvsas/Makefile
drivers/scsi/pcmcia/Makefile
drivers/scsi/scsi_error.c
drivers/scsi/sd.c
drivers/vhost/net.c
drivers/vhost/vhost.c
drivers/video/intelfb/Makefile
drivers/video/matrox/matroxfb_base.c
fs/affs/Makefile
fs/bfs/dir.c
fs/coda/Makefile
fs/compat.c
fs/devpts/inode.c
fs/exec.c
fs/fifo.c
fs/gfs2/Makefile
fs/inode.c
fs/internal.h
fs/ioctl.c
fs/jfs/Makefile
fs/ncpfs/Makefile
fs/nfs/namespace.c
fs/ntfs/Makefile
fs/ocfs2/Makefile
fs/ocfs2/dlm/Makefile
fs/ocfs2/dlmfs/Makefile
fs/open.c
fs/pstore/inode.c
fs/pstore/internal.h
fs/pstore/platform.c
fs/reiserfs/Makefile
fs/select.c
fs/sync.c
fs/xfs/Makefile
fs/xfs/linux-2.6/kmem.c
fs/xfs/linux-2.6/xfs_aops.c
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_linux.h
fs/xfs/linux-2.6/xfs_message.c [new file with mode: 0644]
fs/xfs/linux-2.6/xfs_message.h [new file with mode: 0644]
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/linux-2.6/xfs_sysctl.c
fs/xfs/quota/xfs_dquot.c
fs/xfs/quota/xfs_dquot_item.c
fs/xfs/quota/xfs_qm.c
fs/xfs/quota/xfs_qm_bhv.c
fs/xfs/quota/xfs_qm_syscalls.c
fs/xfs/quota/xfs_trans_dquot.c
fs/xfs/support/debug.c [deleted file]
fs/xfs/support/debug.h [deleted file]
fs/xfs/xfs_alloc.c
fs/xfs/xfs_bmap.c
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_da_btree.c
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_dir2.c
fs/xfs/xfs_dir2_node.c
fs/xfs/xfs_error.c
fs/xfs/xfs_error.h
fs/xfs/xfs_fsops.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_inode.h
fs/xfs/xfs_iomap.c
fs/xfs/xfs_log.c
fs/xfs/xfs_log_priv.h
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_mount.c
fs/xfs/xfs_quota.h
fs/xfs/xfs_rtalloc.c
fs/xfs/xfs_rtalloc.h
fs/xfs/xfs_rw.c
fs/xfs/xfs_trans.h
fs/xfs/xfs_trans_ail.c
fs/xfs/xfs_trans_buf.c
fs/xfs/xfs_trans_inode.c
fs/xfs/xfs_vnodeops.c
include/asm-generic/unistd.h
include/linux/dcache.h
include/linux/ethtool.h
include/linux/firewire.h
include/linux/i2c-id.h [deleted file]
include/linux/i2c.h
include/linux/i2c/ads1015.h [new file with mode: 0644]
include/linux/i2c/pxa-i2c.h [moved from arch/arm/plat-pxa/include/plat/i2c.h with 100% similarity]
include/linux/if_ppp.h
include/linux/netfilter/ipset/ip_set_getport.h
include/linux/netfilter/nfnetlink_log.h
include/linux/netfilter/nfnetlink_queue.h
include/linux/netfilter/xt_connbytes.h
include/linux/netfilter/xt_quota.h
include/linux/slab.h
include/linux/slub_def.h
include/linux/syscalls.h
include/net/ip_vs.h
include/net/snmp.h
include/net/xfrm.h
kernel/gcov/Makefile
kernel/power/Makefile
kernel/signal.c
lib/Kconfig.debug
mm/slab.c
mm/slob.c
mm/slub.c
net/8021q/vlan_dev.c
net/appletalk/ddp.c
net/bridge/br_netfilter.c
net/core/drop_monitor.c
net/core/ethtool.c
net/econet/af_econet.c
net/ipv4/netfilter/ip_tables.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv6/netfilter/ip6_tables.c
net/ipv6/sysctl_net_ipv6.c
net/ipx/af_ipx.c
net/l2tp/l2tp_eth.c
net/netfilter/ipset/ip_set_core.c
net/netfilter/ipset/ip_set_hash_ipport.c
net/netfilter/ipset/ip_set_hash_ipportip.c
net/netfilter/ipset/ip_set_hash_ipportnet.c
net/netfilter/ipset/ip_set_hash_netport.c
net/netfilter/ipvs/ip_vs_app.c
net/netfilter/ipvs/ip_vs_ctl.c
net/socket.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/Makefile
scripts/Makefile.build
scripts/extract-ikconfig
scripts/genksyms/Makefile
scripts/genksyms/genksyms.c
scripts/genksyms/genksyms.h
scripts/genksyms/lex.c_shipped
scripts/genksyms/lex.l
scripts/genksyms/parse.c_shipped
scripts/genksyms/parse.h_shipped
scripts/genksyms/parse.y
scripts/mod/modpost.c
scripts/package/Makefile
scripts/package/buildtar
scripts/setlocalversion
scripts/tags.sh
scripts/unifdef.c
tools/testing/ktest/ktest.pl
tools/testing/ktest/sample.conf

index f1fb2a004264bc6989a20d92ca333b436c7154d4..ddf451ee2a08812eb16a28f3264618ca2e1e749b 100644 (file)
@@ -1,6 +1,6 @@
 Where:         /dev/pstore/...
-Date:          January 2011
-Kernel Version: 2.6.38
+Date:          March 2011
+Kernel Version: 2.6.39
 Contact:       tony.luck@intel.com
 Description:   Generic interface to platform dependent persistent storage.
 
@@ -11,7 +11,7 @@ Description:  Generic interface to platform dependent persistent storage.
                of the console log is captured, but other interesting
                data can also be saved.
 
-               # mount -t pstore - /dev/pstore
+               # mount -t pstore -o kmsg_bytes=8000 - /dev/pstore
 
                $ ls -l /dev/pstore
                total 0
@@ -33,3 +33,9 @@ Description:  Generic interface to platform dependent persistent storage.
                will be saved elsewhere and erased from persistent store
                soon after boot to free up space ready for the next
                catastrophe.
+
+               The 'kmsg_bytes' mount option changes the target amount of
+               data saved on each oops/panic. Pstore saves (possibly
+               multiple) files based on the record size of the underlying
+               persistent storage until at least this amount is reached.
+               Default is 10 Kbytes.
diff --git a/Documentation/ABI/testing/sysfs-fs-pstore b/Documentation/ABI/testing/sysfs-fs-pstore
deleted file mode 100644 (file)
index 8e659d8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-What:          /sys/fs/pstore/kmsg_bytes
-Date:          January 2011
-Kernel Version: 2.6.38
-Contact:       "Tony Luck" <tony.luck@intel.com>
-Description:
-               Controls amount of console log that will be saved
-               to persistent store on oops/panic.
diff --git a/Documentation/devicetree/bindings/hwmon/ads1015.txt b/Documentation/devicetree/bindings/hwmon/ads1015.txt
new file mode 100644 (file)
index 0000000..918a507
--- /dev/null
@@ -0,0 +1,73 @@
+ADS1015 (I2C)
+
+This device is a 12-bit A-D converter with 4 inputs.
+
+The inputs can be used single ended or in certain differential combinations.
+
+For configuration all possible combinations are mapped to 8 channels:
+  0: Voltage over AIN0 and AIN1.
+  1: Voltage over AIN0 and AIN3.
+  2: Voltage over AIN1 and AIN3.
+  3: Voltage over AIN2 and AIN3.
+  4: Voltage over AIN0 and GND.
+  5: Voltage over AIN1 and GND.
+  6: Voltage over AIN2 and GND.
+  7: Voltage over AIN3 and GND.
+
+Each channel can be configured individually:
+ - pga is the programmable gain amplifier (values are full scale)
+    0: +/- 6.144 V
+    1: +/- 4.096 V
+    2: +/- 2.048 V (default)
+    3: +/- 1.024 V
+    4: +/- 0.512 V
+    5: +/- 0.256 V
+ - data_rate in samples per second
+    0: 128
+    1: 250
+    2: 490
+    3: 920
+    4: 1600 (default)
+    5: 2400
+    6: 3300
+
+1) The /ads1015 node
+
+  Required properties:
+
+   - compatible : must be "ti,ads1015"
+   - reg : I2C bus address of the device
+   - #address-cells : must be <1>
+   - #size-cells : must be <0>
+
+  The node contains child nodes for each channel that the platform uses.
+
+  Example ADS1015 node:
+
+    ads1015@49 {
+           compatible = "ti,ads1015";
+           reg = <0x49>;
+           #address-cells = <1>;
+           #size-cells = <0>;
+
+           [ child node definitions... ]
+    }
+
+2) channel nodes
+
+  Required properties:
+
+   - reg : the channel number
+
+  Optional properties:
+
+   - ti,gain : the programmable gain amplifier setting
+   - ti,datarate : the converter data rate
+
+  Example ADS1015 channel node:
+
+    channel@4 {
+           reg = <4>;
+           ti,gain = <3>;
+           ti,datarate = <5>;
+    };
diff --git a/Documentation/devicetree/bindings/open-pic.txt b/Documentation/devicetree/bindings/open-pic.txt
new file mode 100644 (file)
index 0000000..909a902
--- /dev/null
@@ -0,0 +1,98 @@
+* Open PIC Binding
+
+This binding specifies what properties must be available in the device tree
+representation of an Open PIC compliant interrupt controller.  This binding is
+based on the binding defined for Open PIC in [1] and is a superset of that
+binding.
+
+Required properties:
+
+  NOTE: Many of these descriptions were paraphrased here from [1] to aid
+        readability.
+
+    - compatible: Specifies the compatibility list for the PIC.  The type
+      shall be <string> and the value shall include "open-pic".
+
+    - reg: Specifies the base physical address(s) and size(s) of this
+      PIC's addressable register space.  The type shall be <prop-encoded-array>.
+
+    - interrupt-controller: The presence of this property identifies the node
+      as an Open PIC.  No property value shall be defined.
+
+    - #interrupt-cells: Specifies the number of cells needed to encode an
+      interrupt source.  The type shall be a <u32> and the value shall be 2.
+
+    - #address-cells: Specifies the number of cells needed to encode an
+      address.  The type shall be <u32> and the value shall be 0.  As such,
+      'interrupt-map' nodes do not have to specify a parent unit address.
+
+Optional properties:
+
+    - pic-no-reset: The presence of this property indicates that the PIC
+      shall not be reset during runtime initialization.  No property value shall
+      be defined.  The presence of this property also mandates that any
+      initialization related to interrupt sources shall be limited to sources
+      explicitly referenced in the device tree.
+
+* Interrupt Specifier Definition
+
+  Interrupt specifiers consists of 2 cells encoded as
+  follows:
+
+    - <1st-cell>: The interrupt-number that identifies the interrupt source.
+
+    - <2nd-cell>: The level-sense information, encoded as follows:
+                    0 = low-to-high edge triggered
+                    1 = active low level-sensitive
+                    2 = active high level-sensitive
+                    3 = high-to-low edge triggered
+
+* Examples
+
+Example 1:
+
+       /*
+        * An Open PIC interrupt controller
+        */
+       mpic: pic@40000 {
+               // This is an interrupt controller node.
+               interrupt-controller;
+
+               // No address cells so that 'interrupt-map' nodes which reference
+               // this Open PIC node do not need a parent address specifier.
+               #address-cells = <0>;
+
+               // Two cells to encode interrupt sources.
+               #interrupt-cells = <2>;
+
+               // Offset address of 0x40000 and size of 0x40000.
+               reg = <0x40000 0x40000>;
+
+               // Compatible with Open PIC.
+               compatible = "open-pic";
+
+               // The PIC shall not be reset.
+               pic-no-reset;
+       };
+
+Example 2:
+
+       /*
+        * An interrupt generating device that is wired to an Open PIC.
+        */
+       serial0: serial@4500 {
+               // Interrupt source '42' that is active high level-sensitive.
+               // Note that there are only two cells as specified in the interrupt
+               // parent's '#interrupt-cells' property.
+               interrupts = <42 2>;
+
+               // The interrupt controller that this device is wired to.
+               interrupt-parent = <&mpic>;
+       };
+
+* References
+
+[1] Power.org (TM) Standard for Embedded Power Architecture (TM) Platform
+    Requirements (ePAPR), Version 1.0, July 2008.
+    (http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf)
+
index f487c6918d7870c57bec4202cf22482af21b3d6f..895330940f5dfb1560f78dce424dca686d312bf3 100644 (file)
@@ -585,16 +585,6 @@ Who:    NeilBrown <neilb@suse.de>
 
 ----------------------------
 
-What:  i2c_adapter.id
-When:  June 2011
-Why:   This field is deprecated. I2C device drivers shouldn't change their
-       behavior based on the underlying I2C adapter. Instead, the I2C
-       adapter driver should instantiate the I2C devices and provide the
-       needed platform-specific information.
-Who:   Jean Delvare <khali@linux-fr.org>
-
-----------------------------
-
 What:  cancel_rearming_delayed_work[queue]()
 When:  2.6.39
 
@@ -645,3 +635,12 @@ Who:       Florian Westphal <fw@strlen.de>
 Files: include/linux/netfilter_ipv4/ipt_addrtype.h
 
 ----------------------------
+
+What:  i2c_driver.attach_adapter
+       i2c_driver.detach_adapter
+When:  September 2011
+Why:   These legacy callbacks should no longer be used as i2c-core offers
+       a variety of preferable alternative ways to instantiate I2C devices.
+Who:   Jean Delvare <khali@linux-fr.org>
+
+----------------------------
index 7445bf335dae7eeba4bd6640a82fa3987f48d2cc..5282e3e5141310ac1b73c3dd28d192d020932d97 100644 (file)
@@ -791,10 +791,3 @@ mount option. Fundamentally, there is no reason why the log manager would not
 be able to swap methods automatically and transparently depending on load
 characteristics, but this should not be necessary if delayed logging works as
 designed.
-
-Roadmap:
-
-2.6.39 Switch default mount option to use delayed logging
-       => should be roughly 12 months after initial merge
-       => enough time to shake out remaining problems before next round of
-          enterprise distro kernel rebases
diff --git a/Documentation/hwmon/ads1015 b/Documentation/hwmon/ads1015
new file mode 100644 (file)
index 0000000..f6fe9c2
--- /dev/null
@@ -0,0 +1,72 @@
+Kernel driver ads1015
+=====================
+
+Supported chips:
+  * Texas Instruments ADS1015
+    Prefix: 'ads1015'
+    Datasheet: Publicly available at the Texas Instruments website :
+               http://focus.ti.com/lit/ds/symlink/ads1015.pdf
+
+Authors:
+        Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.de>
+
+Description
+-----------
+
+This driver implements support for the Texas Instruments ADS1015.
+
+This device is a 12-bit A-D converter with 4 inputs.
+
+The inputs can be used single ended or in certain differential combinations.
+
+The inputs can be made available by 8 sysfs input files in0_input - in7_input:
+in0: Voltage over AIN0 and AIN1.
+in1: Voltage over AIN0 and AIN3.
+in2: Voltage over AIN1 and AIN3.
+in3: Voltage over AIN2 and AIN3.
+in4: Voltage over AIN0 and GND.
+in5: Voltage over AIN1 and GND.
+in6: Voltage over AIN2 and GND.
+in7: Voltage over AIN3 and GND.
+
+Which inputs are available can be configured using platform data or devicetree.
+
+By default all inputs are exported.
+
+Platform Data
+-------------
+
+In linux/i2c/ads1015.h platform data is defined, channel_data contains
+configuration data for the used input combinations:
+- pga is the programmable gain amplifier (values are full scale)
+  0: +/- 6.144 V
+  1: +/- 4.096 V
+  2: +/- 2.048 V
+  3: +/- 1.024 V
+  4: +/- 0.512 V
+  5: +/- 0.256 V
+- data_rate in samples per second
+  0: 128
+  1: 250
+  2: 490
+  3: 920
+  4: 1600
+  5: 2400
+  6: 3300
+
+Example:
+struct ads1015_platform_data data = {
+       .channel_data = {
+               [2] = { .enabled = true, .pga = 1, .data_rate = 0 },
+               [4] = { .enabled = true, .pga = 4, .data_rate = 5 },
+       }
+};
+
+In this case only in2_input (FS +/- 4.096 V, 128 SPS) and in4_input
+(FS +/- 0.512 V, 2400 SPS) would be created.
+
+Devicetree
+----------
+
+Configuration is also possible via devicetree:
+Documentation/devicetree/bindings/hwmon/ads1015.txt
index 8e6356fe05d78bbea5cdaf41e2def9b2f5aaf5a4..a1790401fddee6bed131867878257b2004a91989 100644 (file)
@@ -7,6 +7,11 @@ Supported chips:
     Addresses scanned: I2C 0x48 - 0x4f
     Datasheet: Publicly available at the National Semiconductor website
                http://www.national.com/
+  * National Semiconductor LM75A
+    Prefix: 'lm75a'
+    Addresses scanned: I2C 0x48 - 0x4f
+    Datasheet: Publicly available at the National Semiconductor website
+               http://www.national.com/
   * Dallas Semiconductor DS75
     Prefix: 'lm75'
     Addresses scanned: I2C 0x48 - 0x4f
diff --git a/Documentation/hwmon/sch5627 b/Documentation/hwmon/sch5627
new file mode 100644 (file)
index 0000000..446a054
--- /dev/null
@@ -0,0 +1,22 @@
+Kernel driver sch5627
+=====================
+
+Supported chips:
+  * SMSC SCH5627
+    Prefix: 'sch5627'
+    Addresses scanned: none, address read from Super I/O config space
+    Datasheet: Application Note available upon request
+
+Author: Hans de Goede <hdegoede@redhat.com>
+
+
+Description
+-----------
+
+SMSC SCH5627 Super I/O chips include complete hardware monitoring
+capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures.
+
+The hardware monitoring part of the SMSC SCH5627 is accessed by talking
+through an embedded microcontroller. An application note describing the
+protocol for communicating with the microcontroller is available upon
+request. Please mail me if you want a copy.
diff --git a/Documentation/hwmon/w83795 b/Documentation/hwmon/w83795
new file mode 100644 (file)
index 0000000..9f16037
--- /dev/null
@@ -0,0 +1,127 @@
+Kernel driver w83795
+====================
+
+Supported chips:
+  * Winbond/Nuvoton W83795G
+    Prefix: 'w83795g'
+    Addresses scanned: I2C 0x2c - 0x2f
+    Datasheet: Available for download on nuvoton.com
+  * Winbond/Nuvoton W83795ADG
+    Prefix: 'w83795adg'
+    Addresses scanned: I2C 0x2c - 0x2f
+    Datasheet: Available for download on nuvoton.com
+
+Authors:
+    Wei Song (Nuvoton)
+    Jean Delvare <khali@linux-fr.org>
+
+
+Pin mapping
+-----------
+
+Here is a summary of the pin mapping for the W83795G and W83795ADG.
+This can be useful to convert data provided by board manufacturers
+into working libsensors configuration statements.
+
+    W83795G                    |
+  Pin  | Name                  | Register      | Sysfs attribute
+------------------------------------------------------------------
+   13  | VSEN1 (VCORE1)        | 10h           | in0
+   14  | VSEN2 (VCORE2)        | 11h           | in1
+   15  | VSEN3 (VCORE3)        | 12h           | in2
+   16  | VSEN4                 | 13h           | in3
+   17  | VSEN5                 | 14h           | in4
+   18  | VSEN6                 | 15h           | in5
+   19  | VSEN7                 | 16h           | in6
+   20  | VSEN8                 | 17h           | in7
+   21  | VSEN9                 | 18h           | in8
+   22  | VSEN10                | 19h           | in9
+   23  | VSEN11                | 1Ah           | in10
+   28  | VTT                   | 1Bh           | in11
+   24  | 3VDD                  | 1Ch           | in12
+   25  | 3VSB                  | 1Dh           | in13
+   26  | VBAT                  | 1Eh           | in14
+    3  | VSEN12/TR5            | 1Fh           | in15/temp5
+    4  | VSEN13/TR5            | 20h           | in16/temp6
+  5/  6        | VDSEN14/TR1/TD1       | 21h           | in17/temp1
+  7/  8        | VDSEN15/TR2/TD2       | 22h           | in18/temp2
+  9/ 10        | VDSEN16/TR3/TD3       | 23h           | in19/temp3
+ 11/ 12        | VDSEN17/TR4/TD4       | 24h           | in20/temp4
+   40  | FANIN1                | 2Eh           | fan1
+   42  | FANIN2                | 2Fh           | fan2
+   44  | FANIN3                | 30h           | fan3
+   46  | FANIN4                | 31h           | fan4
+   48  | FANIN5                | 32h           | fan5
+   50  | FANIN6                | 33h           | fan6
+   52  | FANIN7                | 34h           | fan7
+   54  | FANIN8                | 35h           | fan8
+   57  | FANIN9                | 36h           | fan9
+   58  | FANIN10               | 37h           | fan10
+   59  | FANIN11               | 38h           | fan11
+   60  | FANIN12               | 39h           | fan12
+   31  | FANIN13               | 3Ah           | fan13
+   35  | FANIN14               | 3Bh           | fan14
+   41  | FANCTL1               | 10h (bank 2)  | pwm1
+   43  | FANCTL2               | 11h (bank 2)  | pwm2
+   45  | FANCTL3               | 12h (bank 2)  | pwm3
+   47  | FANCTL4               | 13h (bank 2)  | pwm4
+   49  | FANCTL5               | 14h (bank 2)  | pwm5
+   51  | FANCTL6               | 15h (bank 2)  | pwm6
+   53  | FANCTL7               | 16h (bank 2)  | pwm7
+   55  | FANCTL8               | 17h (bank 2)  | pwm8
+ 29/ 30        | PECI/TSI (DTS1)       | 26h           | temp7
+ 29/ 30        | PECI/TSI (DTS2)       | 27h           | temp8
+ 29/ 30        | PECI/TSI (DTS3)       | 28h           | temp9
+ 29/ 30        | PECI/TSI (DTS4)       | 29h           | temp10
+ 29/ 30        | PECI/TSI (DTS5)       | 2Ah           | temp11
+ 29/ 30        | PECI/TSI (DTS6)       | 2Bh           | temp12
+ 29/ 30        | PECI/TSI (DTS7)       | 2Ch           | temp13
+ 29/ 30        | PECI/TSI (DTS8)       | 2Dh           | temp14
+   27  | CASEOPEN#             | 46h           | intrusion0
+
+    W83795ADG                  |
+  Pin  | Name                  | Register      | Sysfs attribute
+------------------------------------------------------------------
+   10  | VSEN1 (VCORE1)        | 10h           | in0
+   11  | VSEN2 (VCORE2)        | 11h           | in1
+   12  | VSEN3 (VCORE3)        | 12h           | in2
+   13  | VSEN4                 | 13h           | in3
+   14  | VSEN5                 | 14h           | in4
+   15  | VSEN6                 | 15h           | in5
+   16  | VSEN7                 | 16h           | in6
+   17  | VSEN8                 | 17h           | in7
+   22  | VTT                   | 1Bh           | in11
+   18  | 3VDD                  | 1Ch           | in12
+   19  | 3VSB                  | 1Dh           | in13
+   20  | VBAT                  | 1Eh           | in14
+   48  | VSEN12/TR5            | 1Fh           | in15/temp5
+    1  | VSEN13/TR5            | 20h           | in16/temp6
+  2/  3        | VDSEN14/TR1/TD1       | 21h           | in17/temp1
+  4/  5        | VDSEN15/TR2/TD2       | 22h           | in18/temp2
+  6/  7        | VDSEN16/TR3/TD3       | 23h           | in19/temp3
+  8/  9        | VDSEN17/TR4/TD4       | 24h           | in20/temp4
+   32  | FANIN1                | 2Eh           | fan1
+   34  | FANIN2                | 2Fh           | fan2
+   36  | FANIN3                | 30h           | fan3
+   37  | FANIN4                | 31h           | fan4
+   38  | FANIN5                | 32h           | fan5
+   39  | FANIN6                | 33h           | fan6
+   40  | FANIN7                | 34h           | fan7
+   41  | FANIN8                | 35h           | fan8
+   43  | FANIN9                | 36h           | fan9
+   44  | FANIN10               | 37h           | fan10
+   45  | FANIN11               | 38h           | fan11
+   46  | FANIN12               | 39h           | fan12
+   24  | FANIN13               | 3Ah           | fan13
+   28  | FANIN14               | 3Bh           | fan14
+   33  | FANCTL1               | 10h (bank 2)  | pwm1
+   35  | FANCTL2               | 11h (bank 2)  | pwm2
+   23  | PECI (DTS1)           | 26h           | temp7
+   23  | PECI (DTS2)           | 27h           | temp8
+   23  | PECI (DTS3)           | 28h           | temp9
+   23  | PECI (DTS4)           | 29h           | temp10
+   23  | PECI (DTS5)           | 2Ah           | temp11
+   23  | PECI (DTS6)           | 2Bh           | temp12
+   23  | PECI (DTS7)           | 2Ch           | temp13
+   23  | PECI (DTS8)           | 2Dh           | temp14
+   21  | CASEOPEN#             | 46h           | intrusion0
diff --git a/Documentation/i2c/busses/i2c-diolan-u2c b/Documentation/i2c/busses/i2c-diolan-u2c
new file mode 100644 (file)
index 0000000..30fe4bb
--- /dev/null
@@ -0,0 +1,26 @@
+Kernel driver i2c-diolan-u2c
+
+Supported adapters:
+  * Diolan U2C-12 I2C-USB adapter
+    Documentation:
+       http://www.diolan.com/i2c/u2c12.html
+
+Author: Guenter Roeck <guenter.roeck@ericsson.com>
+
+Description
+-----------
+
+This is the driver for the Diolan U2C-12 USB-I2C adapter.
+
+The Diolan U2C-12 I2C-USB Adapter provides a low cost solution to connect
+a computer to I2C slave devices using a USB interface. It also supports
+connectivity to SPI devices.
+
+This driver only supports the I2C interface of U2C-12. The driver does not use
+interrupts.
+
+
+Module parameters
+-----------------
+
+* frequency: I2C bus frequency
index 93fe76e56522a199a0ab5044544673418be64ec0..6df69765ccb75045615dec13c3b564c550d18021 100644 (file)
@@ -16,8 +16,9 @@ Supported adapters:
   * Intel EP80579 (Tolapai)
   * Intel 82801JI (ICH10)
   * Intel 5/3400 Series (PCH)
-  * Intel Cougar Point (PCH)
+  * Intel 6 Series (PCH)
   * Intel Patsburg (PCH)
+  * Intel DH89xxCC (PCH)
    Datasheets: Publicly available at the Intel website
 
 On Intel Patsburg and later chipsets, both the normal host SMBus controller
index 87da405a85979d9cf925fc711590f5d0deef9b7c..9edb75d8c9b94cdc5d7d50241499892bca42243b 100644 (file)
@@ -100,7 +100,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
        (...)
        i2c_adap = i2c_get_adapter(2);
        memset(&i2c_info, 0, sizeof(struct i2c_board_info));
-       strlcpy(i2c_info.name, "isp1301_pnx", I2C_NAME_SIZE);
+       strlcpy(i2c_info.type, "isp1301_pnx", I2C_NAME_SIZE);
        isp1301_i2c_client = i2c_new_probed_device(i2c_adap, &i2c_info,
                                                   normal_i2c, NULL);
        i2c_put_adapter(i2c_adap);
index 9a45f9bb6a255d421bd2903e69120c0a8e281017..d6991625c407d41102f25a008c4f4801396ec1b7 100644 (file)
@@ -61,7 +61,7 @@ static int example_attach(struct i2c_adapter *adap, int addr, int kind)
        return 0;
 }
 
-static int __devexit example_detach(struct i2c_client *client)
+static int example_detach(struct i2c_client *client)
 {
        struct example_state *state = i2c_get_clientdata(client);
 
@@ -81,7 +81,7 @@ static struct i2c_driver example_driver = {
                .name           = "example",
        },
        .attach_adapter = example_attach_adapter,
-       .detach_client  = __devexit_p(example_detach),
+       .detach_client  = example_detach,
        .suspend        = example_suspend,
        .resume         = example_resume,
 };
@@ -93,7 +93,7 @@ Updating the client
 The new style binding model will check against a list of supported
 devices and their associated address supplied by the code registering
 the busses. This means that the driver .attach_adapter and
-.detach_adapter methods can be removed, along with the addr_data,
+.detach_client methods can be removed, along with the addr_data,
 as follows:
 
 - static struct i2c_driver example_driver;
@@ -110,14 +110,14 @@ as follows:
 
  static struct i2c_driver example_driver = {
 -      .attach_adapter = example_attach_adapter,
--      .detach_client  = __devexit_p(example_detach),
+-      .detach_client  = example_detach,
  }
 
 Add the probe and remove methods to the i2c_driver, as so:
 
  static struct i2c_driver example_driver = {
 +      .probe          = example_probe,
-+      .remove         = __devexit_p(example_remove),
++      .remove         = example_remove,
  }
 
 Change the example_attach method to accept the new parameters
@@ -199,8 +199,8 @@ to delete the i2c_detach_client call. It is possible that you
 can also remove the ret variable as it is not not needed for
 any of the core functions.
 
-- static int __devexit example_detach(struct i2c_client *client)
-+ static int __devexit example_remove(struct i2c_client *client)
+- static int example_detach(struct i2c_client *client)
++ static int example_remove(struct i2c_client *client)
 {
        struct example_state *state = i2c_get_clientdata(client);
 
@@ -253,7 +253,7 @@ static int example_probe(struct i2c_client *client,
        return 0;
 }
 
-static int __devexit example_remove(struct i2c_client *client)
+static int example_remove(struct i2c_client *client)
 {
        struct example_state *state = i2c_get_clientdata(client);
 
@@ -275,7 +275,7 @@ static struct i2c_driver example_driver = {
        },
        .id_table       = example_idtable,
        .probe          = example_probe,
-       .remove         = __devexit_p(example_remove),
+       .remove         = example_remove,
        .suspend        = example_suspend,
        .resume         = example_resume,
 };
index 8f63b224ab0969a758e5347d055777f1601d0b4c..f1431d099fce31371aa74f63efed4f7ce5f9b64b 100644 (file)
@@ -196,3 +196,8 @@ to be included in the databases, separated by blank space. E.g.:
 To get all available archs you can also specify all. E.g.:
 
     $ make ALLSOURCE_ARCHS=all tags
+
+KBUILD_ENABLE_EXTRA_GCC_CHECKS
+--------------------------------------------------
+If enabled over the make command line with "W=1", it turns on additional
+gcc -W... options for more extensive build-time checking.
similarity index 96%
rename from Documentation/hwmon/lis3lv02d
rename to Documentation/misc-devices/lis3lv02d
index 06534f25e643e15be91bb9eda118898a3241e5ed..f1a4ec840f86f2623ea53723286ed036532dc050 100644 (file)
@@ -17,8 +17,8 @@ Description
 This driver provides support for the accelerometer found in various HP laptops
 sporting the feature officially called "HP Mobile Data Protection System 3D" or
 "HP 3D DriveGuard". It detects automatically laptops with this sensor. Known
-models (full list can be found in drivers/hwmon/hp_accel.c) will have their
-axis automatically oriented on standard way (eg: you can directly play
+models (full list can be found in drivers/platform/x86/hp_accel.c) will have
+their axis automatically oriented on standard way (eg: you can directly play
 neverball). The accelerometer data is readable via
 /sys/devices/platform/lis3lv02d. Reported values are scaled
 to mg values (1/1000th of earth gravity).
index 699b60e070d216b1860e39aaa58c3f1967cc7866..c40e3bab08fa3cffc72c162931b8694d57fd2a03 100644 (file)
@@ -130,7 +130,7 @@ Card number: 4
 
 Note: No module for the mse3000 is available yet
 Note: No module for the vpx3224 is available yet
-Note: use encoder=X or decoder=X for non-default i2c chips (see i2c-id.h)
+Note: use encoder=X or decoder=X for non-default i2c chips
 
 ===========================
 
index c7a41b1fe453b267e02e5eef5ba649634dbc8060..53e315e777ffbc714658d4f6f35a34b06ac2eb58 100644 (file)
@@ -198,7 +198,7 @@ F:  Documentation/scsi/aacraid.txt
 F:     drivers/scsi/aacraid/
 
 ABIT UGURU 1,2 HARDWARE MONITOR DRIVER
-M:     Hans de Goede <j.w.r.degoede@hhs.nl>
+M:     Hans de Goede <hdegoede@redhat.com>
 L:     lm-sensors@lm-sensors.org
 S:     Maintained
 F:     drivers/hwmon/abituguru.c
@@ -365,6 +365,14 @@ W: http://wiki-analog.com/ADP8860
 S:     Supported
 F:     drivers/video/backlight/adp8860_bl.c
 
+ADS1015 HARDWARE MONITOR DRIVER
+M:     Dirk Eibach <eibach@gdsys.de>
+L:     lm-sensors@lm-sensors.org
+S:     Maintained
+F:     Documentation/hwmon/ads1015
+F:     drivers/hwmon/ads1015.c
+F:     include/linux/i2c/ads1015.h
+
 ADT746X FAN DRIVER
 M:     Colin Leroy <colin@colino.net>
 S:     Maintained
@@ -2130,6 +2138,12 @@ F:       Documentation/serial/digiepca.txt
 F:     drivers/char/epca*
 F:     drivers/char/digi*
 
+DIOLAN U2C-12 I2C DRIVER
+M:     Guenter Roeck <guenter.roeck@ericsson.com>
+L:     linux-i2c@vger.kernel.org
+S:     Maintained
+F:     drivers/i2c/busses/i2c-diolan-u2c.c
+
 DIRECTORY NOTIFICATION (DNOTIFY)
 M:     Eric Paris <eparis@parisplace.org>
 S:     Maintained
@@ -3913,8 +3927,8 @@ S:        Supported
 LIS3LV02D ACCELEROMETER DRIVER
 M:     Eric Piel <eric.piel@tremplin-utc.net>
 S:     Maintained
-F:     Documentation/hwmon/lis3lv02d
-F:     drivers/hwmon/lis3lv02d.*
+F:     Documentation/misc-devices/lis3lv02d
+F:     drivers/misc/lis3lv02d/
 
 LLC (802.2)
 M:     Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
@@ -5769,6 +5783,13 @@ S:       Supported
 F:     Documentation/hwmon/emc2103
 F:     drivers/hwmon/emc2103.c
 
+SMSC SCH5627 HARDWARE MONITOR DRIVER
+M:     Hans de Goede <hdegoede@redhat.com>
+L:     lm-sensors@lm-sensors.org
+S:     Supported
+F:     Documentation/hwmon/sch5627
+F:     drivers/hwmon/sch5627.c
+
 SMSC47B397 HARDWARE MONITOR DRIVER
 M:     "Mark M. Hoffman" <mhoffman@lightlink.com>
 L:     lm-sensors@lm-sensors.org
index 92b8bed3059e5c9fc4e9938a905e00c66ee12f75..7d4e9c8da7295e628d8a7849b72e1d8651d8772c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -102,6 +102,10 @@ ifeq ("$(origin O)", "command line")
   KBUILD_OUTPUT := $(O)
 endif
 
+ifeq ("$(origin W)", "command line")
+  export KBUILD_ENABLE_EXTRA_GCC_CHECKS := 1
+endif
+
 # That's our default target when none is given on the command line
 PHONY := _all
 _all:
@@ -421,7 +425,7 @@ endif
 # of make so .config is not included in this case either (for *config).
 
 no-dot-config-targets := clean mrproper distclean \
-                        cscope TAGS tags help %docs check% coccicheck \
+                        cscope gtags TAGS tags help %docs check% coccicheck \
                         include/linux/version.h headers_% \
                         kernelversion %src-pkg
 
@@ -1018,7 +1022,7 @@ hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
 
 PHONY += __headers
 __headers: include/linux/version.h scripts_basic FORCE
-       $(Q)$(MAKE) $(build)=scripts scripts/unifdef
+       $(Q)$(MAKE) $(build)=scripts build_unifdef
 
 PHONY += headers_install_all
 headers_install_all:
@@ -1135,7 +1139,7 @@ CLEAN_FILES +=    vmlinux System.map \
 MRPROPER_DIRS  += include/config usr/include include/generated
 MRPROPER_FILES += .config .config.old .version .old_version             \
                   include/linux/version.h                               \
-                 Module.symvers tags TAGS cscope*
+                 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
 
 # clean - Delete most, but leave enough to build external modules
 #
@@ -1222,6 +1226,7 @@ help:
        @echo  '  modules_prepare - Set up for building external modules'
        @echo  '  tags/TAGS       - Generate tags file for editors'
        @echo  '  cscope          - Generate cscope index'
+       @echo  '  gtags           - Generate GNU GLOBAL index'
        @echo  '  kernelrelease   - Output the release version string'
        @echo  '  kernelversion   - Output the version stored in Makefile'
        @echo  '  headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
@@ -1262,6 +1267,7 @@ help:
        @echo  '  make O=dir [targets] Locate all output files in "dir", including .config'
        @echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
        @echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
+       @echo  '  make W=1   [targets] Enable extra gcc checks'
        @echo  ''
        @echo  'Execute "make" or "make all" to build all targets marked with [*] '
        @echo  'For further info see the ./README file'
@@ -1380,7 +1386,7 @@ clean: $(clean-dirs)
 quiet_cmd_tags = GEN     $@
       cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@
 
-tags TAGS cscope: FORCE
+tags TAGS cscope gtags: FORCE
        $(call cmd,tags)
 
 # Scripts to check various things for consistency
index f9f77c65dff32d8708ec98b799630076185bafc3..8ebbb511c7836383aac94622d0ed00aed5c5f29a 100644 (file)
@@ -95,8 +95,8 @@ ORIG_CFLAGS := $(KBUILD_CFLAGS)
 KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
 endif
 
-EXTRA_CFLAGS  := -fpic -fno-builtin
-EXTRA_AFLAGS  := -Wa,-march=all
+ccflags-y := -fpic -fno-builtin
+asflags-y := -Wa,-march=all
 
 # Provide size of uncompressed kernel to the decompressor via a linker symbol.
 LDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
index 4aec493640b41c1656bbdded16c1b55e0c2f4f60..2cbf6df09b82851ae7117c69279994723c41ec9f 100644 (file)
@@ -11,8 +11,8 @@ extern void __init mmp2_init_irq(void);
 extern void mmp2_clear_pmic_int(void);
 
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <mach/devices.h>
-#include <plat/i2c.h>
 
 extern struct pxa_device_desc mmp2_device_uart1;
 extern struct pxa_device_desc mmp2_device_uart2;
index 1801e420623259a6a4004dd0f8f9ba280997fc0a..a52b3d2f325ce7a3e6654b3fde2d87ad1af4dce4 100644 (file)
@@ -8,8 +8,8 @@ extern void __init pxa168_init_irq(void);
 extern void pxa168_clear_keypad_wakeup(void);
 
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <mach/devices.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 #include <video/pxa168fb.h>
 #include <plat/pxa27x_keypad.h>
index f13c49d6f8dc052988e6f5f407f333c2be183a2e..91be75591398baf9427a892864316101284dc7cf 100644 (file)
@@ -7,8 +7,8 @@ extern struct sys_timer pxa910_timer;
 extern void __init pxa910_init_irq(void);
 
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <mach/devices.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 
 extern struct pxa_device_desc pxa910_device_uart1;
index e194d928cdaa89161d4ca9e4efbce6f64e6294f6..d2af73321daee0b28162280c3075f465ef9eac4f 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/types.h>
 #include <linux/i2c/pcf857x.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/physmap.h>
 #include <linux/regulator/max1586.h>
@@ -51,8 +52,6 @@
 #include <mach/irda.h>
 #include <mach/ohci.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index 7984268508b65cf2486330fd5e1c78efcfb57530..bfca7ed2fea3be49fb63181c5a86680a71a8a8f0 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <linux/i2c.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <linux/mfd/da903x.h>
 #include <linux/regulator/machine.h>
@@ -48,7 +49,6 @@
 #include <mach/pxafb.h>
 #include <mach/mmc.h>
 #include <mach/ohci.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 #include <mach/audio.h>
 #include <mach/pxa3xx-u2d.h>
index 28f667e52ef9265dd44c4de7bac2e6cb5072c2d1..81c3c433e2d6c8dc35a99b006cad812baf1f53e7 100644 (file)
@@ -20,6 +20,7 @@
 #include <mach/hardware.h>
 #include <asm/mach/arch.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <mach/pxa27x.h>
 #include <mach/colibri.h>
@@ -27,8 +28,6 @@
 #include <mach/ohci.h>
 #include <mach/pxa27x-udc.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index 07b62a096f1757f3f4d8e44220e264074494606c..ee797397dc5bf3b8ebf06d8fa4f646350d10dc4d 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/pwm_backlight.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/sysdev.h>
 
 #include <asm/irq.h>
@@ -33,8 +34,6 @@
 #include <mach/pxa27x-udc.h>
 #include <mach/pxafb.h>
 
-#include <plat/i2c.h>
-
 #include "devices.h"
 #include "generic.h"
 
index a5452a3a276d87f741c00740450557e2fb8d6251..d4e705caefea5a594a4f22a1b04dc2a67a493db9 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/gpio.h>
 #include <linux/backlight.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/io.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
@@ -45,7 +46,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/pxa25x.h>
-#include <plat/i2c.h>
 #include <mach/irda.h>
 #include <mach/mmc.h>
 #include <mach/udc.h>
index a305424a967ddb5c67f4debd20d425d458661029..0481c29a70e8b9540f3419a120c4e0ca43724856 100644 (file)
 #include <linux/mtd/partitions.h>
 #include <linux/sm501.h>
 #include <linux/smsc911x.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/csb726.h>
 #include <mach/mfp-pxa27x.h>
-#include <plat/i2c.h>
 #include <mach/mmc.h>
 #include <mach/ohci.h>
 #include <mach/pxa2xx-regs.h>
index 4c766e3b4af3174c716cbe6a5233ebf928f0bb80..c4bf08b3eb610b477c91d66d2df42fec4d23d26f 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/spi/pxa2xx_spi.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/pmu.h>
 #include <mach/udc.h>
@@ -16,7 +17,6 @@
 #include <mach/camera.h>
 #include <mach/audio.h>
 #include <mach/hardware.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 
 #include "devices.h"
index a78bb3097739573478cae0a6c69760d31c709aca..b411d7cbf5a178f8b865beed6bbdeff4a57cb206 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/apm-emulation.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pca953x.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/regulator/userspace-consumer.h>
 
 #include <media/soc_camera.h>
@@ -45,7 +46,6 @@
 #include <mach/ohci.h>
 #include <mach/mmc.h>
 #include <plat/pxa27x_keypad.h>
-#include <plat/i2c.h>
 #include <mach/camera.h>
 
 #include "generic.h"
index 87cec0abe5b0a3df211c7e9465adce9017ce8492..93f05e024313340b17e40778848cff4d2b839b0c 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/leds-lp3944.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <media/soc_camera.h>
 
@@ -30,7 +31,6 @@
 #include <mach/pxa27x.h>
 #include <mach/pxafb.h>
 #include <mach/ohci.h>
-#include <plat/i2c.h>
 #include <mach/hardware.h>
 #include <plat/pxa27x_keypad.h>
 #include <mach/camera.h>
index a908e0a5f3966984a9c71bc07eae305b5aa0da83..6de0ad0eea654f7c5ef4148005b69ead76871f7b 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/usb/gpio_vbus.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -42,7 +43,6 @@
 
 #include <mach/pxa27x.h>
 #include <mach/hx4700.h>
-#include <plat/i2c.h>
 #include <mach/irda.h>
 
 #include <video/platform_lcd.h>
index ccb7bfad17ca94e7dddd15eea58ed0a3629175b8..87c1ed9ccd2f746a3c613a2f4361bdaa9612df13 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/leds.h>
 #include <linux/mfd/da903x.h>
 #include <linux/i2c/max732x.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -45,7 +46,6 @@
 #include <mach/mmc.h>
 #include <plat/pxa27x_keypad.h>
 #include <mach/littleton.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 
 #include "generic.h"
index 41198f0dc3ac7ad2838f611ad49e458d6c8a8f86..5535991c4a3c15f8e162c35639fb350daacf6aa3 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/regulator/bq24022.h>
 #include <linux/regulator/machine.h>
 #include <linux/usb/gpio_vbus.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -36,7 +37,6 @@
 #include <mach/pxa27x.h>
 #include <mach/magician.h>
 #include <mach/pxafb.h>
-#include <plat/i2c.h>
 #include <mach/mmc.h>
 #include <mach/irda.h>
 #include <mach/ohci.h>
index d4b6f2375f2c47587aad661cab152e1998c6b01f..f9542220595a6beaaa1f9ffe1694df0971a2a3ea 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/pwm_backlight.h>
 #include <linux/smc91x.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -46,7 +47,6 @@
 #include <mach/mainstone.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
-#include <plat/i2c.h>
 #include <mach/mmc.h>
 #include <mach/irda.h>
 #include <mach/ohci.h>
index faafea3542fbb65edc795cae818cc8fb8f911e90..78d98a8607ecaf71609483a25c58f83c1718af9c 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/usb/gpio_vbus.h>
 #include <linux/regulator/max1586.h>
 #include <linux/slab.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -50,7 +51,6 @@
 #include <mach/mmc.h>
 #include <mach/udc.h>
 #include <mach/pxa27x-udc.h>
-#include <plat/i2c.h>
 #include <mach/camera.h>
 #include <mach/audio.h>
 #include <media/soc_camera.h>
index cdf7f41e2bb335d6fb4c917a76258c8c45e8094f..b5a8fd3fce04cff4f5ad83f20c285f985eeb3c7e 100644 (file)
@@ -22,8 +22,8 @@
 #include <linux/serial_8250.h>
 #include <linux/dm9000.h>
 #include <linux/gpio.h>
+#include <linux/i2c/pxa-i2c.h>
 
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 
 #include <mach/pxafb.h>
index 35572c427fa8449a16cfc35e0300001b5114e9b0..72adb3ae2b43fcdd07c3f8cac01b9e6a4650120c 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/power_supply.h>
 #include <linux/usb/gpio_vbus.h>
 #include <linux/regulator/max1586.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -36,8 +37,6 @@
 #include <mach/palmasoc.h>
 #include <mach/palm27x.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index 90820faa711acd4ae8ec02203b9723f68f2a709f..9dbf3ccd4150c88eadfbbb4f79aa72d38c1f321a 100644 (file)
 #include <linux/irq.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/pwm_backlight.h>
 
 #include <media/soc_camera.h>
 
 #include <asm/gpio.h>
-#include <plat/i2c.h>
 #include <mach/camera.h>
 #include <asm/mach/map.h>
 #include <mach/pxa27x.h>
index 4f0ff1ab623d11ccbfe81968a179406f74501a46..35353af345d56d1aa6f65a2fc97339573e49e21e 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/gpio.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/spi/pxa2xx_spi.h>
@@ -44,7 +45,6 @@
 #include <mach/irda.h>
 #include <mach/poodle.h>
 #include <mach/pxafb.h>
-#include <plat/i2c.h>
 
 #include <asm/hardware/scoop.h>
 #include <asm/hardware/locomo.h>
index 28b11be00b3f84b8e5efbe16878f8c3827c80bd7..1cb5d0f9723fb28ea9c5c1dabe441646c3dfcf25 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/sysdev.h>
 #include <linux/io.h>
 #include <linux/irq.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
@@ -32,8 +33,6 @@
 #include <mach/dma.h>
 #include <mach/smemc.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 #include "clock.h"
index 1230343d9c70d828f69ef004a17c93dbe2af7a90..f374247b8466d358fab0ed529f3b2d1704806978 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/sysdev.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
@@ -32,7 +33,6 @@
 #include <mach/dma.h>
 #include <mach/regs-intc.h>
 #include <mach/smemc.h>
-#include <plat/i2c.h>
 
 #include "generic.h"
 #include "devices.h"
index 437980f72710d2ea6b07492e771448bb680dae77..23b229bd06e9a39a66d788b6fb6bea3e5346d038 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/pm.h>
 #include <linux/platform_device.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/sysdev.h>
@@ -27,7 +28,6 @@
 #include <mach/pm.h>
 #include <mach/dma.h>
 #include <mach/regs-intc.h>
-#include <plat/i2c.h>
 
 #include "generic.h"
 #include "devices.h"
index 8361151be054174d85c64e96ba7403671d450767..47094188e029fb565d301dda87b6bee76f5c3dd6 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/sched.h>
 #include <linux/pwm_backlight.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_gpio.h>
 #include <linux/lis3lv02d.h>
@@ -53,7 +54,6 @@
 #include <mach/ohci.h>
 #include <mach/pxafb.h>
 #include <mach/mmc.h>
-#include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 
 #include "generic.h"
index c1ca8cb467fcc354f4456331f65e4caf34fe1af3..eb83c89428ef0f9a3f22e6b822218255344ef6c2 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/delay.h>
 #include <linux/fb.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/smc91x.h>
 #include <linux/mfd/da903x.h>
 #include <linux/mtd/mtd.h>
@@ -31,7 +32,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa930.h>
-#include <plat/i2c.h>
 #include <mach/pxafb.h>
 
 #include "devices.h"
index e497922f761aaff481e96c06eb7f0889086370ca..9322fe527c7f9cb017eb537ee0db9957c06bce9e 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/mfd/88pm860x.h>
 
 #include <asm/mach-types.h>
@@ -24,8 +25,6 @@
 #include <mach/mfp-pxa930.h>
 #include <mach/gpio.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 
 #define SAARB_NR_IRQS  (IRQ_BOARD_START + 40)
index b49a2c21124c4c42391d81e054bd004fe024500d..38e2c0912b9a28006ecfbc739383bec212b68d10 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/gpio.h>
 #include <linux/leds.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
@@ -47,8 +48,6 @@
 #include <mach/sharpsl_pm.h>
 #include <mach/smemc.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index 9a14fdb83c82b3517ba522cba936fab646c3148f..cb5611daf5fe21ddc193ab3f910ab69a878fe861 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mtd/plat-ram.h>
 #include <linux/mtd/partitions.h>
 
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pcf857x.h>
 #include <linux/i2c/at24.h>
 #include <linux/smc91x.h>
@@ -43,7 +44,6 @@
 #include <asm/mach/flash.h>
 
 #include <mach/pxa27x.h>
-#include <plat/i2c.h>
 #include <mach/mmc.h>
 #include <mach/udc.h>
 #include <mach/pxa27x-udc.h>
index 70191a9450eb279e2b4b31b70489716e83424b5a..79f4422f12f4d13b2ae051bbb5c9828138ae1e7a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/gpio.h>
 #include <linux/mfd/88pm860x.h>
 
@@ -23,8 +24,6 @@
 
 #include <mach/pxa930.h>
 
-#include <plat/i2c.h>
-
 #include "devices.h"
 #include "generic.h"
 
index f2582ec300d9ef7311b8392ba9e532628a471c6d..5ad3807af33442a8c0812a23ea46b90ffcb0d144 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/spi/spi.h>
 #include <linux/spi/pxa2xx_spi.h>
 #include <linux/input/matrix_keypad.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -41,7 +42,6 @@
 #include <mach/pxa25x.h>
 #include <mach/reset.h>
 #include <mach/irda.h>
-#include <plat/i2c.h>
 #include <mach/mmc.h>
 #include <mach/udc.h>
 #include <mach/tosa_bt.h>
index 423261d63d073213c5ca0f4d01e5fa25e237f2f1..857bb2e6348661e8a3f0cfef21c4449ba25bf539 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/dm9000.h>
 #include <linux/mtd/physmap.h>
 #include <linux/mtd/partitions.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -47,7 +48,6 @@
 #include <mach/irda.h>
 #include <mach/ohci.h>
 #include <mach/smemc.h>
-#include <plat/i2c.h>
 
 #include "generic.h"
 #include "devices.h"
index 49eeeab2368909a5d40c866d98e90e75eabccb0e..12279214c875a88f242c79dbc8fe02fdeca45ca7 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/gpio.h>
 #include <linux/jiffies.h>
 #include <linux/i2c-gpio.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/serial_8250.h>
 #include <linux/smc91x.h>
 #include <linux/pwm_backlight.h>
@@ -47,7 +48,6 @@
 #include <mach/pxa25x.h>
 #include <mach/audio.h>
 #include <mach/pxafb.h>
-#include <plat/i2c.h>
 #include <mach/regs-uart.h>
 #include <mach/arcom-pcmcia.h>
 #include <mach/viper.h>
index b9b579715ff65e9e65ea2de154273435e16250fc..e709fd4592689b6f1e9c857cb668c53cbf7acb86 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/ucb1400.h>
 #include <linux/ata_platform.h>
 #include <linux/regulator/max1586.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -40,8 +41,6 @@
 #include <mach/udc.h>
 #include <mach/pata_pxa.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index 51c0281c6e0a8cb8f946e443b5431fd9939953b6..f55f8f2e0db3219720e7fc5ed30b22108b8fb6ae 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/smc91x.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -26,8 +27,6 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
 
-#include <plat/i2c.h>
-
 #include <mach/hardware.h>
 #include <mach/pxa2xx-regs.h>
 #include <mach/mfp-pxa25x.h>
index a323e076129e933eae1164ce7bde102d98189deb..aaf883754ef4d7d2e602dcb04bfa950d342f2adf 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/gpio_keys.h>
 #include <linux/delay.h>
 #include <linux/regulator/machine.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -40,8 +41,6 @@
 #include <mach/mmc.h>
 #include <plat/pxa27x_keypad.h>
 
-#include <plat/i2c.h>
-
 #include "generic.h"
 #include "devices.h"
 
index b92aa3b8c4f795894b73fe4ea8e846959ffe25d3..730f51e57c17105fd2184967095b8fa78582fb6e 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/apm-emulation.h>
 #include <linux/can/platform/mcp251x.h>
@@ -33,8 +34,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <plat/i2c.h>
-
 #include <mach/pxa2xx-regs.h>
 #include <mach/regs-uart.h>
 #include <mach/ohci.h>
index 3aa73b3e33f27dd1db5747578d7eefe5a2304104..93c64d8d7de9714e52e1a37b0af18f123fd79611 100644 (file)
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
+#include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/gpio.h>
 
 #include <mach/pxa300.h>
-#include <plat/i2c.h>
 #include <mach/zylonite.h>
 
 #include "generic.h"
index 39f6d8e1af73043890adcf8761b226b5f2e82d4d..6de73aab019599fd4a53abdffa39b863a090128f 100644 (file)
@@ -4,8 +4,8 @@
 # Copyright (C) 2001 ARM Limited
 #
 
-# EXTRA_CFLAGS := -DDEBUG
-# EXTRA_AFLAGS := -DDEBUG
+# ccflags-y := -DDEBUG
+# asflags-y := -DDEBUG
 
 KBUILD_AFLAGS  :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
 LDFLAGS                +=--no-warn-mismatch
index d6189e057ed354804f04822ee78e73f2e069b827..6745cb1ffb4f71340f50a3710f9f8ec9bc2c840e 100644 (file)
@@ -5,7 +5,7 @@
 #
 
 targets                := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
-EXTRA_AFLAGS   := -traditional
+asflags-y      := -traditional
 
 OBJECTS = $(obj)/head.o $(obj)/misc.o
 
index 1089b3e918ace7d533bbecd96de0be54deb26cad..db3d7c5d10711a1d0357a0c179e752f1d6f0df58 100644 (file)
@@ -45,8 +45,8 @@ FORCE : $(obj)/$(offsets-file)
 # Makefile for Kernel-based Virtual Machine module
 #
 
-EXTRA_CFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
-EXTRA_AFLAGS += -Ivirt/kvm -Iarch/ia64/kvm/
+ccflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
+asflags-y := -Ivirt/kvm -Iarch/ia64/kvm/
 
 common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o ioapic.o \
                coalesced_mmio.o irq_comm.o assigned-dev.o)
index 0591038735af53e40e128dd0b7fc0e4f4e7ab286..d27df1d45da7b224a184758b831d264030169903 100644 (file)
@@ -7,7 +7,7 @@
 # Copyright (C) 1999,2001-2006,2008 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
-EXTRA_CFLAGS += -Iarch/ia64/sn/include
+ccflags-y := -Iarch/ia64/sn/include
 
 obj-y                          += setup.o bte.o bte_error.o irq.o mca.o idle.o \
                                   huberror.o io_acpi_init.o io_common.o \
index 08e6565dc908d0b0f5e8358a14698211439bb1c0..3d09108d42776658d193c9e57b59becdfadec881 100644 (file)
@@ -9,7 +9,7 @@
 # sn2 specific kernel files
 #
 
-EXTRA_CFLAGS += -Iarch/ia64/sn/include
+ccflags-y := -Iarch/ia64/sn/include
 
 obj-y += cache.o io.o ptc_deadlock.o sn2_smp.o sn_proc_fs.o \
         prominfo_proc.o timer.o timer_interrupt.o sn_hwperf.o
index ad4ef34dfe263cd66b496c445fd26e61246d02b7..df2a9014542664cf34b0c6f89b76fa898f95bb6d 100644 (file)
@@ -7,6 +7,6 @@
 #
 # Makefile for the sn pci general routines.
 
-EXTRA_CFLAGS += -Iarch/ia64/sn/include
+ccflags-y := -Iarch/ia64/sn/include
 
 obj-y := pci_dma.o tioca_provider.o tioce_provider.o pcibr/
index 01192d3247ddef19b1388cf39be80c03e3ee6d88..396bcae36309ab35e45e827546fd48db3b55e88e 100644 (file)
@@ -7,7 +7,7 @@
 #
 # Makefile for the sn2 io routines.
 
-EXTRA_CFLAGS += -Iarch/ia64/sn/include
+ccflags-y := -Iarch/ia64/sn/include
 
 obj-y                          +=  pcibr_dma.o pcibr_reg.o \
                                    pcibr_ate.o pcibr_provider.o
index 8d92b4684d8e06714b06fbaacfcaec452c58a086..124e441d383d89d72ef72a5965e1d4875ece3b79 100644 (file)
@@ -7,7 +7,7 @@
 # Copyright (C) 2008 Silicon Graphics, Inc.  All Rights Reserved.
 #
 
-EXTRA_CFLAGS += -Iarch/ia64/sn/include
+ccflags-y := -Iarch/ia64/sn/include
 
 obj-y                          += setup.o
 obj-$(CONFIG_IA64_GENERIC)      += machvec.o
index 59cc7bceaf8c493d35ef426e9bafaad914dbf3ab..fceed4edea41966a4de1502b52d745b452966bbf 100644 (file)
@@ -6,7 +6,7 @@ ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_cache.o = -pg
 endif
 
-EXTRA_CFLAGS += -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \
+ccflags-y := -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \
                -DCPU_REV=$(CPU_REV)
 
 obj-y += cache.o cpuinfo.o cpuinfo-pvr-full.o cpuinfo-static.o mb.o pvr.o
index 7c1102e41fe25b917dcce6566c0bf494ceef867e..ac1d5b611a27d2ea08d34cf983bbef5f94f1776e 100644 (file)
@@ -286,11 +286,11 @@ CLEAN_FILES += vmlinux.32 vmlinux.64
 archprepare:
 ifdef CONFIG_MIPS32_N32
        @echo '  Checking missing-syscalls for N32'
-       $(Q)$(MAKE) $(build)=. missing-syscalls EXTRA_CFLAGS="-mabi=n32"
+       $(Q)$(MAKE) $(build)=. missing-syscalls ccflags-y="-mabi=n32"
 endif
 ifdef CONFIG_MIPS32_O32
        @echo '  Checking missing-syscalls for O32'
-       $(Q)$(MAKE) $(build)=. missing-syscalls EXTRA_CFLAGS="-mabi=32"
+       $(Q)$(MAKE) $(build)=. missing-syscalls ccflags-y="-mabi=32"
 endif
 
 install:
index e5cc86dc1da83de4d2b09f6d134a81f1089bb1df..9f64fb41407743358f55a36377617613fb9a0383 100644 (file)
@@ -1,3 +1,3 @@
 obj-$(CONFIG_BOARD_BCM963XX)           += board_bcm963xx.o
 
-EXTRA_CFLAGS += -Werror
+ccflags-y := -Werror
index e0aaad482b0ebc806e971101a4f701ff30d2848e..5314b37aff2c493a736eb438a47f03d33cba509f 100644 (file)
@@ -9,4 +9,4 @@ lib-$(CONFIG_ARC_MEMORY)        += memory.o
 lib-$(CONFIG_ARC_CONSOLE)      += arc_con.o
 lib-$(CONFIG_ARC_PROMLIB)      += promlib.o
 
-EXTRA_CFLAGS                   += -Werror
+ccflags-y                      := -Werror
index a604eaeb6c08533616839485b6f8fc89a032ed2b..a9dff33212518d752b8620a969a79da3935543d1 100644 (file)
@@ -17,4 +17,4 @@ obj-$(CONFIG_JZ4740_QI_LB60)  += board-qi_lb60.o
 
 obj-$(CONFIG_PM) += pm.o
 
-EXTRA_CFLAGS += -Werror -Wall
+ccflags-y := -Werror -Wall
index 02cc65e52d11b47574b2940e5859a733f7d0fd85..4b9d7044e26c236b87f3f4497cacd5acd1cc7e4b 100644 (file)
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS := -Werror
+ccflags-y := -Werror
 
 obj-$(CONFIG_OPROFILE) += oprofile.o
 
index b16f95c3df654a089a33b7b9655228863421e865..02f5fb94ea2808a5bf580679421598e0659961d2 100644 (file)
@@ -6,4 +6,4 @@ obj-y    += irq.o prom.o py-console.o setup.o
 
 obj-$(CONFIG_SMP)              += smp.o
 
-EXTRA_CFLAGS += -Werror
+ccflags-y := -Werror
index baf6e9092a9f84b941b37986dac89a289b5225a8..348d2e850ef5128d42a34fe761fe357fdb5fc5ff 100644 (file)
@@ -28,4 +28,4 @@ obj-y += init.o ioremap.o memory.o powertv_setup.o reset.o time.o \
 
 obj-$(CONFIG_USB) += powertv-usb.o
 
-EXTRA_CFLAGS += -Wall
+ccflags-y := -Wall
index f0e95dc0ac97b4f63e924f3ae4387eb49e73199b..d810a33182a4a6b76a250e86532930b2f4d23f98 100644 (file)
@@ -20,4 +20,4 @@ obj-y += asic-calliope.o asic-cronus.o asic-gaia.o asic-zeus.o \
        asic_devices.o asic_int.o irq_asic.o prealloc-calliope.o \
        prealloc-cronus.o prealloc-cronuslite.o prealloc-gaia.o prealloc-zeus.o
 
-EXTRA_CFLAGS += -Wall -Werror
+ccflags-y := -Wall -Werror
index f5c62462fc9daf458b8248331dca8b6672a8bf7b..5783201cd2c81196659939f6ba495069118e6281 100644 (file)
@@ -18,4 +18,4 @@
 
 obj-$(CONFIG_PCI)      += fixup-powertv.o
 
-EXTRA_CFLAGS += -Wall -Werror
+ccflags-y := -Wall -Werror
index fed2946f73352489e15a5c0448bf6bdc717a00cc..fafdf30bea9e5fc040f0c629078680716a8caf50 100644 (file)
@@ -15,6 +15,7 @@ config PARISC
        select HAVE_GENERIC_HARDIRQS
        select GENERIC_IRQ_PROBE
        select IRQ_PER_CPU
+       select GENERIC_HARDIRQS_NO_DEPRECATED
 
        help
          The PA-RISC microprocessor is designed by Hewlett-Packard and used
index f388a85bba113c7c6f050202e494ad0d71731a43..d18328b3f9386c0477e61340f44e995888a1c47e 100644 (file)
@@ -26,8 +26,6 @@ void flush_user_dcache_range_asm(unsigned long, unsigned long);
 void flush_kernel_dcache_range_asm(unsigned long, unsigned long);
 void flush_kernel_dcache_page_asm(void *);
 void flush_kernel_icache_page(void *);
-void flush_user_dcache_page(unsigned long);
-void flush_user_icache_page(unsigned long);
 void flush_user_dcache_range(unsigned long, unsigned long);
 void flush_user_icache_range(unsigned long, unsigned long);
 
@@ -37,6 +35,13 @@ void flush_cache_all_local(void);
 void flush_cache_all(void);
 void flush_cache_mm(struct mm_struct *mm);
 
+#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
+void flush_kernel_dcache_page_addr(void *addr);
+static inline void flush_kernel_dcache_page(struct page *page)
+{
+       flush_kernel_dcache_page_addr(page_address(page));
+}
+
 #define flush_kernel_dcache_range(start,size) \
        flush_kernel_dcache_range_asm((start), (start)+(size));
 /* vmap range flushes and invalidates.  Architecturally, we don't need
@@ -50,6 +55,16 @@ static inline void flush_kernel_vmap_range(void *vaddr, int size)
 }
 static inline void invalidate_kernel_vmap_range(void *vaddr, int size)
 {
+       unsigned long start = (unsigned long)vaddr;
+       void *cursor = vaddr;
+
+       for ( ; cursor < vaddr + size; cursor += PAGE_SIZE) {
+               struct page *page = vmalloc_to_page(cursor);
+
+               if (test_and_clear_bit(PG_dcache_dirty, &page->flags))
+                       flush_kernel_dcache_page(page);
+       }
+       flush_kernel_dcache_range_asm(start, start + size);
 }
 
 #define flush_cache_vmap(start, end)           flush_cache_all()
@@ -90,19 +105,15 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned
 void flush_cache_range(struct vm_area_struct *vma,
                unsigned long start, unsigned long end);
 
+/* defined in pacache.S exported in cache.c used by flush_anon_page */
+void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
+
 #define ARCH_HAS_FLUSH_ANON_PAGE
 static inline void
 flush_anon_page(struct vm_area_struct *vma, struct page *page, unsigned long vmaddr)
 {
        if (PageAnon(page))
-               flush_user_dcache_page(vmaddr);
-}
-
-#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
-void flush_kernel_dcache_page_addr(void *addr);
-static inline void flush_kernel_dcache_page(struct page *page)
-{
-       flush_kernel_dcache_page_addr(page_address(page));
+               flush_dcache_page_asm(page_to_phys(page), vmaddr);
 }
 
 #ifdef CONFIG_DEBUG_RODATA
index c67dccf2e31f801860a7392598e951560921f3ce..1073599a7be93e6fa2de4e40d88793e5fd62b531 100644 (file)
@@ -32,15 +32,10 @@ static __inline__ int irq_canonicalize(int irq)
 }
 
 struct irq_chip;
+struct irq_data;
 
-/*
- * Some useful "we don't have to do anything here" handlers.  Should
- * probably be provided by the generic code.
- */
-void no_ack_irq(unsigned int irq);
-void no_end_irq(unsigned int irq);
-void cpu_ack_irq(unsigned int irq);
-void cpu_eoi_irq(unsigned int irq);
+void cpu_ack_irq(struct irq_data *d);
+void cpu_eoi_irq(struct irq_data *d);
 
 extern int txn_alloc_irq(unsigned int nbits);
 extern int txn_claim_irq(int);
@@ -49,7 +44,7 @@ extern unsigned long txn_alloc_addr(unsigned int);
 extern unsigned long txn_affinity_addr(unsigned int irq, int cpu);
 
 extern int cpu_claim_irq(unsigned int irq, struct irq_chip *, void *);
-extern int cpu_check_affinity(unsigned int irq, const struct cpumask *dest);
+extern int cpu_check_affinity(struct irq_data *d, const struct cpumask *dest);
 
 /* soft power switch support (power.c) */
 extern struct tasklet_struct power_tasklet;
index 6f1f65d3c0efb06bccbddb49612c4a3a1b01321e..5d7b8ce9fdf36507c8c541d76f4e176f9db01d94 100644 (file)
@@ -138,8 +138,7 @@ struct vm_area_struct;
 #define _PAGE_NO_CACHE_BIT 24   /* (0x080) Uncached Page (U bit) */
 #define _PAGE_ACCESSED_BIT 23   /* (0x100) Software: Page Accessed */
 #define _PAGE_PRESENT_BIT  22   /* (0x200) Software: translation valid */
-#define _PAGE_FLUSH_BIT    21   /* (0x400) Software: translation valid */
-                               /*             for cache flushing only */
+/* bit 21 was formerly the FLUSH bit but is now unused */
 #define _PAGE_USER_BIT     20   /* (0x800) Software: User accessible page */
 
 /* N.B. The bits are defined in terms of a 32 bit word above, so the */
@@ -173,7 +172,6 @@ struct vm_area_struct;
 #define _PAGE_NO_CACHE (1 << xlate_pabit(_PAGE_NO_CACHE_BIT))
 #define _PAGE_ACCESSED (1 << xlate_pabit(_PAGE_ACCESSED_BIT))
 #define _PAGE_PRESENT  (1 << xlate_pabit(_PAGE_PRESENT_BIT))
-#define _PAGE_FLUSH    (1 << xlate_pabit(_PAGE_FLUSH_BIT))
 #define _PAGE_USER     (1 << xlate_pabit(_PAGE_USER_BIT))
 #define _PAGE_FILE     (1 << xlate_pabit(_PAGE_FILE_BIT))
 
@@ -213,7 +211,6 @@ struct vm_area_struct;
 #define PAGE_KERNEL_RO __pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)
 #define PAGE_KERNEL_UNC        __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
 #define PAGE_GATEWAY    __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_GATEWAY| _PAGE_READ)
-#define PAGE_FLUSH      __pgprot(_PAGE_FLUSH)
 
 
 /*
@@ -261,7 +258,7 @@ extern unsigned long *empty_zero_page;
 
 #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
 
-#define pte_none(x)     ((pte_val(x) == 0) || (pte_val(x) & _PAGE_FLUSH))
+#define pte_none(x)     (pte_val(x) == 0)
 #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
 #define pte_clear(mm,addr,xp)  do { pte_val(*(xp)) = 0; } while (0)
 
@@ -444,13 +441,10 @@ struct mm_struct;
 static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
        pte_t old_pte;
-       pte_t pte;
 
        spin_lock(&pa_dbit_lock);
-       pte = old_pte = *ptep;
-       pte_val(pte) &= ~_PAGE_PRESENT;
-       pte_val(pte) |= _PAGE_FLUSH;
-       set_pte_at(mm,addr,ptep,pte);
+       old_pte = *ptep;
+       pte_clear(mm,addr,ptep);
        spin_unlock(&pa_dbit_lock);
 
        return old_pte;
index d054f3da3ff512fa07c0a5b5b818a8e53adfcada..3f11331c27755f835a228cfdc91e5f05cf808042 100644 (file)
 #include <asm/pgalloc.h>
 #include <asm/processor.h>
 #include <asm/sections.h>
+#include <asm/shmparam.h>
 
 int split_tlb __read_mostly;
 int dcache_stride __read_mostly;
 int icache_stride __read_mostly;
 EXPORT_SYMBOL(dcache_stride);
 
+void flush_dcache_page_asm(unsigned long phys_addr, unsigned long vaddr);
+EXPORT_SYMBOL(flush_dcache_page_asm);
+void flush_icache_page_asm(unsigned long phys_addr, unsigned long vaddr);
+
 
 /* On some machines (e.g. ones with the Merced bus), there can be
  * only a single PxTLB broadcast at a time; this must be guaranteed
@@ -259,81 +264,13 @@ void disable_sr_hashing(void)
                panic("SpaceID hashing is still on!\n");
 }
 
-/* Simple function to work out if we have an existing address translation
- * for a user space vma. */
-static inline int translation_exists(struct vm_area_struct *vma,
-                               unsigned long addr, unsigned long pfn)
-{
-       pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
-       pmd_t *pmd;
-       pte_t pte;
-
-       if(pgd_none(*pgd))
-               return 0;
-
-       pmd = pmd_offset(pgd, addr);
-       if(pmd_none(*pmd) || pmd_bad(*pmd))
-               return 0;
-
-       /* We cannot take the pte lock here: flush_cache_page is usually
-        * called with pte lock already held.  Whereas flush_dcache_page
-        * takes flush_dcache_mmap_lock, which is lower in the hierarchy:
-        * the vma itself is secure, but the pte might come or go racily.
-        */
-       pte = *pte_offset_map(pmd, addr);
-       /* But pte_unmap() does nothing on this architecture */
-
-       /* Filter out coincidental file entries and swap entries */
-       if (!(pte_val(pte) & (_PAGE_FLUSH|_PAGE_PRESENT)))
-               return 0;
-
-       return pte_pfn(pte) == pfn;
-}
-
-/* Private function to flush a page from the cache of a non-current
- * process.  cr25 contains the Page Directory of the current user
- * process; we're going to hijack both it and the user space %sr3 to
- * temporarily make the non-current process current.  We have to do
- * this because cache flushing may cause a non-access tlb miss which
- * the handlers have to fill in from the pgd of the non-current
- * process. */
 static inline void
-flush_user_cache_page_non_current(struct vm_area_struct *vma,
-                                 unsigned long vmaddr)
+__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
+                  unsigned long physaddr)
 {
-       /* save the current process space and pgd */
-       unsigned long space = mfsp(3), pgd = mfctl(25);
-
-       /* we don't mind taking interrupts since they may not
-        * do anything with user space, but we can't
-        * be preempted here */
-       preempt_disable();
-
-       /* make us current */
-       mtctl(__pa(vma->vm_mm->pgd), 25);
-       mtsp(vma->vm_mm->context, 3);
-
-       flush_user_dcache_page(vmaddr);
-       if(vma->vm_flags & VM_EXEC)
-               flush_user_icache_page(vmaddr);
-
-       /* put the old current process back */
-       mtsp(space, 3);
-       mtctl(pgd, 25);
-       preempt_enable();
-}
-
-
-static inline void
-__flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)
-{
-       if (likely(vma->vm_mm->context == mfsp(3))) {
-               flush_user_dcache_page(vmaddr);
-               if (vma->vm_flags & VM_EXEC)
-                       flush_user_icache_page(vmaddr);
-       } else {
-               flush_user_cache_page_non_current(vma, vmaddr);
-       }
+       flush_dcache_page_asm(physaddr, vmaddr);
+       if (vma->vm_flags & VM_EXEC)
+               flush_icache_page_asm(physaddr, vmaddr);
 }
 
 void flush_dcache_page(struct page *page)
@@ -342,10 +279,8 @@ void flush_dcache_page(struct page *page)
        struct vm_area_struct *mpnt;
        struct prio_tree_iter iter;
        unsigned long offset;
-       unsigned long addr;
+       unsigned long addr, old_addr = 0;
        pgoff_t pgoff;
-       unsigned long pfn = page_to_pfn(page);
-
 
        if (mapping && !mapping_mapped(mapping)) {
                set_bit(PG_dcache_dirty, &page->flags);
@@ -369,20 +304,11 @@ void flush_dcache_page(struct page *page)
                offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
                addr = mpnt->vm_start + offset;
 
-               /* Flush instructions produce non access tlb misses.
-                * On PA, we nullify these instructions rather than
-                * taking a page fault if the pte doesn't exist.
-                * This is just for speed.  If the page translation
-                * isn't there, there's no point exciting the
-                * nadtlb handler into a nullification frenzy.
-                *
-                * Make sure we really have this page: the private
-                * mappings may cover this area but have COW'd this
-                * particular page.
-                */
-               if (translation_exists(mpnt, addr, pfn)) {
-                       __flush_cache_page(mpnt, addr);
-                       break;
+               if (old_addr == 0 || (old_addr & (SHMLBA - 1)) != (addr & (SHMLBA - 1))) {
+                       __flush_cache_page(mpnt, addr, page_to_phys(page));
+                       if (old_addr)
+                               printk(KERN_ERR "INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %s\n", old_addr, addr, mpnt->vm_file ? mpnt->vm_file->f_path.dentry->d_name.name : "(null)");
+                       old_addr = addr;
                }
        }
        flush_dcache_mmap_unlock(mapping);
@@ -573,7 +499,6 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long
 {
        BUG_ON(!vma->vm_mm->context);
 
-       if (likely(translation_exists(vma, vmaddr, pfn)))
-               __flush_cache_page(vma, vmaddr);
+       __flush_cache_page(vma, vmaddr, page_to_phys(pfn_to_page(pfn)));
 
 }
index 6337adef30f64f158086d6ff322dd20ed7ec6361..e5477092a5d4cde2cde30c2b11c79a6ffd58b18e 100644 (file)
 #ifndef CONFIG_64BIT
        /*
         * naitlb miss interruption handler (parisc 1.1 - 32 bit)
-        *
-        * Note: naitlb misses will be treated
-        * as an ordinary itlb miss for now.
-        * However, note that naitlb misses
-        * have the faulting address in the
-        * IOR/ISR.
         */
 
        .macro  naitlb_11 code
 
        mfctl   %isr,spc
-       b       itlb_miss_11
+       b       naitlb_miss_11
        mfctl   %ior,va
-       /* FIXME: If user causes a naitlb miss, the priv level may not be in
-        * lower bits of va, where the itlb miss handler is expecting them
-        */
 
        .align          32
        .endm
        
        /*
         * naitlb miss interruption handler (parisc 2.0)
-        *
-        * Note: naitlb misses will be treated
-        * as an ordinary itlb miss for now.
-        * However, note that naitlb misses
-        * have the faulting address in the
-        * IOR/ISR.
         */
 
        .macro  naitlb_20 code
 
        mfctl   %isr,spc
 #ifdef CONFIG_64BIT
-       b       itlb_miss_20w
+       b       naitlb_miss_20w
 #else
-       b       itlb_miss_20
+       b       naitlb_miss_20
 #endif
        mfctl   %ior,va
-       /* FIXME: If user causes a naitlb miss, the priv level may not be in
-        * lower bits of va, where the itlb miss handler is expecting them
-        */
 
        .align          32
        .endm
        copy            \va,\tmp1
        depi            0,31,23,\tmp1
        cmpb,COND(<>),n \tmp,\tmp1,\fault
-       ldi             (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),\prot
+       mfctl           %cr19,\tmp      /* iir */
+       /* get the opcode (first six bits) into \tmp */
+       extrw,u         \tmp,5,6,\tmp
+       /*
+        * Only setting the T bit prevents data cache movein
+        * Setting access rights to zero prevents instruction cache movein
+        *
+        * Note subtlety here: _PAGE_GATEWAY, _PAGE_EXEC and _PAGE_WRITE go
+        * to type field and _PAGE_READ goes to top bit of PL1
+        */
+       ldi             (_PAGE_REFTRAP|_PAGE_READ|_PAGE_WRITE),\prot
+       /*
+        * so if the opcode is one (i.e. this is a memory management
+        * instruction) nullify the next load so \prot is only T.
+        * Otherwise this is a normal data operation
+        */
+       cmpiclr,=       0x01,\tmp,%r0
+       ldi             (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot
        depd,z          \prot,8,7,\prot
        /*
         * OK, it is in the temp alias region, check whether "from" or "to".
@@ -631,11 +630,7 @@ ENTRY(fault_vector_20)
        def             13
        def             14
        dtlb_20         15
-#if 0
        naitlb_20       16
-#else
-       def             16
-#endif
        nadtlb_20       17
        def             18
        def             19
@@ -678,11 +673,7 @@ ENTRY(fault_vector_11)
        def             13
        def             14
        dtlb_11         15
-#if 0
        naitlb_11       16
-#else
-       def             16
-#endif
        nadtlb_11       17
        def             18
        def             19
@@ -1203,7 +1194,7 @@ nadtlb_miss_20w:
        get_pgd         spc,ptp
        space_check     spc,t0,nadtlb_fault
 
-       L3_ptep         ptp,pte,t0,va,nadtlb_check_flush_20w
+       L3_ptep         ptp,pte,t0,va,nadtlb_check_alias_20w
 
        update_ptep     ptp,pte,t0,t1
 
@@ -1214,16 +1205,8 @@ nadtlb_miss_20w:
        rfir
        nop
 
-nadtlb_check_flush_20w:
-       bb,>=,n          pte,_PAGE_FLUSH_BIT,nadtlb_emulate
-
-       /* Insert a "flush only" translation */
-
-       depdi,z         7,7,3,prot
-       depdi           1,10,1,prot
-
-       /* Drop prot bits from pte and convert to page addr for idtlbt */
-       convert_for_tlb_insert20 pte
+nadtlb_check_alias_20w:
+       do_alias        spc,t0,t1,va,pte,prot,nadtlb_emulate
 
        idtlbt          pte,prot
 
@@ -1255,25 +1238,7 @@ dtlb_miss_11:
        nop
 
 dtlb_check_alias_11:
-
-       /* Check to see if fault is in the temporary alias region */
-
-       cmpib,<>,n      0,spc,dtlb_fault /* forward */
-       ldil            L%(TMPALIAS_MAP_START),t0
-       copy            va,t1
-       depwi           0,31,23,t1
-       cmpb,<>,n       t0,t1,dtlb_fault /* forward */
-       ldi             (_PAGE_DIRTY|_PAGE_WRITE|_PAGE_READ),prot
-       depw,z          prot,8,7,prot
-
-       /*
-        * OK, it is in the temp alias region, check whether "from" or "to".
-        * Check "subtle" note in pacache.S re: r23/r26.
-        */
-
-       extrw,u,=       va,9,1,r0
-       or,tr           %r23,%r0,pte    /* If "from" use "from" page */
-       or              %r26,%r0,pte    /* else "to", use "to" page  */
+       do_alias        spc,t0,t1,va,pte,prot,dtlb_fault
 
        idtlba          pte,(va)
        idtlbp          prot,(va)
@@ -1286,7 +1251,7 @@ nadtlb_miss_11:
 
        space_check     spc,t0,nadtlb_fault
 
-       L2_ptep         ptp,pte,t0,va,nadtlb_check_flush_11
+       L2_ptep         ptp,pte,t0,va,nadtlb_check_alias_11
 
        update_ptep     ptp,pte,t0,t1
 
@@ -1304,26 +1269,11 @@ nadtlb_miss_11:
        rfir
        nop
 
-nadtlb_check_flush_11:
-       bb,>=,n          pte,_PAGE_FLUSH_BIT,nadtlb_emulate
-
-       /* Insert a "flush only" translation */
-
-       zdepi           7,7,3,prot
-       depi            1,10,1,prot
+nadtlb_check_alias_11:
+       do_alias        spc,t0,t1,va,pte,prot,nadtlb_emulate
 
-       /* Get rid of prot bits and convert to page addr for idtlba */
-
-       depi            0,31,ASM_PFN_PTE_SHIFT,pte
-       SHRREG          pte,(ASM_PFN_PTE_SHIFT-(31-26)),pte
-
-       mfsp            %sr1,t0  /* Save sr1 so we can use it in tlb inserts */
-       mtsp            spc,%sr1
-
-       idtlba          pte,(%sr1,va)
-       idtlbp          prot,(%sr1,va)
-
-       mtsp            t0, %sr1        /* Restore sr1 */
+       idtlba          pte,(va)
+       idtlbp          prot,(va)
 
        rfir
        nop
@@ -1359,7 +1309,7 @@ nadtlb_miss_20:
 
        space_check     spc,t0,nadtlb_fault
 
-       L2_ptep         ptp,pte,t0,va,nadtlb_check_flush_20
+       L2_ptep         ptp,pte,t0,va,nadtlb_check_alias_20
 
        update_ptep     ptp,pte,t0,t1
 
@@ -1372,21 +1322,14 @@ nadtlb_miss_20:
        rfir
        nop
 
-nadtlb_check_flush_20:
-       bb,>=,n          pte,_PAGE_FLUSH_BIT,nadtlb_emulate
-
-       /* Insert a "flush only" translation */
-
-       depdi,z         7,7,3,prot
-       depdi           1,10,1,prot
-
-       /* Drop prot bits from pte and convert to page addr for idtlbt */
-       convert_for_tlb_insert20 pte
+nadtlb_check_alias_20:
+       do_alias        spc,t0,t1,va,pte,prot,nadtlb_emulate
 
        idtlbt          pte,prot
 
        rfir
        nop
+
 #endif
 
 nadtlb_emulate:
@@ -1484,6 +1427,36 @@ itlb_miss_20w:
        rfir
        nop
 
+naitlb_miss_20w:
+
+       /*
+        * I miss is a little different, since we allow users to fault
+        * on the gateway page which is in the kernel address space.
+        */
+
+       space_adjust    spc,va,t0
+       get_pgd         spc,ptp
+       space_check     spc,t0,naitlb_fault
+
+       L3_ptep         ptp,pte,t0,va,naitlb_check_alias_20w
+
+       update_ptep     ptp,pte,t0,t1
+
+       make_insert_tlb spc,pte,prot
+
+       iitlbt          pte,prot
+
+       rfir
+       nop
+
+naitlb_check_alias_20w:
+       do_alias        spc,t0,t1,va,pte,prot,naitlb_fault
+
+       iitlbt          pte,prot
+
+       rfir
+       nop
+
 #else
 
 itlb_miss_11:
@@ -1508,6 +1481,38 @@ itlb_miss_11:
        rfir
        nop
 
+naitlb_miss_11:
+       get_pgd         spc,ptp
+
+       space_check     spc,t0,naitlb_fault
+
+       L2_ptep         ptp,pte,t0,va,naitlb_check_alias_11
+
+       update_ptep     ptp,pte,t0,t1
+
+       make_insert_tlb_11      spc,pte,prot
+
+       mfsp            %sr1,t0  /* Save sr1 so we can use it in tlb inserts */
+       mtsp            spc,%sr1
+
+       iitlba          pte,(%sr1,va)
+       iitlbp          prot,(%sr1,va)
+
+       mtsp            t0, %sr1        /* Restore sr1 */
+
+       rfir
+       nop
+
+naitlb_check_alias_11:
+       do_alias        spc,t0,t1,va,pte,prot,itlb_fault
+
+       iitlba          pte,(%sr0, va)
+       iitlbp          prot,(%sr0, va)
+
+       rfir
+       nop
+
+
 itlb_miss_20:
        get_pgd         spc,ptp
 
@@ -1526,6 +1531,32 @@ itlb_miss_20:
        rfir
        nop
 
+naitlb_miss_20:
+       get_pgd         spc,ptp
+
+       space_check     spc,t0,naitlb_fault
+
+       L2_ptep         ptp,pte,t0,va,naitlb_check_alias_20
+
+       update_ptep     ptp,pte,t0,t1
+
+       make_insert_tlb spc,pte,prot
+
+       f_extend        pte,t0
+
+       iitlbt          pte,prot
+
+       rfir
+       nop
+
+naitlb_check_alias_20:
+       do_alias        spc,t0,t1,va,pte,prot,naitlb_fault
+
+       iitlbt          pte,prot
+
+       rfir
+       nop
+
 #endif
 
 #ifdef CONFIG_64BIT
@@ -1662,6 +1693,10 @@ nadtlb_fault:
        b               intr_save
        ldi             17,%r8
 
+naitlb_fault:
+       b               intr_save
+       ldi             16,%r8
+
 dtlb_fault:
        b               intr_save
        ldi             15,%r8
index d7d94b845dc2c8bb08ece9d5e420f8cae5b7abe2..cb450e1e79b322e074277aa9d56f8802476bd5c6 100644 (file)
@@ -52,9 +52,9 @@ static volatile unsigned long cpu_eiem = 0;
 */
 static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL;
 
-static void cpu_mask_irq(unsigned int irq)
+static void cpu_mask_irq(struct irq_data *d)
 {
-       unsigned long eirr_bit = EIEM_MASK(irq);
+       unsigned long eirr_bit = EIEM_MASK(d->irq);
 
        cpu_eiem &= ~eirr_bit;
        /* Do nothing on the other CPUs.  If they get this interrupt,
@@ -63,7 +63,7 @@ static void cpu_mask_irq(unsigned int irq)
         * then gets disabled */
 }
 
-static void cpu_unmask_irq(unsigned int irq)
+static void __cpu_unmask_irq(unsigned int irq)
 {
        unsigned long eirr_bit = EIEM_MASK(irq);
 
@@ -75,9 +75,14 @@ static void cpu_unmask_irq(unsigned int irq)
        smp_send_all_nop();
 }
 
-void cpu_ack_irq(unsigned int irq)
+static void cpu_unmask_irq(struct irq_data *d)
+{
+       __cpu_unmask_irq(d->irq);
+}
+
+void cpu_ack_irq(struct irq_data *d)
 {
-       unsigned long mask = EIEM_MASK(irq);
+       unsigned long mask = EIEM_MASK(d->irq);
        int cpu = smp_processor_id();
 
        /* Clear in EIEM so we can no longer process */
@@ -90,9 +95,9 @@ void cpu_ack_irq(unsigned int irq)
        mtctl(mask, 23);
 }
 
-void cpu_eoi_irq(unsigned int irq)
+void cpu_eoi_irq(struct irq_data *d)
 {
-       unsigned long mask = EIEM_MASK(irq);
+       unsigned long mask = EIEM_MASK(d->irq);
        int cpu = smp_processor_id();
 
        /* set it in the eiems---it's no longer in process */
@@ -103,15 +108,16 @@ void cpu_eoi_irq(unsigned int irq)
 }
 
 #ifdef CONFIG_SMP
-int cpu_check_affinity(unsigned int irq, const struct cpumask *dest)
+int cpu_check_affinity(struct irq_data *d, const struct cpumask *dest)
 {
        int cpu_dest;
 
        /* timer and ipi have to always be received on all CPUs */
-       if (CHECK_IRQ_PER_CPU(irq)) {
+       if (CHECK_IRQ_PER_CPU(irq_to_desc(d->irq)->status)) {
                /* Bad linux design decision.  The mask has already
-                * been set; we must reset it */
-               cpumask_setall(irq_desc[irq].affinity);
+                * been set; we must reset it. Will fix - tglx
+                */
+               cpumask_setall(d->affinity);
                return -EINVAL;
        }
 
@@ -121,33 +127,34 @@ int cpu_check_affinity(unsigned int irq, const struct cpumask *dest)
        return cpu_dest;
 }
 
-static int cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest)
+static int cpu_set_affinity_irq(struct irq_data *d, const struct cpumask *dest,
+                               bool force)
 {
        int cpu_dest;
 
-       cpu_dest = cpu_check_affinity(irq, dest);
+       cpu_dest = cpu_check_affinity(d, dest);
        if (cpu_dest < 0)
                return -1;
 
-       cpumask_copy(irq_desc[irq].affinity, dest);
+       cpumask_copy(d->affinity, dest);
 
        return 0;
 }
 #endif
 
 static struct irq_chip cpu_interrupt_type = {
-       .name           = "CPU",
-       .mask           = cpu_mask_irq,
-       .unmask         = cpu_unmask_irq,
-       .ack            = cpu_ack_irq,
-       .eoi            = cpu_eoi_irq,
+       .name                   = "CPU",
+       .irq_mask               = cpu_mask_irq,
+       .irq_unmask             = cpu_unmask_irq,
+       .irq_ack                = cpu_ack_irq,
+       .irq_eoi                = cpu_eoi_irq,
 #ifdef CONFIG_SMP
-       .set_affinity   = cpu_set_affinity_irq,
+       .irq_set_affinity       = cpu_set_affinity_irq,
 #endif
        /* XXX: Needs to be written.  We managed without it so far, but
         * we really ought to write it.
         */
-       .retrigger      = NULL,
+       .irq_retrigger  = NULL,
 };
 
 int show_interrupts(struct seq_file *p, void *v)
@@ -181,7 +188,7 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_printf(p, "%10u ", kstat_irqs(i));
 #endif
 
-               seq_printf(p, " %14s", irq_desc[i].chip->name);
+               seq_printf(p, " %14s", irq_desc[i].irq_data.chip->name);
 #ifndef PARISC_IRQ_CR16_COUNTS
                seq_printf(p, "  %s", action->name);
 
@@ -233,14 +240,14 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
 {
        if (irq_desc[irq].action)
                return -EBUSY;
-       if (irq_desc[irq].chip != &cpu_interrupt_type)
+       if (get_irq_chip(irq) != &cpu_interrupt_type)
                return -EBUSY;
 
        /* for iosapic interrupts */
        if (type) {
                set_irq_chip_and_handler(irq, type, handle_percpu_irq);
                set_irq_chip_data(irq, data);
-               cpu_unmask_irq(irq);
+               __cpu_unmask_irq(irq);
        }
        return 0;
 }
@@ -289,7 +296,8 @@ int txn_alloc_irq(unsigned int bits_wide)
 unsigned long txn_affinity_addr(unsigned int irq, int cpu)
 {
 #ifdef CONFIG_SMP
-       cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu));
+       struct irq_data *d = irq_get_irq_data(irq);
+       cpumask_copy(d->affinity, cpumask_of(cpu));
 #endif
 
        return per_cpu(cpu_data, cpu).txn_addr;
@@ -333,6 +341,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
        unsigned long eirr_val;
        int irq, cpu = smp_processor_id();
 #ifdef CONFIG_SMP
+       struct irq_desc *desc;
        cpumask_t dest;
 #endif
 
@@ -346,8 +355,9 @@ void do_cpu_irq_mask(struct pt_regs *regs)
        irq = eirr_to_irq(eirr_val);
 
 #ifdef CONFIG_SMP
-       cpumask_copy(&dest, irq_desc[irq].affinity);
-       if (CHECK_IRQ_PER_CPU(irq_desc[irq].status) &&
+       desc = irq_to_desc(irq);
+       cpumask_copy(&dest, desc->irq_data.affinity);
+       if (CHECK_IRQ_PER_CPU(desc->status) &&
            !cpu_isset(smp_processor_id(), dest)) {
                int cpu = first_cpu(dest);
 
index 09b77b2553c6bf67c1fe36b4d502eda41cc56de5..a85823668cba041708285555e4cc31f2475f131f 100644 (file)
@@ -608,93 +608,131 @@ ENTRY(__clear_user_page_asm)
        .procend
 ENDPROC(__clear_user_page_asm)
 
-ENTRY(flush_kernel_dcache_page_asm)
+ENTRY(flush_dcache_page_asm)
        .proc
        .callinfo NO_CALLS
        .entry
 
+       ldil            L%(TMPALIAS_MAP_START), %r28
+#ifdef CONFIG_64BIT
+#if (TMPALIAS_MAP_START >= 0x80000000)
+       depdi           0, 31,32, %r28          /* clear any sign extension */
+       /* FIXME: page size dependend */
+#endif
+       extrd,u         %r26, 56,32, %r26       /* convert phys addr to tlb insert format */
+       depd            %r25, 63,22, %r28       /* Form aliased virtual address 'to' */
+       depdi           0, 63,12, %r28          /* Clear any offset bits */
+#else
+       extrw,u         %r26, 24,25, %r26       /* convert phys addr to tlb insert format */
+       depw            %r25, 31,22, %r28       /* Form aliased virtual address 'to' */
+       depwi           0, 31,12, %r28          /* Clear any offset bits */
+#endif
+
+       /* Purge any old translation */
+
+       pdtlb           0(%r28)
+
        ldil            L%dcache_stride, %r1
-       ldw             R%dcache_stride(%r1), %r23
+       ldw             R%dcache_stride(%r1), %r1
 
 #ifdef CONFIG_64BIT
        depdi,z         1, 63-PAGE_SHIFT,1, %r25
 #else
        depwi,z         1, 31-PAGE_SHIFT,1, %r25
 #endif
-       add             %r26, %r25, %r25
-       sub             %r25, %r23, %r25
-
-
-1:      fdc,m          %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       fdc,m           %r23(%r26)
-       cmpb,COND(<<)           %r26, %r25,1b
-       fdc,m           %r23(%r26)
+       add             %r28, %r25, %r25
+       sub             %r25, %r1, %r25
+
+
+1:      fdc,m          %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       fdc,m           %r1(%r28)
+       cmpb,COND(<<)           %r28, %r25,1b
+       fdc,m           %r1(%r28)
 
        sync
        bv              %r0(%r2)
-       nop
+       pdtlb           (%r25)
        .exit
 
        .procend
-ENDPROC(flush_kernel_dcache_page_asm)
-       
-ENTRY(flush_user_dcache_page)
+ENDPROC(flush_dcache_page_asm)
+
+ENTRY(flush_icache_page_asm)
        .proc
        .callinfo NO_CALLS
        .entry
 
-       ldil            L%dcache_stride, %r1
-       ldw             R%dcache_stride(%r1), %r23
-
+       ldil            L%(TMPALIAS_MAP_START), %r28
 #ifdef CONFIG_64BIT
-       depdi,z         1,63-PAGE_SHIFT,1, %r25
+#if (TMPALIAS_MAP_START >= 0x80000000)
+       depdi           0, 31,32, %r28          /* clear any sign extension */
+       /* FIXME: page size dependend */
+#endif
+       extrd,u         %r26, 56,32, %r26       /* convert phys addr to tlb insert format */
+       depd            %r25, 63,22, %r28       /* Form aliased virtual address 'to' */
+       depdi           0, 63,12, %r28          /* Clear any offset bits */
 #else
-       depwi,z         1,31-PAGE_SHIFT,1, %r25
+       extrw,u         %r26, 24,25, %r26       /* convert phys addr to tlb insert format */
+       depw            %r25, 31,22, %r28       /* Form aliased virtual address 'to' */
+       depwi           0, 31,12, %r28          /* Clear any offset bits */
 #endif
-       add             %r26, %r25, %r25
-       sub             %r25, %r23, %r25
 
+       /* Purge any old translation */
 
-1:      fdc,m          %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       fdc,m           %r23(%sr3, %r26)
-       cmpb,COND(<<)           %r26, %r25,1b
-       fdc,m           %r23(%sr3, %r26)
+       pitlb           (%sr0,%r28)
+
+       ldil            L%icache_stride, %r1
+       ldw             R%icache_stride(%r1), %r1
+
+#ifdef CONFIG_64BIT
+       depdi,z         1, 63-PAGE_SHIFT,1, %r25
+#else
+       depwi,z         1, 31-PAGE_SHIFT,1, %r25
+#endif
+       add             %r28, %r25, %r25
+       sub             %r25, %r1, %r25
+
+
+1:      fic,m          %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       fic,m           %r1(%r28)
+       cmpb,COND(<<)           %r28, %r25,1b
+       fic,m           %r1(%r28)
 
        sync
        bv              %r0(%r2)
-       nop
+       pitlb           (%sr0,%r25)
        .exit
 
        .procend
-ENDPROC(flush_user_dcache_page)
+ENDPROC(flush_icache_page_asm)
 
-ENTRY(flush_user_icache_page)
+ENTRY(flush_kernel_dcache_page_asm)
        .proc
        .callinfo NO_CALLS
        .entry
@@ -711,23 +749,23 @@ ENTRY(flush_user_icache_page)
        sub             %r25, %r23, %r25
 
 
-1:      fic,m          %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
-       fic,m           %r23(%sr3, %r26)
+1:      fdc,m          %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
+       fdc,m           %r23(%r26)
        cmpb,COND(<<)           %r26, %r25,1b
-       fic,m           %r23(%sr3, %r26)
+       fdc,m           %r23(%r26)
 
        sync
        bv              %r0(%r2)
@@ -735,8 +773,7 @@ ENTRY(flush_user_icache_page)
        .exit
 
        .procend
-ENDPROC(flush_user_icache_page)
-
+ENDPROC(flush_kernel_dcache_page_asm)
 
 ENTRY(purge_kernel_dcache_page)
        .proc
@@ -780,69 +817,6 @@ ENTRY(purge_kernel_dcache_page)
        .procend
 ENDPROC(purge_kernel_dcache_page)
 
-#if 0
-       /* Currently not used, but it still is a possible alternate
-        * solution.
-        */
-
-ENTRY(flush_alias_page)
-       .proc
-       .callinfo NO_CALLS
-       .entry
-
-       tophys_r1               %r26
-
-       ldil            L%(TMPALIAS_MAP_START), %r28
-#ifdef CONFIG_64BIT
-       extrd,u         %r26, 56,32, %r26       /* convert phys addr to tlb insert format */
-       depd            %r25, 63,22, %r28       /* Form aliased virtual address 'to' */
-       depdi           0, 63,12, %r28          /* Clear any offset bits */
-#else
-       extrw,u         %r26, 24,25, %r26       /* convert phys addr to tlb insert format */
-       depw            %r25, 31,22, %r28       /* Form aliased virtual address 'to' */
-       depwi           0, 31,12, %r28          /* Clear any offset bits */
-#endif
-
-       /* Purge any old translation */
-
-       pdtlb           0(%r28)
-
-       ldil            L%dcache_stride, %r1
-       ldw             R%dcache_stride(%r1), %r23
-
-#ifdef CONFIG_64BIT
-       depdi,z         1, 63-PAGE_SHIFT,1, %r29
-#else
-       depwi,z         1, 31-PAGE_SHIFT,1, %r29
-#endif
-       add             %r28, %r29, %r29
-       sub             %r29, %r23, %r29
-
-1:      fdc,m          %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       fdc,m           %r23(%r28)
-       cmpb,COND(<<)           %r28, %r29, 1b
-       fdc,m           %r23(%r28)
-
-       sync
-       bv              %r0(%r2)
-       nop
-       .exit
-
-       .procend
-#endif
 
        .export flush_user_dcache_range_asm
 
@@ -865,7 +839,6 @@ flush_user_dcache_range_asm:
        .exit
 
        .procend
-ENDPROC(flush_alias_page)
 
 ENTRY(flush_kernel_dcache_range_asm)
        .proc
index 946ec4947da282e90589a3012c8fb92653ecc5f2..7005ee0b074d744e6905fd8e0c6dfc144a3a4cb3 100644 (file)
@@ -367,6 +367,10 @@ struct mpic
 #define MPIC_SINGLE_DEST_CPU           0x00001000
 /* Enable CoreInt delivery of interrupts */
 #define MPIC_ENABLE_COREINT            0x00002000
+/* Disable resetting of the MPIC.
+ * NOTE: This flag trumps MPIC_WANTS_RESET.
+ */
+#define MPIC_NO_RESET                  0x00004000
 
 /* MPIC HW modification ID */
 #define MPIC_REGSET_MASK               0xf0000000
index 0175a676b34b5e577c4e52107bfd1f3e99c6e8d2..48223f9b8728d5e1433c6d13ab9c1c583780d2cb 100644 (file)
@@ -125,8 +125,10 @@ extern int ptrace_put_reg(struct task_struct *task, int regno,
 #endif /* ! __powerpc64__ */
 #define TRAP(regs)             ((regs)->trap & ~0xF)
 #ifdef __powerpc64__
+#define NV_REG_POISON          0xdeadbeefdeadbeefUL
 #define CHECK_FULL_REGS(regs)  BUG_ON(regs->trap & 1)
 #else
+#define NV_REG_POISON          0xdeadbeef
 #define CHECK_FULL_REGS(regs)                                                \
 do {                                                                         \
        if ((regs)->trap & 1)                                                 \
index 29852688ceaaae7f6f9c09cbc7e3f6350ee8170f..d225d99fe39d8f076ee637377a43692024c39232 100644 (file)
@@ -176,11 +176,14 @@ static void *is_devfn_node(struct device_node *dn, void *data)
  */
 struct device_node *fetch_dev_dn(struct pci_dev *dev)
 {
-       struct device_node *orig_dn = dev->dev.of_node;
+       struct pci_controller *phb = dev->sysdata;
        struct device_node *dn;
        unsigned long searchval = (dev->bus->number << 8) | dev->devfn;
 
-       dn = traverse_pci_devices(orig_dn, is_devfn_node, (void *)searchval);
+       if (WARN_ON(!phb))
+               return NULL;
+
+       dn = traverse_pci_devices(phb->dn, is_devfn_node, (void *)searchval);
        if (dn)
                dev->dev.of_node = dn;
        return dn;
index 9065369982911f19eab7ee34fa88209597cfbdeb..895b082f1e48bafe5c7826de6950edf14cff6d23 100644 (file)
@@ -229,12 +229,16 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
                   unsigned int pos, unsigned int count,
                   void *kbuf, void __user *ubuf)
 {
-       int ret;
+       int i, ret;
 
        if (target->thread.regs == NULL)
                return -EIO;
 
-       CHECK_FULL_REGS(target->thread.regs);
+       if (!FULL_REGS(target->thread.regs)) {
+               /* We have a partial register set.  Fill 14-31 with bogus values */
+               for (i = 14; i < 32; i++)
+                       target->thread.regs->gpr[i] = NV_REG_POISON;
+       }
 
        ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
                                  target->thread.regs,
@@ -641,11 +645,16 @@ static int gpr32_get(struct task_struct *target,
        compat_ulong_t *k = kbuf;
        compat_ulong_t __user *u = ubuf;
        compat_ulong_t reg;
+       int i;
 
        if (target->thread.regs == NULL)
                return -EIO;
 
-       CHECK_FULL_REGS(target->thread.regs);
+       if (!FULL_REGS(target->thread.regs)) {
+               /* We have a partial register set.  Fill 14-31 with bogus values */
+               for (i = 14; i < 32; i++)
+                       target->thread.regs->gpr[i] = NV_REG_POISON; 
+       }
 
        pos /= sizeof(reg);
        count /= sizeof(reg);
index eb7021815e2da0c28e6bdc85be746e7135acd415..0f7c6718d26107c37e819be52d9794bbe7b9e883 100644 (file)
@@ -147,6 +147,16 @@ static u32 mpic_infos[][MPIC_IDX_END] = {
 
 #endif /* CONFIG_MPIC_WEIRD */
 
+static inline unsigned int mpic_processor_id(struct mpic *mpic)
+{
+       unsigned int cpu = 0;
+
+       if (mpic->flags & MPIC_PRIMARY)
+               cpu = hard_smp_processor_id();
+
+       return cpu;
+}
+
 /*
  * Register accessor functions
  */
@@ -210,19 +220,14 @@ static inline void _mpic_ipi_write(struct mpic *mpic, unsigned int ipi, u32 valu
 
 static inline u32 _mpic_cpu_read(struct mpic *mpic, unsigned int reg)
 {
-       unsigned int cpu = 0;
+       unsigned int cpu = mpic_processor_id(mpic);
 
-       if (mpic->flags & MPIC_PRIMARY)
-               cpu = hard_smp_processor_id();
        return _mpic_read(mpic->reg_type, &mpic->cpuregs[cpu], reg);
 }
 
 static inline void _mpic_cpu_write(struct mpic *mpic, unsigned int reg, u32 value)
 {
-       unsigned int cpu = 0;
-
-       if (mpic->flags & MPIC_PRIMARY)
-               cpu = hard_smp_processor_id();
+       unsigned int cpu = mpic_processor_id(mpic);
 
        _mpic_write(mpic->reg_type, &mpic->cpuregs[cpu], reg, value);
 }
@@ -913,6 +918,20 @@ void mpic_set_vector(unsigned int virq, unsigned int vector)
        mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
 }
 
+void mpic_set_destination(unsigned int virq, unsigned int cpuid)
+{
+       struct mpic *mpic = mpic_from_irq(virq);
+       unsigned int src = mpic_irq_to_hw(virq);
+
+       DBG("mpic: set_destination(mpic:@%p,virq:%d,src:%d,cpuid:0x%x)\n",
+           mpic, virq, src, cpuid);
+
+       if (src >= mpic->irq_count)
+               return;
+
+       mpic_irq_write(src, MPIC_INFO(IRQ_DESTINATION), 1 << cpuid);
+}
+
 static struct irq_chip mpic_irq_chip = {
        .irq_mask       = mpic_mask_irq,
        .irq_unmask     = mpic_unmask_irq,
@@ -993,6 +1012,16 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
        /* Set default irq type */
        set_irq_type(virq, IRQ_TYPE_NONE);
 
+       /* If the MPIC was reset, then all vectors have already been
+        * initialized.  Otherwise, a per source lazy initialization
+        * is done here.
+        */
+       if (!mpic_is_ipi(mpic, hw) && (mpic->flags & MPIC_NO_RESET)) {
+               mpic_set_vector(virq, hw);
+               mpic_set_destination(virq, mpic_processor_id(mpic));
+               mpic_irq_set_priority(virq, 8);
+       }
+
        return 0;
 }
 
@@ -1040,6 +1069,11 @@ static struct irq_host_ops mpic_host_ops = {
        .xlate = mpic_host_xlate,
 };
 
+static int mpic_reset_prohibited(struct device_node *node)
+{
+       return node && of_get_property(node, "pic-no-reset", NULL);
+}
+
 /*
  * Exported functions
  */
@@ -1160,7 +1194,15 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
 
        /* Reset */
-       if (flags & MPIC_WANTS_RESET) {
+
+       /* When using a device-node, reset requests are only honored if the MPIC
+        * is allowed to reset.
+        */
+       if (mpic_reset_prohibited(node))
+               mpic->flags |= MPIC_NO_RESET;
+
+       if ((flags & MPIC_WANTS_RESET) && !(mpic->flags & MPIC_NO_RESET)) {
+               printk(KERN_DEBUG "mpic: Resetting\n");
                mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0),
                           mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0))
                           | MPIC_GREG_GCONF_RESET);
@@ -1320,22 +1362,21 @@ void __init mpic_init(struct mpic *mpic)
 
        mpic_pasemi_msi_init(mpic);
 
-       if (mpic->flags & MPIC_PRIMARY)
-               cpu = hard_smp_processor_id();
-       else
-               cpu = 0;
+       cpu = mpic_processor_id(mpic);
 
-       for (i = 0; i < mpic->num_sources; i++) {
-               /* start with vector = source number, and masked */
-               u32 vecpri = MPIC_VECPRI_MASK | i |
-                       (8 << MPIC_VECPRI_PRIORITY_SHIFT);
+       if (!(mpic->flags & MPIC_NO_RESET)) {
+               for (i = 0; i < mpic->num_sources; i++) {
+                       /* start with vector = source number, and masked */
+                       u32 vecpri = MPIC_VECPRI_MASK | i |
+                               (8 << MPIC_VECPRI_PRIORITY_SHIFT);
                
-               /* check if protected */
-               if (mpic->protected && test_bit(i, mpic->protected))
-                       continue;
-               /* init hw */
-               mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
-               mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
+                       /* check if protected */
+                       if (mpic->protected && test_bit(i, mpic->protected))
+                               continue;
+                       /* init hw */
+                       mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
+                       mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
+               }
        }
        
        /* Init spurious vector */
index 8800cf090694766b87b6a881f28a93d77346aec2..635d677d3281e31eedf36a240b2a886e2d2f50cc 100644 (file)
@@ -6,7 +6,7 @@ COMPILE_VERSION := __linux_compile_version_id__`hostname |  \
                        tr -c '[0-9A-Za-z]' '_'`__`date | \
                        tr -c '[0-9A-Za-z]' '_'`_t
 
-EXTRA_CFLAGS  := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I.
+ccflags-y  := -DCOMPILE_VERSION=$(COMPILE_VERSION) -gstabs -I.
 
 targets := image
 targets += bzImage
index e5221ec0b8e3eeb5b008aefb891841e795d98221..860d26514c08dce870a8810dee1ff1e2a676b719 100644 (file)
@@ -8,7 +8,7 @@
 
 common-objs = $(addprefix ../../../virt/kvm/, kvm_main.o)
 
-EXTRA_CFLAGS += -Ivirt/kvm -Iarch/s390/kvm
+ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
 
 kvm-objs := $(common-objs) kvm-s390.o sie64a.o intercept.o interrupt.o priv.o sigp.o diag.o
 obj-$(CONFIG_KVM) += kvm.o
index c84890341052ce7377fbcf9eb75e11436157dea6..51d399549f604cc2632c329ec1a9776862cc3623 100644 (file)
@@ -4,4 +4,4 @@
 
 obj-$(CONFIG_MATHEMU) := math.o
 
-EXTRA_CFLAGS := -I$(src) -Iinclude/math-emu -w
+ccflags-y := -I$(src) -Iinclude/math-emu -w
index cbf4801deaafc9c9bbb3cb11a3383c5e209a240d..eced3e3ebd30f5603b6a236d0bd7886e67d1ddf2 100644 (file)
@@ -13,4 +13,7 @@
 #define irq_canonicalize(irq)  (irq)
 
 extern void __init init_IRQ(void);
+
+#define NO_IRQ         0xffffffff
+
 #endif
index 4f09666f07984022543c39742231b499a5d085de..16dcae6d56e7a777b1c833bb8f6f16d57279271a 100644 (file)
@@ -97,4 +97,6 @@ extern void *softirq_stack[NR_CPUS];
 #define __ARCH_HAS_DO_SOFTIRQ
 #define ARCH_HAS_NMI_WATCHDOG
 
+#define NO_IRQ         0xffffffff
+
 #endif
index 03eb5a8f6f9363ccc55410e011328f843aa05474..2f475d7c0b53f7f127f5345a7bb1af7e81d9e8bc 100644 (file)
 #define __NR_fanotify_init     329
 #define __NR_fanotify_mark     330
 #define __NR_prlimit64         331
+#define __NR_name_to_handle_at 332
+#define __NR_open_by_handle_at 333
+#define __NR_clock_adjtime     334
 
-#define NR_syscalls            332
+#define NR_syscalls            335
 
 #ifdef __32bit_syscall_numbers__
 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
index 49ddff56cb04130ce1a84ccb0ed152ebf6516e9a..cb15bbf8a201478608672f85f55dc53f7b62247b 100644 (file)
@@ -22,6 +22,33 @@ unsigned int irq_of_parse_and_map(struct device_node *node, int index)
 }
 EXPORT_SYMBOL(irq_of_parse_and_map);
 
+int of_address_to_resource(struct device_node *node, int index,
+                          struct resource *r)
+{
+       struct platform_device *op = of_find_device_by_node(node);
+
+       if (!op || index >= op->num_resources)
+               return -EINVAL;
+
+       memcpy(r, &op->archdata.resource[index], sizeof(*r));
+       return 0;
+}
+EXPORT_SYMBOL_GPL(of_address_to_resource);
+
+void __iomem *of_iomap(struct device_node *node, int index)
+{
+       struct platform_device *op = of_find_device_by_node(node);
+       struct resource *r;
+
+       if (!op || index >= op->num_resources)
+               return NULL;
+
+       r = &op->archdata.resource[index];
+
+       return of_ioremap(r, 0, resource_size(r), (char *) r->name);
+}
+EXPORT_SYMBOL(of_iomap);
+
 /* Take the archdata values for IOMMU, STC, and HOSTDATA found in
  * BUS and propagate to all child platform_device objects.
  */
index ec396e1916b92e4560505175bcdee3b59b3fef49..4b86eaf04fe57ef4ed1aa632462325a0f3372c95 100644 (file)
@@ -83,5 +83,5 @@ sys_call_table:
 /*315*/        .long sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
 /*320*/        .long sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
 /*325*/        .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
-/*330*/        .long sys_fanotify_mark, sys_prlimit64
+/*330*/        .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
 
index 8cfcaa54958054535dcd376296c1f71f780cc147..0331bafdf3a30c9d33f8d4c45228c7407eb2828f 100644 (file)
@@ -84,7 +84,7 @@ sys_call_table32:
        .word compat_sys_timerfd_settime, compat_sys_timerfd_gettime, compat_sys_signalfd4, sys_eventfd2, sys_epoll_create1
 /*320*/        .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, compat_sys_preadv
        .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
-/*330*/        .word sys32_fanotify_mark, sys_prlimit64
+/*330*/        .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
 
 #endif /* CONFIG_COMPAT */
 
@@ -160,4 +160,4 @@ sys_call_table:
        .word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
 /*320*/        .word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
        .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
-/*330*/        .word sys_fanotify_mark, sys_prlimit64
+/*330*/        .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
index f02040d3614e25d06330ed5413b26aa87bcc53e7..46570211df5275766bdf8ef9284ab3edbb802f95 100644 (file)
@@ -202,32 +202,32 @@ static inline int *__futex_setup(int __user *v)
        return __atomic_hashed_lock((int __force *)v);
 }
 
-struct __get_user futex_set(int __user *v, int i)
+struct __get_user futex_set(u32 __user *v, int i)
 {
        return __atomic_xchg((int __force *)v, __futex_setup(v), i);
 }
 
-struct __get_user futex_add(int __user *v, int n)
+struct __get_user futex_add(u32 __user *v, int n)
 {
        return __atomic_xchg_add((int __force *)v, __futex_setup(v), n);
 }
 
-struct __get_user futex_or(int __user *v, int n)
+struct __get_user futex_or(u32 __user *v, int n)
 {
        return __atomic_or((int __force *)v, __futex_setup(v), n);
 }
 
-struct __get_user futex_andn(int __user *v, int n)
+struct __get_user futex_andn(u32 __user *v, int n)
 {
        return __atomic_andn((int __force *)v, __futex_setup(v), n);
 }
 
-struct __get_user futex_xor(int __user *v, int n)
+struct __get_user futex_xor(u32 __user *v, int n)
 {
        return __atomic_xor((int __force *)v, __futex_setup(v), n);
 }
 
-struct __get_user futex_cmpxchg(int __user *v, int o, int n)
+struct __get_user futex_cmpxchg(u32 __user *v, int o, int n)
 {
        return __atomic_cmpxchg((int __force *)v, __futex_setup(v), o, n);
 }
index b8bc844fd2c46d8d9316890068d6927622aaab46..20d363bd70041d1022dd57a8f40a5405655efa90 100644 (file)
@@ -6,7 +6,7 @@ OBJ = built-in.o
 OBJS = ptrace.o sigcontext.o checksum.o miscthings.o misc.o \
        ptrace_user.o sysrq.o
 
-EXTRA_AFLAGS := -DCONFIG_PPC32 -I. -I$(srctree)/arch/ppc/kernel
+asflags-y := -DCONFIG_PPC32 -I. -I$(srctree)/arch/ppc/kernel
 
 all: $(OBJ)
 
@@ -15,10 +15,10 @@ $(OBJ): $(OBJS)
        $(LD) $(LINKFLAGS) --start-group $^ --end-group -o $@
 
 ptrace_user.o: ptrace_user.c
-       $(CC) -D__KERNEL__ $(USER_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+       $(CC) -D__KERNEL__ $(USER_CFLAGS) $(ccflags-y) -c -o $@ $<
 
 sigcontext.o: sigcontext.c
-       $(CC) $(USER_CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+       $(CC) $(USER_CFLAGS) $(ccflags-y) -c -o $@ $<
 
 checksum.S:
        rm -f $@
@@ -53,13 +53,13 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
 checksum.o: checksum.S
        rm -f asm
        ln -s $(srctree)/include/asm-ppc asm
-       $(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
+       $(CC) $(asflags-y) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
        rm -f asm
 
 misc.o: misc.S ppc_defs.h
        rm -f asm
        ln -s $(srctree)/include/asm-ppc asm
-       $(CC) $(EXTRA_AFLAGS) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
+       $(CC) $(asflags-y) $(KBUILD_AFLAGS) -D__ASSEMBLY__ -D__UM_PPC__ -c $< -o $*.o
        rm -f asm
 
 clean-files := $(OBJS) ppc_defs.h checksum.S mk_defs.c
index 430312ba6e3f3b0b9cee93427feb69b18c9a5ab2..849a9d23c71d5c11080d92edbb705343879aa15e 100644 (file)
@@ -847,4 +847,5 @@ ia32_sys_call_table:
        .quad sys_name_to_handle_at
        .quad compat_sys_open_by_handle_at
        .quad compat_sys_clock_adjtime
+       .quad sys_syncfs
 ia32_syscall_end:
index ffaf183c619a21f30c24384f8aa9e106e496dfa2..a755ef5e5977540cd52b63e85374e8c4d03e7b8c 100644 (file)
 #define __NR_name_to_handle_at 341
 #define __NR_open_by_handle_at  342
 #define __NR_clock_adjtime     343
+#define __NR_syncfs             344
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 344
+#define NR_syscalls 345
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
index 5466bea670e7e3c14774c998fb0f90d089cb3d8a..160fa76bd5786e680da555ad96d8101a71edc99e 100644 (file)
@@ -675,6 +675,8 @@ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
 #define __NR_clock_adjtime                     305
 __SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
+#define __NR_syncfs                             306
+__SYSCALL(__NR_syncfs, sys_syncfs)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
index 5f181742e8f91c9510fbac2e0fd0ec7e12daf34d..abce34d5c79de0ce7e6275640a3470ccca9e1805 100644 (file)
@@ -343,3 +343,4 @@ ENTRY(sys_call_table)
        .long sys_name_to_handle_at
        .long sys_open_by_handle_at
        .long sys_clock_adjtime
+       .long sys_syncfs
index 40aa55b485be91747ebc401f5d5d4047ce71aa11..70fd1453e172abcd48c54e11b8fd0af278f3fe45 100644 (file)
@@ -14,7 +14,7 @@ HOSTFLAGS     += -Iarch/$(ARCH)/boot/include
 
 BIG_ENDIAN     := $(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#")
 
-export EXTRA_CFLAGS
+export ccflags-y
 export BIG_ENDIAN
 
 subdir-y       := lib
index d3d2aa2d883aa6e4d9abfc7571b7e3e5eadbc30f..ad8952e8a07f6d369192416d831917cd642f9075 100644 (file)
@@ -6,7 +6,7 @@ zlib    := inffast.c inflate.c inftrees.c
 
 lib-y  += $(zlib:.c=.o) zmem.o
 
-EXTRA_CFLAGS   += -Ilib/zlib_inflate
+ccflags-y      := -Ilib/zlib_inflate
 
 quiet_cmd_copy_zlib = COPY    $@
       cmd_copy_zlib = cat $< > $@
index 26b4fce217b6475ecb3e8a696cb82e4f9f0cccb6..efa6a82e543dc70aab8be26359e73fc46e5cd589 100644 (file)
@@ -9,7 +9,7 @@ obj-$(CONFIG_MWAVE) += mwave.o
 mwave-y := mwavedd.o smapi.o tp3780i.o 3780i.o
 
 # To have the mwave driver disable other uarts if necessary
-# EXTRA_CFLAGS += -DMWAVE_FUTZ_WITH_OTHER_DEVICES
+# ccflags-y := -DMWAVE_FUTZ_WITH_OTHER_DEVICES
 
 # To compile in lots (~20 KiB) of run-time enablable printk()s for debugging:
-ccflags-y := -DMW_TRACE
+ccflags-y += -DMW_TRACE
index 480251fc78e2865dd3d387e59074fcefbce77b12..c2a58f428bc84778c0ca3f09d372cbecc8b24191 100644 (file)
@@ -11,7 +11,7 @@ are not saved by the BIOS and so do not persist after unload and reload.
        0x0008 tp3780i tracing
 
         Tracing only occurs if the driver has been compiled with the
-        MW_TRACE macro #defined  (i.e. let EXTRA_CFLAGS += -DMW_TRACE
+        MW_TRACE macro #defined  (i.e. let ccflags-y := -DMW_TRACE
         in the Makefile).
 
   mwave_3780i_irq=5/7/10/11/15
index 64b21f5cd740fc5dfa1d5f09b1a944ed1f661440..1be065a62f8c6784a17a814d7cfcc632ac67b368 100644 (file)
@@ -1,9 +1,5 @@
-ifeq ($(CONFIG_DMADEVICES_DEBUG),y)
-       ccflags-y       += -DDEBUG
-endif
-ifeq ($(CONFIG_DMADEVICES_VDEBUG),y)
-       ccflags-y       += -DVERBOSE_DEBUG
-endif
+ccflags-$(CONFIG_DMADEVICES_DEBUG)  := -DDEBUG
+ccflags-$(CONFIG_DMADEVICES_VDEBUG) += -DVERBOSE_DEBUG
 
 obj-$(CONFIG_DMA_ENGINE) += dmaengine.o
 obj-$(CONFIG_NET_DMA) += iovlock.o
index 0c56989cd9073b4d0770a5ad4d15d11a907605c1..2be6f452077257bcd7d085eea00bfda70de86e54 100644 (file)
@@ -75,7 +75,8 @@ config FIREWIRE_NOSY
          The following cards are known to be based on PCILynx or PCILynx-2:
          IOI IOI-1394TT (PCI card), Unibrain Fireboard 400 PCI Lynx-2
          (PCI card), Newer Technology FireWire 2 Go (CardBus card),
-         Apple Power Mac G3 blue & white (onboard controller).
+         Apple Power Mac G3 blue & white and G4 with PCI graphics
+         (onboard controller).
 
          To compile this driver as a module, say M here:  The module will be
          called nosy.  Source code of a userspace interface to nosy, called
index 24ff35511e2b1b6a890e7fc9f9499e75c74459d1..3c44fbc81acba5758a38b77169dfe566c9b1cfd5 100644 (file)
@@ -75,6 +75,13 @@ static size_t config_rom_length = 1 + 4 + 1 + 1;
 #define BIB_IRMC               ((1) << 31)
 #define NODE_CAPABILITIES      0x0c0083c0 /* per IEEE 1394 clause 8.3.2.6.5.2 */
 
+/*
+ * IEEE-1394 specifies a default SPLIT_TIMEOUT value of 800 cycles (100 ms),
+ * but we have to make it longer because there are many devices whose firmware
+ * is just too slow for that.
+ */
+#define DEFAULT_SPLIT_TIMEOUT  (2 * 8000)
+
 #define CANON_OUI              0x000085
 
 static void generate_config_rom(struct fw_card *card, __be32 *config_rom)
@@ -233,7 +240,7 @@ static void br_work(struct work_struct *work)
 
        /* Delay for 2s after last reset per IEEE 1394 clause 8.2.1. */
        if (card->reset_jiffies != 0 &&
-           time_is_after_jiffies(card->reset_jiffies + 2 * HZ)) {
+           time_before64(get_jiffies_64(), card->reset_jiffies + 2 * HZ)) {
                if (!schedule_delayed_work(&card->br_work, 2 * HZ))
                        fw_card_put(card);
                return;
@@ -316,7 +323,8 @@ static void bm_work(struct work_struct *work)
        irm_id   = card->irm_node->node_id;
        local_id = card->local_node->node_id;
 
-       grace = time_after(jiffies, card->reset_jiffies + DIV_ROUND_UP(HZ, 8));
+       grace = time_after64(get_jiffies_64(),
+                            card->reset_jiffies + DIV_ROUND_UP(HZ, 8));
 
        if ((is_next_generation(generation, card->bm_generation) &&
             !card->bm_abdicate) ||
@@ -511,10 +519,11 @@ void fw_card_initialize(struct fw_card *card,
        card->device = device;
        card->current_tlabel = 0;
        card->tlabel_mask = 0;
-       card->split_timeout_hi = 0;
-       card->split_timeout_lo = 800 << 19;
-       card->split_timeout_cycles = 800;
-       card->split_timeout_jiffies = DIV_ROUND_UP(HZ, 10);
+       card->split_timeout_hi = DEFAULT_SPLIT_TIMEOUT / 8000;
+       card->split_timeout_lo = (DEFAULT_SPLIT_TIMEOUT % 8000) << 19;
+       card->split_timeout_cycles = DEFAULT_SPLIT_TIMEOUT;
+       card->split_timeout_jiffies =
+                       DIV_ROUND_UP(DEFAULT_SPLIT_TIMEOUT * HZ, 8000);
        card->color = 0;
        card->broadcast_channel = BROADCAST_CHANNEL_INITIAL;
 
index 48ae712e21018e64cca840b3e146b728bda72f99..62ac111af2432d4f8f0c3216be5bf724343e4ea8 100644 (file)
@@ -64,6 +64,7 @@ struct client {
        struct idr resource_idr;
        struct list_head event_list;
        wait_queue_head_t wait;
+       wait_queue_head_t tx_flush_wait;
        u64 bus_reset_closure;
 
        struct fw_iso_context *iso_context;
@@ -251,6 +252,7 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
        idr_init(&client->resource_idr);
        INIT_LIST_HEAD(&client->event_list);
        init_waitqueue_head(&client->wait);
+       init_waitqueue_head(&client->tx_flush_wait);
        INIT_LIST_HEAD(&client->phy_receiver_link);
        kref_init(&client->kref);
 
@@ -520,10 +522,6 @@ static int release_client_resource(struct client *client, u32 handle,
 static void release_transaction(struct client *client,
                                struct client_resource *resource)
 {
-       struct outbound_transaction_resource *r = container_of(resource,
-                       struct outbound_transaction_resource, resource);
-
-       fw_cancel_transaction(client->device->card, &r->transaction);
 }
 
 static void complete_transaction(struct fw_card *card, int rcode,
@@ -540,22 +538,9 @@ static void complete_transaction(struct fw_card *card, int rcode,
                memcpy(rsp->data, payload, rsp->length);
 
        spin_lock_irqsave(&client->lock, flags);
-       /*
-        * 1. If called while in shutdown, the idr tree must be left untouched.
-        *    The idr handle will be removed and the client reference will be
-        *    dropped later.
-        * 2. If the call chain was release_client_resource ->
-        *    release_transaction -> complete_transaction (instead of a normal
-        *    conclusion of the transaction), i.e. if this resource was already
-        *    unregistered from the idr, the client reference will be dropped
-        *    by release_client_resource and we must not drop it here.
-        */
-       if (!client->in_shutdown &&
-           idr_find(&client->resource_idr, e->r.resource.handle)) {
-               idr_remove(&client->resource_idr, e->r.resource.handle);
-               /* Drop the idr's reference */
-               client_put(client);
-       }
+       idr_remove(&client->resource_idr, e->r.resource.handle);
+       if (client->in_shutdown)
+               wake_up(&client->tx_flush_wait);
        spin_unlock_irqrestore(&client->lock, flags);
 
        rsp->type = FW_CDEV_EVENT_RESPONSE;
@@ -575,7 +560,7 @@ static void complete_transaction(struct fw_card *card, int rcode,
                queue_event(client, &e->event, rsp, sizeof(*rsp) + rsp->length,
                            NULL, 0);
 
-       /* Drop the transaction callback's reference */
+       /* Drop the idr's reference */
        client_put(client);
 }
 
@@ -614,9 +599,6 @@ static int init_request(struct client *client,
        if (ret < 0)
                goto failed;
 
-       /* Get a reference for the transaction callback */
-       client_get(client);
-
        fw_send_request(client->device->card, &e->r.transaction,
                        request->tcode, destination_id, request->generation,
                        speed, request->offset, e->response.data,
@@ -1223,7 +1205,8 @@ static void iso_resource_work(struct work_struct *work)
        todo = r->todo;
        /* Allow 1000ms grace period for other reallocations. */
        if (todo == ISO_RES_ALLOC &&
-           time_is_after_jiffies(client->device->card->reset_jiffies + HZ)) {
+           time_before64(get_jiffies_64(),
+                         client->device->card->reset_jiffies + HZ)) {
                schedule_iso_resource(r, DIV_ROUND_UP(HZ, 3));
                skip = true;
        } else {
@@ -1678,6 +1661,25 @@ static int fw_device_op_mmap(struct file *file, struct vm_area_struct *vma)
        return ret;
 }
 
+static int is_outbound_transaction_resource(int id, void *p, void *data)
+{
+       struct client_resource *resource = p;
+
+       return resource->release == release_transaction;
+}
+
+static int has_outbound_transactions(struct client *client)
+{
+       int ret;
+
+       spin_lock_irq(&client->lock);
+       ret = idr_for_each(&client->resource_idr,
+                          is_outbound_transaction_resource, NULL);
+       spin_unlock_irq(&client->lock);
+
+       return ret;
+}
+
 static int shutdown_resource(int id, void *p, void *data)
 {
        struct client_resource *resource = p;
@@ -1713,6 +1715,8 @@ static int fw_device_op_release(struct inode *inode, struct file *file)
        client->in_shutdown = true;
        spin_unlock_irq(&client->lock);
 
+       wait_event(client->tx_flush_wait, !has_outbound_transactions(client));
+
        idr_for_each(&client->resource_idr, shutdown_resource, client);
        idr_remove_all(&client->resource_idr);
        idr_destroy(&client->resource_idr);
index 6113b896e7901013d8564967e45edd5d8988c5d7..9a262439e3a7220aa8bd4712acb73dc99b63fb62 100644 (file)
@@ -747,7 +747,8 @@ static void fw_device_shutdown(struct work_struct *work)
                container_of(work, struct fw_device, work.work);
        int minor = MINOR(device->device.devt);
 
-       if (time_is_after_jiffies(device->card->reset_jiffies + SHUTDOWN_DELAY)
+       if (time_before64(get_jiffies_64(),
+                         device->card->reset_jiffies + SHUTDOWN_DELAY)
            && !list_empty(&device->card->link)) {
                schedule_delayed_work(&device->work, SHUTDOWN_DELAY);
                return;
@@ -954,8 +955,9 @@ static void fw_device_init(struct work_struct *work)
                        device->config_rom_retries++;
                        schedule_delayed_work(&device->work, RETRY_DELAY);
                } else {
-                       fw_notify("giving up on config rom for node id %x\n",
-                                 device->node_id);
+                       if (device->node->link_on)
+                               fw_notify("giving up on config rom for node id %x\n",
+                                         device->node_id);
                        if (device->node == device->card->root_node)
                                fw_schedule_bm_work(device->card, 0);
                        fw_device_release(&device->device);
@@ -1168,9 +1170,12 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
 
        switch (event) {
        case FW_NODE_CREATED:
-       case FW_NODE_LINK_ON:
-               if (!node->link_on)
-                       break;
+               /*
+                * Attempt to scan the node, regardless whether its self ID has
+                * the L (link active) flag set or not.  Some broken devices
+                * send L=0 but have an up-and-running link; others send L=1
+                * without actually having a link.
+                */
  create:
                device = kzalloc(sizeof(*device), GFP_ATOMIC);
                if (device == NULL)
@@ -1213,6 +1218,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
                break;
 
        case FW_NODE_INITIATED_RESET:
+       case FW_NODE_LINK_ON:
                device = node->data;
                if (device == NULL)
                        goto create;
@@ -1230,10 +1236,10 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event)
                break;
 
        case FW_NODE_UPDATED:
-               if (!node->link_on || node->data == NULL)
+               device = node->data;
+               if (device == NULL)
                        break;
 
-               device = node->data;
                device->node_id = node->node_id;
                smp_wmb();  /* update node_id before generation */
                device->generation = card->generation;
index c8658888e67bac701df8cf603b52220f5d219009..481056df9268db5cb51979c83a337715c7c6fb42 100644 (file)
@@ -235,45 +235,45 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation,
 static int manage_channel(struct fw_card *card, int irm_id, int generation,
                u32 channels_mask, u64 offset, bool allocate, __be32 data[2])
 {
-       __be32 c, all, old;
-       int i, ret = -EIO, retry = 5;
+       __be32 bit, all, old;
+       int channel, ret = -EIO, retry = 5;
 
        old = all = allocate ? cpu_to_be32(~0) : 0;
 
-       for (i = 0; i < 32; i++) {
-               if (!(channels_mask & 1 << i))
+       for (channel = 0; channel < 32; channel++) {
+               if (!(channels_mask & 1 << channel))
                        continue;
 
                ret = -EBUSY;
 
-               c = cpu_to_be32(1 << (31 - i));
-               if ((old & c) != (all & c))
+               bit = cpu_to_be32(1 << (31 - channel));
+               if ((old & bit) != (all & bit))
                        continue;
 
                data[0] = old;
-               data[1] = old ^ c;
+               data[1] = old ^ bit;
                switch (fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP,
                                           irm_id, generation, SCODE_100,
                                           offset, data, 8)) {
                case RCODE_GENERATION:
                        /* A generation change frees all channels. */
-                       return allocate ? -EAGAIN : i;
+                       return allocate ? -EAGAIN : channel;
 
                case RCODE_COMPLETE:
                        if (data[0] == old)
-                               return i;
+                               return channel;
 
                        old = data[0];
 
                        /* Is the IRM 1394a-2000 compliant? */
-                       if ((data[0] & c) == (data[1] & c))
+                       if ((data[0] & bit) == (data[1] & bit))
                                continue;
 
                        /* 1394-1995 IRM, fall through to retry. */
                default:
                        if (retry) {
                                retry--;
-                               i--;
+                               channel--;
                        } else {
                                ret = -EIO;
                        }
index 09be1a635505c4737283f595ef8c5ab70fffb631..193ed9233144b458a486dfd13f7217037522efc9 100644 (file)
@@ -545,7 +545,7 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
         */
        smp_wmb();
        card->generation = generation;
-       card->reset_jiffies = jiffies;
+       card->reset_jiffies = get_jiffies_64();
        card->bm_node_id  = 0xffff;
        card->bm_abdicate = bm_abdicate;
        fw_schedule_bm_work(card, 0);
index bd3c61b6dd8d5a76cab9f6380fd4e4a08e959ed6..f903d7b6f34a92bca580b5ed01cf422c9a8caf7c 100644 (file)
@@ -208,9 +208,11 @@ struct fw_ohci {
        struct context at_request_ctx;
        struct context at_response_ctx;
 
+       u32 it_context_support;
        u32 it_context_mask;     /* unoccupied IT contexts */
        struct iso_context *it_context_list;
        u64 ir_context_channels; /* unoccupied channels */
+       u32 ir_context_support;
        u32 ir_context_mask;     /* unoccupied IR contexts */
        struct iso_context *ir_context_list;
        u64 mc_channels; /* channels in use by the multichannel IR context */
@@ -338,7 +340,7 @@ static void log_irqs(u32 evt)
            !(evt & OHCI1394_busReset))
                return;
 
-       fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
+       fw_notify("IRQ %08x%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", evt,
            evt & OHCI1394_selfIDComplete       ? " selfID"             : "",
            evt & OHCI1394_RQPkt                ? " AR_req"             : "",
            evt & OHCI1394_RSPkt                ? " AR_resp"            : "",
@@ -351,6 +353,7 @@ static void log_irqs(u32 evt)
            evt & OHCI1394_cycle64Seconds       ? " cycle64Seconds"     : "",
            evt & OHCI1394_cycleInconsistent    ? " cycleInconsistent"  : "",
            evt & OHCI1394_regAccessFail        ? " regAccessFail"      : "",
+           evt & OHCI1394_unrecoverableError   ? " unrecoverableError" : "",
            evt & OHCI1394_busReset             ? " busReset"           : "",
            evt & ~(OHCI1394_selfIDComplete | OHCI1394_RQPkt |
                    OHCI1394_RSPkt | OHCI1394_reqTxComplete |
@@ -1326,21 +1329,8 @@ static int at_context_queue_packet(struct context *ctx,
                                     DESCRIPTOR_IRQ_ALWAYS |
                                     DESCRIPTOR_BRANCH_ALWAYS);
 
-       /*
-        * If the controller and packet generations don't match, we need to
-        * bail out and try again.  If IntEvent.busReset is set, the AT context
-        * is halted, so appending to the context and trying to run it is
-        * futile.  Most controllers do the right thing and just flush the AT
-        * queue (per section 7.2.3.2 of the OHCI 1.1 specification), but
-        * some controllers (like a JMicron JMB381 PCI-e) misbehave and wind
-        * up stalling out.  So we just bail out in software and try again
-        * later, and everyone is happy.
-        * FIXME: Test of IntEvent.busReset may no longer be necessary since we
-        *        flush AT queues in bus_reset_tasklet.
-        * FIXME: Document how the locking works.
-        */
-       if (ohci->generation != packet->generation ||
-           reg_read(ohci, OHCI1394_IntEventSet) & OHCI1394_busReset) {
+       /* FIXME: Document how the locking works. */
+       if (ohci->generation != packet->generation) {
                if (packet->payload_mapped)
                        dma_unmap_single(ohci->card.device, payload_bus,
                                         packet->payload_length, DMA_TO_DEVICE);
@@ -1590,6 +1580,47 @@ static void at_context_transmit(struct context *ctx, struct fw_packet *packet)
 
 }
 
+static void detect_dead_context(struct fw_ohci *ohci,
+                               const char *name, unsigned int regs)
+{
+       u32 ctl;
+
+       ctl = reg_read(ohci, CONTROL_SET(regs));
+       if (ctl & CONTEXT_DEAD) {
+#ifdef CONFIG_FIREWIRE_OHCI_DEBUG
+               fw_error("DMA context %s has stopped, error code: %s\n",
+                        name, evts[ctl & 0x1f]);
+#else
+               fw_error("DMA context %s has stopped, error code: %#x\n",
+                        name, ctl & 0x1f);
+#endif
+       }
+}
+
+static void handle_dead_contexts(struct fw_ohci *ohci)
+{
+       unsigned int i;
+       char name[8];
+
+       detect_dead_context(ohci, "ATReq", OHCI1394_AsReqTrContextBase);
+       detect_dead_context(ohci, "ATRsp", OHCI1394_AsRspTrContextBase);
+       detect_dead_context(ohci, "ARReq", OHCI1394_AsReqRcvContextBase);
+       detect_dead_context(ohci, "ARRsp", OHCI1394_AsRspRcvContextBase);
+       for (i = 0; i < 32; ++i) {
+               if (!(ohci->it_context_support & (1 << i)))
+                       continue;
+               sprintf(name, "IT%u", i);
+               detect_dead_context(ohci, name, OHCI1394_IsoXmitContextBase(i));
+       }
+       for (i = 0; i < 32; ++i) {
+               if (!(ohci->ir_context_support & (1 << i)))
+                       continue;
+               sprintf(name, "IR%u", i);
+               detect_dead_context(ohci, name, OHCI1394_IsoRcvContextBase(i));
+       }
+       /* TODO: maybe try to flush and restart the dead contexts */
+}
+
 static u32 cycle_timer_ticks(u32 cycle_timer)
 {
        u32 ticks;
@@ -1904,6 +1935,9 @@ static irqreturn_t irq_handler(int irq, void *data)
                        fw_notify("isochronous cycle inconsistent\n");
        }
 
+       if (unlikely(event & OHCI1394_unrecoverableError))
+               handle_dead_contexts(ohci);
+
        if (event & OHCI1394_cycle64Seconds) {
                spin_lock(&ohci->lock);
                update_bus_time(ohci);
@@ -2141,7 +2175,9 @@ static int ohci_enable(struct fw_card *card,
                OHCI1394_selfIDComplete |
                OHCI1394_regAccessFail |
                OHCI1394_cycle64Seconds |
-               OHCI1394_cycleInconsistent | OHCI1394_cycleTooLong |
+               OHCI1394_cycleInconsistent |
+               OHCI1394_unrecoverableError |
+               OHCI1394_cycleTooLong |
                OHCI1394_masterIntEnable;
        if (param_debug & OHCI_PARAM_DEBUG_BUSRESETS)
                irqs |= OHCI1394_busReset;
@@ -2657,6 +2693,10 @@ static int ohci_start_iso(struct fw_iso_context *base,
        u32 control = IR_CONTEXT_ISOCH_HEADER, match;
        int index;
 
+       /* the controller cannot start without any queued packets */
+       if (ctx->context.last->branch_address == 0)
+               return -ENODATA;
+
        switch (ctx->base.type) {
        case FW_ISO_CONTEXT_TRANSMIT:
                index = ctx - ohci->it_context_list;
@@ -2715,6 +2755,7 @@ static int ohci_stop_iso(struct fw_iso_context *base)
        }
        flush_writes(ohci);
        context_stop(&ctx->context);
+       tasklet_kill(&ctx->context.tasklet);
 
        return 0;
 }
@@ -3207,15 +3248,17 @@ static int __devinit pci_probe(struct pci_dev *dev,
 
        reg_write(ohci, OHCI1394_IsoRecvIntMaskSet, ~0);
        ohci->ir_context_channels = ~0ULL;
-       ohci->ir_context_mask = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet);
+       ohci->ir_context_support = reg_read(ohci, OHCI1394_IsoRecvIntMaskSet);
        reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, ~0);
+       ohci->ir_context_mask = ohci->ir_context_support;
        ohci->n_ir = hweight32(ohci->ir_context_mask);
        size = sizeof(struct iso_context) * ohci->n_ir;
        ohci->ir_context_list = kzalloc(size, GFP_KERNEL);
 
        reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, ~0);
-       ohci->it_context_mask = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
+       ohci->it_context_support = reg_read(ohci, OHCI1394_IsoXmitIntMaskSet);
        reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, ~0);
+       ohci->it_context_mask = ohci->it_context_support;
        ohci->n_it = hweight32(ohci->it_context_mask);
        size = sizeof(struct iso_context) * ohci->n_it;
        ohci->it_context_list = kzalloc(size, GFP_KERNEL);
@@ -3266,7 +3309,7 @@ static int __devinit pci_probe(struct pci_dev *dev,
  fail_disable:
        pci_disable_device(dev);
  fail_free:
-       kfree(&ohci->card);
+       kfree(ohci);
        pmac_ohci_off(dev);
  fail:
        if (err == -ENOMEM)
@@ -3310,7 +3353,7 @@ static void pci_remove(struct pci_dev *dev)
        pci_iounmap(dev, ohci->registers);
        pci_release_region(dev, 0);
        pci_disable_device(dev);
-       kfree(&ohci->card);
+       kfree(ohci);
        pmac_ohci_off(dev);
 
        fw_notify("Removed fw-ohci device.\n");
index afa576a75a8ed443273d4722c03edc2bb8c31720..77ed589b360d7dce2d7567685fa032f96f40ed54 100644 (file)
@@ -472,18 +472,12 @@ static void complete_transaction(struct fw_card *card, int rcode,
         * So this callback only sets the rcode if it hasn't already
         * been set and only does the cleanup if the transaction
         * failed and we didn't already get a status write.
-        *
-        * Here we treat RCODE_CANCELLED like RCODE_COMPLETE because some
-        * OXUF936QSE firmwares occasionally respond after Split_Timeout and
-        * complete the ORB just fine.  Note, we also get RCODE_CANCELLED
-        * from sbp2_cancel_orbs() if fw_cancel_transaction() == 0.
         */
        spin_lock_irqsave(&card->lock, flags);
 
        if (orb->rcode == -1)
                orb->rcode = rcode;
-
-       if (orb->rcode != RCODE_COMPLETE && orb->rcode != RCODE_CANCELLED) {
+       if (orb->rcode != RCODE_COMPLETE) {
                list_del(&orb->link);
                spin_unlock_irqrestore(&card->lock, flags);
 
@@ -532,7 +526,8 @@ static int sbp2_cancel_orbs(struct sbp2_logical_unit *lu)
 
        list_for_each_entry_safe(orb, next, &list, link) {
                retval = 0;
-               fw_cancel_transaction(device->card, &orb->t);
+               if (fw_cancel_transaction(device->card, &orb->t) == 0)
+                       continue;
 
                orb->rcode = RCODE_CANCELLED;
                orb->callback(orb, NULL);
index 1bfb4439e4e1cb34fa4cb31a71eaf9a7db024071..e4bd13b3cd8b7e21dfeb3bb61b4762ba275033ba 100644 (file)
@@ -521,7 +521,7 @@ config SENSORS_LM75
                - Dallas Semiconductor DS75 and DS1775
                - Maxim MAX6625 and MAX6626
                - Microchip MCP980x
-               - National Semiconductor LM75
+               - National Semiconductor LM75, LM75A
                - NXP's LM75A
                - ST Microelectronics STDS75
                - TelCom (now Microchip) TCN75
@@ -959,6 +959,25 @@ config SENSORS_SMSC47B397
          This driver can also be built as a module.  If so, the module
          will be called smsc47b397.
 
+config SENSORS_SCH5627
+       tristate "SMSC SCH5627"
+       help
+         If you say yes here you get support for the hardware monitoring
+         features of the SMSC SCH5627 Super-I/O chip.
+
+         This driver can also be built as a module.  If so, the module
+         will be called sch5627.
+
+config SENSORS_ADS1015
+       tristate "Texas Instruments ADS1015"
+       depends on I2C
+       help
+         If you say yes here you get support for Texas Instruments ADS1015
+         12-bit 4-input ADC device.
+
+         This driver can also be built as a module.  If so, the module
+         will be called ads1015.
+
 config SENSORS_ADS7828
        tristate "Texas Instruments ADS7828"
        depends on I2C
@@ -1215,40 +1234,6 @@ config SENSORS_ULTRA45
          This driver provides support for the Ultra45 workstation environmental
          sensors.
 
-config SENSORS_LIS3_SPI
-       tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)"
-       depends on !ACPI && SPI_MASTER && INPUT
-       select INPUT_POLLDEV
-       default n
-       help
-         This driver provides support for the LIS3LV02Dx accelerometer connected
-         via SPI. The accelerometer data is readable via
-         /sys/devices/platform/lis3lv02d.
-
-         This driver also provides an absolute input class device, allowing
-         the laptop to act as a pinball machine-esque joystick.
-
-         This driver can also be built as modules.  If so, the core module
-         will be called lis3lv02d and a specific module for the SPI transport
-         is called lis3lv02d_spi.
-
-config SENSORS_LIS3_I2C
-       tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (I2C)"
-       depends on I2C && INPUT
-       select INPUT_POLLDEV
-       default n
-       help
-         This driver provides support for the LIS3LV02Dx accelerometer connected
-         via I2C. The accelerometer data is readable via
-         /sys/devices/platform/lis3lv02d.
-
-         This driver also provides an absolute input class device, allowing
-         the device to act as a pinball machine-esque joystick.
-
-         This driver can also be built as modules.  If so, the core module
-         will be called lis3lv02d and a specific module for the I2C transport
-         is called lis3lv02d_i2c.
-
 config SENSORS_APPLESMC
        tristate "Apple SMC (Motion sensor, light sensor, keyboard backlight)"
        depends on INPUT && X86
@@ -1296,36 +1281,6 @@ config SENSORS_ATK0110
          This driver can also be built as a module. If so, the module
          will be called asus_atk0110.
 
-config SENSORS_LIS3LV02D
-       tristate "STMicroeletronics LIS3* three-axis digital accelerometer"
-       depends on INPUT
-       select INPUT_POLLDEV
-       select NEW_LEDS
-       select LEDS_CLASS
-       default n
-       help
-         This driver provides support for the LIS3* accelerometers, such as the
-         LIS3LV02DL or the LIS331DL. In particular, it can be found in a number
-         of HP laptops, which have the "Mobile Data Protection System 3D" or
-         "3D DriveGuard" feature. On such systems the driver should load
-         automatically (via ACPI alias). The accelerometer might also be found
-         in other systems, connected via SPI or I2C. The accelerometer data is
-         readable via /sys/devices/platform/lis3lv02d.
-
-         This driver also provides an absolute input class device, allowing
-         a laptop to act as a pinball machine-esque joystick. It provides also
-         a misc device which can be used to detect free-fall. On HP laptops,
-         if the led infrastructure is activated, support for a led indicating
-         disk protection will be provided as hp::hddprotect. For more
-         information on the feature, refer to Documentation/hwmon/lis3lv02d.
-
-         This driver can also be built as modules.  If so, the core module
-         will be called lis3lv02d and a specific module for HP laptops will be
-         called hp_accel.
-
-         Say Y here if you have an applicable laptop and want to experience
-         the awesome power of lis3lv02d.
-
 endif # ACPI
 
 endif # HWMON
index bd0410e4b44f2fdbf39769a305291362c120bb35..54ca5939d028e1e40f7e4f7511b07055741c6486 100644 (file)
@@ -29,6 +29,7 @@ obj-$(CONFIG_SENSORS_ADM1026) += adm1026.o
 obj-$(CONFIG_SENSORS_ADM1029)  += adm1029.o
 obj-$(CONFIG_SENSORS_ADM1031)  += adm1031.o
 obj-$(CONFIG_SENSORS_ADM9240)  += adm9240.o
+obj-$(CONFIG_SENSORS_ADS1015)  += ads1015.o
 obj-$(CONFIG_SENSORS_ADS7828)  += ads7828.o
 obj-$(CONFIG_SENSORS_ADS7871)  += ads7871.o
 obj-$(CONFIG_SENSORS_ADT7411)  += adt7411.o
@@ -63,9 +64,6 @@ obj-$(CONFIG_SENSORS_JZ4740)  += jz4740-hwmon.o
 obj-$(CONFIG_SENSORS_K8TEMP)   += k8temp.o
 obj-$(CONFIG_SENSORS_K10TEMP)  += k10temp.o
 obj-$(CONFIG_SENSORS_LINEAGE)  += lineage-pem.o
-obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o hp_accel.o
-obj-$(CONFIG_SENSORS_LIS3_SPI) += lis3lv02d.o lis3lv02d_spi.o
-obj-$(CONFIG_SENSORS_LIS3_I2C) += lis3lv02d.o lis3lv02d_i2c.o
 obj-$(CONFIG_SENSORS_LM63)     += lm63.o
 obj-$(CONFIG_SENSORS_LM70)     += lm70.o
 obj-$(CONFIG_SENSORS_LM73)     += lm73.o
@@ -93,6 +91,7 @@ obj-$(CONFIG_SENSORS_PC87360) += pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)  += pc87427.o
 obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
 obj-$(CONFIG_SENSORS_S3C)      += s3c-hwmon.o
+obj-$(CONFIG_SENSORS_SCH5627)  += sch5627.o
 obj-$(CONFIG_SENSORS_SHT15)    += sht15.o
 obj-$(CONFIG_SENSORS_SHT21)    += sht21.o
 obj-$(CONFIG_SENSORS_SIS5595)  += sis5595.o
@@ -122,7 +121,5 @@ obj-$(CONFIG_SENSORS_MAX16064)      += max16064.o
 obj-$(CONFIG_SENSORS_MAX34440) += max34440.o
 obj-$(CONFIG_SENSORS_MAX8688)  += max8688.o
 
-ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
 
index 8f07a9dda15216073df1cd937f68d33787e71306..0e05aa179eaa09c1c52763be60a84d1d41d3d3db 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    abituguru.c Copyright (c) 2005-2006 Hans de Goede <j.w.r.degoede@hhs.nl>
+    abituguru.c Copyright (c) 2005-2006 Hans de Goede <hdegoede@redhat.com>
 
     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
@@ -1505,7 +1505,7 @@ static void __exit abituguru_exit(void)
        platform_driver_unregister(&abituguru_driver);
 }
 
-MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
 MODULE_DESCRIPTION("Abit uGuru Sensor device");
 MODULE_LICENSE("GPL");
 
index 48d21e22e9302a66e2d8b467ea5c42532875514e..034cebfcd273cec998779f3c50b5da473f696d1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
     abituguru3.c
 
-    Copyright (c) 2006-2008 Hans de Goede <j.w.r.degoede@hhs.nl>
+    Copyright (c) 2006-2008 Hans de Goede <hdegoede@redhat.com>
     Copyright (c) 2008 Alistair John Strachan <alistair@devzero.co.uk>
 
     This program is free software; you can redistribute it and/or modify
@@ -1266,7 +1266,7 @@ static void __exit abituguru3_exit(void)
        platform_driver_unregister(&abituguru3_driver);
 }
 
-MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
 MODULE_DESCRIPTION("Abit uGuru3 Sensor device");
 MODULE_LICENSE("GPL");
 
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
new file mode 100644 (file)
index 0000000..e9beeda
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * ads1015.c - lm_sensors driver for ads1015 12-bit 4-input ADC
+ * (C) Copyright 2010
+ * Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.de>
+ *
+ * Based on the ads7828 driver by Steve Hardy.
+ *
+ * Datasheet available at: http://focus.ti.com/lit/ds/symlink/ads1015.pdf
+ *
+ * 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.
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/of.h>
+
+#include <linux/i2c/ads1015.h>
+
+/* ADS1015 registers */
+enum {
+       ADS1015_CONVERSION = 0,
+       ADS1015_CONFIG = 1,
+};
+
+/* PGA fullscale voltages in mV */
+static const unsigned int fullscale_table[8] = {
+       6144, 4096, 2048, 1024, 512, 256, 256, 256 };
+
+/* Data rates in samples per second */
+static const unsigned int data_rate_table[8] = {
+       128, 250, 490, 920, 1600, 2400, 3300, 3300 };
+
+#define ADS1015_DEFAULT_CHANNELS 0xff
+#define ADS1015_DEFAULT_PGA 2
+#define ADS1015_DEFAULT_DATA_RATE 4
+
+struct ads1015_data {
+       struct device *hwmon_dev;
+       struct mutex update_lock; /* mutex protect updates */
+       struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
+};
+
+static s32 ads1015_read_reg(struct i2c_client *client, unsigned int reg)
+{
+       s32 data = i2c_smbus_read_word_data(client, reg);
+
+       return (data < 0) ? data : swab16(data);
+}
+
+static s32 ads1015_write_reg(struct i2c_client *client, unsigned int reg,
+                            u16 val)
+{
+       return i2c_smbus_write_word_data(client, reg, swab16(val));
+}
+
+static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
+                             int *value)
+{
+       u16 config;
+       s16 conversion;
+       struct ads1015_data *data = i2c_get_clientdata(client);
+       unsigned int pga = data->channel_data[channel].pga;
+       int fullscale;
+       unsigned int data_rate = data->channel_data[channel].data_rate;
+       unsigned int conversion_time_ms;
+       int res;
+
+       mutex_lock(&data->update_lock);
+
+       /* get channel parameters */
+       res = ads1015_read_reg(client, ADS1015_CONFIG);
+       if (res < 0)
+               goto err_unlock;
+       config = res;
+       fullscale = fullscale_table[pga];
+       conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]);
+
+       /* setup and start single conversion */
+       config &= 0x001f;
+       config |= (1 << 15) | (1 << 8);
+       config |= (channel & 0x0007) << 12;
+       config |= (pga & 0x0007) << 9;
+       config |= (data_rate & 0x0007) << 5;
+
+       res = ads1015_write_reg(client, ADS1015_CONFIG, config);
+       if (res < 0)
+               goto err_unlock;
+
+       /* wait until conversion finished */
+       msleep(conversion_time_ms);
+       res = ads1015_read_reg(client, ADS1015_CONFIG);
+       if (res < 0)
+               goto err_unlock;
+       config = res;
+       if (!(config & (1 << 15))) {
+               /* conversion not finished in time */
+               res = -EIO;
+               goto err_unlock;
+       }
+
+       res = ads1015_read_reg(client, ADS1015_CONVERSION);
+       if (res < 0)
+               goto err_unlock;
+       conversion = res;
+
+       mutex_unlock(&data->update_lock);
+
+       *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0);
+
+       return 0;
+
+err_unlock:
+       mutex_unlock(&data->update_lock);
+       return res;
+}
+
+/* sysfs callback function */
+static ssize_t show_in(struct device *dev, struct device_attribute *da,
+       char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
+       struct i2c_client *client = to_i2c_client(dev);
+       int in;
+       int res;
+
+       res = ads1015_read_value(client, attr->index, &in);
+
+       return (res < 0) ? res : sprintf(buf, "%d\n", in);
+}
+
+static const struct sensor_device_attribute ads1015_in[] = {
+       SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0),
+       SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1),
+       SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2),
+       SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3),
+       SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4),
+       SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5),
+       SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6),
+       SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7),
+};
+
+/*
+ * Driver interface
+ */
+
+static int ads1015_remove(struct i2c_client *client)
+{
+       struct ads1015_data *data = i2c_get_clientdata(client);
+       int k;
+
+       hwmon_device_unregister(data->hwmon_dev);
+       for (k = 0; k < ADS1015_CHANNELS; ++k)
+               device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
+       kfree(data);
+       return 0;
+}
+
+#ifdef CONFIG_OF
+static int ads1015_get_channels_config_of(struct i2c_client *client)
+{
+       struct ads1015_data *data = i2c_get_clientdata(client);
+       struct device_node *node;
+
+       if (!client->dev.of_node
+           || !of_get_next_child(client->dev.of_node, NULL))
+               return -EINVAL;
+
+       for_each_child_of_node(client->dev.of_node, node) {
+               const __be32 *property;
+               int len;
+               unsigned int channel;
+               unsigned int pga = ADS1015_DEFAULT_PGA;
+               unsigned int data_rate = ADS1015_DEFAULT_DATA_RATE;
+
+               property = of_get_property(node, "reg", &len);
+               if (!property || len != sizeof(int)) {
+                       dev_err(&client->dev, "invalid reg on %s\n",
+                               node->full_name);
+                       continue;
+               }
+
+               channel = be32_to_cpup(property);
+               if (channel > ADS1015_CHANNELS) {
+                       dev_err(&client->dev,
+                               "invalid channel index %d on %s\n",
+                               channel, node->full_name);
+                       continue;
+               }
+
+               property = of_get_property(node, "ti,gain", &len);
+               if (property && len == sizeof(int)) {
+                       pga = be32_to_cpup(property);
+                       if (pga > 6) {
+                               dev_err(&client->dev,
+                                       "invalid gain on %s\n",
+                                       node->full_name);
+                       }
+               }
+
+               property = of_get_property(node, "ti,datarate", &len);
+               if (property && len == sizeof(int)) {
+                       data_rate = be32_to_cpup(property);
+                       if (data_rate > 7) {
+                               dev_err(&client->dev,
+                                       "invalid data_rate on %s\n",
+                                       node->full_name);
+                       }
+               }
+
+               data->channel_data[channel].enabled = true;
+               data->channel_data[channel].pga = pga;
+               data->channel_data[channel].data_rate = data_rate;
+       }
+
+       return 0;
+}
+#endif
+
+static void ads1015_get_channels_config(struct i2c_client *client)
+{
+       unsigned int k;
+       struct ads1015_data *data = i2c_get_clientdata(client);
+       struct ads1015_platform_data *pdata = dev_get_platdata(&client->dev);
+
+       /* prefer platform data */
+       if (pdata) {
+               memcpy(data->channel_data, pdata->channel_data,
+                      sizeof(data->channel_data));
+               return;
+       }
+
+#ifdef CONFIG_OF
+       if (!ads1015_get_channels_config_of(client))
+               return;
+#endif
+
+       /* fallback on default configuration */
+       for (k = 0; k < ADS1015_CHANNELS; ++k) {
+               data->channel_data[k].enabled = true;
+               data->channel_data[k].pga = ADS1015_DEFAULT_PGA;
+               data->channel_data[k].data_rate = ADS1015_DEFAULT_DATA_RATE;
+       }
+}
+
+static int ads1015_probe(struct i2c_client *client,
+                        const struct i2c_device_id *id)
+{
+       struct ads1015_data *data;
+       int err;
+       unsigned int k;
+
+       data = kzalloc(sizeof(struct ads1015_data), GFP_KERNEL);
+       if (!data) {
+               err = -ENOMEM;
+               goto exit;
+       }
+
+       i2c_set_clientdata(client, data);
+       mutex_init(&data->update_lock);
+
+       /* build sysfs attribute group */
+       ads1015_get_channels_config(client);
+       for (k = 0; k < ADS1015_CHANNELS; ++k) {
+               if (!data->channel_data[k].enabled)
+                       continue;
+               err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
+               if (err)
+                       goto exit_free;
+       }
+
+       data->hwmon_dev = hwmon_device_register(&client->dev);
+       if (IS_ERR(data->hwmon_dev)) {
+               err = PTR_ERR(data->hwmon_dev);
+               goto exit_remove;
+       }
+
+       return 0;
+
+exit_remove:
+       for (k = 0; k < ADS1015_CHANNELS; ++k)
+               device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
+exit_free:
+       kfree(data);
+exit:
+       return err;
+}
+
+static const struct i2c_device_id ads1015_id[] = {
+       { "ads1015", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, ads1015_id);
+
+static struct i2c_driver ads1015_driver = {
+       .driver = {
+               .name = "ads1015",
+       },
+       .probe = ads1015_probe,
+       .remove = ads1015_remove,
+       .id_table = ads1015_id,
+};
+
+static int __init sensors_ads1015_init(void)
+{
+       return i2c_add_driver(&ads1015_driver);
+}
+
+static void __exit sensors_ads1015_exit(void)
+{
+       i2c_del_driver(&ads1015_driver);
+}
+
+MODULE_AUTHOR("Dirk Eibach <eibach@gdsys.de>");
+MODULE_DESCRIPTION("ADS1015 driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_ads1015_init);
+module_exit(sensors_ads1015_exit);
index f36eb80d227fa27c2e5d2a547465ba7f25ecc132..ef902d5d06ab9f98e610f63ed0ee709eb0f66b87 100644 (file)
@@ -232,13 +232,16 @@ static const struct i2c_device_id lm75_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, lm75_ids);
 
+#define LM75A_ID 0xA1
+
 /* Return 0 if detection is successful, -ENODEV otherwise */
 static int lm75_detect(struct i2c_client *new_client,
                       struct i2c_board_info *info)
 {
        struct i2c_adapter *adapter = new_client->adapter;
        int i;
-       int cur, conf, hyst, os;
+       int conf, hyst, os;
+       bool is_lm75a = 0;
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
                                     I2C_FUNC_SMBUS_WORD_DATA))
@@ -250,37 +253,58 @@ static int lm75_detect(struct i2c_client *new_client,
           addresses 0x04-0x07 returning the last read value.
           The cycling+unused addresses combination is not tested,
           since it would significantly slow the detection down and would
-          hardly add any value. */
+          hardly add any value.
 
-       /* Unused addresses */
-       cur = i2c_smbus_read_word_data(new_client, 0);
-       conf = i2c_smbus_read_byte_data(new_client, 1);
-       hyst = i2c_smbus_read_word_data(new_client, 2);
-       if (i2c_smbus_read_word_data(new_client, 4) != hyst
-        || i2c_smbus_read_word_data(new_client, 5) != hyst
-        || i2c_smbus_read_word_data(new_client, 6) != hyst
-        || i2c_smbus_read_word_data(new_client, 7) != hyst)
-               return -ENODEV;
-       os = i2c_smbus_read_word_data(new_client, 3);
-       if (i2c_smbus_read_word_data(new_client, 4) != os
-        || i2c_smbus_read_word_data(new_client, 5) != os
-        || i2c_smbus_read_word_data(new_client, 6) != os
-        || i2c_smbus_read_word_data(new_client, 7) != os)
-               return -ENODEV;
+          The National Semiconductor LM75A is different than earlier
+          LM75s.  It has an ID byte of 0xaX (where X is the chip
+          revision, with 1 being the only revision in existence) in
+          register 7, and unused registers return 0xff rather than the
+          last read value. */
 
        /* Unused bits */
+       conf = i2c_smbus_read_byte_data(new_client, 1);
        if (conf & 0xe0)
                return -ENODEV;
 
+       /* First check for LM75A */
+       if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) {
+               /* LM75A returns 0xff on unused registers so
+                  just to be sure we check for that too. */
+               if (i2c_smbus_read_byte_data(new_client, 4) != 0xff
+                || i2c_smbus_read_byte_data(new_client, 5) != 0xff
+                || i2c_smbus_read_byte_data(new_client, 6) != 0xff)
+                       return -ENODEV;
+               is_lm75a = 1;
+               hyst = i2c_smbus_read_byte_data(new_client, 2);
+               os = i2c_smbus_read_byte_data(new_client, 3);
+       } else { /* Traditional style LM75 detection */
+               /* Unused addresses */
+               hyst = i2c_smbus_read_byte_data(new_client, 2);
+               if (i2c_smbus_read_byte_data(new_client, 4) != hyst
+                || i2c_smbus_read_byte_data(new_client, 5) != hyst
+                || i2c_smbus_read_byte_data(new_client, 6) != hyst
+                || i2c_smbus_read_byte_data(new_client, 7) != hyst)
+                       return -ENODEV;
+               os = i2c_smbus_read_byte_data(new_client, 3);
+               if (i2c_smbus_read_byte_data(new_client, 4) != os
+                || i2c_smbus_read_byte_data(new_client, 5) != os
+                || i2c_smbus_read_byte_data(new_client, 6) != os
+                || i2c_smbus_read_byte_data(new_client, 7) != os)
+                       return -ENODEV;
+       }
+
        /* Addresses cycling */
-       for (i = 8; i < 0xff; i += 8) {
+       for (i = 8; i <= 248; i += 40) {
                if (i2c_smbus_read_byte_data(new_client, i + 1) != conf
-                || i2c_smbus_read_word_data(new_client, i + 2) != hyst
-                || i2c_smbus_read_word_data(new_client, i + 3) != os)
+                || i2c_smbus_read_byte_data(new_client, i + 2) != hyst
+                || i2c_smbus_read_byte_data(new_client, i + 3) != os)
+                       return -ENODEV;
+               if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7)
+                               != LM75A_ID)
                        return -ENODEV;
        }
 
-       strlcpy(info->type, "lm75", I2C_NAME_SIZE);
+       strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE);
 
        return 0;
 }
diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c
new file mode 100644 (file)
index 0000000..9a51dcc
--- /dev/null
@@ -0,0 +1,858 @@
+/***************************************************************************
+ *   Copyright (C) 2010-2011 Hans de Goede <hdegoede@redhat.com>           *
+ *                                                                         *
+ *   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.,                                       *
+ *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ ***************************************************************************/
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/jiffies.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+#include <linux/io.h>
+#include <linux/acpi.h>
+#include <linux/delay.h>
+
+#define DRVNAME "sch5627"
+#define DEVNAME DRVNAME /* We only support one model */
+
+#define SIO_SCH5627_EM_LD      0x0C    /* Embedded Microcontroller LD */
+#define SIO_UNLOCK_KEY         0x55    /* Key to enable Super-I/O */
+#define SIO_LOCK_KEY           0xAA    /* Key to disable Super-I/O */
+
+#define SIO_REG_LDSEL          0x07    /* Logical device select */
+#define SIO_REG_DEVID          0x20    /* Device ID */
+#define SIO_REG_ENABLE         0x30    /* Logical device enable */
+#define SIO_REG_ADDR           0x66    /* Logical device address (2 bytes) */
+
+#define SIO_SCH5627_ID         0xC6    /* Chipset ID */
+
+#define REGION_LENGTH          9
+
+#define SCH5627_HWMON_ID               0xa5
+#define SCH5627_COMPANY_ID             0x5c
+#define SCH5627_PRIMARY_ID             0xa0
+
+#define SCH5627_REG_BUILD_CODE         0x39
+#define SCH5627_REG_BUILD_ID           0x3a
+#define SCH5627_REG_HWMON_ID           0x3c
+#define SCH5627_REG_HWMON_REV          0x3d
+#define SCH5627_REG_COMPANY_ID         0x3e
+#define SCH5627_REG_PRIMARY_ID         0x3f
+#define SCH5627_REG_CTRL               0x40
+
+#define SCH5627_NO_TEMPS               8
+#define SCH5627_NO_FANS                        4
+#define SCH5627_NO_IN                  5
+
+static const u16 SCH5627_REG_TEMP_MSB[SCH5627_NO_TEMPS] = {
+       0x2B, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x180, 0x181 };
+static const u16 SCH5627_REG_TEMP_LSN[SCH5627_NO_TEMPS] = {
+       0xE2, 0xE1, 0xE1, 0xE5, 0xE5, 0xE6, 0x182, 0x182 };
+static const u16 SCH5627_REG_TEMP_HIGH_NIBBLE[SCH5627_NO_TEMPS] = {
+       0, 0, 1, 1, 0, 0, 0, 1 };
+static const u16 SCH5627_REG_TEMP_HIGH[SCH5627_NO_TEMPS] = {
+       0x61, 0x57, 0x59, 0x5B, 0x5D, 0x5F, 0x184, 0x186 };
+static const u16 SCH5627_REG_TEMP_ABS[SCH5627_NO_TEMPS] = {
+       0x9B, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x1A8, 0x1A9 };
+
+static const u16 SCH5627_REG_FAN[SCH5627_NO_FANS] = {
+       0x2C, 0x2E, 0x30, 0x32 };
+static const u16 SCH5627_REG_FAN_MIN[SCH5627_NO_FANS] = {
+       0x62, 0x64, 0x66, 0x68 };
+
+static const u16 SCH5627_REG_IN_MSB[SCH5627_NO_IN] = {
+       0x22, 0x23, 0x24, 0x25, 0x189 };
+static const u16 SCH5627_REG_IN_LSN[SCH5627_NO_IN] = {
+       0xE4, 0xE4, 0xE3, 0xE3, 0x18A };
+static const u16 SCH5627_REG_IN_HIGH_NIBBLE[SCH5627_NO_IN] = {
+       1, 0, 1, 0, 1 };
+static const u16 SCH5627_REG_IN_FACTOR[SCH5627_NO_IN] = {
+       10745, 3660, 9765, 10745, 3660 };
+static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = {
+       "VCC", "VTT", "VBAT", "VTR", "V_IN" };
+
+struct sch5627_data {
+       unsigned short addr;
+       struct device *hwmon_dev;
+       u8 temp_max[SCH5627_NO_TEMPS];
+       u8 temp_crit[SCH5627_NO_TEMPS];
+       u16 fan_min[SCH5627_NO_FANS];
+
+       struct mutex update_lock;
+       char valid;                     /* !=0 if following fields are valid */
+       unsigned long last_updated;     /* In jiffies */
+       u16 temp[SCH5627_NO_TEMPS];
+       u16 fan[SCH5627_NO_FANS];
+       u16 in[SCH5627_NO_IN];
+};
+
+static struct platform_device *sch5627_pdev;
+
+/* Super I/O functions */
+static inline int superio_inb(int base, int reg)
+{
+       outb(reg, base);
+       return inb(base + 1);
+}
+
+static inline int superio_enter(int base)
+{
+       /* Don't step on other drivers' I/O space by accident */
+       if (!request_muxed_region(base, 2, DRVNAME)) {
+               pr_err("I/O address 0x%04x already in use\n", base);
+               return -EBUSY;
+       }
+
+       outb(SIO_UNLOCK_KEY, base);
+
+       return 0;
+}
+
+static inline void superio_select(int base, int ld)
+{
+       outb(SIO_REG_LDSEL, base);
+       outb(ld, base + 1);
+}
+
+static inline void superio_exit(int base)
+{
+       outb(SIO_LOCK_KEY, base);
+       release_region(base, 2);
+}
+
+static int sch5627_read_virtual_reg(struct sch5627_data *data, u16 reg)
+{
+       u8 val;
+       int i;
+       /*
+        * According to SMSC for the commands we use the maximum time for
+        * the EM to respond is 15 ms, but testing shows in practice it
+        * responds within 15-32 reads, so we first busy poll, and if
+        * that fails sleep a bit and try again until we are way past
+        * the 15 ms maximum response time.
+        */
+       const int max_busy_polls = 64;
+       const int max_lazy_polls = 32;
+
+       /* (Optional) Write-Clear the EC to Host Mailbox Register */
+       val = inb(data->addr + 1);
+       outb(val, data->addr + 1);
+
+       /* Set Mailbox Address Pointer to first location in Region 1 */
+       outb(0x00, data->addr + 2);
+       outb(0x80, data->addr + 3);
+
+       /* Write Request Packet Header */
+       outb(0x02, data->addr + 4); /* Access Type: VREG read */
+       outb(0x01, data->addr + 5); /* # of Entries: 1 Byte (8-bit) */
+       outb(0x04, data->addr + 2); /* Mailbox AP to first data entry loc. */
+
+       /* Write Address field */
+       outb(reg & 0xff, data->addr + 6);
+       outb(reg >> 8, data->addr + 7);
+
+       /* Execute the Random Access Command */
+       outb(0x01, data->addr); /* Write 01h to the Host-to-EC register */
+
+       /* EM Interface Polling "Algorithm" */
+       for (i = 0; i < max_busy_polls + max_lazy_polls; i++) {
+               if (i >= max_busy_polls)
+                       msleep(1);
+               /* Read Interrupt source Register */
+               val = inb(data->addr + 8);
+               /* Write Clear the interrupt source bits */
+               if (val)
+                       outb(val, data->addr + 8);
+               /* Command Completed ? */
+               if (val & 0x01)
+                       break;
+       }
+       if (i == max_busy_polls + max_lazy_polls) {
+               pr_err("Max retries exceeded reading virtual "
+                      "register 0x%04hx (%d)\n", reg, 1);
+               return -EIO;
+       }
+
+       /*
+        * According to SMSC we may need to retry this, but sofar I've always
+        * seen this succeed in 1 try.
+        */
+       for (i = 0; i < max_busy_polls; i++) {
+               /* Read EC-to-Host Register */
+               val = inb(data->addr + 1);
+               /* Command Completed ? */
+               if (val == 0x01)
+                       break;
+
+               if (i == 0)
+                       pr_warn("EC reports: 0x%02x reading virtual register "
+                               "0x%04hx\n", (unsigned int)val, reg);
+       }
+       if (i == max_busy_polls) {
+               pr_err("Max retries exceeded reading virtual "
+                      "register 0x%04hx (%d)\n", reg, 2);
+               return -EIO;
+       }
+
+       /*
+        * According to the SMSC app note we should now do:
+        *
+        * Set Mailbox Address Pointer to first location in Region 1 *
+        * outb(0x00, data->addr + 2);
+        * outb(0x80, data->addr + 3);
+        *
+        * But if we do that things don't work, so let's not.
+        */
+
+       /* Read Data from Mailbox */
+       return inb(data->addr + 4);
+}
+
+static int sch5627_read_virtual_reg16(struct sch5627_data *data, u16 reg)
+{
+       int lsb, msb;
+
+       /* Read LSB first, this will cause the matching MSB to be latched */
+       lsb = sch5627_read_virtual_reg(data, reg);
+       if (lsb < 0)
+               return lsb;
+
+       msb = sch5627_read_virtual_reg(data, reg + 1);
+       if (msb < 0)
+               return msb;
+
+       return lsb | (msb << 8);
+}
+
+static int sch5627_read_virtual_reg12(struct sch5627_data *data, u16 msb_reg,
+                                     u16 lsn_reg, int high_nibble)
+{
+       int msb, lsn;
+
+       /* Read MSB first, this will cause the matching LSN to be latched */
+       msb = sch5627_read_virtual_reg(data, msb_reg);
+       if (msb < 0)
+               return msb;
+
+       lsn = sch5627_read_virtual_reg(data, lsn_reg);
+       if (lsn < 0)
+               return lsn;
+
+       if (high_nibble)
+               return (msb << 4) | (lsn >> 4);
+       else
+               return (msb << 4) | (lsn & 0x0f);
+}
+
+static struct sch5627_data *sch5627_update_device(struct device *dev)
+{
+       struct sch5627_data *data = dev_get_drvdata(dev);
+       struct sch5627_data *ret = data;
+       int i, val;
+
+       mutex_lock(&data->update_lock);
+
+       /* Cache the values for 1 second */
+       if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
+               for (i = 0; i < SCH5627_NO_TEMPS; i++) {
+                       val = sch5627_read_virtual_reg12(data,
+                               SCH5627_REG_TEMP_MSB[i],
+                               SCH5627_REG_TEMP_LSN[i],
+                               SCH5627_REG_TEMP_HIGH_NIBBLE[i]);
+                       if (unlikely(val < 0)) {
+                               ret = ERR_PTR(val);
+                               goto abort;
+                       }
+                       data->temp[i] = val;
+               }
+
+               for (i = 0; i < SCH5627_NO_FANS; i++) {
+                       val = sch5627_read_virtual_reg16(data,
+                                                        SCH5627_REG_FAN[i]);
+                       if (unlikely(val < 0)) {
+                               ret = ERR_PTR(val);
+                               goto abort;
+                       }
+                       data->fan[i] = val;
+               }
+
+               for (i = 0; i < SCH5627_NO_IN; i++) {
+                       val = sch5627_read_virtual_reg12(data,
+                               SCH5627_REG_IN_MSB[i],
+                               SCH5627_REG_IN_LSN[i],
+                               SCH5627_REG_IN_HIGH_NIBBLE[i]);
+                       if (unlikely(val < 0)) {
+                               ret = ERR_PTR(val);
+                               goto abort;
+                       }
+                       data->in[i] = val;
+               }
+
+               data->last_updated = jiffies;
+               data->valid = 1;
+       }
+abort:
+       mutex_unlock(&data->update_lock);
+       return ret;
+}
+
+static int __devinit sch5627_read_limits(struct sch5627_data *data)
+{
+       int i, val;
+
+       for (i = 0; i < SCH5627_NO_TEMPS; i++) {
+               /*
+                * Note what SMSC calls ABS, is what lm_sensors calls max
+                * (aka high), and HIGH is what lm_sensors calls crit.
+                */
+               val = sch5627_read_virtual_reg(data, SCH5627_REG_TEMP_ABS[i]);
+               if (val < 0)
+                       return val;
+               data->temp_max[i] = val;
+
+               val = sch5627_read_virtual_reg(data, SCH5627_REG_TEMP_HIGH[i]);
+               if (val < 0)
+                       return val;
+               data->temp_crit[i] = val;
+       }
+       for (i = 0; i < SCH5627_NO_FANS; i++) {
+               val = sch5627_read_virtual_reg16(data, SCH5627_REG_FAN_MIN[i]);
+               if (val < 0)
+                       return val;
+               data->fan_min[i] = val;
+       }
+
+       return 0;
+}
+
+static int reg_to_temp(u16 reg)
+{
+       return (reg * 625) / 10 - 64000;
+}
+
+static int reg_to_temp_limit(u8 reg)
+{
+       return (reg - 64) * 1000;
+}
+
+static int reg_to_rpm(u16 reg)
+{
+       if (reg == 0)
+               return -EIO;
+       if (reg == 0xffff)
+               return 0;
+
+       return 5400540 / reg;
+}
+
+static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
+       char *buf)
+{
+       return snprintf(buf, PAGE_SIZE, "%s\n", DEVNAME);
+}
+
+static ssize_t show_temp(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = sch5627_update_device(dev);
+       int val;
+
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       val = reg_to_temp(data->temp[attr->index]);
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_temp_fault(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = sch5627_update_device(dev);
+
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       return snprintf(buf, PAGE_SIZE, "%d\n", data->temp[attr->index] == 0);
+}
+
+static ssize_t show_temp_max(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = dev_get_drvdata(dev);
+       int val;
+
+       val = reg_to_temp_limit(data->temp_max[attr->index]);
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_temp_crit(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = dev_get_drvdata(dev);
+       int val;
+
+       val = reg_to_temp_limit(data->temp_crit[attr->index]);
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_fan(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = sch5627_update_device(dev);
+       int val;
+
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       val = reg_to_rpm(data->fan[attr->index]);
+       if (val < 0)
+               return val;
+
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_fan_fault(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = sch5627_update_device(dev);
+
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       return snprintf(buf, PAGE_SIZE, "%d\n",
+                       data->fan[attr->index] == 0xffff);
+}
+
+static ssize_t show_fan_min(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = dev_get_drvdata(dev);
+       int val = reg_to_rpm(data->fan_min[attr->index]);
+       if (val < 0)
+               return val;
+
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_in(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+       struct sch5627_data *data = sch5627_update_device(dev);
+       int val;
+
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
+       val = DIV_ROUND_CLOSEST(
+               data->in[attr->index] * SCH5627_REG_IN_FACTOR[attr->index],
+               10000);
+       return snprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
+static ssize_t show_in_label(struct device *dev, struct device_attribute
+       *devattr, char *buf)
+{
+       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
+
+       return snprintf(buf, PAGE_SIZE, "%s\n",
+                       SCH5627_IN_LABELS[attr->index]);
+}
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
+static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
+static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3);
+static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4);
+static SENSOR_DEVICE_ATTR(temp6_input, S_IRUGO, show_temp, NULL, 5);
+static SENSOR_DEVICE_ATTR(temp7_input, S_IRUGO, show_temp, NULL, 6);
+static SENSOR_DEVICE_ATTR(temp8_input, S_IRUGO, show_temp, NULL, 7);
+static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1);
+static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_temp_fault, NULL, 2);
+static SENSOR_DEVICE_ATTR(temp4_fault, S_IRUGO, show_temp_fault, NULL, 3);
+static SENSOR_DEVICE_ATTR(temp5_fault, S_IRUGO, show_temp_fault, NULL, 4);
+static SENSOR_DEVICE_ATTR(temp6_fault, S_IRUGO, show_temp_fault, NULL, 5);
+static SENSOR_DEVICE_ATTR(temp7_fault, S_IRUGO, show_temp_fault, NULL, 6);
+static SENSOR_DEVICE_ATTR(temp8_fault, S_IRUGO, show_temp_fault, NULL, 7);
+static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, show_temp_max, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp2_max, S_IRUGO, show_temp_max, NULL, 1);
+static SENSOR_DEVICE_ATTR(temp3_max, S_IRUGO, show_temp_max, NULL, 2);
+static SENSOR_DEVICE_ATTR(temp4_max, S_IRUGO, show_temp_max, NULL, 3);
+static SENSOR_DEVICE_ATTR(temp5_max, S_IRUGO, show_temp_max, NULL, 4);
+static SENSOR_DEVICE_ATTR(temp6_max, S_IRUGO, show_temp_max, NULL, 5);
+static SENSOR_DEVICE_ATTR(temp7_max, S_IRUGO, show_temp_max, NULL, 6);
+static SENSOR_DEVICE_ATTR(temp8_max, S_IRUGO, show_temp_max, NULL, 7);
+static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, show_temp_crit, NULL, 0);
+static SENSOR_DEVICE_ATTR(temp2_crit, S_IRUGO, show_temp_crit, NULL, 1);
+static SENSOR_DEVICE_ATTR(temp3_crit, S_IRUGO, show_temp_crit, NULL, 2);
+static SENSOR_DEVICE_ATTR(temp4_crit, S_IRUGO, show_temp_crit, NULL, 3);
+static SENSOR_DEVICE_ATTR(temp5_crit, S_IRUGO, show_temp_crit, NULL, 4);
+static SENSOR_DEVICE_ATTR(temp6_crit, S_IRUGO, show_temp_crit, NULL, 5);
+static SENSOR_DEVICE_ATTR(temp7_crit, S_IRUGO, show_temp_crit, NULL, 6);
+static SENSOR_DEVICE_ATTR(temp8_crit, S_IRUGO, show_temp_crit, NULL, 7);
+
+static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
+static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
+static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
+static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
+static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_fan_fault, NULL, 0);
+static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_fan_fault, NULL, 1);
+static SENSOR_DEVICE_ATTR(fan3_fault, S_IRUGO, show_fan_fault, NULL, 2);
+static SENSOR_DEVICE_ATTR(fan4_fault, S_IRUGO, show_fan_fault, NULL, 3);
+static SENSOR_DEVICE_ATTR(fan1_min, S_IRUGO, show_fan_min, NULL, 0);
+static SENSOR_DEVICE_ATTR(fan2_min, S_IRUGO, show_fan_min, NULL, 1);
+static SENSOR_DEVICE_ATTR(fan3_min, S_IRUGO, show_fan_min, NULL, 2);
+static SENSOR_DEVICE_ATTR(fan4_min, S_IRUGO, show_fan_min, NULL, 3);
+
+static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_in, NULL, 0);
+static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_in, NULL, 1);
+static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_in, NULL, 2);
+static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_in, NULL, 3);
+static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_in, NULL, 4);
+static SENSOR_DEVICE_ATTR(in0_label, S_IRUGO, show_in_label, NULL, 0);
+static SENSOR_DEVICE_ATTR(in1_label, S_IRUGO, show_in_label, NULL, 1);
+static SENSOR_DEVICE_ATTR(in2_label, S_IRUGO, show_in_label, NULL, 2);
+static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_in_label, NULL, 3);
+
+static struct attribute *sch5627_attributes[] = {
+       &dev_attr_name.attr,
+
+       &sensor_dev_attr_temp1_input.dev_attr.attr,
+       &sensor_dev_attr_temp2_input.dev_attr.attr,
+       &sensor_dev_attr_temp3_input.dev_attr.attr,
+       &sensor_dev_attr_temp4_input.dev_attr.attr,
+       &sensor_dev_attr_temp5_input.dev_attr.attr,
+       &sensor_dev_attr_temp6_input.dev_attr.attr,
+       &sensor_dev_attr_temp7_input.dev_attr.attr,
+       &sensor_dev_attr_temp8_input.dev_attr.attr,
+       &sensor_dev_attr_temp1_fault.dev_attr.attr,
+       &sensor_dev_attr_temp2_fault.dev_attr.attr,
+       &sensor_dev_attr_temp3_fault.dev_attr.attr,
+       &sensor_dev_attr_temp4_fault.dev_attr.attr,
+       &sensor_dev_attr_temp5_fault.dev_attr.attr,
+       &sensor_dev_attr_temp6_fault.dev_attr.attr,
+       &sensor_dev_attr_temp7_fault.dev_attr.attr,
+       &sensor_dev_attr_temp8_fault.dev_attr.attr,
+       &sensor_dev_attr_temp1_max.dev_attr.attr,
+       &sensor_dev_attr_temp2_max.dev_attr.attr,
+       &sensor_dev_attr_temp3_max.dev_attr.attr,
+       &sensor_dev_attr_temp4_max.dev_attr.attr,
+       &sensor_dev_attr_temp5_max.dev_attr.attr,
+       &sensor_dev_attr_temp6_max.dev_attr.attr,
+       &sensor_dev_attr_temp7_max.dev_attr.attr,
+       &sensor_dev_attr_temp8_max.dev_attr.attr,
+       &sensor_dev_attr_temp1_crit.dev_attr.attr,
+       &sensor_dev_attr_temp2_crit.dev_attr.attr,
+       &sensor_dev_attr_temp3_crit.dev_attr.attr,
+       &sensor_dev_attr_temp4_crit.dev_attr.attr,
+       &sensor_dev_attr_temp5_crit.dev_attr.attr,
+       &sensor_dev_attr_temp6_crit.dev_attr.attr,
+       &sensor_dev_attr_temp7_crit.dev_attr.attr,
+       &sensor_dev_attr_temp8_crit.dev_attr.attr,
+
+       &sensor_dev_attr_fan1_input.dev_attr.attr,
+       &sensor_dev_attr_fan2_input.dev_attr.attr,
+       &sensor_dev_attr_fan3_input.dev_attr.attr,
+       &sensor_dev_attr_fan4_input.dev_attr.attr,
+       &sensor_dev_attr_fan1_fault.dev_attr.attr,
+       &sensor_dev_attr_fan2_fault.dev_attr.attr,
+       &sensor_dev_attr_fan3_fault.dev_attr.attr,
+       &sensor_dev_attr_fan4_fault.dev_attr.attr,
+       &sensor_dev_attr_fan1_min.dev_attr.attr,
+       &sensor_dev_attr_fan2_min.dev_attr.attr,
+       &sensor_dev_attr_fan3_min.dev_attr.attr,
+       &sensor_dev_attr_fan4_min.dev_attr.attr,
+
+       &sensor_dev_attr_in0_input.dev_attr.attr,
+       &sensor_dev_attr_in1_input.dev_attr.attr,
+       &sensor_dev_attr_in2_input.dev_attr.attr,
+       &sensor_dev_attr_in3_input.dev_attr.attr,
+       &sensor_dev_attr_in4_input.dev_attr.attr,
+       &sensor_dev_attr_in0_label.dev_attr.attr,
+       &sensor_dev_attr_in1_label.dev_attr.attr,
+       &sensor_dev_attr_in2_label.dev_attr.attr,
+       &sensor_dev_attr_in3_label.dev_attr.attr,
+       /* No in4_label as in4 is a generic input pin */
+
+       NULL
+};
+
+static const struct attribute_group sch5627_group = {
+       .attrs = sch5627_attributes,
+};
+
+static int sch5627_remove(struct platform_device *pdev)
+{
+       struct sch5627_data *data = platform_get_drvdata(pdev);
+
+       if (data->hwmon_dev)
+               hwmon_device_unregister(data->hwmon_dev);
+
+       sysfs_remove_group(&pdev->dev.kobj, &sch5627_group);
+       platform_set_drvdata(pdev, NULL);
+       kfree(data);
+
+       return 0;
+}
+
+static int __devinit sch5627_probe(struct platform_device *pdev)
+{
+       struct sch5627_data *data;
+       int err, build_code, build_id, hwmon_rev, val;
+
+       data = kzalloc(sizeof(struct sch5627_data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       data->addr = platform_get_resource(pdev, IORESOURCE_IO, 0)->start;
+       mutex_init(&data->update_lock);
+       platform_set_drvdata(pdev, data);
+
+       val = sch5627_read_virtual_reg(data, SCH5627_REG_HWMON_ID);
+       if (val < 0) {
+               err = val;
+               goto error;
+       }
+       if (val != SCH5627_HWMON_ID) {
+               pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "hwmon",
+                      val, SCH5627_HWMON_ID);
+               err = -ENODEV;
+               goto error;
+       }
+
+       val = sch5627_read_virtual_reg(data, SCH5627_REG_COMPANY_ID);
+       if (val < 0) {
+               err = val;
+               goto error;
+       }
+       if (val != SCH5627_COMPANY_ID) {
+               pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "company",
+                      val, SCH5627_COMPANY_ID);
+               err = -ENODEV;
+               goto error;
+       }
+
+       val = sch5627_read_virtual_reg(data, SCH5627_REG_PRIMARY_ID);
+       if (val < 0) {
+               err = val;
+               goto error;
+       }
+       if (val != SCH5627_PRIMARY_ID) {
+               pr_err("invalid %s id: 0x%02X (expected 0x%02X)\n", "primary",
+                      val, SCH5627_PRIMARY_ID);
+               err = -ENODEV;
+               goto error;
+       }
+
+       build_code = sch5627_read_virtual_reg(data, SCH5627_REG_BUILD_CODE);
+       if (build_code < 0) {
+               err = build_code;
+               goto error;
+       }
+
+       build_id = sch5627_read_virtual_reg16(data, SCH5627_REG_BUILD_ID);
+       if (build_id < 0) {
+               err = build_id;
+               goto error;
+       }
+
+       hwmon_rev = sch5627_read_virtual_reg(data, SCH5627_REG_HWMON_REV);
+       if (hwmon_rev < 0) {
+               err = hwmon_rev;
+               goto error;
+       }
+
+       val = sch5627_read_virtual_reg(data, SCH5627_REG_CTRL);
+       if (val < 0) {
+               err = val;
+               goto error;
+       }
+       if (!(val & 0x01)) {
+               pr_err("hardware monitoring not enabled\n");
+               err = -ENODEV;
+               goto error;
+       }
+
+       /*
+        * Read limits, we do this only once as reading a register on
+        * the sch5627 is quite expensive (and they don't change).
+        */
+       err = sch5627_read_limits(data);
+       if (err)
+               goto error;
+
+       pr_info("firmware build: code 0x%02X, id 0x%04X, hwmon: rev 0x%02X\n",
+               build_code, build_id, hwmon_rev);
+
+       /* Register sysfs interface files */
+       err = sysfs_create_group(&pdev->dev.kobj, &sch5627_group);
+       if (err)
+               goto error;
+
+       data->hwmon_dev = hwmon_device_register(&pdev->dev);
+       if (IS_ERR(data->hwmon_dev)) {
+               err = PTR_ERR(data->hwmon_dev);
+               data->hwmon_dev = NULL;
+               goto error;
+       }
+
+       return 0;
+
+error:
+       sch5627_remove(pdev);
+       return err;
+}
+
+static int __init sch5627_find(int sioaddr, unsigned short *address)
+{
+       u8 devid;
+       int err = superio_enter(sioaddr);
+       if (err)
+               return err;
+
+       devid = superio_inb(sioaddr, SIO_REG_DEVID);
+       if (devid != SIO_SCH5627_ID) {
+               pr_debug("Unsupported device id: 0x%02x\n",
+                        (unsigned int)devid);
+               err = -ENODEV;
+               goto exit;
+       }
+
+       superio_select(sioaddr, SIO_SCH5627_EM_LD);
+
+       if (!(superio_inb(sioaddr, SIO_REG_ENABLE) & 0x01)) {
+               pr_warn("Device not activated\n");
+               err = -ENODEV;
+               goto exit;
+       }
+
+       /*
+        * Warning the order of the low / high byte is the other way around
+        * as on most other superio devices!!
+        */
+       *address = superio_inb(sioaddr, SIO_REG_ADDR) |
+                  superio_inb(sioaddr, SIO_REG_ADDR + 1) << 8;
+       if (*address == 0) {
+               pr_warn("Base address not set\n");
+               err = -ENODEV;
+               goto exit;
+       }
+
+       pr_info("Found %s chip at %#hx\n", DEVNAME, *address);
+exit:
+       superio_exit(sioaddr);
+       return err;
+}
+
+static int __init sch5627_device_add(unsigned short address)
+{
+       struct resource res = {
+               .start  = address,
+               .end    = address + REGION_LENGTH - 1,
+               .flags  = IORESOURCE_IO,
+       };
+       int err;
+
+       sch5627_pdev = platform_device_alloc(DRVNAME, address);
+       if (!sch5627_pdev)
+               return -ENOMEM;
+
+       res.name = sch5627_pdev->name;
+       err = acpi_check_resource_conflict(&res);
+       if (err)
+               goto exit_device_put;
+
+       err = platform_device_add_resources(sch5627_pdev, &res, 1);
+       if (err) {
+               pr_err("Device resource addition failed\n");
+               goto exit_device_put;
+       }
+
+       err = platform_device_add(sch5627_pdev);
+       if (err) {
+               pr_err("Device addition failed\n");
+               goto exit_device_put;
+       }
+
+       return 0;
+
+exit_device_put:
+       platform_device_put(sch5627_pdev);
+
+       return err;
+}
+
+static struct platform_driver sch5627_driver = {
+       .driver = {
+               .owner  = THIS_MODULE,
+               .name   = DRVNAME,
+       },
+       .probe          = sch5627_probe,
+       .remove         = sch5627_remove,
+};
+
+static int __init sch5627_init(void)
+{
+       int err = -ENODEV;
+       unsigned short address;
+
+       if (sch5627_find(0x4e, &address) && sch5627_find(0x2e, &address))
+               goto exit;
+
+       err = platform_driver_register(&sch5627_driver);
+       if (err)
+               goto exit;
+
+       err = sch5627_device_add(address);
+       if (err)
+               goto exit_driver;
+
+       return 0;
+
+exit_driver:
+       platform_driver_unregister(&sch5627_driver);
+exit:
+       return err;
+}
+
+static void __exit sch5627_exit(void)
+{
+       platform_device_unregister(sch5627_pdev);
+       platform_driver_unregister(&sch5627_driver);
+}
+
+MODULE_DESCRIPTION("SMSC SCH5627 Hardware Monitoring Driver");
+MODULE_AUTHOR("Hans de Goede (hdegoede@redhat.com)");
+MODULE_LICENSE("GPL");
+
+module_init(sch5627_init);
+module_exit(sch5627_exit);
index a610e7880fb3e5498b5d836d456ec4e25c58e278..1a9c32d6893a83b2c6603b70c0bfa1e0428488d7 100644 (file)
@@ -333,11 +333,11 @@ static inline int sht15_calc_humid(struct sht15_data *data)
 
        const int c1 = -4;
        const int c2 = 40500; /* x 10 ^ -6 */
-       const int c3 = -2800; /* x10 ^ -9 */
+       const int c3 = -28; /* x 10 ^ -7 */
 
        RHlinear = c1*1000
                + c2 * data->val_humid/1000
-               + (data->val_humid * data->val_humid * c3)/1000000;
+               + (data->val_humid * data->val_humid * c3) / 10000;
        return (temp - 25000) * (10000 + 80 * data->val_humid)
                / 1000000 + RHlinear;
 }
@@ -610,7 +610,7 @@ static int __devexit sht15_remove(struct platform_device *pdev)
        struct sht15_data *data = platform_get_drvdata(pdev);
 
        /* Make sure any reads from the device are done and
-        * prevent new ones beginnning */
+        * prevent new ones from beginning */
        mutex_lock(&data->read_lock);
        hwmon_device_unregister(data->hwmon_dev);
        sysfs_remove_group(&pdev->dev.kobj, &sht15_attr_group);
index 23ac61e2db398363ccb4bb742d8f07aff0aa7e60..beee6b2d361db458a1336a48bd13b5166d6d013c 100644 (file)
@@ -10,3 +10,4 @@ obj-$(CONFIG_I2C_MUX)         += i2c-mux.o
 obj-y                          += algos/ busses/ muxes/
 
 ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
+CFLAGS_i2c-core.o := -Wno-deprecated-declarations
index 230601e8853fff715a23465a507cdc054390d72b..326652f673f7e0fc1b709320204046290e6c7ae7 100644 (file)
@@ -98,8 +98,9 @@ config I2C_I801
            EP80579 (Tolapai)
            ICH10
            5/3400 Series (PCH)
-           Cougar Point (PCH)
+           6 Series (PCH)
            Patsburg (PCH)
+           DH89xxCC (PCH)
 
          This driver can also be built as a module.  If so, the module
          will be called i2c-i801.
@@ -546,15 +547,18 @@ config I2C_PUV3
 
 config I2C_PXA
        tristate "Intel PXA2XX I2C adapter"
-       depends on ARCH_PXA || ARCH_MMP
+       depends on ARCH_PXA || ARCH_MMP || (X86_32 && PCI && OF)
        help
          If you have devices in the PXA I2C bus, say yes to this option.
          This driver can also be built as a module.  If so, the module
          will be called i2c-pxa.
 
+config I2C_PXA_PCI
+       def_bool I2C_PXA && X86_32 && PCI && OF
+
 config I2C_PXA_SLAVE
        bool "Intel PXA2XX I2C Slave comms support"
-       depends on I2C_PXA
+       depends on I2C_PXA && !X86_32
        help
          Support I2C slave mode communications on the PXA I2C bus.  This
          is necessary for systems where the PXA may be a target on the
@@ -667,15 +671,28 @@ config I2C_XILINX
          will be called xilinx_i2c.
 
 config I2C_EG20T
-        tristate "PCH I2C of Intel EG20T"
-        depends on PCI
-        help
-          This driver is for PCH(Platform controller Hub) I2C of EG20T which
-          is an IOH(Input/Output Hub) for x86 embedded processor.
-          This driver can access PCH I2C bus device.
+       tristate "Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH"
+       depends on PCI
+       help
+         This driver is for PCH(Platform controller Hub) I2C of EG20T which
+         is an IOH(Input/Output Hub) for x86 embedded processor.
+         This driver can access PCH I2C bus device.
+
+         This driver also supports the ML7213, a companion chip for the
+         Atom E6xx series and compatible with the Intel EG20T PCH.
 
 comment "External I2C/SMBus adapter drivers"
 
+config I2C_DIOLAN_U2C
+       tristate "Diolan U2C-12 USB adapter"
+       depends on USB
+       help
+         If you say yes to this option, support will be included for Diolan
+         U2C-12, a USB to I2C interface.
+
+         This driver can also be built as a module.  If so, the module
+         will be called i2c-diolan-u2c.
+
 config I2C_PARPORT
        tristate "Parallel port adapter"
        depends on PARPORT
index 3878c959d4fa89356e894633f3d02b9e87e2f867..e6cf294d37293b75287c566353f0945a7d5203ee 100644 (file)
@@ -54,6 +54,7 @@ obj-$(CONFIG_I2C_PMCMSP)      += i2c-pmcmsp.o
 obj-$(CONFIG_I2C_PNX)          += i2c-pnx.o
 obj-$(CONFIG_I2C_PUV3)         += i2c-puv3.o
 obj-$(CONFIG_I2C_PXA)          += i2c-pxa.o
+obj-$(CONFIG_I2C_PXA_PCI)      += i2c-pxa-pci.o
 obj-$(CONFIG_I2C_S3C2410)      += i2c-s3c2410.o
 obj-$(CONFIG_I2C_S6000)                += i2c-s6000.o
 obj-$(CONFIG_I2C_SH7760)       += i2c-sh7760.o
@@ -67,6 +68,7 @@ obj-$(CONFIG_I2C_XILINX)      += i2c-xiic.o
 obj-$(CONFIG_I2C_EG20T)         += i2c-eg20t.o
 
 # External I2C/SMBus adapter drivers
+obj-$(CONFIG_I2C_DIOLAN_U2C)   += i2c-diolan-u2c.o
 obj-$(CONFIG_I2C_PARPORT)      += i2c-parport.o
 obj-$(CONFIG_I2C_PARPORT_LIGHT)        += i2c-parport-light.o
 obj-$(CONFIG_I2C_TAOS_EVM)     += i2c-taos-evm.o
diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c
new file mode 100644 (file)
index 0000000..7636671
--- /dev/null
@@ -0,0 +1,535 @@
+/*
+ * Driver for the Diolan u2c-12 USB-I2C adapter
+ *
+ * Copyright (c) 2010-2011 Ericsson AB
+ *
+ * Derived from:
+ *  i2c-tiny-usb.c
+ *  Copyright (C) 2006-2007 Till Harbaum (Till@Harbaum.org)
+ *
+ * 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, version 2.
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <linux/usb.h>
+#include <linux/i2c.h>
+
+#define DRIVER_NAME            "i2c-diolan-u2c"
+
+#define USB_VENDOR_ID_DIOLAN           0x0abf
+#define USB_DEVICE_ID_DIOLAN_U2C       0x3370
+
+#define DIOLAN_OUT_EP          0x02
+#define DIOLAN_IN_EP           0x84
+
+/* commands via USB, must match command ids in the firmware */
+#define CMD_I2C_READ           0x01
+#define CMD_I2C_WRITE          0x02
+#define CMD_I2C_SCAN           0x03    /* Returns list of detected devices */
+#define CMD_I2C_RELEASE_SDA    0x04
+#define CMD_I2C_RELEASE_SCL    0x05
+#define CMD_I2C_DROP_SDA       0x06
+#define CMD_I2C_DROP_SCL       0x07
+#define CMD_I2C_READ_SDA       0x08
+#define CMD_I2C_READ_SCL       0x09
+#define CMD_GET_FW_VERSION     0x0a
+#define CMD_GET_SERIAL         0x0b
+#define CMD_I2C_START          0x0c
+#define CMD_I2C_STOP           0x0d
+#define CMD_I2C_REPEATED_START 0x0e
+#define CMD_I2C_PUT_BYTE       0x0f
+#define CMD_I2C_GET_BYTE       0x10
+#define CMD_I2C_PUT_ACK                0x11
+#define CMD_I2C_GET_ACK                0x12
+#define CMD_I2C_PUT_BYTE_ACK   0x13
+#define CMD_I2C_GET_BYTE_ACK   0x14
+#define CMD_I2C_SET_SPEED      0x1b
+#define CMD_I2C_GET_SPEED      0x1c
+#define CMD_I2C_SET_CLK_SYNC   0x24
+#define CMD_I2C_GET_CLK_SYNC   0x25
+#define CMD_I2C_SET_CLK_SYNC_TO        0x26
+#define CMD_I2C_GET_CLK_SYNC_TO        0x27
+
+#define RESP_OK                        0x00
+#define RESP_FAILED            0x01
+#define RESP_BAD_MEMADDR       0x04
+#define RESP_DATA_ERR          0x05
+#define RESP_NOT_IMPLEMENTED   0x06
+#define RESP_NACK              0x07
+#define RESP_TIMEOUT           0x09
+
+#define U2C_I2C_SPEED_FAST     0       /* 400 kHz */
+#define U2C_I2C_SPEED_STD      1       /* 100 kHz */
+#define U2C_I2C_SPEED_2KHZ     242     /* 2 kHz, minimum speed */
+#define U2C_I2C_SPEED(f)       ((DIV_ROUND_UP(1000000, (f)) - 10) / 2 + 1)
+
+#define U2C_I2C_FREQ_FAST      400000
+#define U2C_I2C_FREQ_STD       100000
+#define U2C_I2C_FREQ(s)                (1000000 / (2 * (s - 1) + 10))
+
+#define DIOLAN_USB_TIMEOUT     100     /* in ms */
+#define DIOLAN_SYNC_TIMEOUT    20      /* in ms */
+
+#define DIOLAN_OUTBUF_LEN      128
+#define DIOLAN_FLUSH_LEN       (DIOLAN_OUTBUF_LEN - 4)
+#define DIOLAN_INBUF_LEN       256     /* Maximum supported receive length */
+
+/* Structure to hold all of our device specific stuff */
+struct i2c_diolan_u2c {
+       u8 obuffer[DIOLAN_OUTBUF_LEN];  /* output buffer */
+       u8 ibuffer[DIOLAN_INBUF_LEN];   /* input buffer */
+       struct usb_device *usb_dev;     /* the usb device for this device */
+       struct usb_interface *interface;/* the interface for this device */
+       struct i2c_adapter adapter;     /* i2c related things */
+       int olen;                       /* Output buffer length */
+       int ocount;                     /* Number of enqueued messages */
+};
+
+static uint frequency = U2C_I2C_FREQ_STD;      /* I2C clock frequency in Hz */
+
+module_param(frequency, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(frequency, "I2C clock frequency in hertz");
+
+/* usb layer */
+
+/* Send command to device, and get response. */
+static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
+{
+       int ret = 0;
+       int actual;
+       int i;
+
+       if (!dev->olen || !dev->ocount)
+               return -EINVAL;
+
+       ret = usb_bulk_msg(dev->usb_dev,
+                          usb_sndbulkpipe(dev->usb_dev, DIOLAN_OUT_EP),
+                          dev->obuffer, dev->olen, &actual,
+                          DIOLAN_USB_TIMEOUT);
+       if (!ret) {
+               for (i = 0; i < dev->ocount; i++) {
+                       int tmpret;
+
+                       tmpret = usb_bulk_msg(dev->usb_dev,
+                                             usb_rcvbulkpipe(dev->usb_dev,
+                                                             DIOLAN_IN_EP),
+                                             dev->ibuffer,
+                                             sizeof(dev->ibuffer), &actual,
+                                             DIOLAN_USB_TIMEOUT);
+                       /*
+                        * Stop command processing if a previous command
+                        * returned an error.
+                        * Note that we still need to retrieve all messages.
+                        */
+                       if (ret < 0)
+                               continue;
+                       ret = tmpret;
+                       if (ret == 0 && actual > 0) {
+                               switch (dev->ibuffer[actual - 1]) {
+                               case RESP_NACK:
+                                       /*
+                                        * Return ENXIO if NACK was received as
+                                        * response to the address phase,
+                                        * EIO otherwise
+                                        */
+                                       ret = i == 1 ? -ENXIO : -EIO;
+                                       break;
+                               case RESP_TIMEOUT:
+                                       ret = -ETIMEDOUT;
+                                       break;
+                               case RESP_OK:
+                                       /* strip off return code */
+                                       ret = actual - 1;
+                                       break;
+                               default:
+                                       ret = -EIO;
+                                       break;
+                               }
+                       }
+               }
+       }
+       dev->olen = 0;
+       dev->ocount = 0;
+       return ret;
+}
+
+static int diolan_write_cmd(struct i2c_diolan_u2c *dev, bool flush)
+{
+       if (flush || dev->olen >= DIOLAN_FLUSH_LEN)
+               return diolan_usb_transfer(dev);
+       return 0;
+}
+
+/* Send command (no data) */
+static int diolan_usb_cmd(struct i2c_diolan_u2c *dev, u8 command, bool flush)
+{
+       dev->obuffer[dev->olen++] = command;
+       dev->ocount++;
+       return diolan_write_cmd(dev, flush);
+}
+
+/* Send command with one byte of data */
+static int diolan_usb_cmd_data(struct i2c_diolan_u2c *dev, u8 command, u8 data,
+                              bool flush)
+{
+       dev->obuffer[dev->olen++] = command;
+       dev->obuffer[dev->olen++] = data;
+       dev->ocount++;
+       return diolan_write_cmd(dev, flush);
+}
+
+/* Send command with two bytes of data */
+static int diolan_usb_cmd_data2(struct i2c_diolan_u2c *dev, u8 command, u8 d1,
+                               u8 d2, bool flush)
+{
+       dev->obuffer[dev->olen++] = command;
+       dev->obuffer[dev->olen++] = d1;
+       dev->obuffer[dev->olen++] = d2;
+       dev->ocount++;
+       return diolan_write_cmd(dev, flush);
+}
+
+/*
+ * Flush input queue.
+ * If we don't do this at startup and the controller has queued up
+ * messages which were not retrieved, it will stop responding
+ * at some point.
+ */
+static void diolan_flush_input(struct i2c_diolan_u2c *dev)
+{
+       int i;
+
+       for (i = 0; i < 10; i++) {
+               int actual = 0;
+               int ret;
+
+               ret = usb_bulk_msg(dev->usb_dev,
+                                  usb_rcvbulkpipe(dev->usb_dev, DIOLAN_IN_EP),
+                                  dev->ibuffer, sizeof(dev->ibuffer), &actual,
+                                  DIOLAN_USB_TIMEOUT);
+               if (ret < 0 || actual == 0)
+                       break;
+       }
+       if (i == 10)
+               dev_err(&dev->interface->dev, "Failed to flush input buffer\n");
+}
+
+static int diolan_i2c_start(struct i2c_diolan_u2c *dev)
+{
+       return diolan_usb_cmd(dev, CMD_I2C_START, false);
+}
+
+static int diolan_i2c_repeated_start(struct i2c_diolan_u2c *dev)
+{
+       return diolan_usb_cmd(dev, CMD_I2C_REPEATED_START, false);
+}
+
+static int diolan_i2c_stop(struct i2c_diolan_u2c *dev)
+{
+       return diolan_usb_cmd(dev, CMD_I2C_STOP, true);
+}
+
+static int diolan_i2c_get_byte_ack(struct i2c_diolan_u2c *dev, bool ack,
+                                  u8 *byte)
+{
+       int ret;
+
+       ret = diolan_usb_cmd_data(dev, CMD_I2C_GET_BYTE_ACK, ack, true);
+       if (ret > 0)
+               *byte = dev->ibuffer[0];
+       else if (ret == 0)
+               ret = -EIO;
+
+       return ret;
+}
+
+static int diolan_i2c_put_byte_ack(struct i2c_diolan_u2c *dev, u8 byte)
+{
+       return diolan_usb_cmd_data(dev, CMD_I2C_PUT_BYTE_ACK, byte, false);
+}
+
+static int diolan_set_speed(struct i2c_diolan_u2c *dev, u8 speed)
+{
+       return diolan_usb_cmd_data(dev, CMD_I2C_SET_SPEED, speed, true);
+}
+
+/* Enable or disable clock synchronization (stretching) */
+static int diolan_set_clock_synch(struct i2c_diolan_u2c *dev, bool enable)
+{
+       return diolan_usb_cmd_data(dev, CMD_I2C_SET_CLK_SYNC, enable, true);
+}
+
+/* Set clock synchronization timeout in ms */
+static int diolan_set_clock_synch_timeout(struct i2c_diolan_u2c *dev, int ms)
+{
+       int to_val = ms * 10;
+
+       return diolan_usb_cmd_data2(dev, CMD_I2C_SET_CLK_SYNC_TO,
+                                   to_val & 0xff, (to_val >> 8) & 0xff, true);
+}
+
+static void diolan_fw_version(struct i2c_diolan_u2c *dev)
+{
+       int ret;
+
+       ret = diolan_usb_cmd(dev, CMD_GET_FW_VERSION, true);
+       if (ret >= 2)
+               dev_info(&dev->interface->dev,
+                        "Diolan U2C firmware version %u.%u\n",
+                        (unsigned int)dev->ibuffer[0],
+                        (unsigned int)dev->ibuffer[1]);
+}
+
+static void diolan_get_serial(struct i2c_diolan_u2c *dev)
+{
+       int ret;
+       u32 serial;
+
+       ret = diolan_usb_cmd(dev, CMD_GET_SERIAL, true);
+       if (ret >= 4) {
+               serial = le32_to_cpu(*(u32 *)dev->ibuffer);
+               dev_info(&dev->interface->dev,
+                        "Diolan U2C serial number %u\n", serial);
+       }
+}
+
+static int diolan_init(struct i2c_diolan_u2c *dev)
+{
+       int speed, ret;
+
+       if (frequency >= 200000) {
+               speed = U2C_I2C_SPEED_FAST;
+               frequency = U2C_I2C_FREQ_FAST;
+       } else if (frequency >= 100000 || frequency == 0) {
+               speed = U2C_I2C_SPEED_STD;
+               frequency = U2C_I2C_FREQ_STD;
+       } else {
+               speed = U2C_I2C_SPEED(frequency);
+               if (speed > U2C_I2C_SPEED_2KHZ)
+                       speed = U2C_I2C_SPEED_2KHZ;
+               frequency = U2C_I2C_FREQ(speed);
+       }
+
+       dev_info(&dev->interface->dev,
+                "Diolan U2C at USB bus %03d address %03d speed %d Hz\n",
+                dev->usb_dev->bus->busnum, dev->usb_dev->devnum, frequency);
+
+       diolan_flush_input(dev);
+       diolan_fw_version(dev);
+       diolan_get_serial(dev);
+
+       /* Set I2C speed */
+       ret = diolan_set_speed(dev, speed);
+       if (ret < 0)
+               return ret;
+
+       /* Configure I2C clock synchronization */
+       ret = diolan_set_clock_synch(dev, speed != U2C_I2C_SPEED_FAST);
+       if (ret < 0)
+               return ret;
+
+       if (speed != U2C_I2C_SPEED_FAST)
+               ret = diolan_set_clock_synch_timeout(dev, DIOLAN_SYNC_TIMEOUT);
+
+       return ret;
+}
+
+/* i2c layer */
+
+static int diolan_usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
+                          int num)
+{
+       struct i2c_diolan_u2c *dev = i2c_get_adapdata(adapter);
+       struct i2c_msg *pmsg;
+       int i, j;
+       int ret, sret;
+
+       ret = diolan_i2c_start(dev);
+       if (ret < 0)
+               return ret;
+
+       for (i = 0; i < num; i++) {
+               pmsg = &msgs[i];
+               if (i) {
+                       ret = diolan_i2c_repeated_start(dev);
+                       if (ret < 0)
+                               goto abort;
+               }
+               if (pmsg->flags & I2C_M_RD) {
+                       ret =
+                           diolan_i2c_put_byte_ack(dev, (pmsg->addr << 1) | 1);
+                       if (ret < 0)
+                               goto abort;
+                       for (j = 0; j < pmsg->len; j++) {
+                               u8 byte;
+                               bool ack = j < pmsg->len - 1;
+
+                               /*
+                                * Don't send NACK if this is the first byte
+                                * of a SMBUS_BLOCK message.
+                                */
+                               if (j == 0 && (pmsg->flags & I2C_M_RECV_LEN))
+                                       ack = true;
+
+                               ret = diolan_i2c_get_byte_ack(dev, ack, &byte);
+                               if (ret < 0)
+                                       goto abort;
+                               /*
+                                * Adjust count if first received byte is length
+                                */
+                               if (j == 0 && (pmsg->flags & I2C_M_RECV_LEN)) {
+                                       if (byte == 0
+                                           || byte > I2C_SMBUS_BLOCK_MAX) {
+                                               ret = -EPROTO;
+                                               goto abort;
+                                       }
+                                       pmsg->len += byte;
+                               }
+                               pmsg->buf[j] = byte;
+                       }
+               } else {
+                       ret = diolan_i2c_put_byte_ack(dev, pmsg->addr << 1);
+                       if (ret < 0)
+                               goto abort;
+                       for (j = 0; j < pmsg->len; j++) {
+                               ret = diolan_i2c_put_byte_ack(dev,
+                                                             pmsg->buf[j]);
+                               if (ret < 0)
+                                       goto abort;
+                       }
+               }
+       }
+abort:
+       sret = diolan_i2c_stop(dev);
+       if (sret < 0 && ret >= 0)
+               ret = sret;
+       return ret;
+}
+
+/*
+ * Return list of supported functionality.
+ */
+static u32 diolan_usb_func(struct i2c_adapter *a)
+{
+       return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+              I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL;
+}
+
+static const struct i2c_algorithm diolan_usb_algorithm = {
+       .master_xfer = diolan_usb_xfer,
+       .functionality = diolan_usb_func,
+};
+
+/* device layer */
+
+static const struct usb_device_id diolan_u2c_table[] = {
+       { USB_DEVICE(USB_VENDOR_ID_DIOLAN, USB_DEVICE_ID_DIOLAN_U2C) },
+       { }
+};
+
+MODULE_DEVICE_TABLE(usb, diolan_u2c_table);
+
+static void diolan_u2c_free(struct i2c_diolan_u2c *dev)
+{
+       usb_put_dev(dev->usb_dev);
+       kfree(dev);
+}
+
+static int diolan_u2c_probe(struct usb_interface *interface,
+                           const struct usb_device_id *id)
+{
+       struct i2c_diolan_u2c *dev;
+       int ret;
+
+       /* allocate memory for our device state and initialize it */
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       if (dev == NULL) {
+               dev_err(&interface->dev, "no memory for device state\n");
+               ret = -ENOMEM;
+               goto error;
+       }
+
+       dev->usb_dev = usb_get_dev(interface_to_usbdev(interface));
+       dev->interface = interface;
+
+       /* save our data pointer in this interface device */
+       usb_set_intfdata(interface, dev);
+
+       /* setup i2c adapter description */
+       dev->adapter.owner = THIS_MODULE;
+       dev->adapter.class = I2C_CLASS_HWMON;
+       dev->adapter.algo = &diolan_usb_algorithm;
+       i2c_set_adapdata(&dev->adapter, dev);
+       snprintf(dev->adapter.name, sizeof(dev->adapter.name),
+                DRIVER_NAME " at bus %03d device %03d",
+                dev->usb_dev->bus->busnum, dev->usb_dev->devnum);
+
+       dev->adapter.dev.parent = &dev->interface->dev;
+
+       /* initialize diolan i2c interface */
+       ret = diolan_init(dev);
+       if (ret < 0) {
+               dev_err(&interface->dev, "failed to initialize adapter\n");
+               goto error_free;
+       }
+
+       /* and finally attach to i2c layer */
+       ret = i2c_add_adapter(&dev->adapter);
+       if (ret < 0) {
+               dev_err(&interface->dev, "failed to add I2C adapter\n");
+               goto error_free;
+       }
+
+       dev_dbg(&interface->dev, "connected " DRIVER_NAME "\n");
+
+       return 0;
+
+error_free:
+       usb_set_intfdata(interface, NULL);
+       diolan_u2c_free(dev);
+error:
+       return ret;
+}
+
+static void diolan_u2c_disconnect(struct usb_interface *interface)
+{
+       struct i2c_diolan_u2c *dev = usb_get_intfdata(interface);
+
+       i2c_del_adapter(&dev->adapter);
+       usb_set_intfdata(interface, NULL);
+       diolan_u2c_free(dev);
+
+       dev_dbg(&interface->dev, "disconnected\n");
+}
+
+static struct usb_driver diolan_u2c_driver = {
+       .name = DRIVER_NAME,
+       .probe = diolan_u2c_probe,
+       .disconnect = diolan_u2c_disconnect,
+       .id_table = diolan_u2c_table,
+};
+
+static int __init diolan_u2c_init(void)
+{
+       /* register this driver with the USB subsystem */
+       return usb_register(&diolan_u2c_driver);
+}
+
+static void __exit diolan_u2c_exit(void)
+{
+       /* deregister this driver with the USB subsystem */
+       usb_deregister(&diolan_u2c_driver);
+}
+
+module_init(diolan_u2c_init);
+module_exit(diolan_u2c_exit);
+
+MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>");
+MODULE_DESCRIPTION(DRIVER_NAME " driver");
+MODULE_LICENSE("GPL");
index 50ea1f43bdc1ea6f11688c64e044fe573736dba4..878a12026af2e2fa1b89225563248fe597659c02 100644 (file)
 #define pch_pci_dbg(pdev, fmt, arg...)  \
        dev_dbg(&pdev->dev, "%s :" fmt, __func__, ##arg)
 
+/*
+Set the number of I2C instance max
+Intel EG20T PCH :              1ch
+OKI SEMICONDUCTOR ML7213 IOH : 2ch
+*/
+#define PCH_I2C_MAX_DEV                        2
+
 /**
  * struct i2c_algo_pch_data - for I2C driver functionalities
  * @pch_adapter:               stores the reference to i2c_adapter structure
@@ -156,12 +163,14 @@ struct i2c_algo_pch_data {
  * @pch_data:          stores a list of i2c_algo_pch_data
  * @pch_i2c_suspended: specifies whether the system is suspended or not
  *                     perhaps with more lines and words.
+ * @ch_num:            specifies the number of i2c instance
  *
  * pch_data has as many elements as maximum I2C channels
  */
 struct adapter_info {
-       struct i2c_algo_pch_data pch_data;
+       struct i2c_algo_pch_data pch_data[PCH_I2C_MAX_DEV];
        bool pch_i2c_suspended;
+       int ch_num;
 };
 
 
@@ -170,8 +179,13 @@ static int pch_clk = 50000;        /* specifies I2C clock speed in KHz */
 static wait_queue_head_t pch_event;
 static DEFINE_MUTEX(pch_mutex);
 
+/* Definition for ML7213 by OKI SEMICONDUCTOR */
+#define PCI_VENDOR_ID_ROHM             0x10DB
+#define PCI_DEVICE_ID_ML7213_I2C       0x802D
+
 static struct pci_device_id __devinitdata pch_pcidev_id[] = {
-       {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PCH_I2C)},
+       { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH_I2C),   1, },
+       { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ML7213_I2C), 2, },
        {0,}
 };
 
@@ -212,8 +226,7 @@ static void pch_i2c_init(struct i2c_algo_pch_data *adap)
        /* Initialize I2C registers */
        iowrite32(0x21, p + PCH_I2CNF);
 
-       pch_setbit(adap->pch_base_address, PCH_I2CCTL,
-                         PCH_I2CCTL_I2CMEN);
+       pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_I2CCTL_I2CMEN);
 
        if (pch_i2c_speed != 400)
                pch_i2c_speed = 100;
@@ -255,7 +268,7 @@ static inline bool ktime_lt(const ktime_t cmp1, const ktime_t cmp2)
  * @timeout:   waiting time counter (us).
  */
 static s32 pch_i2c_wait_for_bus_idle(struct i2c_algo_pch_data *adap,
-                                s32 timeout)
+                                    s32 timeout)
 {
        void __iomem *p = adap->pch_base_address;
 
@@ -475,8 +488,8 @@ static void pch_i2c_sendnack(struct i2c_algo_pch_data *adap)
  * @last:      specifies whether last message or not.
  * @first:     specifies whether first message or not.
  */
-s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
-                 u32 last, u32 first)
+static s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
+                            u32 last, u32 first)
 {
        struct i2c_algo_pch_data *adap = i2c_adap->algo_data;
 
@@ -569,10 +582,10 @@ s32 pch_i2c_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
 }
 
 /**
- * pch_i2c_cb_ch0() - Interrupt handler Call back function
+ * pch_i2c_cb() - Interrupt handler Call back function
  * @adap:      Pointer to struct i2c_algo_pch_data.
  */
-static void pch_i2c_cb_ch0(struct i2c_algo_pch_data *adap)
+static void pch_i2c_cb(struct i2c_algo_pch_data *adap)
 {
        u32 sts;
        void __iomem *p = adap->pch_base_address;
@@ -600,24 +613,30 @@ static void pch_i2c_cb_ch0(struct i2c_algo_pch_data *adap)
  */
 static irqreturn_t pch_i2c_handler(int irq, void *pData)
 {
-       s32 reg_val;
-
-       struct i2c_algo_pch_data *adap_data = (struct i2c_algo_pch_data *)pData;
-       void __iomem *p = adap_data->pch_base_address;
-       u32 mode = ioread32(p + PCH_I2CMOD) & (BUFFER_MODE | EEPROM_SR_MODE);
-
-       if (mode != NORMAL_MODE) {
-               pch_err(adap_data, "I2C mode is not supported\n");
-               return IRQ_NONE;
+       u32 reg_val;
+       int flag;
+       int i;
+       struct adapter_info *adap_info = pData;
+       void __iomem *p;
+       u32 mode;
+
+       for (i = 0, flag = 0; i < adap_info->ch_num; i++) {
+               p = adap_info->pch_data[i].pch_base_address;
+               mode = ioread32(p + PCH_I2CMOD);
+               mode &= BUFFER_MODE | EEPROM_SR_MODE;
+               if (mode != NORMAL_MODE) {
+                       pch_err(adap_info->pch_data,
+                               "I2C-%d mode(%d) is not supported\n", mode, i);
+                       continue;
+               }
+               reg_val = ioread32(p + PCH_I2CSR);
+               if (reg_val & (I2CMAL_BIT | I2CMCF_BIT | I2CMIF_BIT)) {
+                       pch_i2c_cb(&adap_info->pch_data[i]);
+                       flag = 1;
+               }
        }
 
-       reg_val = ioread32(p + PCH_I2CSR);
-       if (reg_val & (I2CMAL_BIT | I2CMCF_BIT | I2CMIF_BIT))
-               pch_i2c_cb_ch0(adap_data);
-       else
-               return IRQ_NONE;
-
-       return IRQ_HANDLED;
+       return flag ? IRQ_HANDLED : IRQ_NONE;
 }
 
 /**
@@ -627,7 +646,7 @@ static irqreturn_t pch_i2c_handler(int irq, void *pData)
  * @num:       number of messages.
  */
 static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap,
-                   struct i2c_msg *msgs, s32 num)
+                       struct i2c_msg *msgs, s32 num)
 {
        struct i2c_msg *pmsg;
        u32 i = 0;
@@ -710,11 +729,13 @@ static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)
 }
 
 static int __devinit pch_i2c_probe(struct pci_dev *pdev,
-                              const struct pci_device_id *id)
+                                  const struct pci_device_id *id)
 {
        void __iomem *base_addr;
-       s32 ret;
+       int ret;
+       int i, j;
        struct adapter_info *adap_info;
+       struct i2c_adapter *pch_adap;
 
        pch_pci_dbg(pdev, "Entered.\n");
 
@@ -744,44 +765,48 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev,
                goto err_pci_iomap;
        }
 
-       adap_info->pch_i2c_suspended = false;
+       /* Set the number of I2C channel instance */
+       adap_info->ch_num = id->driver_data;
 
-       adap_info->pch_data.p_adapter_info = adap_info;
+       for (i = 0; i < adap_info->ch_num; i++) {
+               pch_adap = &adap_info->pch_data[i].pch_adapter;
+               adap_info->pch_i2c_suspended = false;
 
-       adap_info->pch_data.pch_adapter.owner = THIS_MODULE;
-       adap_info->pch_data.pch_adapter.class = I2C_CLASS_HWMON;
-       strcpy(adap_info->pch_data.pch_adapter.name, KBUILD_MODNAME);
-       adap_info->pch_data.pch_adapter.algo = &pch_algorithm;
-       adap_info->pch_data.pch_adapter.algo_data =
-                                               &adap_info->pch_data;
+               adap_info->pch_data[i].p_adapter_info = adap_info;
 
-       /* (i * 0x80) + base_addr; */
-       adap_info->pch_data.pch_base_address = base_addr;
+               pch_adap->owner = THIS_MODULE;
+               pch_adap->class = I2C_CLASS_HWMON;
+               strcpy(pch_adap->name, KBUILD_MODNAME);
+               pch_adap->algo = &pch_algorithm;
+               pch_adap->algo_data = &adap_info->pch_data[i];
 
-       adap_info->pch_data.pch_adapter.dev.parent = &pdev->dev;
+               /* base_addr + offset; */
+               adap_info->pch_data[i].pch_base_address = base_addr + 0x100 * i;
 
-       ret = i2c_add_adapter(&(adap_info->pch_data.pch_adapter));
+               pch_adap->dev.parent = &pdev->dev;
 
-       if (ret) {
-               pch_pci_err(pdev, "i2c_add_adapter FAILED\n");
-               goto err_i2c_add_adapter;
-       }
+               ret = i2c_add_adapter(pch_adap);
+               if (ret) {
+                       pch_pci_err(pdev, "i2c_add_adapter[ch:%d] FAILED\n", i);
+                       goto err_i2c_add_adapter;
+               }
 
-       pch_i2c_init(&adap_info->pch_data);
+               pch_i2c_init(&adap_info->pch_data[i]);
+       }
        ret = request_irq(pdev->irq, pch_i2c_handler, IRQF_SHARED,
-                 KBUILD_MODNAME, &adap_info->pch_data);
+                 KBUILD_MODNAME, adap_info);
        if (ret) {
                pch_pci_err(pdev, "request_irq FAILED\n");
-               goto err_request_irq;
+               goto err_i2c_add_adapter;
        }
 
        pci_set_drvdata(pdev, adap_info);
        pch_pci_dbg(pdev, "returns %d.\n", ret);
        return 0;
 
-err_request_irq:
-       i2c_del_adapter(&(adap_info->pch_data.pch_adapter));
 err_i2c_add_adapter:
+       for (j = 0; j < i; j++)
+               i2c_del_adapter(&adap_info->pch_data[j].pch_adapter);
        pci_iounmap(pdev, base_addr);
 err_pci_iomap:
        pci_release_regions(pdev);
@@ -794,17 +819,22 @@ err_pci_enable:
 
 static void __devexit pch_i2c_remove(struct pci_dev *pdev)
 {
+       int i;
        struct adapter_info *adap_info = pci_get_drvdata(pdev);
 
-       pch_i2c_disbl_int(&adap_info->pch_data);
-       free_irq(pdev->irq, &adap_info->pch_data);
-       i2c_del_adapter(&(adap_info->pch_data.pch_adapter));
+       free_irq(pdev->irq, adap_info);
 
-       if (adap_info->pch_data.pch_base_address) {
-               pci_iounmap(pdev, adap_info->pch_data.pch_base_address);
-               adap_info->pch_data.pch_base_address = 0;
+       for (i = 0; i < adap_info->ch_num; i++) {
+               pch_i2c_disbl_int(&adap_info->pch_data[i]);
+               i2c_del_adapter(&adap_info->pch_data[i].pch_adapter);
        }
 
+       if (adap_info->pch_data[0].pch_base_address)
+               pci_iounmap(pdev, adap_info->pch_data[0].pch_base_address);
+
+       for (i = 0; i < adap_info->ch_num; i++)
+               adap_info->pch_data[i].pch_base_address = 0;
+
        pci_set_drvdata(pdev, NULL);
 
        pci_release_regions(pdev);
@@ -817,17 +847,22 @@ static void __devexit pch_i2c_remove(struct pci_dev *pdev)
 static int pch_i2c_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        int ret;
+       int i;
        struct adapter_info *adap_info = pci_get_drvdata(pdev);
-       void __iomem *p = adap_info->pch_data.pch_base_address;
+       void __iomem *p = adap_info->pch_data[0].pch_base_address;
 
        adap_info->pch_i2c_suspended = true;
 
-       while ((adap_info->pch_data.pch_i2c_xfer_in_progress)) {
-               /* Wait until all channel transfers are completed */
-               msleep(20);
+       for (i = 0; i < adap_info->ch_num; i++) {
+               while ((adap_info->pch_data[i].pch_i2c_xfer_in_progress)) {
+                       /* Wait until all channel transfers are completed */
+                       msleep(20);
+               }
        }
+
        /* Disable the i2c interrupts */
-       pch_i2c_disbl_int(&adap_info->pch_data);
+       for (i = 0; i < adap_info->ch_num; i++)
+               pch_i2c_disbl_int(&adap_info->pch_data[i]);
 
        pch_pci_dbg(pdev, "I2CSR = %x I2CBUFSTA = %x I2CESRSTA = %x "
                "invoked function pch_i2c_disbl_int successfully\n",
@@ -850,6 +885,7 @@ static int pch_i2c_suspend(struct pci_dev *pdev, pm_message_t state)
 
 static int pch_i2c_resume(struct pci_dev *pdev)
 {
+       int i;
        struct adapter_info *adap_info = pci_get_drvdata(pdev);
 
        pci_set_power_state(pdev, PCI_D0);
@@ -862,7 +898,8 @@ static int pch_i2c_resume(struct pci_dev *pdev)
 
        pci_enable_wake(pdev, PCI_D3hot, 0);
 
-       pch_i2c_init(&adap_info->pch_data);
+       for (i = 0; i < adap_info->ch_num; i++)
+               pch_i2c_init(&adap_info->pch_data[i]);
 
        adap_info->pch_i2c_suspended = false;
 
@@ -894,7 +931,7 @@ static void __exit pch_pci_exit(void)
 }
 module_exit(pch_pci_exit);
 
-MODULE_DESCRIPTION("PCH I2C PCI Driver");
+MODULE_DESCRIPTION("Intel EG20T PCH/OKI SEMICONDUCTOR ML7213 IOH I2C Driver");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Tomoya MORINAGA. <tomoya-linux@dsn.okisemi.com>");
 module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR));
index 7979aef7ee7b2db822ca99937210c04346815006..ed2e0c5ea37c7b53ee1b67a20881caff26e7797d 100644 (file)
   ICH10                 0x3a30     32     hard     yes     yes     yes
   ICH10                 0x3a60     32     hard     yes     yes     yes
   5/3400 Series (PCH)   0x3b30     32     hard     yes     yes     yes
-  Cougar Point (PCH)    0x1c22     32     hard     yes     yes     yes
+  6 Series (PCH)        0x1c22     32     hard     yes     yes     yes
   Patsburg (PCH)        0x1d22     32     hard     yes     yes     yes
   Patsburg (PCH) IDF    0x1d70     32     hard     yes     yes     yes
   Patsburg (PCH) IDF    0x1d71     32     hard     yes     yes     yes
   Patsburg (PCH) IDF    0x1d72     32     hard     yes     yes     yes
+  DH89xxCC (PCH)        0x2330     32     hard     yes     yes     yes
 
   Features supported by this driver:
   Software PEC                     no
@@ -621,6 +622,7 @@ static const struct pci_device_id i801_ids[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF0) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF1) },
        { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PATSBURG_SMBUS_IDF2) },
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) },
        { 0, }
 };
 
index 8022e2390a5a74d9c21ea67df4cf7c7600732581..caf96dc8ca1b9ba5aca46b4fcf7f7a91147d565b 100644 (file)
@@ -118,6 +118,8 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c)
 {
        mxs_reset_block(i2c->regs);
        writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET);
+       writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
+                       i2c->regs + MXS_I2C_QUEUECTRL_SET);
 }
 
 static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len,
@@ -347,8 +349,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
 
        /* Do reset to enforce correct startup after pinmuxing */
        mxs_i2c_reset(i2c);
-       writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
-                       i2c->regs + MXS_I2C_QUEUECTRL_SET);
 
        adap = &i2c->adapter;
        strlcpy(adap->name, "MXS I2C adapter", sizeof(adap->name));
diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c
new file mode 100644 (file)
index 0000000..6659d26
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * The CE4100's I2C device is more or less the same one as found on PXA.
+ * It does not support slave mode, the register slightly moved. This PCI
+ * device provides three bars, every contains a single I2C controller.
+ */
+#include <linux/pci.h>
+#include <linux/platform_device.h>
+#include <linux/i2c/pxa-i2c.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_address.h>
+
+#define CE4100_PCI_I2C_DEVS    3
+
+struct ce4100_devices {
+       struct platform_device *pdev[CE4100_PCI_I2C_DEVS];
+};
+
+static struct platform_device *add_i2c_device(struct pci_dev *dev, int bar)
+{
+       struct platform_device *pdev;
+       struct i2c_pxa_platform_data pdata;
+       struct resource res[2];
+       struct device_node *child;
+       static int devnum;
+       int ret;
+
+       memset(&pdata, 0, sizeof(struct i2c_pxa_platform_data));
+       memset(&res, 0, sizeof(res));
+
+       res[0].flags = IORESOURCE_MEM;
+       res[0].start = pci_resource_start(dev, bar);
+       res[0].end = pci_resource_end(dev, bar);
+
+       res[1].flags = IORESOURCE_IRQ;
+       res[1].start = dev->irq;
+       res[1].end = dev->irq;
+
+       for_each_child_of_node(dev->dev.of_node, child) {
+               const void *prop;
+               struct resource r;
+               int ret;
+
+               ret = of_address_to_resource(child, 0, &r);
+               if (ret < 0)
+                       continue;
+               if (r.start != res[0].start)
+                       continue;
+               if (r.end != res[0].end)
+                       continue;
+               if (r.flags != res[0].flags)
+                       continue;
+
+               prop = of_get_property(child, "fast-mode", NULL);
+               if (prop)
+                       pdata.fast_mode = 1;
+
+               break;
+       }
+
+       if (!child) {
+               dev_err(&dev->dev, "failed to match a DT node for bar %d.\n",
+                               bar);
+               ret = -EINVAL;
+               goto out;
+       }
+
+       pdev = platform_device_alloc("ce4100-i2c", devnum);
+       if (!pdev) {
+               of_node_put(child);
+               ret = -ENOMEM;
+               goto out;
+       }
+       pdev->dev.parent = &dev->dev;
+       pdev->dev.of_node = child;
+
+       ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
+       if (ret)
+               goto err;
+
+       ret = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+       if (ret)
+               goto err;
+
+       ret = platform_device_add(pdev);
+       if (ret)
+               goto err;
+       devnum++;
+       return pdev;
+err:
+       platform_device_put(pdev);
+out:
+       return ERR_PTR(ret);
+}
+
+static int __devinit ce4100_i2c_probe(struct pci_dev *dev,
+               const struct pci_device_id *ent)
+{
+       int ret;
+       int i;
+       struct ce4100_devices *sds;
+
+       ret = pci_enable_device_mem(dev);
+       if (ret)
+               return ret;
+
+       if (!dev->dev.of_node) {
+               dev_err(&dev->dev, "Missing device tree node.\n");
+               return -EINVAL;
+       }
+       sds = kzalloc(sizeof(*sds), GFP_KERNEL);
+       if (!sds)
+               goto err_mem;
+
+       for (i = 0; i < ARRAY_SIZE(sds->pdev); i++) {
+               sds->pdev[i] = add_i2c_device(dev, i);
+               if (IS_ERR(sds->pdev[i])) {
+                       while (--i >= 0)
+                               platform_device_unregister(sds->pdev[i]);
+                       goto err_dev_add;
+               }
+       }
+       pci_set_drvdata(dev, sds);
+       return 0;
+
+err_dev_add:
+       pci_set_drvdata(dev, NULL);
+       kfree(sds);
+err_mem:
+       pci_disable_device(dev);
+       return ret;
+}
+
+static void __devexit ce4100_i2c_remove(struct pci_dev *dev)
+{
+       struct ce4100_devices *sds;
+       unsigned int i;
+
+       sds = pci_get_drvdata(dev);
+       pci_set_drvdata(dev, NULL);
+
+       for (i = 0; i < ARRAY_SIZE(sds->pdev); i++)
+               platform_device_unregister(sds->pdev[i]);
+
+       pci_disable_device(dev);
+       kfree(sds);
+}
+
+static struct pci_device_id ce4100_i2c_devices[] __devinitdata = {
+       { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x2e68)},
+       { },
+};
+MODULE_DEVICE_TABLE(pci, ce4100_i2c_devices);
+
+static struct pci_driver ce4100_i2c_driver = {
+       .name           = "ce4100_i2c",
+       .id_table       = ce4100_i2c_devices,
+       .probe          = ce4100_i2c_probe,
+       .remove         = __devexit_p(ce4100_i2c_remove),
+};
+
+static int __init ce4100_i2c_init(void)
+{
+       return pci_register_driver(&ce4100_i2c_driver);
+}
+module_init(ce4100_i2c_init);
+
+static void __exit ce4100_i2c_exit(void)
+{
+       pci_unregister_driver(&ce4100_i2c_driver);
+}
+module_exit(ce4100_i2c_exit);
+
+MODULE_DESCRIPTION("CE4100 PCI-I2C glue code for PXA's driver");
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Sebastian Andrzej Siewior <bigeasy@linutronix.de>");
index f4c19a97e0b302d4339a9272f1b405bbf05d877a..f59224a5c76183374eaefd99ff072eb38231d80c 100644 (file)
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/i2c-pxa.h>
+#include <linux/of_i2c.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
 #include <linux/clk.h>
 #include <linux/slab.h>
 #include <linux/io.h>
+#include <linux/i2c/pxa-i2c.h>
 
 #include <asm/irq.h>
-#include <plat/i2c.h>
+
+#ifndef CONFIG_HAVE_CLK
+#define clk_get(dev, id)       NULL
+#define clk_put(clk)           do { } while (0)
+#define clk_disable(clk)       do { } while (0)
+#define clk_enable(clk)                do { } while (0)
+#endif
+
+struct pxa_reg_layout {
+       u32 ibmr;
+       u32 idbr;
+       u32 icr;
+       u32 isr;
+       u32 isar;
+};
+
+enum pxa_i2c_types {
+       REGS_PXA2XX,
+       REGS_PXA3XX,
+       REGS_CE4100,
+};
 
 /*
- * I2C register offsets will be shifted 0 or 1 bit left, depending on
- * different SoCs
+ * I2C registers definitions
  */
-#define REG_SHIFT_0    (0 << 0)
-#define REG_SHIFT_1    (1 << 0)
-#define REG_SHIFT(d)   ((d) & 0x1)
+static struct pxa_reg_layout pxa_reg_layout[] = {
+       [REGS_PXA2XX] = {
+               .ibmr = 0x00,
+               .idbr = 0x08,
+               .icr =  0x10,
+               .isr =  0x18,
+               .isar = 0x20,
+       },
+       [REGS_PXA3XX] = {
+               .ibmr = 0x00,
+               .idbr = 0x04,
+               .icr =  0x08,
+               .isr =  0x0c,
+               .isar = 0x10,
+       },
+       [REGS_CE4100] = {
+               .ibmr = 0x14,
+               .idbr = 0x0c,
+               .icr =  0x00,
+               .isr =  0x04,
+               /* no isar register */
+       },
+};
 
 static const struct platform_device_id i2c_pxa_id_table[] = {
-       { "pxa2xx-i2c",         REG_SHIFT_1 },
-       { "pxa3xx-pwri2c",      REG_SHIFT_0 },
+       { "pxa2xx-i2c",         REGS_PXA2XX },
+       { "pxa3xx-pwri2c",      REGS_PXA3XX },
+       { "ce4100-i2c",         REGS_CE4100 },
        { },
 };
 MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table);
 
 /*
- * I2C registers and bit definitions
+ * I2C bit definitions
  */
-#define IBMR           (0x00)
-#define IDBR           (0x08)
-#define ICR            (0x10)
-#define ISR            (0x18)
-#define ISAR           (0x20)
 
 #define ICR_START      (1 << 0)           /* start bit */
 #define ICR_STOP       (1 << 1)           /* stop bit */
@@ -111,7 +148,11 @@ struct pxa_i2c {
        u32                     icrlog[32];
 
        void __iomem            *reg_base;
-       unsigned int            reg_shift;
+       void __iomem            *reg_ibmr;
+       void __iomem            *reg_idbr;
+       void __iomem            *reg_icr;
+       void __iomem            *reg_isr;
+       void __iomem            *reg_isar;
 
        unsigned long           iobase;
        unsigned long           iosize;
@@ -121,11 +162,11 @@ struct pxa_i2c {
        unsigned int            fast_mode :1;
 };
 
-#define _IBMR(i2c)     ((i2c)->reg_base + (0x0 << (i2c)->reg_shift))
-#define _IDBR(i2c)     ((i2c)->reg_base + (0x4 << (i2c)->reg_shift))
-#define _ICR(i2c)      ((i2c)->reg_base + (0x8 << (i2c)->reg_shift))
-#define _ISR(i2c)      ((i2c)->reg_base + (0xc << (i2c)->reg_shift))
-#define _ISAR(i2c)     ((i2c)->reg_base + (0x10 << (i2c)->reg_shift))
+#define _IBMR(i2c)     ((i2c)->reg_ibmr)
+#define _IDBR(i2c)     ((i2c)->reg_idbr)
+#define _ICR(i2c)      ((i2c)->reg_icr)
+#define _ISR(i2c)      ((i2c)->reg_isr)
+#define _ISAR(i2c)     ((i2c)->reg_isar)
 
 /*
  * I2C Slave mode address
@@ -418,7 +459,8 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
        writel(I2C_ISR_INIT, _ISR(i2c));
        writel(readl(_ICR(i2c)) & ~ICR_UR, _ICR(i2c));
 
-       writel(i2c->slave_addr, _ISAR(i2c));
+       if (i2c->reg_isar)
+               writel(i2c->slave_addr, _ISAR(i2c));
 
        /* set control register values */
        writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
@@ -729,8 +771,10 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
         */
        ret = i2c->msg_idx;
 
-       if (timeout == 0)
+       if (!timeout && i2c->msg_num) {
                i2c_pxa_scream_blue_murder(i2c, "timeout");
+               ret = I2C_RETRY;
+       }
 
  out:
        return ret;
@@ -915,11 +959,16 @@ static void i2c_pxa_irq_rxfull(struct pxa_i2c *i2c, u32 isr)
        writel(icr, _ICR(i2c));
 }
 
+#define VALID_INT_SOURCE       (ISR_SSD | ISR_ALD | ISR_ITE | ISR_IRF | \
+                               ISR_SAD | ISR_BED)
 static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id)
 {
        struct pxa_i2c *i2c = dev_id;
        u32 isr = readl(_ISR(i2c));
 
+       if (!(isr & VALID_INT_SOURCE))
+               return IRQ_NONE;
+
        if (i2c_debug > 2 && 0) {
                dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
                        __func__, isr, readl(_ICR(i2c)), readl(_IBMR(i2c)));
@@ -934,7 +983,7 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id)
        /*
         * Always clear all pending IRQs.
         */
-       writel(isr & (ISR_SSD|ISR_ALD|ISR_ITE|ISR_IRF|ISR_SAD|ISR_BED), _ISR(i2c));
+       writel(isr & VALID_INT_SOURCE, _ISR(i2c));
 
        if (isr & ISR_SAD)
                i2c_pxa_slave_start(i2c, isr);
@@ -1001,6 +1050,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
        struct resource *res;
        struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
        const struct platform_device_id *id = platform_get_device_id(dev);
+       enum pxa_i2c_types i2c_type = id->driver_data;
        int ret;
        int irq;
 
@@ -1044,7 +1094,13 @@ static int i2c_pxa_probe(struct platform_device *dev)
                ret = -EIO;
                goto eremap;
        }
-       i2c->reg_shift = REG_SHIFT(id->driver_data);
+
+       i2c->reg_ibmr = i2c->reg_base + pxa_reg_layout[i2c_type].ibmr;
+       i2c->reg_idbr = i2c->reg_base + pxa_reg_layout[i2c_type].idbr;
+       i2c->reg_icr = i2c->reg_base + pxa_reg_layout[i2c_type].icr;
+       i2c->reg_isr = i2c->reg_base + pxa_reg_layout[i2c_type].isr;
+       if (i2c_type != REGS_CE4100)
+               i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar;
 
        i2c->iobase = res->start;
        i2c->iosize = resource_size(res);
@@ -1072,7 +1128,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
                i2c->adap.algo = &i2c_pxa_pio_algorithm;
        } else {
                i2c->adap.algo = &i2c_pxa_algorithm;
-               ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED,
+               ret = request_irq(irq, i2c_pxa_handler, IRQF_SHARED,
                                  i2c->adap.name, i2c);
                if (ret)
                        goto ereqirq;
@@ -1082,12 +1138,19 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
        i2c->adap.algo_data = i2c;
        i2c->adap.dev.parent = &dev->dev;
+#ifdef CONFIG_OF
+       i2c->adap.dev.of_node = dev->dev.of_node;
+#endif
 
-       ret = i2c_add_numbered_adapter(&i2c->adap);
+       if (i2c_type == REGS_CE4100)
+               ret = i2c_add_adapter(&i2c->adap);
+       else
+               ret = i2c_add_numbered_adapter(&i2c->adap);
        if (ret < 0) {
                printk(KERN_INFO "I2C: Failed to add bus\n");
                goto eadapt;
        }
+       of_i2c_register_devices(&i2c->adap);
 
        platform_set_drvdata(dev, i2c);
 
index 7e6a63b571650b1f100c4707309f31de1af415bb..3ca2e012e78932ed8cf33339a3a0a0d404026c03 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * i2c-boardinfo.h - collect pre-declarations of I2C devices
+ * i2c-boardinfo.c - collect pre-declarations of I2C devices
  *
  * 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
index 045ba6efea48fd24cbf651115e2d86a4f87781b4..e5f76a0372fd6f6e9d1fa063b60a07ffb08fb781 100644 (file)
@@ -797,6 +797,9 @@ static int i2c_do_add_adapter(struct i2c_driver *driver,
 
        /* Let legacy drivers scan this bus for matching devices */
        if (driver->attach_adapter) {
+               dev_warn(&adap->dev, "attach_adapter method is deprecated\n");
+               dev_warn(&adap->dev, "Please use another way to instantiate "
+                        "your i2c_client\n");
                /* We ignore the return code; if it fails, too bad */
                driver->attach_adapter(adap);
        }
@@ -981,6 +984,7 @@ static int i2c_do_del_adapter(struct i2c_driver *driver,
 
        if (!driver->detach_adapter)
                return 0;
+       dev_warn(&adapter->dev, "detach_adapter method is deprecated\n");
        res = driver->detach_adapter(adapter);
        if (res)
                dev_err(&adapter->dev, "detach_adapter failed (%d) "
@@ -1091,6 +1095,18 @@ EXPORT_SYMBOL(i2c_del_adapter);
 
 /* ------------------------------------------------------------------------- */
 
+int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *))
+{
+       int res;
+
+       mutex_lock(&core_lock);
+       res = bus_for_each_dev(&i2c_bus_type, NULL, data, fn);
+       mutex_unlock(&core_lock);
+
+       return res;
+}
+EXPORT_SYMBOL_GPL(i2c_for_each_dev);
+
 static int __process_new_driver(struct device *dev, void *data)
 {
        if (dev->type != &i2c_adapter_type)
@@ -1134,9 +1150,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
 
        INIT_LIST_HEAD(&driver->clients);
        /* Walk the adapters that are already present */
-       mutex_lock(&core_lock);
-       bus_for_each_dev(&i2c_bus_type, NULL, driver, __process_new_driver);
-       mutex_unlock(&core_lock);
+       i2c_for_each_dev(driver, __process_new_driver);
 
        return 0;
 }
@@ -1156,9 +1170,7 @@ static int __process_removed_driver(struct device *dev, void *data)
  */
 void i2c_del_driver(struct i2c_driver *driver)
 {
-       mutex_lock(&core_lock);
-       bus_for_each_dev(&i2c_bus_type, NULL, driver, __process_removed_driver);
-       mutex_unlock(&core_lock);
+       i2c_for_each_dev(driver, __process_removed_driver);
 
        driver_unregister(&driver->driver);
        pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name);
@@ -1581,12 +1593,12 @@ i2c_new_probed_device(struct i2c_adapter *adap,
 }
 EXPORT_SYMBOL_GPL(i2c_new_probed_device);
 
-struct i2c_adapter *i2c_get_adapter(int id)
+struct i2c_adapter *i2c_get_adapter(int nr)
 {
        struct i2c_adapter *adapter;
 
        mutex_lock(&core_lock);
-       adapter = idr_find(&i2c_adapter_idr, id);
+       adapter = idr_find(&i2c_adapter_idr, nr);
        if (adapter && !try_module_get(adapter->owner))
                adapter = NULL;
 
index cec0f3ba97f8b1a74d7134d3a86a61e4a79474df..c90ce50b619f7b483b85483a24457a8cab73f3c2 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/device.h>
+#include <linux/notifier.h>
 #include <linux/fs.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/uaccess.h>
 
-static struct i2c_driver i2cdev_driver;
-
 /*
  * An i2c_dev represents an i2c_adapter ... an I2C or SMBus master, not a
  * slave (i2c_client) with which messages will be exchanged.  It's coupled
  * with a character special file which is accessed by user mode drivers.
  *
  * The list of i2c_dev structures is parallel to the i2c_adapter lists
- * maintained by the driver model, and is updated using notifications
- * delivered to the i2cdev_driver.
+ * maintained by the driver model, and is updated using bus notifications.
  */
 struct i2c_dev {
        struct list_head list;
@@ -491,7 +490,6 @@ static int i2cdev_open(struct inode *inode, struct file *file)
                return -ENOMEM;
        }
        snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr);
-       client->driver = &i2cdev_driver;
 
        client->adapter = adap;
        file->private_data = client;
@@ -522,19 +520,18 @@ static const struct file_operations i2cdev_fops = {
 
 /* ------------------------------------------------------------------------- */
 
-/*
- * The legacy "i2cdev_driver" is used primarily to get notifications when
- * I2C adapters are added or removed, so that each one gets an i2c_dev
- * and is thus made available to userspace driver code.
- */
-
 static struct class *i2c_dev_class;
 
-static int i2cdev_attach_adapter(struct i2c_adapter *adap)
+static int i2cdev_attach_adapter(struct device *dev, void *dummy)
 {
+       struct i2c_adapter *adap;
        struct i2c_dev *i2c_dev;
        int res;
 
+       if (dev->type != &i2c_adapter_type)
+               return 0;
+       adap = to_i2c_adapter(dev);
+
        i2c_dev = get_free_i2c_dev(adap);
        if (IS_ERR(i2c_dev))
                return PTR_ERR(i2c_dev);
@@ -561,10 +558,15 @@ error:
        return res;
 }
 
-static int i2cdev_detach_adapter(struct i2c_adapter *adap)
+static int i2cdev_detach_adapter(struct device *dev, void *dummy)
 {
+       struct i2c_adapter *adap;
        struct i2c_dev *i2c_dev;
 
+       if (dev->type != &i2c_adapter_type)
+               return 0;
+       adap = to_i2c_adapter(dev);
+
        i2c_dev = i2c_dev_get_by_minor(adap->nr);
        if (!i2c_dev) /* attach_adapter must have failed */
                return 0;
@@ -577,12 +579,23 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
        return 0;
 }
 
-static struct i2c_driver i2cdev_driver = {
-       .driver = {
-               .name   = "dev_driver",
-       },
-       .attach_adapter = i2cdev_attach_adapter,
-       .detach_adapter = i2cdev_detach_adapter,
+int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action,
+                        void *data)
+{
+       struct device *dev = data;
+
+       switch (action) {
+       case BUS_NOTIFY_ADD_DEVICE:
+               return i2cdev_attach_adapter(dev, NULL);
+       case BUS_NOTIFY_DEL_DEVICE:
+               return i2cdev_detach_adapter(dev, NULL);
+       }
+
+       return 0;
+}
+
+static struct notifier_block i2cdev_notifier = {
+       .notifier_call = i2cdev_notifier_call,
 };
 
 /* ------------------------------------------------------------------------- */
@@ -607,10 +620,14 @@ static int __init i2c_dev_init(void)
                goto out_unreg_chrdev;
        }
 
-       res = i2c_add_driver(&i2cdev_driver);
+       /* Keep track of adapters which will be added or removed later */
+       res = bus_register_notifier(&i2c_bus_type, &i2cdev_notifier);
        if (res)
                goto out_unreg_class;
 
+       /* Bind to already existing adapters right away */
+       i2c_for_each_dev(NULL, i2cdev_attach_adapter);
+
        return 0;
 
 out_unreg_class:
@@ -624,7 +641,8 @@ out:
 
 static void __exit i2c_dev_exit(void)
 {
-       i2c_del_driver(&i2cdev_driver);
+       bus_unregister_notifier(&i2c_bus_type, &i2cdev_notifier);
+       i2c_for_each_dev(NULL, i2cdev_detach_adapter);
        class_destroy(i2c_dev_class);
        unregister_chrdev(I2C_MAJOR, "i2c");
 }
index 81df925f0e8b932c3e821e29dbe2e94d636a2d08..7f879b2397b0e35a535449a3e0dcca8b36f48f10 100644 (file)
@@ -2,7 +2,7 @@
 # link order is important here
 #
 
-EXTRA_CFLAGS                           += -Idrivers/ide
+ccflags-y                              := -Idrivers/ide
 
 ide-core-y += ide.o ide-ioctls.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \
              ide-taskfile.o ide-pm.o ide-park.o ide-sysfs.o ide-devsets.o \
index e0e8e1a184ffa3ff7c7c02682d6fb9eb8c982330..68999137dedfe24cb7044d6de38b6e4f6f8193c5 100644 (file)
@@ -1,3 +1,3 @@
 obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o
 
-EXTRA_CFLAGS += -DDEBUG -DCONFIG_FFD
+ccflags-y := -DDEBUG -DCONFIG_FFD
index ab638b083df9cfffb79071b7a313a5c2663eab4b..646368fe41c94a7a6444b3ce8023663c79cf0308 100644 (file)
@@ -4,7 +4,7 @@
 
 # Define maximum number of cards
 
-EXTRA_CFLAGS      += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
+ccflags-y      := -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
 
 obj-$(CONFIG_ISDN_DRV_HISAX)           += hisax.o
 obj-$(CONFIG_HISAX_SEDLBAUER_CS)       += sedlbauer_cs.o
index dc160fb435150ceeab480513919086a896077d29..98623590c7fe048d727f477f1f6d6ecf42d91ed2 100644 (file)
@@ -2,9 +2,7 @@
 # Makefile for the kernel MemoryStick device drivers.
 #
 
-ifeq ($(CONFIG_MEMSTICK_DEBUG),y)
-       EXTRA_CFLAGS            += -DDEBUG
-endif
+subdir-ccflags-$(CONFIG_MEMSTICK_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_MEMSTICK)         += core/
 obj-$(CONFIG_MEMSTICK)         += host/
index 8b2b5293877e0f1fd7da1766765f72d46d6bf24f..ecd0299377386fee7e062a87c9209a5ad36f22f1 100644 (file)
@@ -2,10 +2,6 @@
 # Makefile for the kernel MemoryStick core.
 #
 
-ifeq ($(CONFIG_MEMSTICK_DEBUG),y)
-       EXTRA_CFLAGS            += -DDEBUG
-endif
-
 obj-$(CONFIG_MEMSTICK)         += memstick.o
 
 obj-$(CONFIG_MSPRO_BLOCK)      += mspro_block.o
index 12530e4311d31143dcab38c1405d92b02418c8de..a1815e9dd0193f49c700ec78c734b203d38bdfa4 100644 (file)
@@ -2,9 +2,5 @@
 # Makefile for MemoryStick host controller drivers
 #
 
-ifeq ($(CONFIG_MEMSTICK_DEBUG),y)
-       EXTRA_CFLAGS                    += -DDEBUG
-endif
-
 obj-$(CONFIG_MEMSTICK_TIFM_MS)         += tifm_ms.o
 obj-$(CONFIG_MEMSTICK_JMICRON_38X)     += jmb38x_ms.o
index 95c9532cb07ca693cd39a6f37a49c9debe3db9d6..d182a24b31955cbf1c9b3fe0c4353d7f962ad968 100644 (file)
@@ -2,7 +2,7 @@
 
 # enable verbose logging
 # CONFIG_FUSION_LOGGING needs to be enabled in Kconfig
-#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE
+#ccflags-y := -DMPT_DEBUG_VERBOSE
 
 
 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
index b7d5ef234ac942f00358abdf700ee2ed21770c5f..203500d9b8483ac8bb412480460d674b84cd3010 100644 (file)
@@ -2,6 +2,14 @@
 # Misc strange devices
 #
 
+# This one has to live outside of the MISC_DEVICES conditional,
+# because it may be selected by drivers/platform/x86/hp_accel.
+config SENSORS_LIS3LV02D
+       tristate
+       depends on INPUT
+       select INPUT_POLLDEV
+       default n
+
 menuconfig MISC_DEVICES
        bool "Misc devices"
        ---help---
@@ -462,5 +470,6 @@ source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
 source "drivers/misc/iwmc3200top/Kconfig"
 source "drivers/misc/ti-st/Kconfig"
+source "drivers/misc/lis3lv02d/Kconfig"
 
 endif # MISC_DEVICES
index 98009cc20cb9c6c887a200bfe96c85948a311be5..804f421bc079432bddc9e4120629d2d037809a22 100644 (file)
@@ -42,3 +42,4 @@ obj-$(CONFIG_ARM_CHARLCD)     += arm-charlcd.o
 obj-$(CONFIG_PCH_PHUB)         += pch_phub.o
 obj-y                          += ti-st/
 obj-$(CONFIG_AB8500_PWM)       += ab8500-pwm.o
+obj-y                          += lis3lv02d/
index 7b80cbf1a609b75f710d9b308a45e66d2bd9deef..467c8e9ca3c94d6b7f54998133a70ec5c88a9403 100644 (file)
@@ -1,6 +1,4 @@
-ifeq ($(CONFIG_CB710_DEBUG),y)
-       EXTRA_CFLAGS            += -DDEBUG
-endif
+ccflags-$(CONFIG_CB710_DEBUG)  := -DDEBUG
 
 obj-$(CONFIG_CB710_CORE)       += cb710.o
 
diff --git a/drivers/misc/lis3lv02d/Kconfig b/drivers/misc/lis3lv02d/Kconfig
new file mode 100644 (file)
index 0000000..8f474e6
--- /dev/null
@@ -0,0 +1,37 @@
+#
+# STMicroelectonics LIS3LV02D and similar accelerometers
+#
+
+config SENSORS_LIS3_SPI
+       tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI)"
+       depends on !ACPI && SPI_MASTER && INPUT
+       select SENSORS_LIS3LV02D
+       default n
+       help
+         This driver provides support for the LIS3LV02Dx accelerometer connected
+         via SPI. The accelerometer data is readable via
+         /sys/devices/platform/lis3lv02d.
+
+         This driver also provides an absolute input class device, allowing
+         the laptop to act as a pinball machine-esque joystick.
+
+         This driver can also be built as modules.  If so, the core module
+         will be called lis3lv02d and a specific module for the SPI transport
+         is called lis3lv02d_spi.
+
+config SENSORS_LIS3_I2C
+       tristate "STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (I2C)"
+       depends on I2C && INPUT
+       select SENSORS_LIS3LV02D
+       default n
+       help
+         This driver provides support for the LIS3LV02Dx accelerometer connected
+         via I2C. The accelerometer data is readable via
+         /sys/devices/platform/lis3lv02d.
+
+         This driver also provides an absolute input class device, allowing
+         the device to act as a pinball machine-esque joystick.
+
+         This driver can also be built as modules.  If so, the core module
+         will be called lis3lv02d and a specific module for the I2C transport
+         is called lis3lv02d_i2c.
diff --git a/drivers/misc/lis3lv02d/Makefile b/drivers/misc/lis3lv02d/Makefile
new file mode 100644 (file)
index 0000000..4bf58b1
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# STMicroelectonics LIS3LV02D and similar accelerometers
+#
+
+obj-$(CONFIG_SENSORS_LIS3LV02D) += lis3lv02d.o
+obj-$(CONFIG_SENSORS_LIS3_SPI) += lis3lv02d_spi.o
+obj-$(CONFIG_SENSORS_LIS3_I2C) += lis3lv02d_i2c.o
similarity index 99%
rename from drivers/hwmon/lis3lv02d.c
rename to drivers/misc/lis3lv02d/lis3lv02d.c
index d805e8e579671d4218a9e1517a487aca1daed761..b928bc14e97b5765c3f815050fc441a3c4bf8787 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 #include <linux/pm_runtime.h>
-#include <asm/atomic.h>
+#include <linux/atomic.h>
 #include "lis3lv02d.h"
 
 #define DRIVER_NAME     "lis3lv02d"
@@ -88,7 +88,6 @@
 struct lis3lv02d lis3_dev = {
        .misc_wait   = __WAIT_QUEUE_HEAD_INITIALIZER(lis3_dev.misc_wait),
 };
-
 EXPORT_SYMBOL_GPL(lis3_dev);
 
 /* just like param_set_int() but does sanity-check so that it won't point
similarity index 99%
rename from drivers/hwmon/lis3lv02d_i2c.c
rename to drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index 8853afce85ce138464787fc9182e27be9206ef1f..b20dfb4522d278eebefa6eb8f2242e78c32f3f8d 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/delay.h>
 #include "lis3lv02d.h"
 
-#define DRV_NAME       "lis3lv02d_i2c"
+#define DRV_NAME       "lis3lv02d_i2c"
 
 static const char reg_vdd[]    = "Vdd";
 static const char reg_vdd_io[] = "Vdd_IO";
index 7c4c306dfa8a464073b74b8c1358c72ed1f0d12d..0003a1d56f7f63123411de0388e2221abc997193 100644 (file)
@@ -1,6 +1,4 @@
-ifdef CONFIG_SGI_GRU_DEBUG
-  EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_SGI_GRU_DEBUG)        := -DDEBUG
 
 obj-$(CONFIG_SGI_GRU) := gru.o
 gru-y := grufile.o grumain.o grufault.o grutlbpurge.o gruprocfs.o grukservices.o gruhandles.o grukdump.o
index 1a6e9eb7af431b8d7d833da233f7a44106775874..338bea147c645c0e418c9028431ed57aa6c1c653 100644 (file)
@@ -2130,7 +2130,7 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
 }
 
 /*
-* First release a slave and than destroy the bond if no more slaves are left.
+* First release a slave and then destroy the bond if no more slaves are left.
 * Must be under rtnl_lock when this function is called.
 */
 static int  bond_release_and_destroy(struct net_device *bond_dev,
index b38d987da67d9c810d069ec9303313aa2978243d..9560b9d624bd56b1bef99b972b3f2d7931819977 100644 (file)
@@ -1,6 +1,4 @@
-ifeq ($(CONFIG_CAIF_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG
 
 # Serial interface
 obj-$(CONFIG_CAIF_TTY) += caif_serial.o
index 14050786218aee8f236fa1d43bd347319b5649dd..110eda01843c6033de8d27afea9ada737da35996 100644 (file)
@@ -633,9 +633,6 @@ static void c_can_start(struct net_device *dev)
 {
        struct c_can_priv *priv = netdev_priv(dev);
 
-       /* enable status change, error and module interrupts */
-       c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);
-
        /* basic c_can configuration */
        c_can_chip_config(dev);
 
@@ -643,6 +640,9 @@ static void c_can_start(struct net_device *dev)
 
        /* reset tx helper pointers */
        priv->tx_next = priv->tx_echo = 0;
+
+       /* enable status change, error and module interrupts */
+       c_can_enable_all_interrupts(priv, ENABLE_ALL_INTERRUPTS);
 }
 
 static void c_can_stop(struct net_device *dev)
index 1d6f4b8d393ab8de500c54f81270df8013b6bff2..a31661948c420e0d467c7e8b7bb4ecae4c078de0 100644 (file)
@@ -1102,7 +1102,7 @@ static int ftmac100_probe(struct platform_device *pdev)
                goto err_req_mem;
        }
 
-       priv->base = ioremap(res->start, res->end - res->start);
+       priv->base = ioremap(res->start, resource_size(res));
        if (!priv->base) {
                dev_err(&pdev->dev, "Failed to ioremap ethernet registers\n");
                err = -EIO;
index ccb231c4d9334bbe49336eeee5f8491e0c8e321b..2a0ad9a501bbea1d99a5ba9b819f7856a34c1346 100644 (file)
@@ -949,6 +949,11 @@ static void gfar_detect_errata(struct gfar_private *priv)
                        (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
                priv->errata |= GFAR_ERRATA_A002;
 
+       /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */
+       if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) ||
+                       (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
+               priv->errata |= GFAR_ERRATA_12;
+
        if (priv->errata)
                dev_info(dev, "enabled errata workarounds, flags: 0x%x\n",
                         priv->errata);
@@ -2154,8 +2159,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
        /* Set up checksumming */
        if (CHECKSUM_PARTIAL == skb->ip_summed) {
                fcb = gfar_add_fcb(skb);
-               lstatus |= BD_LFLAG(TXBD_TOE);
-               gfar_tx_checksum(skb, fcb);
+               /* as specified by errata */
+               if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)
+                            && ((unsigned long)fcb % 0x20) > 0x18)) {
+                       __skb_pull(skb, GMAC_FCB_LEN);
+                       skb_checksum_help(skb);
+               } else {
+                       lstatus |= BD_LFLAG(TXBD_TOE);
+                       gfar_tx_checksum(skb, fcb);
+               }
        }
 
        if (vlan_tx_tag_present(skb)) {
index 54de4135e932b9dd2d92eedd32cf0338a20f3011..ec5d595ce2e265a342ed2c92cb479e202a239e37 100644 (file)
@@ -1039,6 +1039,7 @@ enum gfar_errata {
        GFAR_ERRATA_74          = 0x01,
        GFAR_ERRATA_76          = 0x02,
        GFAR_ERRATA_A002        = 0x04,
+       GFAR_ERRATA_12          = 0x08, /* a.k.a errata eTSEC49 */
 };
 
 /* Struct stolen almost completely (and shamelessly) from the FCC enet source
index 5b37d3c191e49a6146796e84e744fd4496ca2879..78e34e9e4f0082c12baf559ad0a242c2c48f2231 100644 (file)
@@ -39,8 +39,11 @@ struct macvlan_port {
        struct list_head        vlans;
        struct rcu_head         rcu;
        bool                    passthru;
+       int                     count;
 };
 
+static void macvlan_port_destroy(struct net_device *dev);
+
 #define macvlan_port_get_rcu(dev) \
        ((struct macvlan_port *) rcu_dereference(dev->rx_handler_data))
 #define macvlan_port_get(dev) ((struct macvlan_port *) dev->rx_handler_data)
@@ -457,8 +460,13 @@ static int macvlan_init(struct net_device *dev)
 static void macvlan_uninit(struct net_device *dev)
 {
        struct macvlan_dev *vlan = netdev_priv(dev);
+       struct macvlan_port *port = vlan->port;
 
        free_percpu(vlan->pcpu_stats);
+
+       port->count -= 1;
+       if (!port->count)
+               macvlan_port_destroy(port->dev);
 }
 
 static struct rtnl_link_stats64 *macvlan_dev_get_stats64(struct net_device *dev,
@@ -691,12 +699,13 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
                vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
 
        if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
-               if (!list_empty(&port->vlans))
+               if (port->count)
                        return -EINVAL;
                port->passthru = true;
                memcpy(dev->dev_addr, lowerdev->dev_addr, ETH_ALEN);
        }
 
+       port->count += 1;
        err = register_netdevice(dev);
        if (err < 0)
                goto destroy_port;
@@ -707,7 +716,8 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
        return 0;
 
 destroy_port:
-       if (list_empty(&port->vlans))
+       port->count -= 1;
+       if (!port->count)
                macvlan_port_destroy(lowerdev);
 
        return err;
@@ -725,13 +735,9 @@ static int macvlan_newlink(struct net *src_net, struct net_device *dev,
 void macvlan_dellink(struct net_device *dev, struct list_head *head)
 {
        struct macvlan_dev *vlan = netdev_priv(dev);
-       struct macvlan_port *port = vlan->port;
 
        list_del(&vlan->list);
        unregister_netdevice_queue(dev, head);
-
-       if (list_empty(&port->vlans))
-               macvlan_port_destroy(port->dev);
 }
 EXPORT_SYMBOL_GPL(macvlan_dellink);
 
index 40fa59e2fd5c65aa973e688b87cb3e9251d2d435..32678b6c6b3997e3c408e754a3e8ec7b358fd752 100644 (file)
@@ -9501,7 +9501,7 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np,
        struct niu_parent *p;
        int i;
 
-       plat_dev = platform_device_register_simple("niu", niu_parent_index,
+       plat_dev = platform_device_register_simple("niu-board", niu_parent_index,
                                                   NULL, 0);
        if (IS_ERR(plat_dev))
                return NULL;
index 5e403511289de11b17f189c9649cdeb66cfdc1ee..493b0de3848bf17fadd6741ad57d5b4701b2f074 100644 (file)
@@ -2685,9 +2685,9 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
        rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
                ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
                ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
-               tp->mii.supports_gmii ?
+               (tp->mii.supports_gmii ?
                        ADVERTISED_1000baseT_Half |
-                       ADVERTISED_1000baseT_Full : 0);
+                       ADVERTISED_1000baseT_Full : 0));
 
        if (RTL_R8(PHYstatus) & TBI_Enable)
                netif_info(tp, link, dev, "TBI auto-negotiating\n");
index cb23580fcffa5894d1f10db8dce271575c7a1781..b0be0234abf6a3bc8a1060434a2b5c6af88112f5 100644 (file)
@@ -17,4 +17,4 @@ skfp-objs :=  skfddi.o    hwmtm.o    fplustm.o  smt.o      cfm.o     \
 #   projects. To keep the source common for all those drivers (and
 #   thus simplify fixes to it), please do not clean it up!
 
-EXTRA_CFLAGS += -Idrivers/net/skfp -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes 
+ccflags-y := -Idrivers/net/skfp -DPCI -DMEM_MAPPED_IO -Wno-strict-prototypes
index 105d7f0630ccb9c0a14b12395b04b322c5362e99..2de9b90c5f8f079859b695979acb4871c5a0ea08 100644 (file)
@@ -171,7 +171,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
        if (skb->ip_summed == CHECKSUM_NONE)
                skb->ip_summed = rcv_priv->ip_summed;
 
-       length = skb->len + ETH_HLEN;
+       length = skb->len;
        if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)
                goto rx_drop;
 
index dabdcfed4efd1fc8b96d02635fa0ea40f19037fb..609710d64eb5c196a506a33ae2d832aa1cb5d7bb 100644 (file)
@@ -14,4 +14,4 @@ lmc-objs := lmc_debug.o lmc_media.o lmc_main.o lmc_proto.o
 # -DDEBUG \
 # -DLMC_PACKET_LOG
 
-EXTRA_CFLAGS += -I. $(DBGDEF)
+ccflags-y := -I. $(DBGDEF)
index 30acd39d76a2892de5a684b9b716201c74b9da1f..2c8f71f0ed456e5718e322350339ff8b55556d0a 100644 (file)
@@ -30,9 +30,9 @@
 
 /* Following defines can be used to remove unneeded parts of the driver, e.g.,
  * to limit the size of the kernel module. Definitions can be added here in
- * hostap_config.h or they can be added to make command with EXTRA_CFLAGS,
+ * hostap_config.h or they can be added to make command with ccflags-y,
  * e.g.,
- * 'make pccard EXTRA_CFLAGS="-DPRISM2_NO_DEBUG -DPRISM2_NO_PROCFS_DEBUG"'
+ * 'make pccard ccflags-y="-DPRISM2_NO_DEBUG -DPRISM2_NO_PROCFS_DEBUG"'
  */
 
 /* Do not include debug messages into the driver */
index 1907eafb9b16b72aea2502869b420dbe87dbe8b5..5728a918e508ba9bf9636ac98f615b25fcd48c28 100644 (file)
@@ -5,7 +5,5 @@ zd1211rw-objs := zd_chip.o zd_mac.o \
                zd_rf_al7230b.o zd_rf_uw2453.o \
                zd_rf.o zd_usb.o
 
-ifeq ($(CONFIG_ZD1211RW_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_ZD1211RW_DEBUG) := -DDEBUG
 
index 9383063d2b16896bfcc740855221c5eccfbf0570..bcd5d54b7d4d2b3cfc938acf6141cc65bb4ec8ec 100644 (file)
@@ -296,25 +296,25 @@ static struct pci_port_ops dino_port_ops = {
        .outl   = dino_out32
 };
 
-static void dino_mask_irq(unsigned int irq)
+static void dino_mask_irq(struct irq_data *d)
 {
-       struct dino_device *dino_dev = get_irq_chip_data(irq);
-       int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
+       struct dino_device *dino_dev = irq_data_get_irq_chip_data(d);
+       int local_irq = gsc_find_local_irq(d->irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
 
-       DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
+       DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, d->irq);
 
        /* Clear the matching bit in the IMR register */
        dino_dev->imr &= ~(DINO_MASK_IRQ(local_irq));
        __raw_writel(dino_dev->imr, dino_dev->hba.base_addr+DINO_IMR);
 }
 
-static void dino_unmask_irq(unsigned int irq)
+static void dino_unmask_irq(struct irq_data *d)
 {
-       struct dino_device *dino_dev = get_irq_chip_data(irq);
-       int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
+       struct dino_device *dino_dev = irq_data_get_irq_chip_data(d);
+       int local_irq = gsc_find_local_irq(d->irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
        u32 tmp;
 
-       DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, irq);
+       DBG(KERN_WARNING "%s(0x%p, %d)\n", __func__, dino_dev, d->irq);
 
        /*
        ** clear pending IRQ bits
@@ -346,9 +346,9 @@ static void dino_unmask_irq(unsigned int irq)
 }
 
 static struct irq_chip dino_interrupt_type = {
-       .name   = "GSC-PCI",
-       .unmask = dino_unmask_irq,
-       .mask   = dino_mask_irq,
+       .name           = "GSC-PCI",
+       .irq_unmask     = dino_unmask_irq,
+       .irq_mask       = dino_mask_irq,
 };
 
 
index e860038b0b841952f29021a5fa752f6d9ee4ea3e..deeec32a5803c30834469819102f7efac98342ed 100644 (file)
@@ -144,8 +144,9 @@ static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered *
 
 
 /* called by free irq */
-static void eisa_mask_irq(unsigned int irq)
+static void eisa_mask_irq(struct irq_data *d)
 {
+       unsigned int irq = d->irq;
        unsigned long flags;
 
        EISA_DBG("disable irq %d\n", irq);
@@ -164,8 +165,9 @@ static void eisa_mask_irq(unsigned int irq)
 }
 
 /* called by request irq */
-static void eisa_unmask_irq(unsigned int irq)
+static void eisa_unmask_irq(struct irq_data *d)
 {
+       unsigned int irq = d->irq;
        unsigned long flags;
        EISA_DBG("enable irq %d\n", irq);
                
@@ -183,9 +185,9 @@ static void eisa_unmask_irq(unsigned int irq)
 }
 
 static struct irq_chip eisa_interrupt_type = {
-       .name   =       "EISA",
-       .unmask =       eisa_unmask_irq,
-       .mask   =       eisa_mask_irq,
+       .name           =       "EISA",
+       .irq_unmask     =       eisa_unmask_irq,
+       .irq_mask       =       eisa_mask_irq,
 };
 
 static irqreturn_t eisa_irq(int wax_irq, void *intr_dev)
index 772b1939ac218a2b9fc936ce57bc567761f050fc..ef31080cf5912323d31284fd3ddb2b0036158aea 100644 (file)
@@ -105,13 +105,13 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit)
        return NO_IRQ;
 }
 
-static void gsc_asic_mask_irq(unsigned int irq)
+static void gsc_asic_mask_irq(struct irq_data *d)
 {
-       struct gsc_asic *irq_dev = get_irq_chip_data(irq);
-       int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
+       struct gsc_asic *irq_dev = irq_data_get_irq_chip_data(d);
+       int local_irq = gsc_find_local_irq(d->irq, irq_dev->global_irq, 32);
        u32 imr;
 
-       DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq,
+       DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, d->irq,
                        irq_dev->name, imr);
 
        /* Disable the IRQ line by clearing the bit in the IMR */
@@ -120,13 +120,13 @@ static void gsc_asic_mask_irq(unsigned int irq)
        gsc_writel(imr, irq_dev->hpa + OFFSET_IMR);
 }
 
-static void gsc_asic_unmask_irq(unsigned int irq)
+static void gsc_asic_unmask_irq(struct irq_data *d)
 {
-       struct gsc_asic *irq_dev = get_irq_chip_data(irq);
-       int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
+       struct gsc_asic *irq_dev = irq_data_get_irq_chip_data(d);
+       int local_irq = gsc_find_local_irq(d->irq, irq_dev->global_irq, 32);
        u32 imr;
 
-       DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, irq,
+       DEBPRINTK(KERN_DEBUG "%s(%d) %s: IMR 0x%x\n", __func__, d->irq,
                        irq_dev->name, imr);
 
        /* Enable the IRQ line by setting the bit in the IMR */
@@ -140,9 +140,9 @@ static void gsc_asic_unmask_irq(unsigned int irq)
 }
 
 static struct irq_chip gsc_asic_interrupt_type = {
-       .name   =       "GSC-ASIC",
-       .unmask =       gsc_asic_unmask_irq,
-       .mask   =       gsc_asic_mask_irq,
+       .name           =       "GSC-ASIC",
+       .irq_unmask     =       gsc_asic_unmask_irq,
+       .irq_mask       =       gsc_asic_mask_irq,
 };
 
 int gsc_assign_irq(struct irq_chip *type, void *data)
index 0327894bf2355c23d3e2b3daae80c8a2cadf7aeb..95930d016235ae3a39fdfe71e1b409291d21d370 100644 (file)
@@ -615,10 +615,10 @@ iosapic_set_irt_data( struct vector_info *vi, u32 *dp0, u32 *dp1)
 }
 
 
-static void iosapic_mask_irq(unsigned int irq)
+static void iosapic_mask_irq(struct irq_data *d)
 {
        unsigned long flags;
-       struct vector_info *vi = get_irq_chip_data(irq);
+       struct vector_info *vi = irq_data_get_irq_chip_data(d);
        u32 d0, d1;
 
        spin_lock_irqsave(&iosapic_lock, flags);
@@ -628,9 +628,9 @@ static void iosapic_mask_irq(unsigned int irq)
        spin_unlock_irqrestore(&iosapic_lock, flags);
 }
 
-static void iosapic_unmask_irq(unsigned int irq)
+static void iosapic_unmask_irq(struct irq_data *d)
 {
-       struct vector_info *vi = get_irq_chip_data(irq);
+       struct vector_info *vi = irq_data_get_irq_chip_data(d);
        u32 d0, d1;
 
        /* data is initialized by fixup_irq */
@@ -666,34 +666,34 @@ printk("\n");
         * enables their IRQ. It can lead to "interesting" race conditions
         * in the driver initialization sequence.
         */
-       DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", irq,
+       DBG(KERN_DEBUG "enable_irq(%d): eoi(%p, 0x%x)\n", d->irq,
                        vi->eoi_addr, vi->eoi_data);
        iosapic_eoi(vi->eoi_addr, vi->eoi_data);
 }
 
-static void iosapic_eoi_irq(unsigned int irq)
+static void iosapic_eoi_irq(struct irq_data *d)
 {
-       struct vector_info *vi = get_irq_chip_data(irq);
+       struct vector_info *vi = irq_data_get_irq_chip_data(d);
 
        iosapic_eoi(vi->eoi_addr, vi->eoi_data);
-       cpu_eoi_irq(irq);
+       cpu_eoi_irq(d);
 }
 
 #ifdef CONFIG_SMP
-static int iosapic_set_affinity_irq(unsigned int irq,
-                                    const struct cpumask *dest)
+static int iosapic_set_affinity_irq(struct irq_data *d,
+                                   const struct cpumask *dest, bool force)
 {
-       struct vector_info *vi = get_irq_chip_data(irq);
+       struct vector_info *vi = irq_data_get_irq_chip_data(d);
        u32 d0, d1, dummy_d0;
        unsigned long flags;
        int dest_cpu;
 
-       dest_cpu = cpu_check_affinity(irq, dest);
+       dest_cpu = cpu_check_affinity(d, dest);
        if (dest_cpu < 0)
                return -1;
 
-       cpumask_copy(irq_desc[irq].affinity, cpumask_of(dest_cpu));
-       vi->txn_addr = txn_affinity_addr(irq, dest_cpu);
+       cpumask_copy(d->affinity, cpumask_of(dest_cpu));
+       vi->txn_addr = txn_affinity_addr(d->irq, dest_cpu);
 
        spin_lock_irqsave(&iosapic_lock, flags);
        /* d1 contains the destination CPU, so only want to set that
@@ -708,13 +708,13 @@ static int iosapic_set_affinity_irq(unsigned int irq,
 #endif
 
 static struct irq_chip iosapic_interrupt_type = {
-       .name   =       "IO-SAPIC-level",
-       .unmask =       iosapic_unmask_irq,
-       .mask   =       iosapic_mask_irq,
-       .ack    =       cpu_ack_irq,
-       .eoi    =       iosapic_eoi_irq,
+       .name           =       "IO-SAPIC-level",
+       .irq_unmask     =       iosapic_unmask_irq,
+       .irq_mask       =       iosapic_mask_irq,
+       .irq_ack        =       cpu_ack_irq,
+       .irq_eoi        =       iosapic_eoi_irq,
 #ifdef CONFIG_SMP
-       .set_affinity = iosapic_set_affinity_irq,
+       .irq_set_affinity =     iosapic_set_affinity_irq,
 #endif
 };
 
index 28241532c0fd1b56c7f6bfa50d788c5fef1e9e3a..a4d8ff66a63901833ec06a6eb69830d6246d0d8e 100644 (file)
@@ -286,8 +286,9 @@ superio_init(struct pci_dev *pcidev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init);
 
-static void superio_mask_irq(unsigned int irq)
+static void superio_mask_irq(struct irq_data *d)
 {
+       unsigned int irq = d->irq;
        u8 r8;
 
        if ((irq < 1) || (irq == 2) || (irq > 7)) {
@@ -303,8 +304,9 @@ static void superio_mask_irq(unsigned int irq)
        outb (r8,IC_PIC1+1);
 }
 
-static void superio_unmask_irq(unsigned int irq)
+static void superio_unmask_irq(struct irq_data *d)
 {
+       unsigned int irq = d->irq;
        u8 r8;
 
        if ((irq < 1) || (irq == 2) || (irq > 7)) {
@@ -320,9 +322,9 @@ static void superio_unmask_irq(unsigned int irq)
 }
 
 static struct irq_chip superio_interrupt_type = {
-       .name   =       SUPERIO,
-       .unmask =       superio_unmask_irq,
-       .mask   =       superio_mask_irq,
+       .name           =       SUPERIO,
+       .irq_unmask     =       superio_unmask_irq,
+       .irq_mask       =       superio_mask_irq,
 };
 
 #ifdef DEBUG_SUPERIO_INIT
index a59af5b24f0ac9d9f0e4ea7c88cc2ad00ddddbb0..222dfb737b11a699d559c12c23e26a7577ab99de 100644 (file)
@@ -138,6 +138,24 @@ config TC1100_WMI
          This is a driver for the WMI extensions (wireless and bluetooth power
          control) of the HP Compaq TC1100 tablet.
 
+config HP_ACCEL
+       tristate "HP laptop accelerometer"
+       depends on INPUT && ACPI
+       select SENSORS_LIS3LV02D
+       select NEW_LEDS
+       select LEDS_CLASS
+       help
+         This driver provides support for the "Mobile Data Protection System 3D"
+         or "3D DriveGuard" feature of HP laptops. On such systems the driver
+         should load automatically (via ACPI alias).
+
+         Support for a led indicating disk protection will be provided as
+         hp::hddprotect. For more information on the feature, refer to
+         Documentation/hwmon/lis3lv02d.
+
+         To compile this driver as a module, choose M here: the module will
+         be called hp_accel.
+
 config HP_WMI
        tristate "HP WMI extras"
        depends on ACPI_WMI
index 4ec4ff8f918240e657153d7bdd0a11202ba8d498..299aefb3e74ce222b0a146703b601fe73b1f933d 100644 (file)
@@ -12,6 +12,7 @@ obj-$(CONFIG_DELL_LAPTOP)     += dell-laptop.o
 obj-$(CONFIG_DELL_WMI)         += dell-wmi.o
 obj-$(CONFIG_ACER_WMI)         += acer-wmi.o
 obj-$(CONFIG_ACERHDF)          += acerhdf.o
+obj-$(CONFIG_HP_ACCEL)         += hp_accel.o
 obj-$(CONFIG_HP_WMI)           += hp-wmi.o
 obj-$(CONFIG_TC1100_WMI)       += tc1100-wmi.o
 obj-$(CONFIG_SONY_LAPTOP)      += sony-laptop.o
similarity index 99%
rename from drivers/hwmon/hp_accel.c
rename to drivers/platform/x86/hp_accel.c
index 3d21fa2b97cd1d922119b17ea6a4780e89fc8a63..1b52d00e2f9069b045e8cfad7f399821d753f935 100644 (file)
 #include <linux/freezer.h>
 #include <linux/uaccess.h>
 #include <linux/leds.h>
+#include <linux/atomic.h>
 #include <acpi/acpi_drivers.h>
-#include <asm/atomic.h>
-#include "lis3lv02d.h"
+#include "../../misc/lis3lv02d/lis3lv02d.h"
 
-#define DRIVER_NAME     "lis3lv02d"
+#define DRIVER_NAME     "hp_accel"
 #define ACPI_MDPS_CLASS "accelerometer"
 
 /* Delayed LEDs infrastructure ------------------------------------ */
@@ -402,4 +402,3 @@ MODULE_LICENSE("GPL");
 
 module_init(lis3lv02d_init_module);
 module_exit(lis3lv02d_exit_module);
-
index 42517da07049e38e04da56a0ce4cdb78a87795eb..4feb7e9e71ee6c14fb8ce8585437ccd3d7dde24c 100644 (file)
@@ -6,6 +6,4 @@ obj-$(CONFIG_PPS_CLIENT_KTIMER) += pps-ktimer.o
 obj-$(CONFIG_PPS_CLIENT_LDISC) += pps-ldisc.o
 obj-$(CONFIG_PPS_CLIENT_PARPORT) += pps_parport.o
 
-ifeq ($(CONFIG_PPS_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
index b6139fe187bfe7389f1b30970dc03c16660ca161..89b8eca825b55f28dc6a29afa8eabed91730bd3e 100644 (file)
@@ -5,6 +5,4 @@ obj-y += rio.o rio-access.o rio-driver.o rio-scan.o rio-sysfs.o
 
 obj-$(CONFIG_RAPIDIO)          += switches/
 
-ifeq ($(CONFIG_RAPIDIO_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+subdir-ccflags-$(CONFIG_RAPIDIO_DEBUG) := -DDEBUG
index 48d67a6b98c89febb63780c598ad394f2fb15bc8..c4d3acc3c71560f63b605b410072ace4828c81a5 100644 (file)
@@ -7,7 +7,3 @@ obj-$(CONFIG_RAPIDIO_CPS_XX)    += idtcps.o
 obj-$(CONFIG_RAPIDIO_TSI568)   += tsi568.o
 obj-$(CONFIG_RAPIDIO_TSI500)   += tsi500.o
 obj-$(CONFIG_RAPIDIO_CPS_GEN2) += idt_gen2.o
-
-ifeq ($(CONFIG_RAPIDIO_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
index 2afdaf3ff98660f53c72a189503786ebeac0a27c..5f6c3838dcf6ab3b6c71c785dc8747fd107fd9b7 100644 (file)
@@ -2,9 +2,7 @@
 # Makefile for RTC class/drivers.
 #
 
-ifeq ($(CONFIG_RTC_DEBUG),y)
-       EXTRA_CFLAGS            += -DDEBUG
-endif
+ccflags-$(CONFIG_RTC_DEBUG)    := -DDEBUG
 
 obj-$(CONFIG_RTC_LIB)          += rtc-lib.o
 obj-$(CONFIG_RTC_HCTOSYS)      += hctosys.o
index f1cca4ee541006c6767b5242f124dfcefcc6d6a0..92df4d6b6147c677a76a4852bf521cd43ea88711 100644 (file)
@@ -5,4 +5,4 @@ obj-$(CONFIG_SCSI_AACRAID) := aacraid.o
 aacraid-objs   := linit.o aachba.o commctrl.o comminit.o commsup.o \
                   dpcsup.o rx.o sa.o rkt.o nark.o
 
-EXTRA_CFLAGS   := -Idrivers/scsi
+ccflags-y      := -Idrivers/scsi
index e78ce0fa44d2dd8c9d0eb8fe87ffd3141b9c2915..c0a15c75458506373e481fc36e79a857af8abc59 100644 (file)
@@ -22,9 +22,7 @@
 # along with the aic94xx driver; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-ifeq ($(CONFIG_AIC94XX_DEBUG),y)
-       EXTRA_CFLAGS += -DASD_DEBUG -DASD_ENTER_EXIT
-endif
+ccflags-$(CONFIG_AIC94XX_DEBUG) := -DASD_DEBUG -DASD_ENTER_EXIT
 
 obj-$(CONFIG_SCSI_AIC94XX) += aic94xx.o
 aic94xx-y += aic94xx_init.o \
index 566a10024598b630f44d28544a22de8cd636ccca..2e70140f70c3d88f3aee051601e945bcd0f7abec 100644 (file)
@@ -32,4 +32,4 @@ libsas-y +=  sas_init.o     \
                sas_scsi_host.o \
                sas_task.o
 libsas-$(CONFIG_SCSI_SAS_ATA) +=       sas_ata.o
-libsas-$(CONFIG_SCSI_SAS_HOST_SMP) +=  sas_host_smp.o
\ No newline at end of file
+libsas-$(CONFIG_SCSI_SAS_HOST_SMP) +=  sas_host_smp.o
index ad05d6edb8f6906eaf28943d71738fa98a5848b7..14de249917f8c226c2159cea4cf767aa56029239 100644 (file)
 # *******************************************************************/
 ######################################################################
 
-ifneq ($(GCOV),)
-  EXTRA_CFLAGS += -fprofile-arcs -ftest-coverage
-  EXTRA_CFLAGS += -O0
-endif
+ccflags-$(GCOV) := -fprofile-arcs -ftest-coverage
+ccflags-$(GCOV) += -O0
 
 obj-$(CONFIG_SCSI_LPFC) := lpfc.o
 
index 52ac4264677d3a053065f2dc3c3513bbc8e7626c..ffbf759e46f1ec83db27607a210e1e0354f4398c 100644 (file)
@@ -21,9 +21,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA
 
-ifeq ($(CONFIG_SCSI_MVSAS_DEBUG),y)
-       EXTRA_CFLAGS += -DMV_DEBUG
-endif
+ccflags-$(CONFIG_SCSI_MVSAS_DEBUG) := -DMV_DEBUG
 
 obj-$(CONFIG_SCSI_MVSAS) += mvsas.o
 mvsas-y +=  mv_init.o  \
index eca379059db652691ae7988024cf6b9a818a54a5..683bf148b5b7675beecb001365fa307da11dc206 100644 (file)
@@ -1,5 +1,5 @@
 
-EXTRA_CFLAGS           += -Idrivers/scsi
+ccflags-y              := -Idrivers/scsi
 
 # 16-bit client drivers
 obj-$(CONFIG_PCMCIA_QLOGIC)    += qlogic_cs.o
index 991de3c15cfcbc4bcc61096272e747f40e30448c..633c2395a92a2c918cfd068d541f99063f9470f2 100644 (file)
@@ -3,14 +3,14 @@
  *
  *  SCSI error/timeout handling
  *      Initial versions: Eric Youngdale.  Based upon conversations with
- *                        Leonard Zubkoff and David Miller at Linux Expo, 
+ *                        Leonard Zubkoff and David Miller at Linux Expo,
  *                        ideas originating from all over the place.
  *
  *     Restructured scsi_unjam_host and associated functions.
  *     September 04, 2002 Mike Anderson (andmike@us.ibm.com)
  *
  *     Forward port of Russell King's (rmk@arm.linux.org.uk) changes and
- *     minor  cleanups.
+ *     minor cleanups.
  *     September 30, 2002 Mike Anderson (andmike@us.ibm.com)
  */
 
@@ -129,14 +129,15 @@ enum blk_eh_timer_return scsi_times_out(struct request *req)
 {
        struct scsi_cmnd *scmd = req->special;
        enum blk_eh_timer_return rtn = BLK_EH_NOT_HANDLED;
+       struct Scsi_Host *host = scmd->device->host;
 
        trace_scsi_dispatch_cmd_timeout(scmd);
        scsi_log_completion(scmd, TIMEOUT_ERROR);
 
-       if (scmd->device->host->transportt->eh_timed_out)
-               rtn = scmd->device->host->transportt->eh_timed_out(scmd);
-       else if (scmd->device->host->hostt->eh_timed_out)
-               rtn = scmd->device->host->hostt->eh_timed_out(scmd);
+       if (host->transportt->eh_timed_out)
+               rtn = host->transportt->eh_timed_out(scmd);
+       else if (host->hostt->eh_timed_out)
+               rtn = host->hostt->eh_timed_out(scmd);
 
        if (unlikely(rtn == BLK_EH_NOT_HANDLED &&
                     !scsi_eh_scmd_add(scmd, SCSI_EH_CANCEL_CMD))) {
@@ -195,7 +196,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
                                ++total_failures;
                                if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD)
                                        ++cmd_cancel;
-                               else 
+                               else
                                        ++cmd_failed;
                        }
                }
@@ -214,7 +215,7 @@ static inline void scsi_eh_prt_fail_stats(struct Scsi_Host *shost,
 
        SCSI_LOG_ERROR_RECOVERY(2, printk("Total of %d commands on %d"
                                          " devices require eh work\n",
-                                 total_failures, devices_failed));
+                                  total_failures, devices_failed));
 }
 #endif
 
@@ -294,7 +295,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
                        return NEEDS_RETRY;
                }
                /*
-                * if the device is in the process of becoming ready, we 
+                * if the device is in the process of becoming ready, we
                 * should retry.
                 */
                if ((sshdr.asc == 0x04) && (sshdr.ascq == 0x01))
@@ -488,7 +489,7 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
  */
 static void scsi_eh_done(struct scsi_cmnd *scmd)
 {
-       struct completion     *eh_action;
+       struct completion *eh_action;
 
        SCSI_LOG_ERROR_RECOVERY(3,
                printk("%s scmd: %p result: %x\n",
@@ -507,22 +508,23 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd)
 {
        unsigned long flags;
        int rtn;
+       struct Scsi_Host *host = scmd->device->host;
+       struct scsi_host_template *hostt = host->hostt;
 
        SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Host RST\n",
                                          __func__));
 
-       if (!scmd->device->host->hostt->eh_host_reset_handler)
+       if (!hostt->eh_host_reset_handler)
                return FAILED;
 
-       rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd);
+       rtn = hostt->eh_host_reset_handler(scmd);
 
        if (rtn == SUCCESS) {
-               if (!scmd->device->host->hostt->skip_settle_delay)
+               if (!hostt->skip_settle_delay)
                        ssleep(HOST_RESET_SETTLE_TIME);
-               spin_lock_irqsave(scmd->device->host->host_lock, flags);
-               scsi_report_bus_reset(scmd->device->host,
-                                     scmd_channel(scmd));
-               spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+               spin_lock_irqsave(host->host_lock, flags);
+               scsi_report_bus_reset(host, scmd_channel(scmd));
+               spin_unlock_irqrestore(host->host_lock, flags);
        }
 
        return rtn;
@@ -536,22 +538,23 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd)
 {
        unsigned long flags;
        int rtn;
+       struct Scsi_Host *host = scmd->device->host;
+       struct scsi_host_template *hostt = host->hostt;
 
        SCSI_LOG_ERROR_RECOVERY(3, printk("%s: Snd Bus RST\n",
                                          __func__));
 
-       if (!scmd->device->host->hostt->eh_bus_reset_handler)
+       if (!hostt->eh_bus_reset_handler)
                return FAILED;
 
-       rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd);
+       rtn = hostt->eh_bus_reset_handler(scmd);
 
        if (rtn == SUCCESS) {
-               if (!scmd->device->host->hostt->skip_settle_delay)
+               if (!hostt->skip_settle_delay)
                        ssleep(BUS_RESET_SETTLE_TIME);
-               spin_lock_irqsave(scmd->device->host->host_lock, flags);
-               scsi_report_bus_reset(scmd->device->host,
-                                     scmd_channel(scmd));
-               spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+               spin_lock_irqsave(host->host_lock, flags);
+               scsi_report_bus_reset(host, scmd_channel(scmd));
+               spin_unlock_irqrestore(host->host_lock, flags);
        }
 
        return rtn;
@@ -577,16 +580,18 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
 {
        unsigned long flags;
        int rtn;
+       struct Scsi_Host *host = scmd->device->host;
+       struct scsi_host_template *hostt = host->hostt;
 
-       if (!scmd->device->host->hostt->eh_target_reset_handler)
+       if (!hostt->eh_target_reset_handler)
                return FAILED;
 
-       rtn = scmd->device->host->hostt->eh_target_reset_handler(scmd);
+       rtn = hostt->eh_target_reset_handler(scmd);
        if (rtn == SUCCESS) {
-               spin_lock_irqsave(scmd->device->host->host_lock, flags);
+               spin_lock_irqsave(host->host_lock, flags);
                __starget_for_each_device(scsi_target(scmd->device), NULL,
                                          __scsi_report_device_reset);
-               spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
+               spin_unlock_irqrestore(host->host_lock, flags);
        }
 
        return rtn;
@@ -605,27 +610,28 @@ static int scsi_try_target_reset(struct scsi_cmnd *scmd)
 static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd)
 {
        int rtn;
+       struct scsi_host_template *hostt = scmd->device->host->hostt;
 
-       if (!scmd->device->host->hostt->eh_device_reset_handler)
+       if (!hostt->eh_device_reset_handler)
                return FAILED;
 
-       rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd);
+       rtn = hostt->eh_device_reset_handler(scmd);
        if (rtn == SUCCESS)
                __scsi_report_device_reset(scmd->device, NULL);
        return rtn;
 }
 
-static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd)
+static int scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd)
 {
-       if (!scmd->device->host->hostt->eh_abort_handler)
+       if (!hostt->eh_abort_handler)
                return FAILED;
 
-       return scmd->device->host->hostt->eh_abort_handler(scmd);
+       return hostt->eh_abort_handler(scmd);
 }
 
 static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd)
 {
-       if (scsi_try_to_abort_cmd(scmd) != SUCCESS)
+       if (scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd) != SUCCESS)
                if (scsi_try_bus_device_reset(scmd) != SUCCESS)
                        if (scsi_try_target_reset(scmd) != SUCCESS)
                                if (scsi_try_bus_reset(scmd) != SUCCESS)
@@ -846,7 +852,7 @@ EXPORT_SYMBOL(scsi_eh_finish_cmd);
  *
  * Description:
  *    See if we need to request sense information.  if so, then get it
- *    now, so we have a better idea of what to do.  
+ *    now, so we have a better idea of what to do.
  *
  * Notes:
  *    This has the unfortunate side effect that if a shost adapter does
@@ -958,7 +964,7 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
                SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting cmd:"
                                                  "0x%p\n", current->comm,
                                                  scmd));
-               rtn = scsi_try_to_abort_cmd(scmd);
+               rtn = scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd);
                if (rtn == SUCCESS || rtn == FAST_IO_FAIL) {
                        scmd->eh_eflags &= ~SCSI_EH_CANCEL_CMD;
                        if (!scsi_device_online(scmd->device) ||
@@ -966,7 +972,6 @@ static int scsi_eh_abort_cmds(struct list_head *work_q,
                            !scsi_eh_tur(scmd)) {
                                scsi_eh_finish_cmd(scmd, done_q);
                        }
-                               
                } else
                        SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting"
                                                          " cmd failed:"
@@ -1010,7 +1015,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
  *
  * Notes:
  *    If commands are failing due to not ready, initializing command required,
- *     try revalidating the device, which will end up sending a start unit. 
+ *     try revalidating the device, which will end up sending a start unit.
  */
 static int scsi_eh_stu(struct Scsi_Host *shost,
                              struct list_head *work_q,
@@ -1064,7 +1069,7 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
  *    Try a bus device reset.  Still, look to see whether we have multiple
  *    devices that are jammed or not - if we have multiple devices, it
  *    makes no sense to try bus_device_reset - we really would need to try
- *    a bus_reset instead. 
+ *    a bus_reset instead.
  */
 static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
                                    struct list_head *work_q,
@@ -1164,7 +1169,7 @@ static int scsi_eh_target_reset(struct Scsi_Host *shost,
 }
 
 /**
- * scsi_eh_bus_reset - send a bus reset 
+ * scsi_eh_bus_reset - send a bus reset
  * @shost:     &scsi host being recovered.
  * @work_q:     &list_head for pending commands.
  * @done_q:    &list_head for processed commands.
@@ -1181,7 +1186,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
         * we really want to loop over the various channels, and do this on
         * a channel by channel basis.  we should also check to see if any
         * of the failed commands are on soft_reset devices, and if so, skip
-        * the reset.  
+        * the reset.
         */
 
        for (channel = 0; channel <= shost->max_channel; channel++) {
@@ -1223,7 +1228,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost,
 }
 
 /**
- * scsi_eh_host_reset - send a host reset 
+ * scsi_eh_host_reset - send a host reset
  * @work_q:    list_head for processed commands.
  * @done_q:    list_head for processed commands.
  */
@@ -1376,7 +1381,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                return SUCCESS;
                /*
                 * when the low level driver returns did_soft_error,
-                * it is responsible for keeping an internal retry counter 
+                * it is responsible for keeping an internal retry counter
                 * in order to avoid endless loops (db)
                 *
                 * actually this is a bug in this function here.  we should
@@ -1414,7 +1419,6 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
                         */
                        break;
                /* fallthrough */
-
        case DID_BUS_BUSY:
        case DID_PARITY:
                goto maybe_retry;
@@ -1982,7 +1986,7 @@ int scsi_normalize_sense(const u8 *sense_buffer, int sb_len,
                if (sb_len > 7)
                        sshdr->additional_length = sense_buffer[7];
        } else {
-               /* 
+               /*
                 * fixed format
                 */
                if (sb_len > 2)
index 3be5db5d6343966cbbbcda26f9e12dd005f7e62b..7ff61d76b4c5de4d233353b6424ed33357b39e46 100644 (file)
@@ -597,6 +597,7 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
                break;
 
        default:
+               ret = BLKPREP_KILL;
                goto out;
        }
 
index f616cefc95ba74e13bf159c817c49a6fe928fe10..2f7c76a85e532a658bf9652b0875887346ff374c 100644 (file)
@@ -60,6 +60,7 @@ static int move_iovec_hdr(struct iovec *from, struct iovec *to,
 {
        int seg = 0;
        size_t size;
+
        while (len && seg < iov_count) {
                size = min(from->iov_len, len);
                to->iov_base = from->iov_base;
@@ -79,6 +80,7 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to,
 {
        int seg = 0;
        size_t size;
+
        while (len && seg < iovcount) {
                size = min(from->iov_len, len);
                to->iov_base = from->iov_base;
@@ -211,12 +213,13 @@ static int peek_head_len(struct sock *sk)
 {
        struct sk_buff *head;
        int len = 0;
+       unsigned long flags;
 
-       lock_sock(sk);
+       spin_lock_irqsave(&sk->sk_receive_queue.lock, flags);
        head = skb_peek(&sk->sk_receive_queue);
-       if (head)
+       if (likely(head))
                len = head->len;
-       release_sock(sk);
+       spin_unlock_irqrestore(&sk->sk_receive_queue.lock, flags);
        return len;
 }
 
@@ -227,6 +230,7 @@ static int peek_head_len(struct sock *sk)
  * @iovcount   - returned count of io vectors we fill
  * @log                - vhost log
  * @log_num    - log offset
+ * @quota       - headcount quota, 1 for big buffer
  *     returns number of buffer heads allocated, negative on error
  */
 static int get_rx_bufs(struct vhost_virtqueue *vq,
@@ -234,7 +238,8 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
                       int datalen,
                       unsigned *iovcount,
                       struct vhost_log *log,
-                      unsigned *log_num)
+                      unsigned *log_num,
+                      unsigned int quota)
 {
        unsigned int out, in;
        int seg = 0;
@@ -242,7 +247,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
        unsigned d;
        int r, nlogs = 0;
 
-       while (datalen > 0) {
+       while (datalen > 0 && headcount < quota) {
                if (unlikely(seg >= UIO_MAXIOV)) {
                        r = -ENOBUFS;
                        goto err;
@@ -282,117 +287,7 @@ err:
 
 /* Expects to be always run from workqueue - which acts as
  * read-size critical section for our kind of RCU. */
-static void handle_rx_big(struct vhost_net *net)
-{
-       struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
-       unsigned out, in, log, s;
-       int head;
-       struct vhost_log *vq_log;
-       struct msghdr msg = {
-               .msg_name = NULL,
-               .msg_namelen = 0,
-               .msg_control = NULL, /* FIXME: get and handle RX aux data. */
-               .msg_controllen = 0,
-               .msg_iov = vq->iov,
-               .msg_flags = MSG_DONTWAIT,
-       };
-
-       struct virtio_net_hdr hdr = {
-               .flags = 0,
-               .gso_type = VIRTIO_NET_HDR_GSO_NONE
-       };
-
-       size_t len, total_len = 0;
-       int err;
-       size_t hdr_size;
-       /* TODO: check that we are running from vhost_worker? */
-       struct socket *sock = rcu_dereference_check(vq->private_data, 1);
-       if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
-               return;
-
-       mutex_lock(&vq->mutex);
-       vhost_disable_notify(vq);
-       hdr_size = vq->vhost_hlen;
-
-       vq_log = unlikely(vhost_has_feature(&net->dev, VHOST_F_LOG_ALL)) ?
-               vq->log : NULL;
-
-       for (;;) {
-               head = vhost_get_vq_desc(&net->dev, vq, vq->iov,
-                                        ARRAY_SIZE(vq->iov),
-                                        &out, &in,
-                                        vq_log, &log);
-               /* On error, stop handling until the next kick. */
-               if (unlikely(head < 0))
-                       break;
-               /* OK, now we need to know about added descriptors. */
-               if (head == vq->num) {
-                       if (unlikely(vhost_enable_notify(vq))) {
-                               /* They have slipped one in as we were
-                                * doing that: check again. */
-                               vhost_disable_notify(vq);
-                               continue;
-                       }
-                       /* Nothing new?  Wait for eventfd to tell us
-                        * they refilled. */
-                       break;
-               }
-               /* We don't need to be notified again. */
-               if (out) {
-                       vq_err(vq, "Unexpected descriptor format for RX: "
-                              "out %d, int %d\n",
-                              out, in);
-                       break;
-               }
-               /* Skip header. TODO: support TSO/mergeable rx buffers. */
-               s = move_iovec_hdr(vq->iov, vq->hdr, hdr_size, in);
-               msg.msg_iovlen = in;
-               len = iov_length(vq->iov, in);
-               /* Sanity check */
-               if (!len) {
-                       vq_err(vq, "Unexpected header len for RX: "
-                              "%zd expected %zd\n",
-                              iov_length(vq->hdr, s), hdr_size);
-                       break;
-               }
-               err = sock->ops->recvmsg(NULL, sock, &msg,
-                                        len, MSG_DONTWAIT | MSG_TRUNC);
-               /* TODO: Check specific error and bomb out unless EAGAIN? */
-               if (err < 0) {
-                       vhost_discard_vq_desc(vq, 1);
-                       break;
-               }
-               /* TODO: Should check and handle checksum. */
-               if (err > len) {
-                       pr_debug("Discarded truncated rx packet: "
-                                " len %d > %zd\n", err, len);
-                       vhost_discard_vq_desc(vq, 1);
-                       continue;
-               }
-               len = err;
-               err = memcpy_toiovec(vq->hdr, (unsigned char *)&hdr, hdr_size);
-               if (err) {
-                       vq_err(vq, "Unable to write vnet_hdr at addr %p: %d\n",
-                              vq->iov->iov_base, err);
-                       break;
-               }
-               len += hdr_size;
-               vhost_add_used_and_signal(&net->dev, vq, head, len);
-               if (unlikely(vq_log))
-                       vhost_log_write(vq, vq_log, log, len);
-               total_len += len;
-               if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
-                       vhost_poll_queue(&vq->poll);
-                       break;
-               }
-       }
-
-       mutex_unlock(&vq->mutex);
-}
-
-/* Expects to be always run from workqueue - which acts as
- * read-size critical section for our kind of RCU. */
-static void handle_rx_mergeable(struct vhost_net *net)
+static void handle_rx(struct vhost_net *net)
 {
        struct vhost_virtqueue *vq = &net->dev.vqs[VHOST_NET_VQ_RX];
        unsigned uninitialized_var(in), log;
@@ -405,19 +300,18 @@ static void handle_rx_mergeable(struct vhost_net *net)
                .msg_iov = vq->iov,
                .msg_flags = MSG_DONTWAIT,
        };
-
        struct virtio_net_hdr_mrg_rxbuf hdr = {
                .hdr.flags = 0,
                .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE
        };
-
        size_t total_len = 0;
-       int err, headcount;
+       int err, headcount, mergeable;
        size_t vhost_hlen, sock_hlen;
        size_t vhost_len, sock_len;
        /* TODO: check that we are running from vhost_worker? */
        struct socket *sock = rcu_dereference_check(vq->private_data, 1);
-       if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
+
+       if (!sock)
                return;
 
        mutex_lock(&vq->mutex);
@@ -427,12 +321,14 @@ static void handle_rx_mergeable(struct vhost_net *net)
 
        vq_log = unlikely(vhost_has_feature(&net->dev, VHOST_F_LOG_ALL)) ?
                vq->log : NULL;
+       mergeable = vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF);
 
        while ((sock_len = peek_head_len(sock->sk))) {
                sock_len += sock_hlen;
                vhost_len = sock_len + vhost_hlen;
                headcount = get_rx_bufs(vq, vq->heads, vhost_len,
-                                       &in, vq_log, &log);
+                                       &in, vq_log, &log,
+                                       likely(mergeable) ? UIO_MAXIOV : 1);
                /* On error, stop handling until the next kick. */
                if (unlikely(headcount < 0))
                        break;
@@ -476,7 +372,7 @@ static void handle_rx_mergeable(struct vhost_net *net)
                        break;
                }
                /* TODO: Should check and handle checksum. */
-               if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF) &&
+               if (likely(mergeable) &&
                    memcpy_toiovecend(vq->hdr, (unsigned char *)&headcount,
                                      offsetof(typeof(hdr), num_buffers),
                                      sizeof hdr.num_buffers)) {
@@ -498,14 +394,6 @@ static void handle_rx_mergeable(struct vhost_net *net)
        mutex_unlock(&vq->mutex);
 }
 
-static void handle_rx(struct vhost_net *net)
-{
-       if (vhost_has_feature(&net->dev, VIRTIO_NET_F_MRG_RXBUF))
-               handle_rx_mergeable(net);
-       else
-               handle_rx_big(net);
-}
-
 static void handle_tx_kick(struct vhost_work *work)
 {
        struct vhost_virtqueue *vq = container_of(work, struct vhost_virtqueue,
@@ -654,6 +542,7 @@ static struct socket *get_raw_socket(int fd)
        } uaddr;
        int uaddr_len = sizeof uaddr, r;
        struct socket *sock = sockfd_lookup(fd, &r);
+
        if (!sock)
                return ERR_PTR(-ENOTSOCK);
 
@@ -682,6 +571,7 @@ static struct socket *get_tap_socket(int fd)
 {
        struct file *file = fget(fd);
        struct socket *sock;
+
        if (!file)
                return ERR_PTR(-EBADF);
        sock = tun_get_socket(file);
@@ -696,6 +586,7 @@ static struct socket *get_tap_socket(int fd)
 static struct socket *get_socket(int fd)
 {
        struct socket *sock;
+
        /* special case to disable backend */
        if (fd == -1)
                return NULL;
@@ -741,9 +632,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
        oldsock = rcu_dereference_protected(vq->private_data,
                                            lockdep_is_held(&vq->mutex));
        if (sock != oldsock) {
-                vhost_net_disable_vq(n, vq);
-                rcu_assign_pointer(vq->private_data, sock);
-                vhost_net_enable_vq(n, vq);
+               vhost_net_disable_vq(n, vq);
+               rcu_assign_pointer(vq->private_data, sock);
+               vhost_net_enable_vq(n, vq);
        }
 
        mutex_unlock(&vq->mutex);
@@ -768,6 +659,7 @@ static long vhost_net_reset_owner(struct vhost_net *n)
        struct socket *tx_sock = NULL;
        struct socket *rx_sock = NULL;
        long err;
+
        mutex_lock(&n->dev.mutex);
        err = vhost_dev_check_owner(&n->dev);
        if (err)
@@ -829,6 +721,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
        struct vhost_vring_file backend;
        u64 features;
        int r;
+
        switch (ioctl) {
        case VHOST_NET_SET_BACKEND:
                if (copy_from_user(&backend, argp, sizeof backend))
index ade0568c07a4e9ff3ab2fc56e9dc527ca58bdf72..2ab291241635d94278ff9f417b19223c265a044c 100644 (file)
@@ -41,8 +41,8 @@ static void vhost_poll_func(struct file *file, wait_queue_head_t *wqh,
                            poll_table *pt)
 {
        struct vhost_poll *poll;
-       poll = container_of(pt, struct vhost_poll, table);
 
+       poll = container_of(pt, struct vhost_poll, table);
        poll->wqh = wqh;
        add_wait_queue(wqh, &poll->wait);
 }
@@ -85,6 +85,7 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
 void vhost_poll_start(struct vhost_poll *poll, struct file *file)
 {
        unsigned long mask;
+
        mask = file->f_op->poll(file, &poll->table);
        if (mask)
                vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask);
@@ -101,6 +102,7 @@ static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
                                unsigned seq)
 {
        int left;
+
        spin_lock_irq(&dev->work_lock);
        left = seq - work->done_seq;
        spin_unlock_irq(&dev->work_lock);
@@ -222,6 +224,7 @@ static int vhost_worker(void *data)
 static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
 {
        int i;
+
        for (i = 0; i < dev->nvqs; ++i) {
                dev->vqs[i].indirect = kmalloc(sizeof *dev->vqs[i].indirect *
                                               UIO_MAXIOV, GFP_KERNEL);
@@ -235,6 +238,7 @@ static long vhost_dev_alloc_iovecs(struct vhost_dev *dev)
                        goto err_nomem;
        }
        return 0;
+
 err_nomem:
        for (; i >= 0; --i) {
                kfree(dev->vqs[i].indirect);
@@ -247,6 +251,7 @@ err_nomem:
 static void vhost_dev_free_iovecs(struct vhost_dev *dev)
 {
        int i;
+
        for (i = 0; i < dev->nvqs; ++i) {
                kfree(dev->vqs[i].indirect);
                dev->vqs[i].indirect = NULL;
@@ -296,26 +301,28 @@ long vhost_dev_check_owner(struct vhost_dev *dev)
 }
 
 struct vhost_attach_cgroups_struct {
-        struct vhost_work work;
-        struct task_struct *owner;
-        int ret;
+       struct vhost_work work;
+       struct task_struct *owner;
+       int ret;
 };
 
 static void vhost_attach_cgroups_work(struct vhost_work *work)
 {
-        struct vhost_attach_cgroups_struct *s;
-        s = container_of(work, struct vhost_attach_cgroups_struct, work);
-        s->ret = cgroup_attach_task_all(s->owner, current);
+       struct vhost_attach_cgroups_struct *s;
+
+       s = container_of(work, struct vhost_attach_cgroups_struct, work);
+       s->ret = cgroup_attach_task_all(s->owner, current);
 }
 
 static int vhost_attach_cgroups(struct vhost_dev *dev)
 {
-        struct vhost_attach_cgroups_struct attach;
-        attach.owner = current;
-        vhost_work_init(&attach.work, vhost_attach_cgroups_work);
-        vhost_work_queue(dev, &attach.work);
-        vhost_work_flush(dev, &attach.work);
-        return attach.ret;
+       struct vhost_attach_cgroups_struct attach;
+
+       attach.owner = current;
+       vhost_work_init(&attach.work, vhost_attach_cgroups_work);
+       vhost_work_queue(dev, &attach.work);
+       vhost_work_flush(dev, &attach.work);
+       return attach.ret;
 }
 
 /* Caller should have device mutex */
@@ -323,11 +330,13 @@ static long vhost_dev_set_owner(struct vhost_dev *dev)
 {
        struct task_struct *worker;
        int err;
+
        /* Is there an owner already? */
        if (dev->mm) {
                err = -EBUSY;
                goto err_mm;
        }
+
        /* No owner, become one */
        dev->mm = get_task_mm(current);
        worker = kthread_create(vhost_worker, dev, "vhost-%d", current->pid);
@@ -380,6 +389,7 @@ long vhost_dev_reset_owner(struct vhost_dev *dev)
 void vhost_dev_cleanup(struct vhost_dev *dev)
 {
        int i;
+
        for (i = 0; i < dev->nvqs; ++i) {
                if (dev->vqs[i].kick && dev->vqs[i].handle_kick) {
                        vhost_poll_stop(&dev->vqs[i].poll);
@@ -421,6 +431,7 @@ void vhost_dev_cleanup(struct vhost_dev *dev)
 static int log_access_ok(void __user *log_base, u64 addr, unsigned long sz)
 {
        u64 a = addr / VHOST_PAGE_SIZE / 8;
+
        /* Make sure 64 bit math will not overflow. */
        if (a > ULONG_MAX - (unsigned long)log_base ||
            a + (unsigned long)log_base > ULONG_MAX)
@@ -461,6 +472,7 @@ static int memory_access_ok(struct vhost_dev *d, struct vhost_memory *mem,
                            int log_all)
 {
        int i;
+
        for (i = 0; i < d->nvqs; ++i) {
                int ok;
                mutex_lock(&d->vqs[i].mutex);
@@ -527,6 +539,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
 {
        struct vhost_memory mem, *newmem, *oldmem;
        unsigned long size = offsetof(struct vhost_memory, regions);
+
        if (copy_from_user(&mem, m, size))
                return -EFAULT;
        if (mem.padding)
@@ -544,7 +557,8 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m)
                return -EFAULT;
        }
 
-       if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST_F_LOG_ALL))) {
+       if (!memory_access_ok(d, newmem,
+                             vhost_has_feature(d, VHOST_F_LOG_ALL))) {
                kfree(newmem);
                return -EFAULT;
        }
@@ -560,6 +574,7 @@ static int init_used(struct vhost_virtqueue *vq,
                     struct vring_used __user *used)
 {
        int r = put_user(vq->used_flags, &used->flags);
+
        if (r)
                return r;
        return get_user(vq->last_used_idx, &used->idx);
@@ -849,6 +864,7 @@ static const struct vhost_memory_region *find_region(struct vhost_memory *mem,
 {
        struct vhost_memory_region *reg;
        int i;
+
        /* linear search is not brilliant, but we really have on the order of 6
         * regions in practice */
        for (i = 0; i < mem->nregions; ++i) {
@@ -871,6 +887,7 @@ static int set_bit_to_user(int nr, void __user *addr)
        void *base;
        int bit = nr + (log % PAGE_SIZE) * 8;
        int r;
+
        r = get_user_pages_fast(log, 1, 1, &page);
        if (r < 0)
                return r;
@@ -888,6 +905,7 @@ static int log_write(void __user *log_base,
 {
        u64 write_page = write_address / VHOST_PAGE_SIZE;
        int r;
+
        if (!write_length)
                return 0;
        write_length += write_address % VHOST_PAGE_SIZE;
@@ -1037,8 +1055,8 @@ static int get_indirect(struct vhost_dev *dev, struct vhost_virtqueue *vq,
                               i, count);
                        return -EINVAL;
                }
-               if (unlikely(memcpy_fromiovec((unsigned char *)&desc, vq->indirect,
-                                             sizeof desc))) {
+               if (unlikely(memcpy_fromiovec((unsigned char *)&desc,
+                                             vq->indirect, sizeof desc))) {
                        vq_err(vq, "Failed indirect descriptor: idx %d, %zx\n",
                               i, (size_t)indirect->addr + i * sizeof desc);
                        return -EINVAL;
@@ -1153,7 +1171,7 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
                               i, vq->num, head);
                        return -EINVAL;
                }
-               ret = copy_from_user(&desc, vq->desc + i, sizeof desc);
+               ret = __copy_from_user(&desc, vq->desc + i, sizeof desc);
                if (unlikely(ret)) {
                        vq_err(vq, "Failed to get descriptor: idx %d addr %p\n",
                               i, vq->desc + i);
@@ -1317,6 +1335,7 @@ int vhost_add_used_n(struct vhost_virtqueue *vq, struct vring_used_elem *heads,
 void vhost_signal(struct vhost_dev *dev, struct vhost_virtqueue *vq)
 {
        __u16 flags;
+
        /* Flush out used index updates. This is paired
         * with the barrier that the Guest executes when enabling
         * interrupts. */
@@ -1361,6 +1380,7 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq)
 {
        u16 avail_idx;
        int r;
+
        if (!(vq->used_flags & VRING_USED_F_NO_NOTIFY))
                return false;
        vq->used_flags &= ~VRING_USED_F_NO_NOTIFY;
@@ -1387,6 +1407,7 @@ bool vhost_enable_notify(struct vhost_virtqueue *vq)
 void vhost_disable_notify(struct vhost_virtqueue *vq)
 {
        int r;
+
        if (vq->used_flags & VRING_USED_F_NO_NOTIFY)
                return;
        vq->used_flags |= VRING_USED_F_NO_NOTIFY;
index 6c782d3ae1bede62c0bc8a7c93526c144d102600..f7d631ebee8e34981360a83e5c56c97555238a43 100644 (file)
@@ -4,7 +4,4 @@ intelfb-y := intelfbdrv.o intelfbhw.o
 intelfb-$(CONFIG_FB_INTEL_I2C) += intelfb_i2c.o
 intelfb-objs := $(intelfb-y)
 
-ifdef CONFIG_FB_INTEL_DEBUG
-#EXTRA_CFLAGS += -DDEBUG -DVERBOSE -DREGDUMP
-EXTRA_CFLAGS += -DDEBUG -DREGDUMP
-endif
+ccflags-$(CONFIG_FB_INTEL_DEBUG) := -DDEBUG -DREGDUMP
index a082debe824b9969bf3cb76018d638471b6700ae..a74439affce9c7a4b09c0783e226911ce3894a2c 100644 (file)
@@ -1461,13 +1461,6 @@ static struct board {
                MGA_G100,
                &vbG100,
                "MGA-G100 (AGP)"},
-       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200EV_PCI,        0xFF,
-               0,                      0,
-               DEVF_G200,
-               230000,
-               MGA_G200,
-               &vbG200,
-               "MGA-G200eV (PCI)"},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_PCI,  0xFF,
                0,                      0,
                DEVF_G200,
@@ -2119,8 +2112,6 @@ static struct pci_device_id matroxfb_devices[] = {
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G100_AGP,
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
-       {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200EV_PCI,
-               PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_PCI,
                PCI_ANY_ID,     PCI_ANY_ID,     0, 0, 0},
        {PCI_VENDOR_ID_MATROX,  PCI_DEVICE_ID_MATROX_G200_AGP,
index b2c4f54446f3c720e22dd51ce6717c5d1e9a6b3e..3988b4a78339aab8ff6dd1fd3656560ccd9aee3f 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the Linux affs filesystem routines.
 #
 
-#EXTRA_CFLAGS=-DDEBUG=1
+#ccflags-y := -DDEBUG=1
 
 obj-$(CONFIG_AFFS_FS) += affs.o
 
index 685ecff3ab31728d2362a9be39f98dfbc76947c4..b14cebfd90477ead4b15f0c1583da6393c247de5 100644 (file)
@@ -97,7 +97,7 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
        if (!inode)
                return -ENOSPC;
        mutex_lock(&info->bfs_lock);
-       ino = find_first_zero_bit(info->si_imap, info->si_lasti);
+       ino = find_first_zero_bit(info->si_imap, info->si_lasti + 1);
        if (ino > info->si_lasti) {
                mutex_unlock(&info->bfs_lock);
                iput(inode);
index 6c22e61da39779be11ef3e9765de1b1df17743d4..1bab69a0d347696d28f854f6b1928f09937ac5f5 100644 (file)
@@ -9,4 +9,4 @@ coda-objs := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o \
 
 # If you want debugging output, please uncomment the following line.
 
-# EXTRA_CFLAGS += -DDEBUG -DDEBUG_SMB_MALLOC=1
+# ccflags-y := -DDEBUG -DDEBUG_SMB_MALLOC=1
index c6d31a3bab8863af2c5403e487f1cfc23bf63310..72fe6cda9108a162177e91093514a68854323f5a 100644 (file)
@@ -1671,9 +1671,6 @@ int compat_set_fd_set(unsigned long nr, compat_ulong_t __user *ufdset,
  * Update: ERESTARTSYS breaks at least the xview clock binary, so
  * I'm trying ERESTARTNOHAND which restart only when you want to.
  */
-#define MAX_SELECT_SECONDS \
-       ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
 int compat_core_sys_select(int n, compat_ulong_t __user *inp,
        compat_ulong_t __user *outp, compat_ulong_t __user *exp,
        struct timespec *end_time)
index 1bb547c9cad6d98d5c2816a3bf01d46481a72224..c6bd815dc7943c1035e82cd6010b83ba2b00b584 100644 (file)
@@ -479,6 +479,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
        struct dentry *root = sb->s_root;
        struct pts_fs_info *fsi = DEVPTS_SB(sb);
        struct pts_mount_opts *opts = &fsi->mount_opts;
+       int ret = 0;
        char s[12];
 
        /* We're supposed to be given the slave end of a pty */
@@ -504,11 +505,14 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
        if (!IS_ERR(dentry)) {
                d_add(dentry, inode);
                fsnotify_create(root->d_inode, dentry);
+       } else {
+               iput(inode);
+               ret = -ENOMEM;
        }
 
        mutex_unlock(&root->d_inode->i_mutex);
 
-       return 0;
+       return ret;
 }
 
 struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
@@ -544,17 +548,12 @@ void devpts_pty_kill(struct tty_struct *tty)
        mutex_lock(&root->d_inode->i_mutex);
 
        dentry = d_find_alias(inode);
-       if (IS_ERR(dentry))
-               goto out;
-
-       if (dentry) {
-               inode->i_nlink--;
-               d_delete(dentry);
-               dput(dentry);   /* d_alloc_name() in devpts_pty_new() */
-       }
 
+       inode->i_nlink--;
+       d_delete(dentry);
+       dput(dentry);   /* d_alloc_name() in devpts_pty_new() */
        dput(dentry);           /* d_find_alias above */
-out:
+
        mutex_unlock(&root->d_inode->i_mutex);
 }
 
index ba99e1abb1aa3427aca0e95f116e4deaa85ff793..5e62d26a4fecec227d81700b0b9fd6542b715ad6 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1875,7 +1875,7 @@ static void wait_for_dump_helpers(struct file *file)
 
 
 /*
- * uhm_pipe_setup
+ * umh_pipe_setup
  * helper function to customize the process used
  * to collect the core in userspace.  Specifically
  * it sets up a pipe and installs it as fd 0 (stdin)
index 4e303c22d5ee53613682530bd1705a0a3cec8382..b1a524d798e720cf18ad7ad4decdab430a2b9c5e 100644 (file)
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -66,8 +66,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
                                /* suppress POLLHUP until we have
                                 * seen a writer */
                                filp->f_version = pipe->w_counter;
-                       } else 
-                       {
+                       } else {
                                wait_for_partner(inode, &pipe->w_counter);
                                if(signal_pending(current))
                                        goto err_rd;
index 21f7e46da4c015925b5ff4ae1b6856f25653ea64..f3d23ef4e876a913aa48608bfe71aa2d192ecb05 100644 (file)
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS := -I$(src)
+ccflags-y := -I$(src)
 obj-$(CONFIG_GFS2_FS) += gfs2.o
 gfs2-y := acl.o bmap.o dir.o xattr.o glock.o \
        glops.o inode.o log.o lops.o main.o meta_io.o \
index 9910c039f026254a9caea134a5a7ac8d40c9c76f..16fefd373fc2570449c97a34697f315536022f19 100644 (file)
@@ -1715,7 +1715,7 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev)
 EXPORT_SYMBOL(init_special_inode);
 
 /**
- * Init uid,gid,mode for new inode according to posix standards
+ * inode_init_owner - Init uid,gid,mode for new inode according to posix standards
  * @inode: New inode
  * @dir: Directory inode
  * @mode: mode of the new inode
index 17191546d52768691e405da4cc53735d9589e275..8318059b42c6b950b9b3e338ff8c15654ca1798a 100644 (file)
@@ -64,6 +64,7 @@ extern int copy_mount_string(const void __user *, char **);
 
 extern unsigned int mnt_get_count(struct vfsmount *mnt);
 extern struct vfsmount *__lookup_mnt(struct vfsmount *, struct dentry *, int);
+extern struct vfsmount *lookup_mnt(struct path *);
 extern void mnt_set_mountpoint(struct vfsmount *, struct dentry *,
                                struct vfsmount *);
 extern void release_mounts(struct list_head *);
index 1eebeb72b20276191fcad6199d8bf0b79a4d9921..1d9b9fcb2db48ec682b4e696bbab9dbb79fd26b9 100644 (file)
@@ -548,6 +548,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
 {
        int error = 0;
        int __user *argp = (int __user *)arg;
+       struct inode *inode = filp->f_path.dentry->d_inode;
 
        switch (cmd) {
        case FIOCLEX:
@@ -567,13 +568,11 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
                break;
 
        case FIOQSIZE:
-               if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
-                   S_ISREG(filp->f_path.dentry->d_inode->i_mode) ||
-                   S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) {
-                       loff_t res =
-                               inode_get_bytes(filp->f_path.dentry->d_inode);
-                       error = copy_to_user((loff_t __user *)arg, &res,
-                                            sizeof(res)) ? -EFAULT : 0;
+               if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode) ||
+                   S_ISLNK(inode->i_mode)) {
+                       loff_t res = inode_get_bytes(inode);
+                       error = copy_to_user(argp, &res, sizeof(res)) ?
+                                       -EFAULT : 0;
                } else
                        error = -ENOTTY;
                break;
@@ -590,14 +589,10 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
                return ioctl_fiemap(filp, arg);
 
        case FIGETBSZ:
-       {
-               struct inode *inode = filp->f_path.dentry->d_inode;
-               int __user *p = (int __user *)arg;
-               return put_user(inode->i_sb->s_blocksize, p);
-       }
+               return put_user(inode->i_sb->s_blocksize, argp);
 
        default:
-               if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
+               if (S_ISREG(inode->i_mode))
                        error = file_ioctl(filp, cmd, arg);
                else
                        error = vfs_ioctl(filp, cmd, arg);
index 3adb6395e42de858ada7adec76b964dfef250e41..a58fa72d7e59e511cc849eb01cee92fa5afb1320 100644 (file)
@@ -13,4 +13,4 @@ jfs-y    := super.o file.o inode.o namei.o jfs_mount.o jfs_umount.o \
 
 jfs-$(CONFIG_JFS_POSIX_ACL) += acl.o
 
-EXTRA_CFLAGS += -D_JFS_4K
+ccflags-y := -D_JFS_4K
index 68ea095100a817262d1858bba4754c22c5206016..c66af563f2ceef35fbf68b01527866f8128711d0 100644 (file)
@@ -11,6 +11,6 @@ ncpfs-$(CONFIG_NCPFS_EXTRAS)   += symlink.o
 ncpfs-$(CONFIG_NCPFS_NFS_NS)   += symlink.o
 
 # If you want debugging output, please uncomment the following line
-# EXTRA_CFLAGS += -DDEBUG_NCP=1
+# ccflags-y := -DDEBUG_NCP=1
 
 CFLAGS_ncplib_kernel.o := -finline-functions
index c0b8344db0c65129d08d6a299a051fed0ce430fd..bf1c68009ffd8b64001ecdd4d9f266654d2a3656 100644 (file)
@@ -98,7 +98,7 @@ rename_retry:
                namelen--;
        buflen -= namelen;
        if (buflen < 0) {
-               spin_lock(&dentry->d_lock);
+               spin_unlock(&dentry->d_lock);
                rcu_read_unlock();
                goto Elong;
        }
@@ -108,7 +108,7 @@ rename_retry:
        rcu_read_unlock();
        return end;
 Elong_unlock:
-       spin_lock(&dentry->d_lock);
+       spin_unlock(&dentry->d_lock);
        rcu_read_unlock();
        if (read_seqretry(&rename_lock, seq))
                goto rename_retry;
index 4ff028fcfd6e36a6cd576a8ce084d5486df696c4..30206b238433bac48582af6c252dc9413575de1d 100644 (file)
@@ -2,18 +2,13 @@
 
 obj-$(CONFIG_NTFS_FS) += ntfs.o
 
-ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
-            index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \
-            unistr.o upcase.o
+ntfs-y := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \
+         index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \
+         unistr.o upcase.o
 
-EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.30\"
+ntfs-$(CONFIG_NTFS_RW) += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o
 
-ifeq ($(CONFIG_NTFS_DEBUG),y)
-EXTRA_CFLAGS += -DDEBUG
-endif
+ccflags-y := -DNTFS_VERSION=\"2.1.30\"
+ccflags-$(CONFIG_NTFS_DEBUG)   += -DDEBUG
+ccflags-$(CONFIG_NTFS_RW)      += -DNTFS_RW
 
-ifeq ($(CONFIG_NTFS_RW),y)
-EXTRA_CFLAGS += -DNTFS_RW
-
-ntfs-objs += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o
-endif
index 07d9fd85435028f2ca2e0ad1b298a490741b6c70..d8a0313e99e6af42b8412e91bb44cb2d7bb410b8 100644 (file)
@@ -1,6 +1,6 @@
-EXTRA_CFLAGS += -Ifs/ocfs2
+ccflags-y := -Ifs/ocfs2
 
-EXTRA_CFLAGS += -DCATCH_BH_JBD_RACES
+ccflags-y += -DCATCH_BH_JBD_RACES
 
 obj-$(CONFIG_OCFS2_FS) +=      \
        ocfs2.o                 \
index dcebf0d920fa17cbd0bae8db9bcb2090f4a3e3a6..c8a044efbb150653c32d94460fa929944d25181f 100644 (file)
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -Ifs/ocfs2
+ccflags-y := -Ifs/ocfs2
 
 obj-$(CONFIG_OCFS2_FS_O2CB) += ocfs2_dlm.o
 
index df69b4856d0d82fd908d64acf48472dd8c8e578f..f14be89a67016101afb74705399a7724ec6d55bf 100644 (file)
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -Ifs/ocfs2
+ccflags-y := -Ifs/ocfs2
 
 obj-$(CONFIG_OCFS2_FS) += ocfs2_dlmfs.o
 
index f83ca80cc59a1d72c8b933d7562efc853cfe3f8c..b52cf013ffa145de32e5c641aba7a3625de8cc29 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -835,17 +835,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags,
 
        validate_creds(cred);
 
-       /*
-        * We must always pass in a valid mount pointer.   Historically
-        * callers got away with not passing it, but we must enforce this at
-        * the earliest possible point now to avoid strange problems deep in the
-        * filesystem stack.
-        */
-       if (!mnt) {
-               printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
-               dump_stack();
-               return ERR_PTR(-EINVAL);
-       }
+       /* We must always pass in a valid mount pointer. */
+       BUG_ON(!mnt);
 
        error = -ENFILE;
        f = get_empty_filp();
index 08342232cb1c4f82ddb07db1fc4c8fcb9908d72b..977ed272384574e0220bdfe06439ea3cdd045ad5 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/string.h>
 #include <linux/mount.h>
 #include <linux/ramfs.h>
+#include <linux/parser.h>
 #include <linux/sched.h>
 #include <linux/magic.h>
 #include <linux/pstore.h>
@@ -73,11 +74,16 @@ static int pstore_unlink(struct inode *dir, struct dentry *dentry)
        struct pstore_private *p = dentry->d_inode->i_private;
 
        p->erase(p->id);
-       kfree(p);
 
        return simple_unlink(dir, dentry);
 }
 
+static void pstore_evict_inode(struct inode *inode)
+{
+       end_writeback(inode);
+       kfree(inode->i_private);
+}
+
 static const struct inode_operations pstore_dir_inode_operations = {
        .lookup         = simple_lookup,
        .unlink         = pstore_unlink,
@@ -107,9 +113,52 @@ static struct inode *pstore_get_inode(struct super_block *sb,
        return inode;
 }
 
+enum {
+       Opt_kmsg_bytes, Opt_err
+};
+
+static const match_table_t tokens = {
+       {Opt_kmsg_bytes, "kmsg_bytes=%u"},
+       {Opt_err, NULL}
+};
+
+static void parse_options(char *options)
+{
+       char            *p;
+       substring_t     args[MAX_OPT_ARGS];
+       int             option;
+
+       if (!options)
+               return;
+
+       while ((p = strsep(&options, ",")) != NULL) {
+               int token;
+
+               if (!*p)
+                       continue;
+
+               token = match_token(p, tokens, args);
+               switch (token) {
+               case Opt_kmsg_bytes:
+                       if (!match_int(&args[0], &option))
+                               pstore_set_kmsg_bytes(option);
+                       break;
+               }
+       }
+}
+
+static int pstore_remount(struct super_block *sb, int *flags, char *data)
+{
+       parse_options(data);
+
+       return 0;
+}
+
 static const struct super_operations pstore_ops = {
        .statfs         = simple_statfs,
        .drop_inode     = generic_delete_inode,
+       .evict_inode    = pstore_evict_inode,
+       .remount_fs     = pstore_remount,
        .show_options   = generic_show_options,
 };
 
@@ -209,6 +258,8 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
        sb->s_op                = &pstore_ops;
        sb->s_time_gran         = 1;
 
+       parse_options(data);
+
        inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0);
        if (!inode) {
                err = -ENOMEM;
@@ -252,28 +303,7 @@ static struct file_system_type pstore_fs_type = {
 
 static int __init init_pstore_fs(void)
 {
-       int rc = 0;
-       struct kobject *pstorefs_kobj;
-
-       pstorefs_kobj = kobject_create_and_add("pstore", fs_kobj);
-       if (!pstorefs_kobj) {
-               rc = -ENOMEM;
-               goto done;
-       }
-
-       rc = sysfs_create_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
-       if (rc)
-               goto done1;
-
-       rc = register_filesystem(&pstore_fs_type);
-       if (rc == 0)
-               goto done;
-
-       sysfs_remove_file(pstorefs_kobj, &pstore_kmsg_bytes_attr.attr);
-done1:
-       kobject_put(pstorefs_kobj);
-done:
-       return rc;
+       return register_filesystem(&pstore_fs_type);
 }
 module_init(init_pstore_fs)
 
index 76c26d2fab2925e2f4835e7707fb55a88b5e74c0..8c9f23eb16451a294cfb1b379c8cb8b55c40565d 100644 (file)
@@ -1,7 +1,6 @@
+extern void    pstore_set_kmsg_bytes(int);
 extern void    pstore_get_records(void);
 extern int     pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
                              char *data, size_t size,
                              struct timespec time, int (*erase)(u64));
 extern int     pstore_is_mounted(void);
-
-extern struct kobj_attribute pstore_kmsg_bytes_attr;
index 705fdf8abf6e5b838481029576b86879b8f79152..ce9ad84d5dd9fdbefcf03530396e88e29b6408aa 100644 (file)
 static DEFINE_SPINLOCK(pstore_lock);
 static struct pstore_info *psinfo;
 
-/* How much of the console log to snapshot. /sys/fs/pstore/kmsg_bytes */
+/* How much of the console log to snapshot */
 static unsigned long kmsg_bytes = 10240;
 
-static ssize_t b_show(struct kobject *kobj,
-                     struct kobj_attribute *attr, char *buf)
+void pstore_set_kmsg_bytes(int bytes)
 {
-       return snprintf(buf, PAGE_SIZE, "%lu\n", kmsg_bytes);
+       kmsg_bytes = bytes;
 }
 
-static ssize_t b_store(struct kobject *kobj, struct kobj_attribute *attr,
-                      const char *buf, size_t count)
-{
-       return (sscanf(buf, "%lu", &kmsg_bytes) > 0) ? count : 0;
-}
-
-struct kobj_attribute pstore_kmsg_bytes_attr =
-       __ATTR(kmsg_bytes, S_IRUGO | S_IWUSR, b_show, b_store);
-
 /* Tag each group of saved records with a sequence number */
 static int     oopscount;
 
index 792b3cb2cd18a745772e8d6e138656c1c5314eaf..3c3b00165114c8023d4e8e98c1cafb9474095039 100644 (file)
@@ -31,9 +31,7 @@ endif
 # and causing a panic. Since this behavior only affects ppc32, this ifeq
 # will work around it. If any other architecture displays this behavior,
 # add it here.
-ifeq ($(CONFIG_PPC32),y)
-EXTRA_CFLAGS := $(call cc-ifversion, -lt, 0400, -O1)
-endif
+ccflags-$(CONFIG_PPC32) := $(call cc-ifversion, -lt, 0400, -O1)
 
 TAGS:
        etags *.c
index e56560d2b08a8db433f890f7a8baa344f50a3df1..d33418fdc858fbbe7f929d692dae1533c2e9a271 100644 (file)
@@ -517,9 +517,6 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
  * Update: ERESTARTSYS breaks at least the xview clock binary, so
  * I'm trying ERESTARTNOHAND which restart only when you want to.
  */
-#define MAX_SELECT_SECONDS \
-       ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
-
 int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
                           fd_set __user *exp, struct timespec *end_time)
 {
index ba76b9623e7e809f6b3c5e6223020836069dc4ab..92ca208777d562e64bfc769dc41a326f7c3da84e 100644 (file)
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -7,6 +7,7 @@
 #include <linux/fs.h>
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/namei.h>
 #include <linux/sched.h>
 #include <linux/writeback.h>
 #include <linux/syscalls.h>
@@ -128,6 +129,29 @@ void emergency_sync(void)
        }
 }
 
+/*
+ * sync a single super
+ */
+SYSCALL_DEFINE1(syncfs, int, fd)
+{
+       struct file *file;
+       struct super_block *sb;
+       int ret;
+       int fput_needed;
+
+       file = fget_light(fd, &fput_needed);
+       if (!file)
+               return -EBADF;
+       sb = file->f_dentry->d_sb;
+
+       down_read(&sb->s_umount);
+       ret = sync_filesystem(sb);
+       up_read(&sb->s_umount);
+
+       fput_light(file, fput_needed);
+       return ret;
+}
+
 /**
  * vfs_fsync_range - helper to sync a range of data & metadata to disk
  * @file:              file to sync
index faca449970995ab41a8fc9117efeceac63cf1991..284a7c89697efd7d083b5a60dfc9671796fe80b1 100644 (file)
 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 
-EXTRA_CFLAGS +=         -I$(src) -I$(src)/linux-2.6
+ccflags-y := -I$(src) -I$(src)/linux-2.6
+ccflags-$(CONFIG_XFS_DEBUG) += -g
 
 XFS_LINUX := linux-2.6
 
-ifeq ($(CONFIG_XFS_DEBUG),y)
-       EXTRA_CFLAGS += -g
-endif
-
 obj-$(CONFIG_XFS_FS)           += xfs.o
 
 xfs-y                          += linux-2.6/xfs_trace.o
@@ -105,11 +102,10 @@ xfs-y                             += $(addprefix $(XFS_LINUX)/, \
                                   xfs_globals.o \
                                   xfs_ioctl.o \
                                   xfs_iops.o \
+                                  xfs_message.o \
                                   xfs_super.o \
                                   xfs_sync.o \
                                   xfs_xattr.o)
 
 # Objects in support/
-xfs-y                          += $(addprefix support/, \
-                                  debug.o \
-                                  uuid.o)
+xfs-y                          += support/uuid.o
index 666c9db48eb63893cc3da777c44478ccd4d6942b..a907de565db3bf287f7d1a7894fff23f85ca18d5 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/backing-dev.h>
 #include "time.h"
 #include "kmem.h"
+#include "xfs_message.h"
 
 /*
  * Greedy allocation.  May fail and may return vmalloced memory.
@@ -56,8 +57,8 @@ kmem_alloc(size_t size, unsigned int __nocast flags)
                if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
                        return ptr;
                if (!(++retries % 100))
-                       printk(KERN_ERR "XFS: possible memory allocation "
-                                       "deadlock in %s (mode:0x%x)\n",
+                       xfs_err(NULL,
+               "possible memory allocation deadlock in %s (mode:0x%x)",
                                        __func__, lflags);
                congestion_wait(BLK_RW_ASYNC, HZ/50);
        } while (1);
@@ -112,8 +113,8 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
                if (ptr || (flags & (KM_MAYFAIL|KM_NOSLEEP)))
                        return ptr;
                if (!(++retries % 100))
-                       printk(KERN_ERR "XFS: possible memory allocation "
-                                       "deadlock in %s (mode:0x%x)\n",
+                       xfs_err(NULL,
+               "possible memory allocation deadlock in %s (mode:0x%x)",
                                        __func__, lflags);
                congestion_wait(BLK_RW_ASYNC, HZ/50);
        } while (1);
index ec7bbb5645b63d85811e2ee731637139881b370c..8c5c8727745607800f91270ccf7184986b86b75e 100644 (file)
@@ -854,7 +854,7 @@ xfs_aops_discard_page(
        if (XFS_FORCED_SHUTDOWN(ip->i_mount))
                goto out_invalidate;
 
-       xfs_fs_cmn_err(CE_ALERT, ip->i_mount,
+       xfs_alert(ip->i_mount,
                "page discard on page %p, inode 0x%llx, offset %llu.",
                        page, ip->i_ino, offset);
 
@@ -872,7 +872,7 @@ xfs_aops_discard_page(
                if (error) {
                        /* something screwed, just bail */
                        if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-                               xfs_fs_cmn_err(CE_ALERT, ip->i_mount,
+                               xfs_alert(ip->i_mount,
                        "page discard unable to remove delalloc mapping.");
                        }
                        break;
@@ -1411,7 +1411,7 @@ xfs_vm_write_failed(
                if (error) {
                        /* something screwed, just bail */
                        if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-                               xfs_fs_cmn_err(CE_ALERT, ip->i_mount,
+                               xfs_alert(ip->i_mount,
                        "xfs_vm_write_failed: unable to clean up ino %lld",
                                                ip->i_ino);
                        }
index f83a4c830a65e865f8d680849278f5dfa4eb41a2..5cb230f2cb4f613263cbb1e90c5ec06a5a1eb597 100644 (file)
@@ -401,9 +401,8 @@ _xfs_buf_lookup_pages(
                         * handle buffer allocation failures we can't do much.
                         */
                        if (!(++retries % 100))
-                               printk(KERN_ERR
-                                       "XFS: possible memory allocation "
-                                       "deadlock in %s (mode:0x%x)\n",
+                               xfs_err(NULL,
+               "possible memory allocation deadlock in %s (mode:0x%x)",
                                        __func__, gfp_mask);
 
                        XFS_STATS_INC(xb_page_retries);
@@ -615,8 +614,8 @@ xfs_buf_get(
        if (!(bp->b_flags & XBF_MAPPED)) {
                error = _xfs_buf_map_pages(bp, flags);
                if (unlikely(error)) {
-                       printk(KERN_WARNING "%s: failed to map pages\n",
-                                       __func__);
+                       xfs_warn(target->bt_mount,
+                               "%s: failed to map pages\n", __func__);
                        goto no_buffer;
                }
        }
@@ -850,8 +849,8 @@ xfs_buf_get_uncached(
 
        error = _xfs_buf_map_pages(bp, XBF_MAPPED);
        if (unlikely(error)) {
-               printk(KERN_WARNING "%s: failed to map pages\n",
-                               __func__);
+               xfs_warn(target->bt_mount,
+                       "%s: failed to map pages\n", __func__);
                goto fail_free_mem;
        }
 
@@ -1617,8 +1616,8 @@ xfs_setsize_buftarg_flags(
        btp->bt_smask = sectorsize - 1;
 
        if (set_blocksize(btp->bt_bdev, sectorsize)) {
-               printk(KERN_WARNING
-                       "XFS: Cannot set_blocksize to %u on device %s\n",
+               xfs_warn(btp->bt_mount,
+                       "Cannot set_blocksize to %u on device %s\n",
                        sectorsize, XFS_BUFTARG_NAME(btp));
                return EINVAL;
        }
index 096494997747da5904ed71a9af24d70c1555106e..244be9cbfe78d195ca1ee0a3ff20473f244af0a0 100644 (file)
@@ -39,7 +39,6 @@
 #include <mrlock.h>
 #include <time.h>
 
-#include <support/debug.h>
 #include <support/uuid.h>
 
 #include <linux/semaphore.h>
@@ -86,6 +85,7 @@
 #include <xfs_aops.h>
 #include <xfs_super.h>
 #include <xfs_buf.h>
+#include <xfs_message.h>
 
 /*
  * Feature macros (disable/enable)
@@ -280,4 +280,25 @@ static inline __uint64_t howmany_64(__uint64_t x, __uint32_t y)
 #define __arch_pack
 #endif
 
+#define ASSERT_ALWAYS(expr)    \
+       (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
+
+#ifndef DEBUG
+#define ASSERT(expr)   ((void)0)
+
+#ifndef STATIC
+# define STATIC static noinline
+#endif
+
+#else /* DEBUG */
+
+#define ASSERT(expr)   \
+       (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
+
+#ifndef STATIC
+# define STATIC noinline
+#endif
+
+#endif /* DEBUG */
+
 #endif /* __XFS_LINUX__ */
diff --git a/fs/xfs/linux-2.6/xfs_message.c b/fs/xfs/linux-2.6/xfs_message.c
new file mode 100644 (file)
index 0000000..508e06f
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2011 Red Hat, Inc.  All Rights Reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it would 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 the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "xfs.h"
+#include "xfs_fs.h"
+#include "xfs_types.h"
+#include "xfs_log.h"
+#include "xfs_inum.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
+#include "xfs_mount.h"
+
+/*
+ * XFS logging functions
+ */
+static int
+__xfs_printk(
+       const char              *level,
+       const struct xfs_mount  *mp,
+       struct va_format        *vaf)
+{
+       if (mp && mp->m_fsname)
+               return printk("%sXFS (%s): %pV\n", level, mp->m_fsname, vaf);
+       return printk("%sXFS: %pV\n", level, vaf);
+}
+
+int xfs_printk(
+       const char              *level,
+       const struct xfs_mount  *mp,
+       const char              *fmt, ...)
+{
+       struct va_format        vaf;
+       va_list                 args;
+       int                      r;
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       r = __xfs_printk(level, mp, &vaf);
+       va_end(args);
+
+       return r;
+}
+
+#define define_xfs_printk_level(func, kern_level)              \
+int func(const struct xfs_mount *mp, const char *fmt, ...)     \
+{                                                              \
+       struct va_format        vaf;                            \
+       va_list                 args;                           \
+       int                     r;                              \
+                                                               \
+       va_start(args, fmt);                                    \
+                                                               \
+       vaf.fmt = fmt;                                          \
+       vaf.va = &args;                                         \
+                                                               \
+       r = __xfs_printk(kern_level, mp, &vaf);                 \
+       va_end(args);                                           \
+                                                               \
+       return r;                                               \
+}                                                              \
+
+define_xfs_printk_level(xfs_emerg, KERN_EMERG);
+define_xfs_printk_level(xfs_alert, KERN_ALERT);
+define_xfs_printk_level(xfs_crit, KERN_CRIT);
+define_xfs_printk_level(xfs_err, KERN_ERR);
+define_xfs_printk_level(xfs_warn, KERN_WARNING);
+define_xfs_printk_level(xfs_notice, KERN_NOTICE);
+define_xfs_printk_level(xfs_info, KERN_INFO);
+#ifdef DEBUG
+define_xfs_printk_level(xfs_debug, KERN_DEBUG);
+#endif
+
+int
+xfs_alert_tag(
+       const struct xfs_mount  *mp,
+       int                     panic_tag,
+       const char              *fmt, ...)
+{
+       struct va_format        vaf;
+       va_list                 args;
+       int                     do_panic = 0;
+       int                     r;
+
+       if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
+               xfs_printk(KERN_ALERT, mp,
+                       "XFS: Transforming an alert into a BUG.");
+               do_panic = 1;
+       }
+
+       va_start(args, fmt);
+
+       vaf.fmt = fmt;
+       vaf.va = &args;
+
+       r = __xfs_printk(KERN_ALERT, mp, &vaf);
+       va_end(args);
+
+       BUG_ON(do_panic);
+
+       return r;
+}
+
+void
+assfail(char *expr, char *file, int line)
+{
+       xfs_emerg(NULL, "Assertion failed: %s, file: %s, line: %d",
+               expr, file, line);
+       BUG();
+}
+
+void
+xfs_hex_dump(void *p, int length)
+{
+       print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
+}
diff --git a/fs/xfs/linux-2.6/xfs_message.h b/fs/xfs/linux-2.6/xfs_message.h
new file mode 100644 (file)
index 0000000..e77ffa1
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __XFS_MESSAGE_H
+#define __XFS_MESSAGE_H 1
+
+struct xfs_mount;
+
+extern int xfs_printk(const char *level, const struct xfs_mount *mp,
+                      const char *fmt, ...)
+        __attribute__ ((format (printf, 3, 4)));
+extern int xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_alert(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_alert_tag(const struct xfs_mount *mp, int tag,
+                        const char *fmt, ...)
+        __attribute__ ((format (printf, 3, 4)));
+extern int xfs_crit(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_err(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_warn(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_notice(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+extern int xfs_info(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+
+#ifdef DEBUG
+extern int xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
+        __attribute__ ((format (printf, 2, 3)));
+#else
+#define xfs_debug(mp, fmt, ...)        (0)
+#endif
+
+extern void assfail(char *expr, char *f, int l);
+
+extern void xfs_hex_dump(void *p, int length);
+
+#endif /* __XFS_MESSAGE_H */
index 9731898083ae86ee79f546f372684ab5d03dbcc8..818c4cf2de863e5450ac75ad300a1c78bfdbca60 100644 (file)
@@ -172,6 +172,15 @@ xfs_parseargs(
        int                     iosize = 0;
        __uint8_t               iosizelog = 0;
 
+       /*
+        * set up the mount name first so all the errors will refer to the
+        * correct device.
+        */
+       mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);
+       if (!mp->m_fsname)
+               return ENOMEM;
+       mp->m_fsname_len = strlen(mp->m_fsname) + 1;
+
        /*
         * Copy binary VFS mount flags we are interested in.
         */
@@ -189,6 +198,7 @@ xfs_parseargs(
        mp->m_flags |= XFS_MOUNT_BARRIER;
        mp->m_flags |= XFS_MOUNT_COMPAT_IOSIZE;
        mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
+       mp->m_flags |= XFS_MOUNT_DELAYLOG;
 
        /*
         * These can be overridden by the mount option parsing.
@@ -207,24 +217,21 @@ xfs_parseargs(
 
                if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        mp->m_logbufs = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        mp->m_logbsize = suffix_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -232,14 +239,12 @@ xfs_parseargs(
                        if (!mp->m_logname)
                                return ENOMEM;
                } else if (!strcmp(this_char, MNTOPT_MTPT)) {
-                       cmn_err(CE_WARN,
-                               "XFS: %s option not allowed on this system",
+                       xfs_warn(mp, "%s option not allowed on this system",
                                this_char);
                        return EINVAL;
                } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -248,8 +253,7 @@ xfs_parseargs(
                                return ENOMEM;
                } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -257,8 +261,7 @@ xfs_parseargs(
                        iosizelog = ffs(iosize) - 1;
                } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -280,16 +283,14 @@ xfs_parseargs(
                        mp->m_flags |= XFS_MOUNT_SWALLOC;
                } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
                        dsunit = simple_strtoul(value, &eov, 10);
                } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
                        if (!value || !*value) {
-                               cmn_err(CE_WARN,
-                                       "XFS: %s option requires an argument",
+                               xfs_warn(mp, "%s option requires an argument",
                                        this_char);
                                return EINVAL;
                        }
@@ -297,8 +298,7 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
                        mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS;
 #if !XFS_BIG_INUMS
-                       cmn_err(CE_WARN,
-                               "XFS: %s option not allowed on this system",
+                       xfs_warn(mp, "%s option not allowed on this system",
                                this_char);
                        return EINVAL;
 #endif
@@ -356,20 +356,19 @@ xfs_parseargs(
                } else if (!strcmp(this_char, MNTOPT_NODELAYLOG)) {
                        mp->m_flags &= ~XFS_MOUNT_DELAYLOG;
                } else if (!strcmp(this_char, "ihashsize")) {
-                       cmn_err(CE_WARN,
-       "XFS: ihashsize no longer used, option is deprecated.");
+                       xfs_warn(mp,
+       "ihashsize no longer used, option is deprecated.");
                } else if (!strcmp(this_char, "osyncisdsync")) {
-                       cmn_err(CE_WARN,
-       "XFS: osyncisdsync has no effect, option is deprecated.");
+                       xfs_warn(mp,
+       "osyncisdsync has no effect, option is deprecated.");
                } else if (!strcmp(this_char, "osyncisosync")) {
-                       cmn_err(CE_WARN,
-       "XFS: osyncisosync has no effect, option is deprecated.");
+                       xfs_warn(mp,
+       "osyncisosync has no effect, option is deprecated.");
                } else if (!strcmp(this_char, "irixsgid")) {
-                       cmn_err(CE_WARN,
-       "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
+                       xfs_warn(mp,
+       "irixsgid is now a sysctl(2) variable, option is deprecated.");
                } else {
-                       cmn_err(CE_WARN,
-                               "XFS: unknown mount option [%s].", this_char);
+                       xfs_warn(mp, "unknown mount option [%s].", this_char);
                        return EINVAL;
                }
        }
@@ -379,40 +378,37 @@ xfs_parseargs(
         */
        if ((mp->m_flags & XFS_MOUNT_NORECOVERY) &&
            !(mp->m_flags & XFS_MOUNT_RDONLY)) {
-               cmn_err(CE_WARN, "XFS: no-recovery mounts must be read-only.");
+               xfs_warn(mp, "no-recovery mounts must be read-only.");
                return EINVAL;
        }
 
        if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) {
-               cmn_err(CE_WARN,
-       "XFS: sunit and swidth options incompatible with the noalign option");
+               xfs_warn(mp,
+       "sunit and swidth options incompatible with the noalign option");
                return EINVAL;
        }
 
 #ifndef CONFIG_XFS_QUOTA
        if (XFS_IS_QUOTA_RUNNING(mp)) {
-               cmn_err(CE_WARN,
-                       "XFS: quota support not available in this kernel.");
+               xfs_warn(mp, "quota support not available in this kernel.");
                return EINVAL;
        }
 #endif
 
        if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) &&
            (mp->m_qflags & (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE))) {
-               cmn_err(CE_WARN,
-                       "XFS: cannot mount with both project and group quota");
+               xfs_warn(mp, "cannot mount with both project and group quota");
                return EINVAL;
        }
 
        if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
-               cmn_err(CE_WARN,
-                       "XFS: sunit and swidth must be specified together");
+               xfs_warn(mp, "sunit and swidth must be specified together");
                return EINVAL;
        }
 
        if (dsunit && (dswidth % dsunit != 0)) {
-               cmn_err(CE_WARN,
-       "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)",
+               xfs_warn(mp,
+       "stripe width (%d) must be a multiple of the stripe unit (%d)",
                        dswidth, dsunit);
                return EINVAL;
        }
@@ -438,8 +434,7 @@ done:
            mp->m_logbufs != 0 &&
            (mp->m_logbufs < XLOG_MIN_ICLOGS ||
             mp->m_logbufs > XLOG_MAX_ICLOGS)) {
-               cmn_err(CE_WARN,
-                       "XFS: invalid logbufs value: %d [not %d-%d]",
+               xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]",
                        mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
                return XFS_ERROR(EINVAL);
        }
@@ -448,22 +443,16 @@ done:
            (mp->m_logbsize < XLOG_MIN_RECORD_BSIZE ||
             mp->m_logbsize > XLOG_MAX_RECORD_BSIZE ||
             !is_power_of_2(mp->m_logbsize))) {
-               cmn_err(CE_WARN,
-       "XFS: invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
+               xfs_warn(mp,
+                       "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
                        mp->m_logbsize);
                return XFS_ERROR(EINVAL);
        }
 
-       mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);
-       if (!mp->m_fsname)
-               return ENOMEM;
-       mp->m_fsname_len = strlen(mp->m_fsname) + 1;
-
        if (iosizelog) {
                if (iosizelog > XFS_MAX_IO_LOG ||
                    iosizelog < XFS_MIN_IO_LOG) {
-                       cmn_err(CE_WARN,
-               "XFS: invalid log iosize: %d [not %d-%d]",
+                       xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
                                iosizelog, XFS_MIN_IO_LOG,
                                XFS_MAX_IO_LOG);
                        return XFS_ERROR(EINVAL);
@@ -610,7 +599,7 @@ xfs_blkdev_get(
                                    mp);
        if (IS_ERR(*bdevp)) {
                error = PTR_ERR(*bdevp);
-               printk("XFS: Invalid device [%s], error=%d\n", name, error);
+               xfs_warn(mp, "Invalid device [%s], error=%d\n", name, error);
        }
 
        return -error;
@@ -664,23 +653,23 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
        int error;
 
        if (mp->m_logdev_targp != mp->m_ddev_targp) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
+               xfs_notice(mp,
                  "Disabling barriers, not supported with external log device");
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
                return;
        }
 
        if (xfs_readonly_buftarg(mp->m_ddev_targp)) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
-                 "Disabling barriers, underlying device is readonly");
+               xfs_notice(mp,
+                       "Disabling barriers, underlying device is readonly");
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
                return;
        }
 
        error = xfs_barrier_test(mp);
        if (error) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
-                 "Disabling barriers, trial barrier write failed");
+               xfs_notice(mp,
+                       "Disabling barriers, trial barrier write failed");
                mp->m_flags &= ~XFS_MOUNT_BARRIER;
                return;
        }
@@ -743,8 +732,8 @@ xfs_open_devices(
                        goto out_close_logdev;
 
                if (rtdev == ddev || rtdev == logdev) {
-                       cmn_err(CE_WARN,
-       "XFS: Cannot mount filesystem with identical rtdev and ddev/logdev.");
+                       xfs_warn(mp,
+       "Cannot mount filesystem with identical rtdev and ddev/logdev.");
                        error = EINVAL;
                        goto out_close_rtdev;
                }
@@ -1345,8 +1334,8 @@ xfs_fs_remount(
                         * options that we can't actually change.
                         */
 #if 0
-                       printk(KERN_INFO
-       "XFS: mount option \"%s\" not supported for remount\n", p);
+                       xfs_info(mp,
+               "mount option \"%s\" not supported for remount\n", p);
                        return -EINVAL;
 #else
                        break;
@@ -1367,8 +1356,7 @@ xfs_fs_remount(
                if (mp->m_update_flags) {
                        error = xfs_mount_log_sb(mp, mp->m_update_flags);
                        if (error) {
-                               cmn_err(CE_WARN,
-                                       "XFS: failed to write sb changes");
+                               xfs_warn(mp, "failed to write sb changes");
                                return error;
                        }
                        mp->m_update_flags = 0;
@@ -1452,15 +1440,15 @@ xfs_finish_flags(
                        mp->m_logbsize = mp->m_sb.sb_logsunit;
                } else if (mp->m_logbsize > 0 &&
                           mp->m_logbsize < mp->m_sb.sb_logsunit) {
-                       cmn_err(CE_WARN,
-       "XFS: logbuf size must be greater than or equal to log stripe size");
+                       xfs_warn(mp,
+               "logbuf size must be greater than or equal to log stripe size");
                        return XFS_ERROR(EINVAL);
                }
        } else {
                /* Fail a mount if the logbuf is larger than 32K */
                if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) {
-                       cmn_err(CE_WARN,
-       "XFS: logbuf size for version 1 logs must be 16K or 32K");
+                       xfs_warn(mp,
+               "logbuf size for version 1 logs must be 16K or 32K");
                        return XFS_ERROR(EINVAL);
                }
        }
@@ -1477,8 +1465,8 @@ xfs_finish_flags(
         * prohibit r/w mounts of read-only filesystems
         */
        if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
-               cmn_err(CE_WARN,
-       "XFS: cannot mount a read-only filesystem as read-write");
+               xfs_warn(mp,
+                       "cannot mount a read-only filesystem as read-write");
                return XFS_ERROR(EROFS);
        }
 
index e22f0057d21fa8d2d3e04c11a2e62438ac17a3e9..6c10f1d2e3d3a8e4e094c5153d90b5c8ac60973f 100644 (file)
@@ -425,8 +425,7 @@ xfs_quiesce_attr(
        /* Push the superblock and write an unmount record */
        error = xfs_log_sbcount(mp, 1);
        if (error)
-               xfs_fs_cmn_err(CE_WARN, mp,
-                               "xfs_attr_quiesce: failed to log sb changes. "
+               xfs_warn(mp, "xfs_attr_quiesce: failed to log sb changes. "
                                "Frozen image may not be consistent.");
        xfs_log_unmount_write(mp);
        xfs_unmountfs_writesb(mp);
@@ -806,7 +805,7 @@ xfs_reclaim_inode(
         * pass on the error.
         */
        if (error && error != EAGAIN && !XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-               xfs_fs_cmn_err(CE_WARN, ip->i_mount,
+               xfs_warn(ip->i_mount,
                        "inode 0x%llx background reclaim flush failed with %d",
                        (long long)ip->i_ino, error);
        }
index ee3cee097e7eba33b7139987b6c201ef44c82f64..ee2d2adaa438121a1c875a5a7dda6b96f16c20c0 100644 (file)
@@ -37,7 +37,7 @@ xfs_stats_clear_proc_handler(
        ret = proc_dointvec_minmax(ctl, write, buffer, lenp, ppos);
 
        if (!ret && write && *valp) {
-               printk("XFS Clearing xfsstats\n");
+               xfs_notice(NULL, "Clearing xfsstats");
                for_each_possible_cpu(c) {
                        preempt_disable();
                        /* save vn_active, it's a universal truth! */
index d22aa3103106c47d7d0ca6b9f1532bd17b4289ea..7e241647850335967262b8763ff14bdb5dd86a5b 100644 (file)
@@ -544,9 +544,10 @@ xfs_qm_dqtobp(
        /*
         * A simple sanity check in case we got a corrupted dquot...
         */
-       if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,
+       error = xfs_qm_dqcheck(mp, ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES,
                           flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN),
-                          "dqtobp")) {
+                          "dqtobp");
+       if (error) {
                if (!(flags & XFS_QMOPT_DQREPAIR)) {
                        xfs_trans_brelse(tp, bp);
                        return XFS_ERROR(EIO);
@@ -827,7 +828,7 @@ xfs_qm_dqget(
        if (xfs_do_dqerror) {
                if ((xfs_dqerror_target == mp->m_ddev_targp) &&
                    (xfs_dqreq_num++ % xfs_dqerror_mod) == 0) {
-                       cmn_err(CE_DEBUG, "Returning error in dqget");
+                       xfs_debug(mp, "Returning error in dqget");
                        return (EIO);
                }
        }
@@ -1207,8 +1208,9 @@ xfs_qm_dqflush(
        /*
         * A simple sanity check in case we got a corrupted dquot..
         */
-       if (xfs_qm_dqcheck(&dqp->q_core, be32_to_cpu(ddqp->d_id), 0,
-                          XFS_QMOPT_DOWARN, "dqflush (incore copy)")) {
+       error = xfs_qm_dqcheck(mp, &dqp->q_core, be32_to_cpu(ddqp->d_id), 0,
+                          XFS_QMOPT_DOWARN, "dqflush (incore copy)");
+       if (error) {
                xfs_buf_relse(bp);
                xfs_dqfunlock(dqp);
                xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
@@ -1391,8 +1393,8 @@ xfs_qm_dqpurge(
                 */
                error = xfs_qm_dqflush(dqp, SYNC_WAIT);
                if (error)
-                       xfs_fs_cmn_err(CE_WARN, mp,
-                               "xfs_qm_dqpurge: dquot %p flush failed", dqp);
+                       xfs_warn(mp, "%s: dquot %p flush failed",
+                               __func__, dqp);
                xfs_dqflock(dqp);
        }
        ASSERT(atomic_read(&dqp->q_pincount) == 0);
@@ -1425,36 +1427,38 @@ xfs_qm_dqpurge(
 void
 xfs_qm_dqprint(xfs_dquot_t *dqp)
 {
-       cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------");
-       cmn_err(CE_DEBUG, "---- dquotID =  %d",
+       struct xfs_mount        *mp = dqp->q_mount;
+
+       xfs_debug(mp, "-----------KERNEL DQUOT----------------");
+       xfs_debug(mp, "---- dquotID =  %d",
                (int)be32_to_cpu(dqp->q_core.d_id));
-       cmn_err(CE_DEBUG, "---- type    =  %s", DQFLAGTO_TYPESTR(dqp));
-       cmn_err(CE_DEBUG, "---- fs      =  0x%p", dqp->q_mount);
-       cmn_err(CE_DEBUG, "---- blkno   =  0x%x", (int) dqp->q_blkno);
-       cmn_err(CE_DEBUG, "---- boffset =  0x%x", (int) dqp->q_bufoffset);
-       cmn_err(CE_DEBUG, "---- blkhlimit =  %Lu (0x%x)",
+       xfs_debug(mp, "---- type    =  %s", DQFLAGTO_TYPESTR(dqp));
+       xfs_debug(mp, "---- fs      =  0x%p", dqp->q_mount);
+       xfs_debug(mp, "---- blkno   =  0x%x", (int) dqp->q_blkno);
+       xfs_debug(mp, "---- boffset =  0x%x", (int) dqp->q_bufoffset);
+       xfs_debug(mp, "---- blkhlimit =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_blk_hardlimit),
                (int)be64_to_cpu(dqp->q_core.d_blk_hardlimit));
-       cmn_err(CE_DEBUG, "---- blkslimit =  %Lu (0x%x)",
+       xfs_debug(mp, "---- blkslimit =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_blk_softlimit),
                (int)be64_to_cpu(dqp->q_core.d_blk_softlimit));
-       cmn_err(CE_DEBUG, "---- inohlimit =  %Lu (0x%x)",
+       xfs_debug(mp, "---- inohlimit =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_ino_hardlimit),
                (int)be64_to_cpu(dqp->q_core.d_ino_hardlimit));
-       cmn_err(CE_DEBUG, "---- inoslimit =  %Lu (0x%x)",
+       xfs_debug(mp, "---- inoslimit =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_ino_softlimit),
                (int)be64_to_cpu(dqp->q_core.d_ino_softlimit));
-       cmn_err(CE_DEBUG, "---- bcount  =  %Lu (0x%x)",
+       xfs_debug(mp, "---- bcount  =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_bcount),
                (int)be64_to_cpu(dqp->q_core.d_bcount));
-       cmn_err(CE_DEBUG, "---- icount  =  %Lu (0x%x)",
+       xfs_debug(mp, "---- icount  =  %Lu (0x%x)",
                be64_to_cpu(dqp->q_core.d_icount),
                (int)be64_to_cpu(dqp->q_core.d_icount));
-       cmn_err(CE_DEBUG, "---- btimer  =  %d",
+       xfs_debug(mp, "---- btimer  =  %d",
                (int)be32_to_cpu(dqp->q_core.d_btimer));
-       cmn_err(CE_DEBUG, "---- itimer  =  %d",
+       xfs_debug(mp, "---- itimer  =  %d",
                (int)be32_to_cpu(dqp->q_core.d_itimer));
-       cmn_err(CE_DEBUG, "---------------------------");
+       xfs_debug(mp, "---------------------------");
 }
 #endif
 
index 2a1f3dc10a02dba4f401a326fd72f07bd40212af..9e0e2fa3f2c8c532157609229734329cd8a3bbee 100644 (file)
@@ -136,9 +136,8 @@ xfs_qm_dquot_logitem_push(
         */
        error = xfs_qm_dqflush(dqp, 0);
        if (error)
-               xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
-                       "xfs_qm_dquot_logitem_push: push error %d on dqp %p",
-                       error, dqp);
+               xfs_warn(dqp->q_mount, "%s: push error %d on dqp %p",
+                       __func__, error, dqp);
        xfs_dqunlock(dqp);
 }
 
index 206a2815ced67399c9cfa248a45d185605e12aee..254ee062bd7dde135e0c238ca3696fe180ec78fe 100644 (file)
@@ -80,7 +80,7 @@ xfs_qm_dquot_list_print(
        int             i = 0;
 
        list_for_each_entry(dqp, &mp->m_quotainfo->qi_dqlist_lock, qi_mplist) {
-               cmn_err(CE_DEBUG, "   %d. \"%d (%s)\"   "
+               xfs_debug(mp, "   %d. \"%d (%s)\"   "
                                  "bcnt = %lld, icnt = %lld, refs = %d",
                        i++, be32_to_cpu(dqp->q_core.d_id),
                        DQFLAGTO_TYPESTR(dqp),
@@ -205,7 +205,7 @@ xfs_qm_destroy(
        list_for_each_entry_safe(dqp, n, &xqm->qm_dqfrlist, q_freelist) {
                xfs_dqlock(dqp);
 #ifdef QUOTADEBUG
-               cmn_err(CE_DEBUG, "FREELIST destroy 0x%p", dqp);
+               xfs_debug(dqp->q_mount, "FREELIST destroy 0x%p", dqp);
 #endif
                list_del_init(&dqp->q_freelist);
                xfs_Gqm->qm_dqfrlist_cnt--;
@@ -341,9 +341,7 @@ xfs_qm_mount_quotas(
         * quotas immediately.
         */
        if (mp->m_sb.sb_rextents) {
-               cmn_err(CE_NOTE,
-                       "Cannot turn on quotas for realtime filesystem %s",
-                       mp->m_fsname);
+               xfs_notice(mp, "Cannot turn on quotas for realtime filesystem");
                mp->m_qflags = 0;
                goto write_changes;
        }
@@ -402,14 +400,13 @@ xfs_qm_mount_quotas(
                         * off, but the on disk superblock doesn't know that !
                         */
                        ASSERT(!(XFS_IS_QUOTA_RUNNING(mp)));
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "XFS mount_quotas: Superblock update failed!");
+                       xfs_alert(mp, "%s: Superblock update failed!",
+                               __func__);
                }
        }
 
        if (error) {
-               xfs_fs_cmn_err(CE_WARN, mp,
-                       "Failed to initialize disk quotas.");
+               xfs_warn(mp, "Failed to initialize disk quotas.");
                return;
        }
 
@@ -1229,13 +1226,6 @@ xfs_qm_qino_alloc(
                return error;
        }
 
-       /*
-        * Keep an extra reference to this quota inode. This inode is
-        * locked exclusively and joined to the transaction already.
-        */
-       ASSERT(xfs_isilocked(*ip, XFS_ILOCK_EXCL));
-       IHOLD(*ip);
-
        /*
         * Make the changes in the superblock, and log those too.
         * sbfields arg may contain fields other than *QUOTINO;
@@ -1264,7 +1254,7 @@ xfs_qm_qino_alloc(
        xfs_mod_sb(tp, sbfields);
 
        if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "XFS qino_alloc failed!");
+               xfs_alert(mp, "%s failed (error %d)!", __func__, error);
                return error;
        }
        return 0;
@@ -1299,7 +1289,7 @@ xfs_qm_reset_dqcounts(
                 * output any warnings because it's perfectly possible to
                 * find uninitialised dquot blks. See comment in xfs_qm_dqcheck.
                 */
-               (void) xfs_qm_dqcheck(ddq, id+j, type, XFS_QMOPT_DQREPAIR,
+               (void) xfs_qm_dqcheck(mp, ddq, id+j, type, XFS_QMOPT_DQREPAIR,
                                      "xfs_quotacheck");
                ddq->d_bcount = 0;
                ddq->d_icount = 0;
@@ -1676,7 +1666,7 @@ xfs_qm_quotacheck(
         */
        ASSERT(list_empty(&mp->m_quotainfo->qi_dqlist));
 
-       cmn_err(CE_NOTE, "XFS quotacheck %s: Please wait.", mp->m_fsname);
+       xfs_notice(mp, "Quotacheck needed: Please wait.");
 
        /*
         * First we go thru all the dquots on disk, USR and GRP/PRJ, and reset
@@ -1754,9 +1744,9 @@ xfs_qm_quotacheck(
 
  error_return:
        if (error) {
-               cmn_err(CE_WARN, "XFS quotacheck %s: Unsuccessful (Error %d): "
-                       "Disabling quotas.",
-                       mp->m_fsname, error);
+               xfs_warn(mp,
+       "Quotacheck: Unsuccessful (Error %d): Disabling quotas.",
+                       error);
                /*
                 * We must turn off quotas.
                 */
@@ -1764,12 +1754,11 @@ xfs_qm_quotacheck(
                ASSERT(xfs_Gqm != NULL);
                xfs_qm_destroy_quotainfo(mp);
                if (xfs_mount_reset_sbqflags(mp)) {
-                       cmn_err(CE_WARN, "XFS quotacheck %s: "
-                               "Failed to reset quota flags.", mp->m_fsname);
+                       xfs_warn(mp,
+                               "Quotacheck: Failed to reset quota flags.");
                }
-       } else {
-               cmn_err(CE_NOTE, "XFS quotacheck %s: Done.", mp->m_fsname);
-       }
+       } else
+               xfs_notice(mp, "Quotacheck: Done.");
        return (error);
 }
 
@@ -1937,8 +1926,8 @@ again:
                         */
                        error = xfs_qm_dqflush(dqp, 0);
                        if (error) {
-                               xfs_fs_cmn_err(CE_WARN, mp,
-                       "xfs_qm_dqreclaim: dquot %p flush failed", dqp);
+                               xfs_warn(mp, "%s: dquot %p flush failed",
+                                       __func__, dqp);
                        }
                        goto dqunlock;
                }
@@ -2115,7 +2104,7 @@ xfs_qm_write_sb_changes(
        int             error;
 
 #ifdef QUOTADEBUG
-       cmn_err(CE_NOTE, "Writing superblock quota changes :%s", mp->m_fsname);
+       xfs_notice(mp, "Writing superblock quota changes");
 #endif
        tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
        if ((error = xfs_trans_reserve(tp, 0,
index 45b5cb1788abb953d43f845cf462332cfe5863ac..774d7ec6df8e800e43c484916fbcec7d920de1e1 100644 (file)
@@ -119,8 +119,7 @@ xfs_qm_newmount(
             (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||
            (!gquotaondisk &&  XFS_IS_OQUOTA_ON(mp)))  &&
            xfs_dev_is_read_only(mp, "changing quota state")) {
-               cmn_err(CE_WARN,
-                       "XFS: please mount with%s%s%s%s.",
+               xfs_warn(mp, "please mount with%s%s%s%s.",
                        (!quotaondisk ? "out quota" : ""),
                        (uquotaondisk ? " usrquota" : ""),
                        (pquotaondisk ? " prjquota" : ""),
index bdebc183223e53c47ab6734976f1ba2bc1aa8901..c82f06778a27d4388f9bdf61ac6c1193c1b373eb 100644 (file)
 #include "xfs_qm.h"
 #include "xfs_trace.h"
 
-#ifdef DEBUG
-# define qdprintk(s, args...)  cmn_err(CE_DEBUG, s, ## args)
-#else
-# define qdprintk(s, args...)  do { } while (0)
-#endif
-
 STATIC int     xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint);
 STATIC int     xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
                                        uint);
@@ -294,7 +288,8 @@ xfs_qm_scall_trunc_qfiles(
        int             error = 0, error2 = 0;
 
        if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0) {
-               qdprintk("qtrunc flags=%x m_qflags=%x\n", flags, mp->m_qflags);
+               xfs_debug(mp, "%s: flags=%x m_qflags=%x\n",
+                       __func__, flags, mp->m_qflags);
                return XFS_ERROR(EINVAL);
        }
 
@@ -331,7 +326,8 @@ xfs_qm_scall_quotaon(
        sbflags = 0;
 
        if (flags == 0) {
-               qdprintk("quotaon: zero flags, m_qflags=%x\n", mp->m_qflags);
+               xfs_debug(mp, "%s: zero flags, m_qflags=%x\n",
+                       __func__, mp->m_qflags);
                return XFS_ERROR(EINVAL);
        }
 
@@ -352,8 +348,9 @@ xfs_qm_scall_quotaon(
            (flags & XFS_GQUOTA_ACCT) == 0 &&
            (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
            (flags & XFS_OQUOTA_ENFD))) {
-               qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n",
-                       flags, mp->m_sb.sb_qflags);
+               xfs_debug(mp,
+                       "%s: Can't enforce without acct, flags=%x sbflags=%x\n",
+                       __func__, flags, mp->m_sb.sb_qflags);
                return XFS_ERROR(EINVAL);
        }
        /*
@@ -541,7 +538,7 @@ xfs_qm_scall_setqlim(
                        q->qi_bsoftlimit = soft;
                }
        } else {
-               qdprintk("blkhard %Ld < blksoft %Ld\n", hard, soft);
+               xfs_debug(mp, "blkhard %Ld < blksoft %Ld\n", hard, soft);
        }
        hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ?
                (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) :
@@ -557,7 +554,7 @@ xfs_qm_scall_setqlim(
                        q->qi_rtbsoftlimit = soft;
                }
        } else {
-               qdprintk("rtbhard %Ld < rtbsoft %Ld\n", hard, soft);
+               xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld\n", hard, soft);
        }
 
        hard = (newlim->d_fieldmask & FS_DQ_IHARD) ?
@@ -574,7 +571,7 @@ xfs_qm_scall_setqlim(
                        q->qi_isoftlimit = soft;
                }
        } else {
-               qdprintk("ihard %Ld < isoft %Ld\n", hard, soft);
+               xfs_debug(mp, "ihard %Ld < isoft %Ld\n", hard, soft);
        }
 
        /*
@@ -939,10 +936,11 @@ struct mutex  qcheck_lock;
 #define DQTEST_LIST_PRINT(l, NXT, title) \
 { \
          xfs_dqtest_t  *dqp; int i = 0;\
-         cmn_err(CE_DEBUG, "%s (#%d)", title, (int) (l)->qh_nelems); \
+         xfs_debug(NULL, "%s (#%d)", title, (int) (l)->qh_nelems); \
          for (dqp = (xfs_dqtest_t *)(l)->qh_next; dqp != NULL; \
               dqp = (xfs_dqtest_t *)dqp->NXT) { \
-               cmn_err(CE_DEBUG, "  %d. \"%d (%s)\"  bcnt = %d, icnt = %d", \
+               xfs_debug(dqp->q_mount,         \
+                       "  %d. \"%d (%s)\"  bcnt = %d, icnt = %d", \
                         ++i, dqp->d_id, DQFLAGTO_TYPESTR(dqp),      \
                         dqp->d_bcount, dqp->d_icount); } \
 }
@@ -966,16 +964,17 @@ xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp)
 }
 STATIC void
 xfs_qm_dqtest_print(
-       xfs_dqtest_t    *d)
+       struct xfs_mount        *mp,
+       struct dqtest           *d)
 {
-       cmn_err(CE_DEBUG, "-----------DQTEST DQUOT----------------");
-       cmn_err(CE_DEBUG, "---- dquot ID = %d", d->d_id);
-       cmn_err(CE_DEBUG, "---- fs       = 0x%p", d->q_mount);
-       cmn_err(CE_DEBUG, "---- bcount   = %Lu (0x%x)",
+       xfs_debug(mp, "-----------DQTEST DQUOT----------------");
+       xfs_debug(mp, "---- dquot ID = %d", d->d_id);
+       xfs_debug(mp, "---- fs       = 0x%p", d->q_mount);
+       xfs_debug(mp, "---- bcount   = %Lu (0x%x)",
                d->d_bcount, (int)d->d_bcount);
-       cmn_err(CE_DEBUG, "---- icount   = %Lu (0x%x)",
+       xfs_debug(mp, "---- icount   = %Lu (0x%x)",
                d->d_icount, (int)d->d_icount);
-       cmn_err(CE_DEBUG, "---------------------------");
+       xfs_debug(mp, "---------------------------");
 }
 
 STATIC void
@@ -989,12 +988,14 @@ xfs_qm_dqtest_failed(
 {
        qmtest_nfails++;
        if (error)
-               cmn_err(CE_DEBUG, "quotacheck failed id=%d, err=%d\nreason: %s",
-                      d->d_id, error, reason);
+               xfs_debug(dqp->q_mount,
+                       "quotacheck failed id=%d, err=%d\nreason: %s",
+                       d->d_id, error, reason);
        else
-               cmn_err(CE_DEBUG, "quotacheck failed id=%d (%s) [%d != %d]",
-                      d->d_id, reason, (int)a, (int)b);
-       xfs_qm_dqtest_print(d);
+               xfs_debug(dqp->q_mount,
+                       "quotacheck failed id=%d (%s) [%d != %d]",
+                       d->d_id, reason, (int)a, (int)b);
+       xfs_qm_dqtest_print(dqp->q_mount, d);
        if (dqp)
                xfs_qm_dqprint(dqp);
 }
@@ -1021,9 +1022,9 @@ xfs_dqtest_cmp2(
            be64_to_cpu(dqp->q_core.d_bcount) >=
            be64_to_cpu(dqp->q_core.d_blk_softlimit)) {
                if (!dqp->q_core.d_btimer && dqp->q_core.d_id) {
-                       cmn_err(CE_DEBUG,
-                               "%d [%s] [0x%p] BLK TIMER NOT STARTED",
-                               d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount);
+                       xfs_debug(dqp->q_mount,
+                               "%d [%s] BLK TIMER NOT STARTED",
+                               d->d_id, DQFLAGTO_TYPESTR(d));
                        err++;
                }
        }
@@ -1031,16 +1032,16 @@ xfs_dqtest_cmp2(
            be64_to_cpu(dqp->q_core.d_icount) >=
            be64_to_cpu(dqp->q_core.d_ino_softlimit)) {
                if (!dqp->q_core.d_itimer && dqp->q_core.d_id) {
-                       cmn_err(CE_DEBUG,
-                               "%d [%s] [0x%p] INO TIMER NOT STARTED",
-                               d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount);
+                       xfs_debug(dqp->q_mount,
+                               "%d [%s] INO TIMER NOT STARTED",
+                               d->d_id, DQFLAGTO_TYPESTR(d));
                        err++;
                }
        }
 #ifdef QUOTADEBUG
        if (!err) {
-               cmn_err(CE_DEBUG, "%d [%s] [0x%p] qchecked",
-                       d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount);
+               xfs_debug(dqp->q_mount, "%d [%s] qchecked",
+                       d->d_id, DQFLAGTO_TYPESTR(d));
        }
 #endif
        return (err);
@@ -1137,8 +1138,8 @@ xfs_qm_internalqcheck_adjust(
 
        if (ino == mp->m_sb.sb_uquotino || ino == mp->m_sb.sb_gquotino) {
                *res = BULKSTAT_RV_NOTHING;
-               qdprintk("internalqcheck: ino=%llu, uqino=%llu, gqino=%llu\n",
-                       (unsigned long long) ino,
+               xfs_debug(mp, "%s: ino=%llu, uqino=%llu, gqino=%llu\n",
+                       __func__, (unsigned long long) ino,
                        (unsigned long long) mp->m_sb.sb_uquotino,
                        (unsigned long long) mp->m_sb.sb_gquotino);
                return XFS_ERROR(EINVAL);
@@ -1223,12 +1224,12 @@ xfs_qm_internalqcheck(
                                 xfs_qm_internalqcheck_adjust,
                                 0, NULL, &done);
                if (error) {
-                       cmn_err(CE_DEBUG, "Bulkstat returned error 0x%x", error);
+                       xfs_debug(mp, "Bulkstat returned error 0x%x", error);
                        break;
                }
        } while (!done);
 
-       cmn_err(CE_DEBUG, "Checking results against system dquots");
+       xfs_debug(mp, "Checking results against system dquots");
        for (i = 0; i < qmtest_hashmask; i++) {
                xfs_dqtest_t    *d, *n;
                xfs_dqhash_t    *h;
@@ -1246,10 +1247,10 @@ xfs_qm_internalqcheck(
        }
 
        if (qmtest_nfails) {
-               cmn_err(CE_DEBUG, "******** quotacheck failed  ********");
-               cmn_err(CE_DEBUG, "failures = %d", qmtest_nfails);
+               xfs_debug(mp, "******** quotacheck failed  ********");
+               xfs_debug(mp, "failures = %d", qmtest_nfails);
        } else {
-               cmn_err(CE_DEBUG, "******** quotacheck successful! ********");
+               xfs_debug(mp, "******** quotacheck successful! ********");
        }
        kmem_free(qmtest_udqtab);
        kmem_free(qmtest_gdqtab);
index 7de91d1b75c06c91daea768da891ab49a4152818..2a36487313319f45b45b5dbc39bc4fc1c69c8d64 100644 (file)
@@ -643,8 +643,9 @@ xfs_trans_dqresv(
             (XFS_IS_OQUOTA_ENFORCED(dqp->q_mount) &&
              (XFS_QM_ISPDQ(dqp) || XFS_QM_ISGDQ(dqp))))) {
 #ifdef QUOTADEBUG
-               cmn_err(CE_DEBUG, "BLK Res: nblks=%ld + resbcount=%Ld"
-                         " > hardlimit=%Ld?", nblks, *resbcountp, hardlimit);
+               xfs_debug(mp,
+                       "BLK Res: nblks=%ld + resbcount=%Ld > hardlimit=%Ld?",
+                       nblks, *resbcountp, hardlimit);
 #endif
                if (nblks > 0) {
                        /*
diff --git a/fs/xfs/support/debug.c b/fs/xfs/support/debug.c
deleted file mode 100644 (file)
index 0df8889..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * 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.
- *
- * This program is distributed in the hope that it would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#include <xfs.h>
-#include "debug.h"
-
-/* xfs_mount.h drags a lot of crap in, sorry.. */
-#include "xfs_sb.h"
-#include "xfs_inum.h"
-#include "xfs_ag.h"
-#include "xfs_mount.h"
-#include "xfs_error.h"
-
-void
-cmn_err(
-       const char      *lvl,
-       const char      *fmt,
-       ...)
-{
-       struct va_format vaf;
-       va_list         args;
-
-       va_start(args, fmt);
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       printk("%s%pV", lvl, &vaf);
-       va_end(args);
-
-       BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
-}
-
-void
-xfs_fs_cmn_err(
-       const char              *lvl,
-       struct xfs_mount        *mp,
-       const char              *fmt,
-       ...)
-{
-       struct va_format        vaf;
-       va_list                 args;
-
-       va_start(args, fmt);
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       printk("%sFilesystem %s: %pV", lvl, mp->m_fsname, &vaf);
-       va_end(args);
-
-       BUG_ON(strncmp(lvl, KERN_EMERG, strlen(KERN_EMERG)) == 0);
-}
-
-/* All callers to xfs_cmn_err use CE_ALERT, so don't bother testing lvl */
-void
-xfs_cmn_err(
-       int                     panic_tag,
-       const char              *lvl,
-       struct xfs_mount        *mp,
-       const char              *fmt,
-       ...)
-{
-       struct va_format        vaf;
-       va_list                 args;
-       int                     do_panic = 0;
-
-       if (xfs_panic_mask && (xfs_panic_mask & panic_tag)) {
-               printk(KERN_ALERT "XFS: Transforming an alert into a BUG.");
-               do_panic = 1;
-       }
-
-       va_start(args, fmt);
-       vaf.fmt = fmt;
-       vaf.va = &args;
-
-       printk(KERN_ALERT "Filesystem %s: %pV", mp->m_fsname, &vaf);
-       va_end(args);
-
-       BUG_ON(do_panic);
-}
-
-void
-assfail(char *expr, char *file, int line)
-{
-       printk(KERN_CRIT "Assertion failed: %s, file: %s, line: %d\n", expr,
-              file, line);
-       BUG();
-}
-
-void
-xfs_hex_dump(void *p, int length)
-{
-       print_hex_dump(KERN_ALERT, "", DUMP_PREFIX_ADDRESS, 16, 1, p, length, 1);
-}
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
deleted file mode 100644 (file)
index 05699f6..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2000-2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * 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.
- *
- * This program is distributed in the hope that it would 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 the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef        __XFS_SUPPORT_DEBUG_H__
-#define        __XFS_SUPPORT_DEBUG_H__
-
-#include <stdarg.h>
-
-struct xfs_mount;
-
-#define CE_DEBUG        KERN_DEBUG
-#define CE_CONT         KERN_INFO
-#define CE_NOTE         KERN_NOTICE
-#define CE_WARN         KERN_WARNING
-#define CE_ALERT        KERN_ALERT
-#define CE_PANIC        KERN_EMERG
-
-void cmn_err(const char *lvl, const char *fmt, ...)
-               __attribute__ ((format (printf, 2, 3)));
-void xfs_fs_cmn_err( const char *lvl, struct xfs_mount *mp,
-               const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
-void xfs_cmn_err( int panic_tag, const char *lvl, struct xfs_mount *mp,
-               const char *fmt, ...) __attribute__ ((format (printf, 4, 5)));
-
-extern void assfail(char *expr, char *f, int l);
-
-#define ASSERT_ALWAYS(expr)    \
-       (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
-
-#ifndef DEBUG
-#define ASSERT(expr)   ((void)0)
-
-#ifndef STATIC
-# define STATIC static noinline
-#endif
-
-#else /* DEBUG */
-
-#define ASSERT(expr)   \
-       (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
-
-#ifndef STATIC
-# define STATIC noinline
-#endif
-
-#endif /* DEBUG */
-#endif  /* __XFS_SUPPORT_DEBUG_H__ */
index f3227984a9bf815d554034ec4661bdcc37d6db36..4bc3c649aee4bb35a6c7ebaa790ef8b73d264073 100644 (file)
@@ -147,10 +147,9 @@ xfs_alloc_get_rec(
  */
 STATIC void
 xfs_alloc_compute_aligned(
+       xfs_alloc_arg_t *args,          /* allocation argument structure */
        xfs_agblock_t   foundbno,       /* starting block in found extent */
        xfs_extlen_t    foundlen,       /* length in found extent */
-       xfs_extlen_t    alignment,      /* alignment for allocation */
-       xfs_extlen_t    minlen,         /* minimum length for allocation */
        xfs_agblock_t   *resbno,        /* result block number */
        xfs_extlen_t    *reslen)        /* result length */
 {
@@ -158,8 +157,8 @@ xfs_alloc_compute_aligned(
        xfs_extlen_t    diff;
        xfs_extlen_t    len;
 
-       if (alignment > 1 && foundlen >= minlen) {
-               bno = roundup(foundbno, alignment);
+       if (args->alignment > 1 && foundlen >= args->minlen) {
+               bno = roundup(foundbno, args->alignment);
                diff = bno - foundbno;
                len = diff >= foundlen ? 0 : foundlen - diff;
        } else {
@@ -464,6 +463,27 @@ xfs_alloc_read_agfl(
        return 0;
 }
 
+STATIC int
+xfs_alloc_update_counters(
+       struct xfs_trans        *tp,
+       struct xfs_perag        *pag,
+       struct xfs_buf          *agbp,
+       long                    len)
+{
+       struct xfs_agf          *agf = XFS_BUF_TO_AGF(agbp);
+
+       pag->pagf_freeblks += len;
+       be32_add_cpu(&agf->agf_freeblks, len);
+
+       xfs_trans_agblocks_delta(tp, len);
+       if (unlikely(be32_to_cpu(agf->agf_freeblks) >
+                    be32_to_cpu(agf->agf_length)))
+               return EFSCORRUPTED;
+
+       xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS);
+       return 0;
+}
+
 /*
  * Allocation group level functions.
  */
@@ -505,49 +525,44 @@ xfs_alloc_ag_vextent(
                ASSERT(0);
                /* NOTREACHED */
        }
-       if (error)
+
+       if (error || args->agbno == NULLAGBLOCK)
                return error;
-       /*
-        * If the allocation worked, need to change the agf structure
-        * (and log it), and the superblock.
-        */
-       if (args->agbno != NULLAGBLOCK) {
-               xfs_agf_t       *agf;   /* allocation group freelist header */
-               long            slen = (long)args->len;
 
-               ASSERT(args->len >= args->minlen && args->len <= args->maxlen);
-               ASSERT(!(args->wasfromfl) || !args->isfl);
-               ASSERT(args->agbno % args->alignment == 0);
-               if (!(args->wasfromfl)) {
-
-                       agf = XFS_BUF_TO_AGF(args->agbp);
-                       be32_add_cpu(&agf->agf_freeblks, -(args->len));
-                       xfs_trans_agblocks_delta(args->tp,
-                                                -((long)(args->len)));
-                       args->pag->pagf_freeblks -= args->len;
-                       ASSERT(be32_to_cpu(agf->agf_freeblks) <=
-                               be32_to_cpu(agf->agf_length));
-                       xfs_alloc_log_agf(args->tp, args->agbp,
-                                               XFS_AGF_FREEBLKS);
-                       /*
-                        * Search the busylist for these blocks and mark the
-                        * transaction as synchronous if blocks are found. This
-                        * avoids the need to block due to a synchronous log
-                        * force to ensure correct ordering as the synchronous
-                        * transaction will guarantee that for us.
-                        */
-                       if (xfs_alloc_busy_search(args->mp, args->agno,
-                                               args->agbno, args->len))
-                               xfs_trans_set_sync(args->tp);
-               }
-               if (!args->isfl)
-                       xfs_trans_mod_sb(args->tp,
-                               args->wasdel ? XFS_TRANS_SB_RES_FDBLOCKS :
-                                       XFS_TRANS_SB_FDBLOCKS, -slen);
-               XFS_STATS_INC(xs_allocx);
-               XFS_STATS_ADD(xs_allocb, args->len);
+       ASSERT(args->len >= args->minlen);
+       ASSERT(args->len <= args->maxlen);
+       ASSERT(!args->wasfromfl || !args->isfl);
+       ASSERT(args->agbno % args->alignment == 0);
+
+       if (!args->wasfromfl) {
+               error = xfs_alloc_update_counters(args->tp, args->pag,
+                                                 args->agbp,
+                                                 -((long)(args->len)));
+               if (error)
+                       return error;
+
+               /*
+                * Search the busylist for these blocks and mark the
+                * transaction as synchronous if blocks are found. This
+                * avoids the need to block due to a synchronous log
+                * force to ensure correct ordering as the synchronous
+                * transaction will guarantee that for us.
+                */
+               if (xfs_alloc_busy_search(args->mp, args->agno,
+                                       args->agbno, args->len))
+                       xfs_trans_set_sync(args->tp);
        }
-       return 0;
+
+       if (!args->isfl) {
+               xfs_trans_mod_sb(args->tp, args->wasdel ?
+                                XFS_TRANS_SB_RES_FDBLOCKS :
+                                XFS_TRANS_SB_FDBLOCKS,
+                                -((long)(args->len)));
+       }
+
+       XFS_STATS_INC(xs_allocx);
+       XFS_STATS_ADD(xs_allocb, args->len);
+       return error;
 }
 
 /*
@@ -693,8 +708,7 @@ xfs_alloc_find_best_extent(
                if (error)
                        goto error0;
                XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
-               xfs_alloc_compute_aligned(*sbno, *slen, args->alignment,
-                                         args->minlen, &bno, slena);
+               xfs_alloc_compute_aligned(args, *sbno, *slen, &bno, slena);
 
                /*
                 * The good extent is closer than this one.
@@ -866,8 +880,8 @@ xfs_alloc_ag_vextent_near(
                        if ((error = xfs_alloc_get_rec(cnt_cur, &ltbno, &ltlen, &i)))
                                goto error0;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
-                       xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment,
-                                       args->minlen, &ltbnoa, &ltlena);
+                       xfs_alloc_compute_aligned(args, ltbno, ltlen,
+                                                 &ltbnoa, &ltlena);
                        if (ltlena < args->minlen)
                                continue;
                        args->len = XFS_EXTLEN_MIN(ltlena, args->maxlen);
@@ -987,8 +1001,8 @@ xfs_alloc_ag_vextent_near(
                        if ((error = xfs_alloc_get_rec(bno_cur_lt, &ltbno, &ltlen, &i)))
                                goto error0;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
-                       xfs_alloc_compute_aligned(ltbno, ltlen, args->alignment,
-                                       args->minlen, &ltbnoa, &ltlena);
+                       xfs_alloc_compute_aligned(args, ltbno, ltlen,
+                                                 &ltbnoa, &ltlena);
                        if (ltlena >= args->minlen)
                                break;
                        if ((error = xfs_btree_decrement(bno_cur_lt, 0, &i)))
@@ -1003,8 +1017,8 @@ xfs_alloc_ag_vextent_near(
                        if ((error = xfs_alloc_get_rec(bno_cur_gt, &gtbno, &gtlen, &i)))
                                goto error0;
                        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
-                       xfs_alloc_compute_aligned(gtbno, gtlen, args->alignment,
-                                       args->minlen, &gtbnoa, &gtlena);
+                       xfs_alloc_compute_aligned(args, gtbno, gtlen,
+                                                 &gtbnoa, &gtlena);
                        if (gtlena >= args->minlen)
                                break;
                        if ((error = xfs_btree_increment(bno_cur_gt, 0, &i)))
@@ -1183,8 +1197,7 @@ xfs_alloc_ag_vextent_size(
         * once aligned; if not, we search left for something better.
         * This can't happen in the second case above.
         */
-       xfs_alloc_compute_aligned(fbno, flen, args->alignment, args->minlen,
-               &rbno, &rlen);
+       xfs_alloc_compute_aligned(args, fbno, flen, &rbno, &rlen);
        rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
        XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
                        (rlen <= flen && rbno + rlen <= fbno + flen), error0);
@@ -1209,8 +1222,8 @@ xfs_alloc_ag_vextent_size(
                        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
                        if (flen < bestrlen)
                                break;
-                       xfs_alloc_compute_aligned(fbno, flen, args->alignment,
-                               args->minlen, &rbno, &rlen);
+                       xfs_alloc_compute_aligned(args, fbno, flen,
+                                                 &rbno, &rlen);
                        rlen = XFS_EXTLEN_MIN(args->maxlen, rlen);
                        XFS_WANT_CORRUPTED_GOTO(rlen == 0 ||
                                (rlen <= flen && rbno + rlen <= fbno + flen),
@@ -1388,6 +1401,7 @@ xfs_free_ag_extent(
        xfs_mount_t     *mp;            /* mount point struct for filesystem */
        xfs_agblock_t   nbno;           /* new starting block of freespace */
        xfs_extlen_t    nlen;           /* new length of freespace */
+       xfs_perag_t     *pag;           /* per allocation group data */
 
        mp = tp->t_mountp;
        /*
@@ -1586,30 +1600,20 @@ xfs_free_ag_extent(
        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
        xfs_btree_del_cursor(cnt_cur, XFS_BTREE_NOERROR);
        cnt_cur = NULL;
+
        /*
         * Update the freespace totals in the ag and superblock.
         */
-       {
-               xfs_agf_t       *agf;
-               xfs_perag_t     *pag;           /* per allocation group data */
-
-               pag = xfs_perag_get(mp, agno);
-               pag->pagf_freeblks += len;
-               xfs_perag_put(pag);
-
-               agf = XFS_BUF_TO_AGF(agbp);
-               be32_add_cpu(&agf->agf_freeblks, len);
-               xfs_trans_agblocks_delta(tp, len);
-               XFS_WANT_CORRUPTED_GOTO(
-                       be32_to_cpu(agf->agf_freeblks) <=
-                       be32_to_cpu(agf->agf_length),
-                       error0);
-               xfs_alloc_log_agf(tp, agbp, XFS_AGF_FREEBLKS);
-               if (!isfl)
-                       xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len);
-               XFS_STATS_INC(xs_freex);
-               XFS_STATS_ADD(xs_freeb, len);
-       }
+       pag = xfs_perag_get(mp, agno);
+       error = xfs_alloc_update_counters(tp, pag, agbp, len);
+       xfs_perag_put(pag);
+       if (error)
+               goto error0;
+
+       if (!isfl)
+               xfs_trans_mod_sb(tp, XFS_TRANS_SB_FDBLOCKS, (long)len);
+       XFS_STATS_INC(xs_freex);
+       XFS_STATS_ADD(xs_freeb, len);
 
        trace_xfs_free_extent(mp, agno, bno, len, isfl, haveleft, haveright);
 
index dc3afd7739ff40754d1e04eda13178acc78ef3c2..fa00788de2f549acf0d51bdb913e64350f703b16 100644 (file)
@@ -2365,6 +2365,13 @@ xfs_bmap_rtalloc(
         */
        if (ralen * mp->m_sb.sb_rextsize >= MAXEXTLEN)
                ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
+
+       /*
+        * Lock out other modifications to the RT bitmap inode.
+        */
+       xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
+       xfs_trans_ijoin_ref(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL);
+
        /*
         * If it's an allocation to an empty file at offset 0,
         * pick an extent that will space things out in the rt area.
@@ -3519,7 +3526,7 @@ xfs_bmap_search_extents(
 
        if (unlikely(!(gotp->br_startblock) && (*lastxp != NULLEXTNUM) &&
                     !(XFS_IS_REALTIME_INODE(ip) && fork == XFS_DATA_FORK))) {
-               xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount,
+               xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
                                "Access to block zero in inode %llu "
                                "start_block: %llx start_off: %llx "
                                "blkcnt: %llx extent-state: %x lastx: %x\n",
@@ -4193,12 +4200,11 @@ xfs_bmap_read_extents(
                num_recs = xfs_btree_get_numrecs(block);
                if (unlikely(i + num_recs > room)) {
                        ASSERT(i + num_recs <= room);
-                       xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
+                       xfs_warn(ip->i_mount,
                                "corrupt dinode %Lu, (btree extents).",
                                (unsigned long long) ip->i_ino);
-                       XFS_ERROR_REPORT("xfs_bmap_read_extents(1)",
-                                        XFS_ERRLEVEL_LOW,
-                                       ip->i_mount);
+                       XFS_CORRUPTION_ERROR("xfs_bmap_read_extents(1)",
+                               XFS_ERRLEVEL_LOW, ip->i_mount, block);
                        goto error0;
                }
                XFS_WANT_CORRUPTED_GOTO(
@@ -5772,7 +5778,7 @@ xfs_check_block(
                        else
                                thispa = XFS_BMBT_PTR_ADDR(mp, block, j, dmxr);
                        if (*thispa == *pp) {
-                               cmn_err(CE_WARN, "%s: thispa(%d) == pp(%d) %Ld",
+                               xfs_warn(mp, "%s: thispa(%d) == pp(%d) %Ld",
                                        __func__, j, i,
                                        (unsigned long long)be64_to_cpu(*thispa));
                                panic("%s: ptrs are equal in node\n",
@@ -5937,11 +5943,11 @@ xfs_bmap_check_leaf_extents(
        return;
 
 error0:
-       cmn_err(CE_WARN, "%s: at error0", __func__);
+       xfs_warn(mp, "%s: at error0", __func__);
        if (bp_release)
                xfs_trans_brelse(NULL, bp);
 error_norelse:
-       cmn_err(CE_WARN, "%s: BAD after btree leaves for %d extents",
+       xfs_warn(mp, "%s: BAD after btree leaves for %d extents",
                __func__, i);
        panic("%s: CORRUPTED BTREE OR SOMETHING", __func__);
        return;
@@ -6144,7 +6150,7 @@ xfs_bmap_punch_delalloc_range(
                if (error) {
                        /* something screwed, just bail */
                        if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
-                               xfs_fs_cmn_err(CE_ALERT, ip->i_mount,
+                               xfs_alert(ip->i_mount,
                        "Failed delalloc mapping lookup ino %lld fsb %lld.",
                                                ip->i_ino, start_fsb);
                        }
index 6f8c21ce0d6d95fd8c45a5d3eea4ef0240fad1fd..e5413d96f1af90a67831dc2498e8d5fbdd8e42ed 100644 (file)
@@ -130,10 +130,12 @@ xfs_buf_item_log_check(
        orig = bip->bli_orig;
        buffer = XFS_BUF_PTR(bp);
        for (x = 0; x < XFS_BUF_COUNT(bp); x++) {
-               if (orig[x] != buffer[x] && !btst(bip->bli_logged, x))
-                       cmn_err(CE_PANIC,
-       "xfs_buf_item_log_check bip %x buffer %x orig %x index %d",
-                               bip, bp, orig, x);
+               if (orig[x] != buffer[x] && !btst(bip->bli_logged, x)) {
+                       xfs_emerg(bp->b_mount,
+                               "%s: bip %x buffer %x orig %x index %d",
+                               __func__, bip, bp, orig, x);
+                       ASSERT(0);
+               }
        }
 }
 #else
@@ -983,10 +985,9 @@ xfs_buf_iodone_callbacks(
        if (XFS_BUF_TARGET(bp) != lasttarg ||
            time_after(jiffies, (lasttime + 5*HZ))) {
                lasttime = jiffies;
-               cmn_err(CE_ALERT, "Device %s, XFS metadata write error"
-                               " block 0x%llx in %s",
+               xfs_alert(mp, "Device %s: metadata write error block 0x%llx",
                        XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
-                     (__uint64_t)XFS_BUF_ADDR(bp), mp->m_fsname);
+                     (__uint64_t)XFS_BUF_ADDR(bp));
        }
        lasttarg = XFS_BUF_TARGET(bp);
 
index 1c00bedb3175c1f5e58d006b0cdf0c8089bc0df5..6102ac6d1dffb99adf41f7ad9171b618e0ab3ae7 100644 (file)
@@ -1995,13 +1995,12 @@ xfs_da_do_buf(
                error = mappedbno == -2 ? 0 : XFS_ERROR(EFSCORRUPTED);
                if (unlikely(error == EFSCORRUPTED)) {
                        if (xfs_error_level >= XFS_ERRLEVEL_LOW) {
-                               cmn_err(CE_ALERT, "xfs_da_do_buf: bno %lld\n",
-                                       (long long)bno);
-                               cmn_err(CE_ALERT, "dir: inode %lld\n",
+                               xfs_alert(mp, "%s: bno %lld dir: inode %lld",
+                                       __func__, (long long)bno,
                                        (long long)dp->i_ino);
                                for (i = 0; i < nmap; i++) {
-                                       cmn_err(CE_ALERT,
-                                               "[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d\n",
+                                       xfs_alert(mp,
+"[%02d] br_startoff %lld br_startblock %lld br_blockcount %lld br_state %d",
                                                i,
                                                (long long)mapp[i].br_startoff,
                                                (long long)mapp[i].br_startblock,
index e60490bc00a61b6c8bc1bfbe04df4e56e536596c..be628677c2884723c58cce77f6f98af4ff3d1926 100644 (file)
@@ -270,9 +270,9 @@ xfs_swap_extents(
        /* check inode formats now that data is flushed */
        error = xfs_swap_extents_check_format(ip, tip);
        if (error) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
+               xfs_notice(mp,
                    "%s: inode 0x%llx format is incompatible for exchanging.",
-                               __FILE__, ip->i_ino);
+                               __func__, ip->i_ino);
                goto out_unlock;
        }
 
index a1321bc7f19210a3b4bd1d87ec7c9d5eae410b28..dba7a71cedf3e6f903368416554730d9885142ad 100644 (file)
@@ -159,7 +159,7 @@ xfs_dir_ino_validate(
                XFS_AGINO_TO_INO(mp, agno, agino) == ino;
        if (unlikely(XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,
                        XFS_RANDOM_DIR_INO_VALIDATE))) {
-               xfs_fs_cmn_err(CE_WARN, mp, "Invalid inode number 0x%Lx",
+               xfs_warn(mp, "Invalid inode number 0x%Lx",
                                (unsigned long long) ino);
                XFS_ERROR_REPORT("xfs_dir_ino_validate", XFS_ERRLEVEL_LOW, mp);
                return XFS_ERROR(EFSCORRUPTED);
index f9a0864b696afea29fec8567a906ac793c882455..a0aab7d3294fd4874df67f70014f4f5a7df7dcb0 100644 (file)
@@ -899,10 +899,9 @@ xfs_dir2_leafn_rebalance(
        if(blk2->index < 0) {
                state->inleaf = 1;
                blk2->index = 0;
-               cmn_err(CE_ALERT,
-                       "xfs_dir2_leafn_rebalance: picked the wrong leaf? reverting original leaf: "
-                       "blk1->index %d\n",
-                       blk1->index);
+               xfs_alert(args->dp->i_mount,
+       "%s: picked the wrong leaf? reverting original leaf: blk1->index %d\n",
+                       __func__, blk1->index);
        }
 }
 
@@ -1641,26 +1640,22 @@ xfs_dir2_node_addname_int(
                        }
 
                        if (unlikely(xfs_dir2_db_to_fdb(mp, dbno) != fbno)) {
-                               cmn_err(CE_ALERT,
-                                       "xfs_dir2_node_addname_int: dir ino "
-                                       "%llu needed freesp block %lld for\n"
-                                       "  data block %lld, got %lld\n"
-                                       "  ifbno %llu lastfbno %d\n",
-                                       (unsigned long long)dp->i_ino,
+                               xfs_alert(mp,
+                       "%s: dir ino " "%llu needed freesp block %lld for\n"
+                       "  data block %lld, got %lld ifbno %llu lastfbno %d",
+                                       __func__, (unsigned long long)dp->i_ino,
                                        (long long)xfs_dir2_db_to_fdb(mp, dbno),
                                        (long long)dbno, (long long)fbno,
                                        (unsigned long long)ifbno, lastfbno);
                                if (fblk) {
-                                       cmn_err(CE_ALERT,
-                                               " fblk 0x%p blkno %llu "
-                                               "index %d magic 0x%x\n",
+                                       xfs_alert(mp,
+                               " fblk 0x%p blkno %llu index %d magic 0x%x",
                                                fblk,
                                                (unsigned long long)fblk->blkno,
                                                fblk->index,
                                                fblk->magic);
                                } else {
-                                       cmn_err(CE_ALERT,
-                                               " ... fblk is NULL\n");
+                                       xfs_alert(mp, " ... fblk is NULL");
                                }
                                XFS_ERROR_REPORT("xfs_dir2_node_addname_int",
                                                 XFS_ERRLEVEL_LOW, mp);
index 4c7db74a05f70ba5359c81ad6480c1d34c86ca01..39f06336b99dd7ae13d86bf216fa146437a9af36 100644 (file)
@@ -48,7 +48,7 @@ xfs_error_trap(int e)
                        break;
                if (e != xfs_etrap[i])
                        continue;
-               cmn_err(CE_NOTE, "xfs_error_trap: error %d", e);
+               xfs_notice(NULL, "%s: error %d", __func__, e);
                BUG();
                break;
        }
@@ -74,7 +74,7 @@ xfs_error_test(int error_tag, int *fsidp, char *expression,
 
        for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {
                if (xfs_etest[i] == error_tag && xfs_etest_fsid[i] == fsid) {
-                       cmn_err(CE_WARN,
+                       xfs_warn(NULL,
        "Injecting error (%s) at file %s, line %d, on filesystem \"%s\"",
                                expression, file, line, xfs_etest_fsname[i]);
                        return 1;
@@ -95,14 +95,14 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)
 
        for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {
                if (xfs_etest_fsid[i] == fsid && xfs_etest[i] == error_tag) {
-                       cmn_err(CE_WARN, "XFS error tag #%d on", error_tag);
+                       xfs_warn(mp, "error tag #%d on", error_tag);
                        return 0;
                }
        }
 
        for (i = 0; i < XFS_NUM_INJECT_ERROR; i++)  {
                if (xfs_etest[i] == 0) {
-                       cmn_err(CE_WARN, "Turned on XFS error tag #%d",
+                       xfs_warn(mp, "Turned on XFS error tag #%d",
                                error_tag);
                        xfs_etest[i] = error_tag;
                        xfs_etest_fsid[i] = fsid;
@@ -114,7 +114,7 @@ xfs_errortag_add(int error_tag, xfs_mount_t *mp)
                }
        }
 
-       cmn_err(CE_WARN, "error tag overflow, too many turned on");
+       xfs_warn(mp, "error tag overflow, too many turned on");
 
        return 1;
 }
@@ -133,7 +133,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)
                if ((fsid == 0LL || xfs_etest_fsid[i] == fsid) &&
                     xfs_etest[i] != 0) {
                        cleared = 1;
-                       cmn_err(CE_WARN, "Clearing XFS error tag #%d",
+                       xfs_warn(mp, "Clearing XFS error tag #%d",
                                xfs_etest[i]);
                        xfs_etest[i] = 0;
                        xfs_etest_fsid[i] = 0LL;
@@ -144,9 +144,7 @@ xfs_errortag_clearall(xfs_mount_t *mp, int loud)
        }
 
        if (loud || cleared)
-               cmn_err(CE_WARN,
-                       "Cleared all XFS error tags for filesystem \"%s\"",
-                       mp->m_fsname);
+               xfs_warn(mp, "Cleared all XFS error tags for filesystem");
 
        return 0;
 }
@@ -162,9 +160,8 @@ xfs_error_report(
        inst_t                  *ra)
 {
        if (level <= xfs_error_level) {
-               xfs_cmn_err(XFS_PTAG_ERROR_REPORT,
-                           CE_ALERT, mp,
-               "XFS internal error %s at line %d of file %s.  Caller 0x%p\n",
+               xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT,
+               "Internal error %s at line %d of file %s.  Caller 0x%p\n",
                            tag, linenum, filename, ra);
 
                xfs_stack_trace();
@@ -184,4 +181,5 @@ xfs_corruption_error(
        if (level <= xfs_error_level)
                xfs_hex_dump(p, 16);
        xfs_error_report(tag, level, mp, filename, linenum, ra);
+       xfs_alert(mp, "Corruption detected. Unmount and run xfs_repair");
 }
index 10dce5475f022061ac95e863b98a07b6c715c21d..079a367f44eeb6f67c16666c695a5fd3a246637d 100644 (file)
@@ -145,10 +145,8 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #endif /* DEBUG */
 
 /*
- * XFS panic tags -- allow a call to xfs_cmn_err() be turned into
- *                     a panic by setting xfs_panic_mask in a
- *                     sysctl.  update xfs_max[XFS_PARAM] if
- *                     more are added.
+ * XFS panic tags -- allow a call to xfs_alert_tag() be turned into
+ *                     a panic by setting xfs_panic_mask in a sysctl.
  */
 #define                XFS_NO_PTAG                     0
 #define                XFS_PTAG_IFLUSH                 0x00000001
@@ -160,17 +158,4 @@ extern int xfs_errortag_clearall(struct xfs_mount *mp, int loud);
 #define                XFS_PTAG_SHUTDOWN_LOGERROR      0x00000040
 #define                XFS_PTAG_FSBLOCK_ZERO           0x00000080
 
-struct xfs_mount;
-
-extern void xfs_hex_dump(void *p, int length);
-
-#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
-       xfs_fs_cmn_err(level, mp, fmt "  Unmount and run xfs_repair.", ## args)
-
-#define xfs_fs_mount_cmn_err(f, fmt, args...) \
-       do { \
-               if (!(f & XFS_MFSI_QUIET))      \
-                       cmn_err(CE_WARN, "XFS: " fmt, ## args); \
-       } while (0)
-
 #endif /* __XFS_ERROR_H__ */
index 85668efb3e3e03221b5e6dd3f517ad2e38b16f94..9153d2c77caf2856ea636bb76d317f2ef1a8676e 100644 (file)
@@ -385,8 +385,8 @@ xfs_growfs_data_private(
                                  XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
                                  XFS_FSS_TO_BB(mp, 1), 0, &bp);
                if (error) {
-                       xfs_fs_cmn_err(CE_WARN, mp,
-                       "error %d reading secondary superblock for ag %d",
+                       xfs_warn(mp,
+               "error %d reading secondary superblock for ag %d",
                                error, agno);
                        break;
                }
@@ -399,7 +399,7 @@ xfs_growfs_data_private(
                if (!(error = xfs_bwrite(mp, bp))) {
                        continue;
                } else {
-                       xfs_fs_cmn_err(CE_WARN, mp,
+                       xfs_warn(mp,
                "write error %d updating secondary superblock for ag %d",
                                error, agno);
                        break; /* no point in continuing */
index 0626a32c3447a4e8ab4a3676ba5aad9e35cd1f0a..84ebeec16642155d3bf5faf48b3443585504389a 100644 (file)
@@ -1055,28 +1055,23 @@ xfs_difree(
         */
        agno = XFS_INO_TO_AGNO(mp, inode);
        if (agno >= mp->m_sb.sb_agcount)  {
-               cmn_err(CE_WARN,
-                       "xfs_difree: agno >= mp->m_sb.sb_agcount (%d >= %d) on %s.  Returning EINVAL.",
-                       agno, mp->m_sb.sb_agcount, mp->m_fsname);
+               xfs_warn(mp, "%s: agno >= mp->m_sb.sb_agcount (%d >= %d).",
+                       __func__, agno, mp->m_sb.sb_agcount);
                ASSERT(0);
                return XFS_ERROR(EINVAL);
        }
        agino = XFS_INO_TO_AGINO(mp, inode);
        if (inode != XFS_AGINO_TO_INO(mp, agno, agino))  {
-               cmn_err(CE_WARN,
-                       "xfs_difree: inode != XFS_AGINO_TO_INO() "
-                       "(%llu != %llu) on %s.  Returning EINVAL.",
-                       (unsigned long long)inode,
-                       (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino),
-                       mp->m_fsname);
+               xfs_warn(mp, "%s: inode != XFS_AGINO_TO_INO() (%llu != %llu).",
+                       __func__, (unsigned long long)inode,
+                       (unsigned long long)XFS_AGINO_TO_INO(mp, agno, agino));
                ASSERT(0);
                return XFS_ERROR(EINVAL);
        }
        agbno = XFS_AGINO_TO_AGBNO(mp, agino);
        if (agbno >= mp->m_sb.sb_agblocks)  {
-               cmn_err(CE_WARN,
-                       "xfs_difree: agbno >= mp->m_sb.sb_agblocks (%d >= %d) on %s.  Returning EINVAL.",
-                       agbno, mp->m_sb.sb_agblocks, mp->m_fsname);
+               xfs_warn(mp, "%s: agbno >= mp->m_sb.sb_agblocks (%d >= %d).",
+                       __func__, agbno, mp->m_sb.sb_agblocks);
                ASSERT(0);
                return XFS_ERROR(EINVAL);
        }
@@ -1085,9 +1080,8 @@ xfs_difree(
         */
        error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
        if (error) {
-               cmn_err(CE_WARN,
-                       "xfs_difree: xfs_ialloc_read_agi() returned an error %d on %s.  Returning error.",
-                       error, mp->m_fsname);
+               xfs_warn(mp, "%s: xfs_ialloc_read_agi() returned error %d.",
+                       __func__, error);
                return error;
        }
        agi = XFS_BUF_TO_AGI(agbp);
@@ -1106,17 +1100,15 @@ xfs_difree(
         * Look for the entry describing this inode.
         */
        if ((error = xfs_inobt_lookup(cur, agino, XFS_LOOKUP_LE, &i))) {
-               cmn_err(CE_WARN,
-                       "xfs_difree: xfs_inobt_lookup returned()  an error %d on %s.  Returning error.",
-                       error, mp->m_fsname);
+               xfs_warn(mp, "%s: xfs_inobt_lookup() returned error %d.",
+                       __func__, error);
                goto error0;
        }
        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
        error = xfs_inobt_get_rec(cur, &rec, &i);
        if (error) {
-               cmn_err(CE_WARN,
-                       "xfs_difree: xfs_inobt_get_rec()  returned an error %d on %s.  Returning error.",
-                       error, mp->m_fsname);
+               xfs_warn(mp, "%s: xfs_inobt_get_rec() returned error %d.",
+                       __func__, error);
                goto error0;
        }
        XFS_WANT_CORRUPTED_GOTO(i == 1, error0);
@@ -1157,8 +1149,8 @@ xfs_difree(
                xfs_trans_mod_sb(tp, XFS_TRANS_SB_IFREE, -(ilen - 1));
 
                if ((error = xfs_btree_delete(cur, &i))) {
-                       cmn_err(CE_WARN, "xfs_difree: xfs_btree_delete returned an error %d on %s.\n",
-                               error, mp->m_fsname);
+                       xfs_warn(mp, "%s: xfs_btree_delete returned error %d.",
+                               __func__, error);
                        goto error0;
                }
 
@@ -1170,9 +1162,8 @@ xfs_difree(
 
                error = xfs_inobt_update(cur, &rec);
                if (error) {
-                       cmn_err(CE_WARN,
-       "xfs_difree: xfs_inobt_update returned an error %d on %s.",
-                               error, mp->m_fsname);
+                       xfs_warn(mp, "%s: xfs_inobt_update returned error %d.",
+                               __func__, error);
                        goto error0;
                }
 
@@ -1218,10 +1209,9 @@ xfs_imap_lookup(
 
        error = xfs_ialloc_read_agi(mp, tp, agno, &agbp);
        if (error) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
-                               "xfs_ialloc_read_agi() returned "
-                               "error %d, agno %d",
-                               error, agno);
+               xfs_alert(mp,
+                       "%s: xfs_ialloc_read_agi() returned error %d, agno %d",
+                       __func__, error, agno);
                return error;
        }
 
@@ -1299,24 +1289,21 @@ xfs_imap(
                if (flags & XFS_IGET_UNTRUSTED)
                        return XFS_ERROR(EINVAL);
                if (agno >= mp->m_sb.sb_agcount) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: agno (%d) >= "
-                                       "mp->m_sb.sb_agcount (%d)",
-                                       agno,  mp->m_sb.sb_agcount);
+                       xfs_alert(mp,
+                               "%s: agno (%d) >= mp->m_sb.sb_agcount (%d)",
+                               __func__, agno, mp->m_sb.sb_agcount);
                }
                if (agbno >= mp->m_sb.sb_agblocks) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: agbno (0x%llx) >= "
-                                       "mp->m_sb.sb_agblocks (0x%lx)",
-                                       (unsigned long long) agbno,
-                                       (unsigned long) mp->m_sb.sb_agblocks);
+                       xfs_alert(mp,
+               "%s: agbno (0x%llx) >= mp->m_sb.sb_agblocks (0x%lx)",
+                               __func__, (unsigned long long)agbno,
+                               (unsigned long)mp->m_sb.sb_agblocks);
                }
                if (ino != XFS_AGINO_TO_INO(mp, agno, agino)) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xfs_imap: ino (0x%llx) != "
-                                       "XFS_AGINO_TO_INO(mp, agno, agino) "
-                                       "(0x%llx)",
-                                       ino, XFS_AGINO_TO_INO(mp, agno, agino));
+                       xfs_alert(mp,
+               "%s: ino (0x%llx) != XFS_AGINO_TO_INO() (0x%llx)",
+                               __func__, ino,
+                               XFS_AGINO_TO_INO(mp, agno, agino));
                }
                xfs_stack_trace();
 #endif /* DEBUG */
@@ -1388,10 +1375,9 @@ out_map:
         */
        if ((imap->im_blkno + imap->im_len) >
            XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)) {
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_imap: "
-                       "(imap->im_blkno (0x%llx) + imap->im_len (0x%llx)) > "
-                       " XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) (0x%llx)",
-                       (unsigned long long) imap->im_blkno,
+               xfs_alert(mp,
+       "%s: (im_blkno (0x%llx) + im_len (0x%llx)) > sb_dblocks (0x%llx)",
+                       __func__, (unsigned long long) imap->im_blkno,
                        (unsigned long long) imap->im_len,
                        XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks));
                return XFS_ERROR(EINVAL);
index be7cf625421f15a50a739af9dfc1166981a3fd06..da871f5322368dffac20f1514a5966a45f26061e 100644 (file)
@@ -110,8 +110,8 @@ xfs_inobp_check(
                dip = (xfs_dinode_t *)xfs_buf_offset(bp,
                                        i * mp->m_sb.sb_inodesize);
                if (!dip->di_next_unlinked)  {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "Detected a bogus zero next_unlinked field in incore inode buffer 0x%p.  About to pop an ASSERT.",
+                       xfs_alert(mp,
+       "Detected bogus zero next_unlinked field in incore inode buffer 0x%p.",
                                bp);
                        ASSERT(dip->di_next_unlinked);
                }
@@ -142,10 +142,9 @@ xfs_imap_to_bp(
                                   (int)imap->im_len, buf_flags, &bp);
        if (error) {
                if (error != EAGAIN) {
-                       cmn_err(CE_WARN,
-                               "xfs_imap_to_bp: xfs_trans_read_buf()returned "
-                               "an error %d on %s.  Returning error.",
-                               error, mp->m_fsname);
+                       xfs_warn(mp,
+                               "%s: xfs_trans_read_buf() returned error %d.",
+                               __func__, error);
                } else {
                        ASSERT(buf_flags & XBF_TRYLOCK);
                }
@@ -180,12 +179,11 @@ xfs_imap_to_bp(
                        XFS_CORRUPTION_ERROR("xfs_imap_to_bp",
                                                XFS_ERRLEVEL_HIGH, mp, dip);
 #ifdef DEBUG
-                       cmn_err(CE_PANIC,
-                                       "Device %s - bad inode magic/vsn "
-                                       "daddr %lld #%d (magic=%x)",
-                               XFS_BUFTARG_NAME(mp->m_ddev_targp),
+                       xfs_emerg(mp,
+                               "bad inode magic/vsn daddr %lld #%d (magic=%x)",
                                (unsigned long long)imap->im_blkno, i,
                                be16_to_cpu(dip->di_magic));
+                       ASSERT(0);
 #endif
                        xfs_trans_brelse(tp, bp);
                        return XFS_ERROR(EFSCORRUPTED);
@@ -317,7 +315,7 @@ xfs_iformat(
        if (unlikely(be32_to_cpu(dip->di_nextents) +
                     be16_to_cpu(dip->di_anextents) >
                     be64_to_cpu(dip->di_nblocks))) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
+               xfs_warn(ip->i_mount,
                        "corrupt dinode %Lu, extent total = %d, nblocks = %Lu.",
                        (unsigned long long)ip->i_ino,
                        (int)(be32_to_cpu(dip->di_nextents) +
@@ -330,8 +328,7 @@ xfs_iformat(
        }
 
        if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                       "corrupt dinode %Lu, forkoff = 0x%x.",
+               xfs_warn(ip->i_mount, "corrupt dinode %Lu, forkoff = 0x%x.",
                        (unsigned long long)ip->i_ino,
                        dip->di_forkoff);
                XFS_CORRUPTION_ERROR("xfs_iformat(2)", XFS_ERRLEVEL_LOW,
@@ -341,7 +338,7 @@ xfs_iformat(
 
        if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) &&
                     !ip->i_mount->m_rtdev_targp)) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
+               xfs_warn(ip->i_mount,
                        "corrupt dinode %Lu, has realtime flag set.",
                        ip->i_ino);
                XFS_CORRUPTION_ERROR("xfs_iformat(realtime)",
@@ -373,9 +370,8 @@ xfs_iformat(
                         * no local regular files yet
                         */
                        if (unlikely((be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFREG)) {
-                               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                                       "corrupt inode %Lu "
-                                       "(local format for regular file).",
+                               xfs_warn(ip->i_mount,
+                       "corrupt inode %Lu (local format for regular file).",
                                        (unsigned long long) ip->i_ino);
                                XFS_CORRUPTION_ERROR("xfs_iformat(4)",
                                                     XFS_ERRLEVEL_LOW,
@@ -385,9 +381,8 @@ xfs_iformat(
 
                        di_size = be64_to_cpu(dip->di_size);
                        if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) {
-                               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                                       "corrupt inode %Lu "
-                                       "(bad size %Ld for local inode).",
+                               xfs_warn(ip->i_mount,
+                       "corrupt inode %Lu (bad size %Ld for local inode).",
                                        (unsigned long long) ip->i_ino,
                                        (long long) di_size);
                                XFS_CORRUPTION_ERROR("xfs_iformat(5)",
@@ -431,9 +426,8 @@ xfs_iformat(
                size = be16_to_cpu(atp->hdr.totsize);
 
                if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
-                       xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                               "corrupt inode %Lu "
-                               "(bad attr fork size %Ld).",
+                       xfs_warn(ip->i_mount,
+                               "corrupt inode %Lu (bad attr fork size %Ld).",
                                (unsigned long long) ip->i_ino,
                                (long long) size);
                        XFS_CORRUPTION_ERROR("xfs_iformat(8)",
@@ -488,9 +482,8 @@ xfs_iformat_local(
         * kmem_alloc() or memcpy() below.
         */
        if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                       "corrupt inode %Lu "
-                       "(bad size %d for local fork, size = %d).",
+               xfs_warn(ip->i_mount,
+       "corrupt inode %Lu (bad size %d for local fork, size = %d).",
                        (unsigned long long) ip->i_ino, size,
                        XFS_DFORK_SIZE(dip, ip->i_mount, whichfork));
                XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW,
@@ -547,8 +540,7 @@ xfs_iformat_extents(
         * kmem_alloc() or memcpy() below.
         */
        if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                       "corrupt inode %Lu ((a)extents = %d).",
+               xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
                        (unsigned long long) ip->i_ino, nex);
                XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW,
                                     ip->i_mount, dip);
@@ -623,11 +615,10 @@ xfs_iformat_btree(
            || XFS_BMDR_SPACE_CALC(nrecs) >
                        XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)
            || XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) {
-               xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
-                       "corrupt inode %Lu (btree).",
+               xfs_warn(ip->i_mount, "corrupt inode %Lu (btree).",
                        (unsigned long long) ip->i_ino);
-               XFS_ERROR_REPORT("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
-                                ip->i_mount);
+               XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW,
+                                ip->i_mount, dip);
                return XFS_ERROR(EFSCORRUPTED);
        }
 
@@ -813,11 +804,9 @@ xfs_iread(
         */
        if (be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC) {
 #ifdef DEBUG
-               xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
-                               "dip->di_magic (0x%x) != "
-                               "XFS_DINODE_MAGIC (0x%x)",
-                               be16_to_cpu(dip->di_magic),
-                               XFS_DINODE_MAGIC);
+               xfs_alert(mp,
+                       "%s: dip->di_magic (0x%x) != XFS_DINODE_MAGIC (0x%x)",
+                       __func__, be16_to_cpu(dip->di_magic), XFS_DINODE_MAGIC);
 #endif /* DEBUG */
                error = XFS_ERROR(EINVAL);
                goto out_brelse;
@@ -835,9 +824,8 @@ xfs_iread(
                error = xfs_iformat(ip, dip);
                if (error)  {
 #ifdef DEBUG
-                       xfs_fs_cmn_err(CE_ALERT, mp, "xfs_iread: "
-                                       "xfs_iformat() returned error %d",
-                                       error);
+                       xfs_alert(mp, "%s: xfs_iformat() returned error %d",
+                               __func__, error);
 #endif /* DEBUG */
                        goto out_brelse;
                }
@@ -1016,8 +1004,8 @@ xfs_ialloc(
         * This is because we're setting fields here we need
         * to prevent others from looking at until we're done.
         */
-       error = xfs_trans_iget(tp->t_mountp, tp, ino,
-                               XFS_IGET_CREATE, XFS_ILOCK_EXCL, &ip);
+       error = xfs_iget(tp->t_mountp, tp, ino, XFS_IGET_CREATE,
+                        XFS_ILOCK_EXCL, &ip);
        if (error)
                return error;
        ASSERT(ip != NULL);
@@ -1166,6 +1154,7 @@ xfs_ialloc(
        /*
         * Log the new values stuffed into the inode.
         */
+       xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
        xfs_trans_log_inode(tp, ip, flags);
 
        /* now that we have an i_mode we can setup inode ops and unlock */
@@ -1820,9 +1809,8 @@ xfs_iunlink_remove(
                 */
                error = xfs_itobp(mp, tp, ip, &dip, &ibp, XBF_LOCK);
                if (error) {
-                       cmn_err(CE_WARN,
-                               "xfs_iunlink_remove: xfs_itobp()  returned an error %d on %s.  Returning error.",
-                               error, mp->m_fsname);
+                       xfs_warn(mp, "%s: xfs_itobp() returned error %d.",
+                               __func__, error);
                        return error;
                }
                next_agino = be32_to_cpu(dip->di_next_unlinked);
@@ -1867,9 +1855,9 @@ xfs_iunlink_remove(
                        error = xfs_inotobp(mp, tp, next_ino, &last_dip,
                                            &last_ibp, &last_offset, 0);
                        if (error) {
-                               cmn_err(CE_WARN,
-                       "xfs_iunlink_remove: xfs_inotobp()  returned an error %d on %s.  Returning error.",
-                                       error, mp->m_fsname);
+                               xfs_warn(mp,
+                                       "%s: xfs_inotobp() returned error %d.",
+                                       __func__, error);
                                return error;
                        }
                        next_agino = be32_to_cpu(last_dip->di_next_unlinked);
@@ -1882,9 +1870,8 @@ xfs_iunlink_remove(
                 */
                error = xfs_itobp(mp, tp, ip, &dip, &ibp, XBF_LOCK);
                if (error) {
-                       cmn_err(CE_WARN,
-                               "xfs_iunlink_remove: xfs_itobp()  returned an error %d on %s.  Returning error.",
-                               error, mp->m_fsname);
+                       xfs_warn(mp, "%s: xfs_itobp(2) returned error %d.",
+                               __func__, error);
                        return error;
                }
                next_agino = be32_to_cpu(dip->di_next_unlinked);
@@ -2939,16 +2926,16 @@ xfs_iflush_int(
 
        if (XFS_TEST_ERROR(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC,
                               mp, XFS_ERRTAG_IFLUSH_1, XFS_RANDOM_IFLUSH_1)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                   "xfs_iflush: Bad inode %Lu magic number 0x%x, ptr 0x%p",
-                       ip->i_ino, be16_to_cpu(dip->di_magic), dip);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: Bad inode %Lu magic number 0x%x, ptr 0x%p",
+                       __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
                goto corrupt_out;
        }
        if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC,
                                mp, XFS_ERRTAG_IFLUSH_2, XFS_RANDOM_IFLUSH_2)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
-                       ip->i_ino, ip, ip->i_d.di_magic);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: Bad inode %Lu, ptr 0x%p, magic number 0x%x",
+                       __func__, ip->i_ino, ip, ip->i_d.di_magic);
                goto corrupt_out;
        }
        if ((ip->i_d.di_mode & S_IFMT) == S_IFREG) {
@@ -2956,9 +2943,9 @@ xfs_iflush_int(
                    (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE),
                    mp, XFS_ERRTAG_IFLUSH_3, XFS_RANDOM_IFLUSH_3)) {
-                       xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                               "xfs_iflush: Bad regular inode %Lu, ptr 0x%p",
-                               ip->i_ino, ip);
+                       xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                               "%s: Bad regular inode %Lu, ptr 0x%p",
+                               __func__, ip->i_ino, ip);
                        goto corrupt_out;
                }
        } else if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) {
@@ -2967,28 +2954,28 @@ xfs_iflush_int(
                    (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) &&
                    (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL),
                    mp, XFS_ERRTAG_IFLUSH_4, XFS_RANDOM_IFLUSH_4)) {
-                       xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                               "xfs_iflush: Bad directory inode %Lu, ptr 0x%p",
-                               ip->i_ino, ip);
+                       xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                               "%s: Bad directory inode %Lu, ptr 0x%p",
+                               __func__, ip->i_ino, ip);
                        goto corrupt_out;
                }
        }
        if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents >
                                ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5,
                                XFS_RANDOM_IFLUSH_5)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: detected corrupt incore inode %Lu, total extents = %d, nblocks = %Ld, ptr 0x%p",
-                       ip->i_ino,
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: detected corrupt incore inode %Lu, "
+                       "total extents = %d, nblocks = %Ld, ptr 0x%p",
+                       __func__, ip->i_ino,
                        ip->i_d.di_nextents + ip->i_d.di_anextents,
-                       ip->i_d.di_nblocks,
-                       ip);
+                       ip->i_d.di_nblocks, ip);
                goto corrupt_out;
        }
        if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize,
                                mp, XFS_ERRTAG_IFLUSH_6, XFS_RANDOM_IFLUSH_6)) {
-               xfs_cmn_err(XFS_PTAG_IFLUSH, CE_ALERT, mp,
-                       "xfs_iflush: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
-                       ip->i_ino, ip->i_d.di_forkoff, ip);
+               xfs_alert_tag(mp, XFS_PTAG_IFLUSH,
+                       "%s: bad inode %Lu, forkoff 0x%x, ptr 0x%p",
+                       __func__, ip->i_ino, ip->i_d.di_forkoff, ip);
                goto corrupt_out;
        }
        /*
index 5c95fa8ec11da9c703f756b4dbe42e81a569a6ac..f753200cef8d365593e9a0c1c1b155e968f3f8f8 100644 (file)
@@ -409,28 +409,35 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
 /*
  * Flags for lockdep annotations.
  *
- * XFS_I[O]LOCK_PARENT - for operations that require locking two inodes
- * (ie directory operations that require locking a directory inode and
- * an entry inode).  The first inode gets locked with this flag so it
- * gets a lockdep subclass of 1 and the second lock will have a lockdep
- * subclass of 0.
+ * XFS_LOCK_PARENT - for directory operations that require locking a
+ * parent directory inode and a child entry inode.  The parent gets locked
+ * with this flag so it gets a lockdep subclass of 1 and the child entry
+ * lock will have a lockdep subclass of 0.
+ *
+ * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
+ * inodes do not participate in the normal lock order, and thus have their
+ * own subclasses.
  *
  * XFS_LOCK_INUMORDER - for locking several inodes at the some time
  * with xfs_lock_inodes().  This flag is used as the starting subclass
  * and each subsequent lock acquired will increment the subclass by one.
- * So the first lock acquired will have a lockdep subclass of 2, the
- * second lock will have a lockdep subclass of 3, and so on. It is
+ * So the first lock acquired will have a lockdep subclass of 4, the
+ * second lock will have a lockdep subclass of 5, and so on. It is
  * the responsibility of the class builder to shift this to the correct
  * portion of the lock_mode lockdep mask.
  */
 #define XFS_LOCK_PARENT                1
-#define XFS_LOCK_INUMORDER     2
+#define XFS_LOCK_RTBITMAP      2
+#define XFS_LOCK_RTSUM         3
+#define XFS_LOCK_INUMORDER     4
 
 #define XFS_IOLOCK_SHIFT       16
 #define        XFS_IOLOCK_PARENT       (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT)
 
 #define XFS_ILOCK_SHIFT                24
 #define        XFS_ILOCK_PARENT        (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT)
+#define        XFS_ILOCK_RTBITMAP      (XFS_LOCK_RTBITMAP << XFS_ILOCK_SHIFT)
+#define        XFS_ILOCK_RTSUM         (XFS_LOCK_RTSUM << XFS_ILOCK_SHIFT)
 
 #define XFS_IOLOCK_DEP_MASK    0x00ff0000
 #define XFS_ILOCK_DEP_MASK     0xff000000
index 8a0f044750c3207eff174c4137bcd77580465894..091d82b94c4de518208d8eebc37abe4a7f3d4f1d 100644 (file)
@@ -101,11 +101,11 @@ xfs_iomap_eof_align_last_fsb(
 }
 
 STATIC int
-xfs_cmn_err_fsblock_zero(
+xfs_alert_fsblock_zero(
        xfs_inode_t     *ip,
        xfs_bmbt_irec_t *imap)
 {
-       xfs_cmn_err(XFS_PTAG_FSBLOCK_ZERO, CE_ALERT, ip->i_mount,
+       xfs_alert_tag(ip->i_mount, XFS_PTAG_FSBLOCK_ZERO,
                        "Access to block zero in inode %llu "
                        "start_block: %llx start_off: %llx "
                        "blkcnt: %llx extent-state: %x\n",
@@ -246,7 +246,7 @@ xfs_iomap_write_direct(
        }
 
        if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip))) {
-               error = xfs_cmn_err_fsblock_zero(ip, imap);
+               error = xfs_alert_fsblock_zero(ip, imap);
                goto error_out;
        }
 
@@ -464,7 +464,7 @@ retry:
        }
 
        if (!(imap[0].br_startblock || XFS_IS_REALTIME_INODE(ip)))
-               return xfs_cmn_err_fsblock_zero(ip, &imap[0]);
+               return xfs_alert_fsblock_zero(ip, &imap[0]);
 
        *ret_imap = imap[0];
        return 0;
@@ -614,7 +614,7 @@ xfs_iomap_write_allocate(
                 * covers at least part of the callers request
                 */
                if (!(imap->br_startblock || XFS_IS_REALTIME_INODE(ip)))
-                       return xfs_cmn_err_fsblock_zero(ip, imap);
+                       return xfs_alert_fsblock_zero(ip, imap);
 
                if ((offset_fsb >= imap->br_startoff) &&
                    (offset_fsb < (imap->br_startoff +
@@ -724,7 +724,7 @@ xfs_iomap_write_unwritten(
                        return XFS_ERROR(error);
 
                if (!(imap.br_startblock || XFS_IS_REALTIME_INODE(ip)))
-                       return xfs_cmn_err_fsblock_zero(ip, &imap);
+                       return xfs_alert_fsblock_zero(ip, &imap);
 
                if ((numblks_fsb = imap.br_blockcount) == 0) {
                        /*
index ae6fef1ff563e19ceb6b97393ed3ec8804c110b5..25efa9b8a6029ac35df73942459132abd71dc228 100644 (file)
@@ -374,11 +374,10 @@ xfs_log_mount(
        int             error;
 
        if (!(mp->m_flags & XFS_MOUNT_NORECOVERY))
-               cmn_err(CE_NOTE, "XFS mounting filesystem %s", mp->m_fsname);
+               xfs_notice(mp, "Mounting Filesystem");
        else {
-               cmn_err(CE_NOTE,
-                       "Mounting filesystem \"%s\" in no-recovery mode.  Filesystem will be inconsistent.",
-                       mp->m_fsname);
+               xfs_notice(mp,
+"Mounting filesystem in no-recovery mode.  Filesystem will be inconsistent.");
                ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
        }
 
@@ -393,7 +392,7 @@ xfs_log_mount(
         */
        error = xfs_trans_ail_init(mp);
        if (error) {
-               cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
+               xfs_warn(mp, "AIL initialisation failed: error %d", error);
                goto out_free_log;
        }
        mp->m_log->l_ailp = mp->m_ail;
@@ -413,7 +412,8 @@ xfs_log_mount(
                if (readonly)
                        mp->m_flags |= XFS_MOUNT_RDONLY;
                if (error) {
-                       cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
+                       xfs_warn(mp, "log mount/recovery failed: error %d",
+                               error);
                        goto out_destroy_ail;
                }
        }
@@ -542,10 +542,8 @@ xfs_log_unmount_write(xfs_mount_t *mp)
                         */
                }
 
-               if (error) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "xfs_log_unmount: unmount record failed");
-               }
+               if (error)
+                       xfs_alert(mp, "%s: unmount record failed", __func__);
 
 
                spin_lock(&log->l_icloglock);
@@ -852,7 +850,7 @@ xlog_space_left(
                 * In this case we just want to return the size of the
                 * log as the amount of space left.
                 */
-               xfs_fs_cmn_err(CE_ALERT, log->l_mp,
+               xfs_alert(log->l_mp,
                        "xlog_space_left: head behind tail\n"
                        "  tail_cycle = %d, tail_bytes = %d\n"
                        "  GH   cycle = %d, GH   bytes = %d",
@@ -1001,7 +999,7 @@ xlog_alloc_log(xfs_mount_t *mp,
 
        log = kmem_zalloc(sizeof(xlog_t), KM_MAYFAIL);
        if (!log) {
-               xlog_warn("XFS: Log allocation failed: No memory!");
+               xfs_warn(mp, "Log allocation failed: No memory!");
                goto out;
        }
 
@@ -1029,24 +1027,24 @@ xlog_alloc_log(xfs_mount_t      *mp,
        if (xfs_sb_version_hassector(&mp->m_sb)) {
                log2_size = mp->m_sb.sb_logsectlog;
                if (log2_size < BBSHIFT) {
-                       xlog_warn("XFS: Log sector size too small "
-                               "(0x%x < 0x%x)", log2_size, BBSHIFT);
+                       xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)",
+                               log2_size, BBSHIFT);
                        goto out_free_log;
                }
 
                log2_size -= BBSHIFT;
                if (log2_size > mp->m_sectbb_log) {
-                       xlog_warn("XFS: Log sector size too large "
-                               "(0x%x > 0x%x)", log2_size, mp->m_sectbb_log);
+                       xfs_warn(mp, "Log sector size too large (0x%x > 0x%x)",
+                               log2_size, mp->m_sectbb_log);
                        goto out_free_log;
                }
 
                /* for larger sector sizes, must have v2 or external log */
                if (log2_size && log->l_logBBstart > 0 &&
                            !xfs_sb_version_haslogv2(&mp->m_sb)) {
-
-                       xlog_warn("XFS: log sector size (0x%x) invalid "
-                                 "for configuration.", log2_size);
+                       xfs_warn(mp,
+               "log sector size (0x%x) invalid for configuration.",
+                               log2_size);
                        goto out_free_log;
                }
        }
@@ -1563,38 +1561,36 @@ xlog_print_tic_res(
            "SWAPEXT"
        };
 
-       xfs_fs_cmn_err(CE_WARN, mp,
-                       "xfs_log_write: reservation summary:\n"
-                       "  trans type  = %s (%u)\n"
-                       "  unit res    = %d bytes\n"
-                       "  current res = %d bytes\n"
-                       "  total reg   = %u bytes (o/flow = %u bytes)\n"
-                       "  ophdrs      = %u (ophdr space = %u bytes)\n"
-                       "  ophdr + reg = %u bytes\n"
-                       "  num regions = %u\n",
-                       ((ticket->t_trans_type <= 0 ||
-                         ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
-                         "bad-trans-type" : trans_type_str[ticket->t_trans_type-1]),
-                       ticket->t_trans_type,
-                       ticket->t_unit_res,
-                       ticket->t_curr_res,
-                       ticket->t_res_arr_sum, ticket->t_res_o_flow,
-                       ticket->t_res_num_ophdrs, ophdr_spc,
-                       ticket->t_res_arr_sum + 
-                       ticket->t_res_o_flow + ophdr_spc,
-                       ticket->t_res_num);
+       xfs_warn(mp,
+               "xfs_log_write: reservation summary:\n"
+               "  trans type  = %s (%u)\n"
+               "  unit res    = %d bytes\n"
+               "  current res = %d bytes\n"
+               "  total reg   = %u bytes (o/flow = %u bytes)\n"
+               "  ophdrs      = %u (ophdr space = %u bytes)\n"
+               "  ophdr + reg = %u bytes\n"
+               "  num regions = %u\n",
+               ((ticket->t_trans_type <= 0 ||
+                 ticket->t_trans_type > XFS_TRANS_TYPE_MAX) ?
+                 "bad-trans-type" : trans_type_str[ticket->t_trans_type-1]),
+               ticket->t_trans_type,
+               ticket->t_unit_res,
+               ticket->t_curr_res,
+               ticket->t_res_arr_sum, ticket->t_res_o_flow,
+               ticket->t_res_num_ophdrs, ophdr_spc,
+               ticket->t_res_arr_sum +
+               ticket->t_res_o_flow + ophdr_spc,
+               ticket->t_res_num);
 
        for (i = 0; i < ticket->t_res_num; i++) {
-               uint r_type = ticket->t_res_arr[i].r_type; 
-               cmn_err(CE_WARN,
-                           "region[%u]: %s - %u bytes\n",
-                           i, 
+               uint r_type = ticket->t_res_arr[i].r_type;
+               xfs_warn(mp, "region[%u]: %s - %u bytes\n", i,
                            ((r_type <= 0 || r_type > XLOG_REG_TYPE_MAX) ?
                            "bad-rtype" : res_type_str[r_type-1]),
                            ticket->t_res_arr[i].r_len);
        }
 
-       xfs_cmn_err(XFS_PTAG_LOGRES, CE_ALERT, mp,
+       xfs_alert_tag(mp, XFS_PTAG_LOGRES,
                "xfs_log_write: reservation ran out. Need to up reservation");
        xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
 }
@@ -1682,7 +1678,7 @@ xlog_write_setup_ophdr(
        case XFS_LOG:
                break;
        default:
-               xfs_fs_cmn_err(CE_WARN, log->l_mp,
+               xfs_warn(log->l_mp,
                        "Bad XFS transaction clientid 0x%x in ticket 0x%p",
                        ophdr->oh_clientid, ticket);
                return NULL;
@@ -2264,7 +2260,7 @@ xlog_state_do_callback(
                if (repeats > 5000) {
                        flushcnt += repeats;
                        repeats = 0;
-                       xfs_fs_cmn_err(CE_WARN, log->l_mp,
+                       xfs_warn(log->l_mp,
                                "%s: possible infinite loop (%d iterations)",
                                __func__, flushcnt);
                }
@@ -3052,10 +3048,8 @@ xfs_log_force(
        int     error;
 
        error = _xfs_log_force(mp, flags, NULL);
-       if (error) {
-               xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: "
-                       "error %d returned.", error);
-       }
+       if (error)
+               xfs_warn(mp, "%s: error %d returned.", __func__, error);
 }
 
 /*
@@ -3204,10 +3198,8 @@ xfs_log_force_lsn(
        int     error;
 
        error = _xfs_log_force_lsn(mp, lsn, flags, NULL);
-       if (error) {
-               xfs_fs_cmn_err(CE_WARN, mp, "xfs_log_force: "
-                       "error %d returned.", error);
-       }
+       if (error)
+               xfs_warn(mp, "%s: error %d returned.", __func__, error);
 }
 
 /*
@@ -3412,7 +3404,7 @@ xlog_verify_dest_ptr(
        }
 
        if (!good_ptr)
-               xlog_panic("xlog_verify_dest_ptr: invalid ptr");
+               xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
 }
 
 STATIC void
@@ -3448,16 +3440,16 @@ xlog_verify_tail_lsn(xlog_t         *log,
        blocks =
            log->l_logBBsize - (log->l_prev_block - BLOCK_LSN(tail_lsn));
        if (blocks < BTOBB(iclog->ic_offset)+BTOBB(log->l_iclog_hsize))
-           xlog_panic("xlog_verify_tail_lsn: ran out of log space");
+               xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
     } else {
        ASSERT(CYCLE_LSN(tail_lsn)+1 == log->l_prev_cycle);
 
        if (BLOCK_LSN(tail_lsn) == log->l_prev_block)
-           xlog_panic("xlog_verify_tail_lsn: tail wrapped");
+               xfs_emerg(log->l_mp, "%s: tail wrapped", __func__);
 
        blocks = BLOCK_LSN(tail_lsn) - log->l_prev_block;
        if (blocks < BTOBB(iclog->ic_offset) + 1)
-           xlog_panic("xlog_verify_tail_lsn: ran out of log space");
+               xfs_emerg(log->l_mp, "%s: ran out of log space", __func__);
     }
 }      /* xlog_verify_tail_lsn */
 
@@ -3497,22 +3489,23 @@ xlog_verify_iclog(xlog_t         *log,
        icptr = log->l_iclog;
        for (i=0; i < log->l_iclog_bufs; i++) {
                if (icptr == NULL)
-                       xlog_panic("xlog_verify_iclog: invalid ptr");
+                       xfs_emerg(log->l_mp, "%s: invalid ptr", __func__);
                icptr = icptr->ic_next;
        }
        if (icptr != log->l_iclog)
-               xlog_panic("xlog_verify_iclog: corrupt iclog ring");
+               xfs_emerg(log->l_mp, "%s: corrupt iclog ring", __func__);
        spin_unlock(&log->l_icloglock);
 
        /* check log magic numbers */
        if (be32_to_cpu(iclog->ic_header.h_magicno) != XLOG_HEADER_MAGIC_NUM)
-               xlog_panic("xlog_verify_iclog: invalid magic num");
+               xfs_emerg(log->l_mp, "%s: invalid magic num", __func__);
 
        ptr = (xfs_caddr_t) &iclog->ic_header;
        for (ptr += BBSIZE; ptr < ((xfs_caddr_t)&iclog->ic_header) + count;
             ptr += BBSIZE) {
                if (be32_to_cpu(*(__be32 *)ptr) == XLOG_HEADER_MAGIC_NUM)
-                       xlog_panic("xlog_verify_iclog: unexpected magic num");
+                       xfs_emerg(log->l_mp, "%s: unexpected magic num",
+                               __func__);
        }
 
        /* check fields */
@@ -3542,9 +3535,10 @@ xlog_verify_iclog(xlog_t  *log,
                        }
                }
                if (clientid != XFS_TRANSACTION && clientid != XFS_LOG)
-                       cmn_err(CE_WARN, "xlog_verify_iclog: "
-                               "invalid clientid %d op 0x%p offset 0x%lx",
-                               clientid, ophead, (unsigned long)field_offset);
+                       xfs_warn(log->l_mp,
+                               "%s: invalid clientid %d op 0x%p offset 0x%lx",
+                               __func__, clientid, ophead,
+                               (unsigned long)field_offset);
 
                /* check length */
                field_offset = (__psint_t)
index d5f8be8f4bf603cac8c3f0394759e5fefdd8d42e..15dbf1f9c2be6c962655a84f6a254cc191723cee 100644 (file)
@@ -87,10 +87,6 @@ static inline uint xlog_get_client_id(__be32 i)
        return be32_to_cpu(i) >> 24;
 }
 
-#define xlog_panic(args...)    cmn_err(CE_PANIC, ## args)
-#define xlog_exit(args...)     cmn_err(CE_PANIC, ## args)
-#define xlog_warn(args...)     cmn_err(CE_WARN, ## args)
-
 /*
  * In core log state
  */
index aa0ebb776903317a8d29916396eb547c3ce296c9..0c4a5618e7af769c051da1337f4f338457b14866 100644 (file)
@@ -92,7 +92,7 @@ xlog_get_bp(
        int             nbblks)
 {
        if (!xlog_buf_bbcount_valid(log, nbblks)) {
-               xlog_warn("XFS: Invalid block length (0x%x) given for buffer",
+               xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
                        nbblks);
                XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp);
                return NULL;
@@ -160,7 +160,7 @@ xlog_bread_noalign(
        int             error;
 
        if (!xlog_buf_bbcount_valid(log, nbblks)) {
-               xlog_warn("XFS: Invalid block length (0x%x) given for buffer",
+               xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
                        nbblks);
                XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp);
                return EFSCORRUPTED;
@@ -219,7 +219,7 @@ xlog_bwrite(
        int             error;
 
        if (!xlog_buf_bbcount_valid(log, nbblks)) {
-               xlog_warn("XFS: Invalid block length (0x%x) given for buffer",
+               xfs_warn(log->l_mp, "Invalid block length (0x%x) for buffer",
                        nbblks);
                XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_HIGH, log->l_mp);
                return EFSCORRUPTED;
@@ -254,9 +254,9 @@ xlog_header_check_dump(
        xfs_mount_t             *mp,
        xlog_rec_header_t       *head)
 {
-       cmn_err(CE_DEBUG, "%s:  SB : uuid = %pU, fmt = %d\n",
+       xfs_debug(mp, "%s:  SB : uuid = %pU, fmt = %d\n",
                __func__, &mp->m_sb.sb_uuid, XLOG_FMT);
-       cmn_err(CE_DEBUG, "    log : uuid = %pU, fmt = %d\n",
+       xfs_debug(mp, "    log : uuid = %pU, fmt = %d\n",
                &head->h_fs_uuid, be32_to_cpu(head->h_fmt));
 }
 #else
@@ -279,15 +279,15 @@ xlog_header_check_recover(
         * a dirty log created in IRIX.
         */
        if (unlikely(be32_to_cpu(head->h_fmt) != XLOG_FMT)) {
-               xlog_warn(
-       "XFS: dirty log written in incompatible format - can't recover");
+               xfs_warn(mp,
+       "dirty log written in incompatible format - can't recover");
                xlog_header_check_dump(mp, head);
                XFS_ERROR_REPORT("xlog_header_check_recover(1)",
                                 XFS_ERRLEVEL_HIGH, mp);
                return XFS_ERROR(EFSCORRUPTED);
        } else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
-               xlog_warn(
-       "XFS: dirty log entry has mismatched uuid - can't recover");
+               xfs_warn(mp,
+       "dirty log entry has mismatched uuid - can't recover");
                xlog_header_check_dump(mp, head);
                XFS_ERROR_REPORT("xlog_header_check_recover(2)",
                                 XFS_ERRLEVEL_HIGH, mp);
@@ -312,9 +312,9 @@ xlog_header_check_mount(
                 * h_fs_uuid is nil, we assume this log was last mounted
                 * by IRIX and continue.
                 */
-               xlog_warn("XFS: nil uuid in log - IRIX style log");
+               xfs_warn(mp, "nil uuid in log - IRIX style log");
        } else if (unlikely(!uuid_equal(&mp->m_sb.sb_uuid, &head->h_fs_uuid))) {
-               xlog_warn("XFS: log has mismatched uuid - can't recover");
+               xfs_warn(mp, "log has mismatched uuid - can't recover");
                xlog_header_check_dump(mp, head);
                XFS_ERROR_REPORT("xlog_header_check_mount",
                                 XFS_ERRLEVEL_HIGH, mp);
@@ -490,8 +490,8 @@ xlog_find_verify_log_record(
        for (i = (*last_blk) - 1; i >= 0; i--) {
                if (i < start_blk) {
                        /* valid log record not found */
-                       xlog_warn(
-               "XFS: Log inconsistent (didn't find previous header)");
+                       xfs_warn(log->l_mp,
+               "Log inconsistent (didn't find previous header)");
                        ASSERT(0);
                        error = XFS_ERROR(EIO);
                        goto out;
@@ -591,12 +591,12 @@ xlog_find_head(
                         * mkfs etc write a dummy unmount record to a fresh
                         * log so we can store the uuid in there
                         */
-                       xlog_warn("XFS: totally zeroed log");
+                       xfs_warn(log->l_mp, "totally zeroed log");
                }
 
                return 0;
        } else if (error) {
-               xlog_warn("XFS: empty log check failed");
+               xfs_warn(log->l_mp, "empty log check failed");
                return error;
        }
 
@@ -819,7 +819,7 @@ validate_head:
        xlog_put_bp(bp);
 
        if (error)
-           xlog_warn("XFS: failed to find log head");
+               xfs_warn(log->l_mp, "failed to find log head");
        return error;
 }
 
@@ -912,7 +912,7 @@ xlog_find_tail(
                }
        }
        if (!found) {
-               xlog_warn("XFS: xlog_find_tail: couldn't find sync record");
+               xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
                ASSERT(0);
                return XFS_ERROR(EIO);
        }
@@ -1028,7 +1028,7 @@ done:
        xlog_put_bp(bp);
 
        if (error)
-               xlog_warn("XFS: failed to locate log tail");
+               xfs_warn(log->l_mp, "failed to locate log tail");
        return error;
 }
 
@@ -1092,7 +1092,8 @@ xlog_find_zeroed(
                 * the first block must be 1. If it's not, maybe we're
                 * not looking at a log... Bail out.
                 */
-               xlog_warn("XFS: Log inconsistent or not a log (last==0, first!=1)");
+               xfs_warn(log->l_mp,
+                       "Log inconsistent or not a log (last==0, first!=1)");
                return XFS_ERROR(EINVAL);
        }
 
@@ -1506,8 +1507,8 @@ xlog_recover_add_to_trans(
        if (list_empty(&trans->r_itemq)) {
                /* we need to catch log corruptions here */
                if (*(uint *)dp != XFS_TRANS_HEADER_MAGIC) {
-                       xlog_warn("XFS: xlog_recover_add_to_trans: "
-                                 "bad header magic number");
+                       xfs_warn(log->l_mp, "%s: bad header magic number",
+                               __func__);
                        ASSERT(0);
                        return XFS_ERROR(EIO);
                }
@@ -1534,8 +1535,8 @@ xlog_recover_add_to_trans(
        if (item->ri_total == 0) {              /* first region to be added */
                if (in_f->ilf_size == 0 ||
                    in_f->ilf_size > XLOG_MAX_REGIONS_IN_ITEM) {
-                       xlog_warn(
-       "XFS: bad number of regions (%d) in inode log format",
+                       xfs_warn(log->l_mp,
+               "bad number of regions (%d) in inode log format",
                                  in_f->ilf_size);
                        ASSERT(0);
                        return XFS_ERROR(EIO);
@@ -1592,8 +1593,9 @@ xlog_recover_reorder_trans(
                        list_move_tail(&item->ri_list, &trans->r_itemq);
                        break;
                default:
-                       xlog_warn(
-       "XFS: xlog_recover_reorder_trans: unrecognized type of log operation");
+                       xfs_warn(log->l_mp,
+                               "%s: unrecognized type of log operation",
+                               __func__);
                        ASSERT(0);
                        return XFS_ERROR(EIO);
                }
@@ -1803,8 +1805,9 @@ xlog_recover_do_inode_buffer(
                logged_nextp = item->ri_buf[item_index].i_addr +
                                next_unlinked_offset - reg_buf_offset;
                if (unlikely(*logged_nextp == 0)) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "bad inode buffer log record (ptr = 0x%p, bp = 0x%p).  XFS trying to replay bad (0) inode di_next_unlinked field",
+                       xfs_alert(mp,
+               "Bad inode buffer log record (ptr = 0x%p, bp = 0x%p). "
+               "Trying to replay bad (0) inode di_next_unlinked field.",
                                item, bp);
                        XFS_ERROR_REPORT("xlog_recover_do_inode_buf",
                                         XFS_ERRLEVEL_LOW, mp);
@@ -1863,17 +1866,17 @@ xlog_recover_do_reg_buffer(
                if (buf_f->blf_flags &
                   (XFS_BLF_UDQUOT_BUF|XFS_BLF_PDQUOT_BUF|XFS_BLF_GDQUOT_BUF)) {
                        if (item->ri_buf[i].i_addr == NULL) {
-                               cmn_err(CE_ALERT,
+                               xfs_alert(mp,
                                        "XFS: NULL dquot in %s.", __func__);
                                goto next;
                        }
                        if (item->ri_buf[i].i_len < sizeof(xfs_disk_dquot_t)) {
-                               cmn_err(CE_ALERT,
+                               xfs_alert(mp,
                                        "XFS: dquot too small (%d) in %s.",
                                        item->ri_buf[i].i_len, __func__);
                                goto next;
                        }
-                       error = xfs_qm_dqcheck(item->ri_buf[i].i_addr,
+                       error = xfs_qm_dqcheck(mp, item->ri_buf[i].i_addr,
                                               -1, 0, XFS_QMOPT_DOWARN,
                                               "dquot_buf_recover");
                        if (error)
@@ -1898,6 +1901,7 @@ xlog_recover_do_reg_buffer(
  */
 int
 xfs_qm_dqcheck(
+       struct xfs_mount *mp,
        xfs_disk_dquot_t *ddq,
        xfs_dqid_t       id,
        uint             type,    /* used only when IO_dorepair is true */
@@ -1924,14 +1928,14 @@ xfs_qm_dqcheck(
         */
        if (be16_to_cpu(ddq->d_magic) != XFS_DQUOT_MAGIC) {
                if (flags & XFS_QMOPT_DOWARN)
-                       cmn_err(CE_ALERT,
+                       xfs_alert(mp,
                        "%s : XFS dquot ID 0x%x, magic 0x%x != 0x%x",
                        str, id, be16_to_cpu(ddq->d_magic), XFS_DQUOT_MAGIC);
                errs++;
        }
        if (ddq->d_version != XFS_DQUOT_VERSION) {
                if (flags & XFS_QMOPT_DOWARN)
-                       cmn_err(CE_ALERT,
+                       xfs_alert(mp,
                        "%s : XFS dquot ID 0x%x, version 0x%x != 0x%x",
                        str, id, ddq->d_version, XFS_DQUOT_VERSION);
                errs++;
@@ -1941,7 +1945,7 @@ xfs_qm_dqcheck(
            ddq->d_flags != XFS_DQ_PROJ &&
            ddq->d_flags != XFS_DQ_GROUP) {
                if (flags & XFS_QMOPT_DOWARN)
-                       cmn_err(CE_ALERT,
+                       xfs_alert(mp,
                        "%s : XFS dquot ID 0x%x, unknown flags 0x%x",
                        str, id, ddq->d_flags);
                errs++;
@@ -1949,7 +1953,7 @@ xfs_qm_dqcheck(
 
        if (id != -1 && id != be32_to_cpu(ddq->d_id)) {
                if (flags & XFS_QMOPT_DOWARN)
-                       cmn_err(CE_ALERT,
+                       xfs_alert(mp,
                        "%s : ondisk-dquot 0x%p, ID mismatch: "
                        "0x%x expected, found id 0x%x",
                        str, ddq, id, be32_to_cpu(ddq->d_id));
@@ -1962,9 +1966,8 @@ xfs_qm_dqcheck(
                                be64_to_cpu(ddq->d_blk_softlimit)) {
                        if (!ddq->d_btimer) {
                                if (flags & XFS_QMOPT_DOWARN)
-                                       cmn_err(CE_ALERT,
-                                       "%s : Dquot ID 0x%x (0x%p) "
-                                       "BLK TIMER NOT STARTED",
+                                       xfs_alert(mp,
+                       "%s : Dquot ID 0x%x (0x%p) BLK TIMER NOT STARTED",
                                        str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
@@ -1974,9 +1977,8 @@ xfs_qm_dqcheck(
                                be64_to_cpu(ddq->d_ino_softlimit)) {
                        if (!ddq->d_itimer) {
                                if (flags & XFS_QMOPT_DOWARN)
-                                       cmn_err(CE_ALERT,
-                                       "%s : Dquot ID 0x%x (0x%p) "
-                                       "INODE TIMER NOT STARTED",
+                                       xfs_alert(mp,
+                       "%s : Dquot ID 0x%x (0x%p) INODE TIMER NOT STARTED",
                                        str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
@@ -1986,9 +1988,8 @@ xfs_qm_dqcheck(
                                be64_to_cpu(ddq->d_rtb_softlimit)) {
                        if (!ddq->d_rtbtimer) {
                                if (flags & XFS_QMOPT_DOWARN)
-                                       cmn_err(CE_ALERT,
-                                       "%s : Dquot ID 0x%x (0x%p) "
-                                       "RTBLK TIMER NOT STARTED",
+                                       xfs_alert(mp,
+                       "%s : Dquot ID 0x%x (0x%p) RTBLK TIMER NOT STARTED",
                                        str, (int)be32_to_cpu(ddq->d_id), ddq);
                                errs++;
                        }
@@ -1999,7 +2000,7 @@ xfs_qm_dqcheck(
                return errs;
 
        if (flags & XFS_QMOPT_DOWARN)
-               cmn_err(CE_NOTE, "Re-initializing dquot ID 0x%x", id);
+               xfs_notice(mp, "Re-initializing dquot ID 0x%x", id);
 
        /*
         * Typically, a repair is only requested by quotacheck.
@@ -2218,9 +2219,9 @@ xlog_recover_inode_pass2(
         */
        if (unlikely(be16_to_cpu(dip->di_magic) != XFS_DINODE_MAGIC)) {
                xfs_buf_relse(bp);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_inode_recover: Bad inode magic number, dino ptr = 0x%p, dino bp = 0x%p, ino = %Ld",
-                       dip, bp, in_f->ilf_ino);
+               xfs_alert(mp,
+       "%s: Bad inode magic number, dip = 0x%p, dino bp = 0x%p, ino = %Ld",
+                       __func__, dip, bp, in_f->ilf_ino);
                XFS_ERROR_REPORT("xlog_recover_inode_pass2(1)",
                                 XFS_ERRLEVEL_LOW, mp);
                error = EFSCORRUPTED;
@@ -2229,9 +2230,9 @@ xlog_recover_inode_pass2(
        dicp = item->ri_buf[1].i_addr;
        if (unlikely(dicp->di_magic != XFS_DINODE_MAGIC)) {
                xfs_buf_relse(bp);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_inode_recover: Bad inode log record, rec ptr 0x%p, ino %Ld",
-                       item, in_f->ilf_ino);
+               xfs_alert(mp,
+                       "%s: Bad inode log record, rec ptr 0x%p, ino %Ld",
+                       __func__, item, in_f->ilf_ino);
                XFS_ERROR_REPORT("xlog_recover_inode_pass2(2)",
                                 XFS_ERRLEVEL_LOW, mp);
                error = EFSCORRUPTED;
@@ -2263,9 +2264,10 @@ xlog_recover_inode_pass2(
                        XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(3)",
                                         XFS_ERRLEVEL_LOW, mp, dicp);
                        xfs_buf_relse(bp);
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "xfs_inode_recover: Bad regular inode log record, rec ptr 0x%p, ino ptr = 0x%p, ino bp = 0x%p, ino %Ld",
-                               item, dip, bp, in_f->ilf_ino);
+                       xfs_alert(mp,
+               "%s: Bad regular inode log record, rec ptr 0x%p, "
+               "ino ptr = 0x%p, ino bp = 0x%p, ino %Ld",
+                               __func__, item, dip, bp, in_f->ilf_ino);
                        error = EFSCORRUPTED;
                        goto error;
                }
@@ -2276,9 +2278,10 @@ xlog_recover_inode_pass2(
                        XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(4)",
                                             XFS_ERRLEVEL_LOW, mp, dicp);
                        xfs_buf_relse(bp);
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                               "xfs_inode_recover: Bad dir inode log record, rec ptr 0x%p, ino ptr = 0x%p, ino bp = 0x%p, ino %Ld",
-                               item, dip, bp, in_f->ilf_ino);
+                       xfs_alert(mp,
+               "%s: Bad dir inode log record, rec ptr 0x%p, "
+               "ino ptr = 0x%p, ino bp = 0x%p, ino %Ld",
+                               __func__, item, dip, bp, in_f->ilf_ino);
                        error = EFSCORRUPTED;
                        goto error;
                }
@@ -2287,9 +2290,10 @@ xlog_recover_inode_pass2(
                XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(5)",
                                     XFS_ERRLEVEL_LOW, mp, dicp);
                xfs_buf_relse(bp);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_inode_recover: Bad inode log record, rec ptr 0x%p, dino ptr 0x%p, dino bp 0x%p, ino %Ld, total extents = %d, nblocks = %Ld",
-                       item, dip, bp, in_f->ilf_ino,
+               xfs_alert(mp,
+       "%s: Bad inode log record, rec ptr 0x%p, dino ptr 0x%p, "
+       "dino bp 0x%p, ino %Ld, total extents = %d, nblocks = %Ld",
+                       __func__, item, dip, bp, in_f->ilf_ino,
                        dicp->di_nextents + dicp->di_anextents,
                        dicp->di_nblocks);
                error = EFSCORRUPTED;
@@ -2299,8 +2303,9 @@ xlog_recover_inode_pass2(
                XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(6)",
                                     XFS_ERRLEVEL_LOW, mp, dicp);
                xfs_buf_relse(bp);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_inode_recover: Bad inode log rec ptr 0x%p, dino ptr 0x%p, dino bp 0x%p, ino %Ld, forkoff 0x%x",
+               xfs_alert(mp,
+       "%s: Bad inode log record, rec ptr 0x%p, dino ptr 0x%p, "
+       "dino bp 0x%p, ino %Ld, forkoff 0x%x", __func__,
                        item, dip, bp, in_f->ilf_ino, dicp->di_forkoff);
                error = EFSCORRUPTED;
                goto error;
@@ -2309,9 +2314,9 @@ xlog_recover_inode_pass2(
                XFS_CORRUPTION_ERROR("xlog_recover_inode_pass2(7)",
                                     XFS_ERRLEVEL_LOW, mp, dicp);
                xfs_buf_relse(bp);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_inode_recover: Bad inode log record length %d, rec ptr 0x%p",
-                       item->ri_buf[1].i_len, item);
+               xfs_alert(mp,
+                       "%s: Bad inode log record length %d, rec ptr 0x%p",
+                       __func__, item->ri_buf[1].i_len, item);
                error = EFSCORRUPTED;
                goto error;
        }
@@ -2398,7 +2403,7 @@ xlog_recover_inode_pass2(
                        break;
 
                default:
-                       xlog_warn("XFS: xlog_recover_inode_pass2: Invalid flag");
+                       xfs_warn(log->l_mp, "%s: Invalid flag", __func__);
                        ASSERT(0);
                        xfs_buf_relse(bp);
                        error = EIO;
@@ -2467,13 +2472,11 @@ xlog_recover_dquot_pass2(
 
        recddq = item->ri_buf[1].i_addr;
        if (recddq == NULL) {
-               cmn_err(CE_ALERT,
-                       "XFS: NULL dquot in %s.", __func__);
+               xfs_alert(log->l_mp, "NULL dquot in %s.", __func__);
                return XFS_ERROR(EIO);
        }
        if (item->ri_buf[1].i_len < sizeof(xfs_disk_dquot_t)) {
-               cmn_err(CE_ALERT,
-                       "XFS: dquot too small (%d) in %s.",
+               xfs_alert(log->l_mp, "dquot too small (%d) in %s.",
                        item->ri_buf[1].i_len, __func__);
                return XFS_ERROR(EIO);
        }
@@ -2498,12 +2501,10 @@ xlog_recover_dquot_pass2(
         */
        dq_f = item->ri_buf[0].i_addr;
        ASSERT(dq_f);
-       if ((error = xfs_qm_dqcheck(recddq,
-                          dq_f->qlf_id,
-                          0, XFS_QMOPT_DOWARN,
-                          "xlog_recover_dquot_pass2 (log copy)"))) {
+       error = xfs_qm_dqcheck(mp, recddq, dq_f->qlf_id, 0, XFS_QMOPT_DOWARN,
+                          "xlog_recover_dquot_pass2 (log copy)");
+       if (error)
                return XFS_ERROR(EIO);
-       }
        ASSERT(dq_f->qlf_len == 1);
 
        error = xfs_read_buf(mp, mp->m_ddev_targp,
@@ -2523,8 +2524,9 @@ xlog_recover_dquot_pass2(
         * was among a chunk of dquots created earlier, and we did some
         * minimal initialization then.
         */
-       if (xfs_qm_dqcheck(ddq, dq_f->qlf_id, 0, XFS_QMOPT_DOWARN,
-                          "xlog_recover_dquot_pass2")) {
+       error = xfs_qm_dqcheck(mp, ddq, dq_f->qlf_id, 0, XFS_QMOPT_DOWARN,
+                          "xlog_recover_dquot_pass2");
+       if (error) {
                xfs_buf_relse(bp);
                return XFS_ERROR(EIO);
        }
@@ -2676,9 +2678,8 @@ xlog_recover_commit_pass1(
                /* nothing to do in pass 1 */
                return 0;
        default:
-               xlog_warn(
-       "XFS: invalid item type (%d) xlog_recover_commit_pass1",
-                       ITEM_TYPE(item));
+               xfs_warn(log->l_mp, "%s: invalid item type (%d)",
+                       __func__, ITEM_TYPE(item));
                ASSERT(0);
                return XFS_ERROR(EIO);
        }
@@ -2707,9 +2708,8 @@ xlog_recover_commit_pass2(
                /* nothing to do in pass2 */
                return 0;
        default:
-               xlog_warn(
-       "XFS: invalid item type (%d) xlog_recover_commit_pass2",
-                       ITEM_TYPE(item));
+               xfs_warn(log->l_mp, "%s: invalid item type (%d)",
+                       __func__, ITEM_TYPE(item));
                ASSERT(0);
                return XFS_ERROR(EIO);
        }
@@ -2751,10 +2751,11 @@ xlog_recover_commit_trans(
 
 STATIC int
 xlog_recover_unmount_trans(
+       struct log              *log,
        xlog_recover_t          *trans)
 {
        /* Do nothing now */
-       xlog_warn("XFS: xlog_recover_unmount_trans: Unmount LR");
+       xfs_warn(log->l_mp, "%s: Unmount LR", __func__);
        return 0;
 }
 
@@ -2797,8 +2798,8 @@ xlog_recover_process_data(
                dp += sizeof(xlog_op_header_t);
                if (ohead->oh_clientid != XFS_TRANSACTION &&
                    ohead->oh_clientid != XFS_LOG) {
-                       xlog_warn(
-               "XFS: xlog_recover_process_data: bad clientid");
+                       xfs_warn(log->l_mp, "%s: bad clientid 0x%x",
+                                       __func__, ohead->oh_clientid);
                        ASSERT(0);
                        return (XFS_ERROR(EIO));
                }
@@ -2811,8 +2812,8 @@ xlog_recover_process_data(
                                        be64_to_cpu(rhead->h_lsn));
                } else {
                        if (dp + be32_to_cpu(ohead->oh_len) > lp) {
-                               xlog_warn(
-                       "XFS: xlog_recover_process_data: bad length");
+                               xfs_warn(log->l_mp, "%s: bad length 0x%x",
+                                       __func__, be32_to_cpu(ohead->oh_len));
                                WARN_ON(1);
                                return (XFS_ERROR(EIO));
                        }
@@ -2825,7 +2826,7 @@ xlog_recover_process_data(
                                                                trans, pass);
                                break;
                        case XLOG_UNMOUNT_TRANS:
-                               error = xlog_recover_unmount_trans(trans);
+                               error = xlog_recover_unmount_trans(log, trans);
                                break;
                        case XLOG_WAS_CONT_TRANS:
                                error = xlog_recover_add_to_cont_trans(log,
@@ -2833,8 +2834,8 @@ xlog_recover_process_data(
                                                be32_to_cpu(ohead->oh_len));
                                break;
                        case XLOG_START_TRANS:
-                               xlog_warn(
-                       "XFS: xlog_recover_process_data: bad transaction");
+                               xfs_warn(log->l_mp, "%s: bad transaction",
+                                       __func__);
                                ASSERT(0);
                                error = XFS_ERROR(EIO);
                                break;
@@ -2844,8 +2845,8 @@ xlog_recover_process_data(
                                                dp, be32_to_cpu(ohead->oh_len));
                                break;
                        default:
-                               xlog_warn(
-                       "XFS: xlog_recover_process_data: bad flag");
+                               xfs_warn(log->l_mp, "%s: bad flag 0x%x",
+                                       __func__, flags);
                                ASSERT(0);
                                error = XFS_ERROR(EIO);
                                break;
@@ -3030,8 +3031,7 @@ xlog_recover_clear_agi_bucket(
 out_abort:
        xfs_trans_cancel(tp, XFS_TRANS_ABORT);
 out_error:
-       xfs_fs_cmn_err(CE_WARN, mp, "xlog_recover_clear_agi_bucket: "
-                       "failed to clear agi %d. Continuing.", agno);
+       xfs_warn(mp, "%s: failed to clear agi %d. Continuing.", __func__, agno);
        return;
 }
 
@@ -3282,7 +3282,7 @@ xlog_valid_rec_header(
        if (unlikely(
            (!rhead->h_version ||
            (be32_to_cpu(rhead->h_version) & (~XLOG_VERSION_OKBITS))))) {
-               xlog_warn("XFS: %s: unrecognised log version (%d).",
+               xfs_warn(log->l_mp, "%s: unrecognised log version (%d).",
                        __func__, be32_to_cpu(rhead->h_version));
                return XFS_ERROR(EIO);
        }
@@ -3740,10 +3740,9 @@ xlog_recover(
                        return error;
                }
 
-               cmn_err(CE_NOTE,
-                       "Starting XFS recovery on filesystem: %s (logdev: %s)",
-                       log->l_mp->m_fsname, log->l_mp->m_logname ?
-                       log->l_mp->m_logname : "internal");
+               xfs_notice(log->l_mp, "Starting recovery (logdev: %s)",
+                               log->l_mp->m_logname ? log->l_mp->m_logname
+                                                    : "internal");
 
                error = xlog_do_recover(log, head_blk, tail_blk);
                log->l_flags |= XLOG_RECOVERY_NEEDED;
@@ -3776,9 +3775,7 @@ xlog_recover_finish(
                int     error;
                error = xlog_recover_process_efis(log);
                if (error) {
-                       cmn_err(CE_ALERT,
-                               "Failed to recover EFIs on filesystem: %s",
-                               log->l_mp->m_fsname);
+                       xfs_alert(log->l_mp, "Failed to recover EFIs");
                        return error;
                }
                /*
@@ -3793,15 +3790,12 @@ xlog_recover_finish(
 
                xlog_recover_check_summary(log);
 
-               cmn_err(CE_NOTE,
-                       "Ending XFS recovery on filesystem: %s (logdev: %s)",
-                       log->l_mp->m_fsname, log->l_mp->m_logname ?
-                       log->l_mp->m_logname : "internal");
+               xfs_notice(log->l_mp, "Ending recovery (logdev: %s)",
+                               log->l_mp->m_logname ? log->l_mp->m_logname
+                                                    : "internal");
                log->l_flags &= ~XLOG_RECOVERY_NEEDED;
        } else {
-               cmn_err(CE_DEBUG,
-                       "Ending clean XFS mount for filesystem: %s\n",
-                       log->l_mp->m_fsname);
+               xfs_info(log->l_mp, "Ending clean mount");
        }
        return 0;
 }
@@ -3834,10 +3828,8 @@ xlog_recover_check_summary(
        for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
                error = xfs_read_agf(mp, NULL, agno, 0, &agfbp);
                if (error) {
-                       xfs_fs_cmn_err(CE_ALERT, mp,
-                                       "xlog_recover_check_summary(agf)"
-                                       "agf read failed agno %d error %d",
-                                                       agno, error);
+                       xfs_alert(mp, "%s agf read failed agno %d error %d",
+                                               __func__, agno, error);
                } else {
                        agfp = XFS_BUF_TO_AGF(agfbp);
                        freeblks += be32_to_cpu(agfp->agf_freeblks) +
@@ -3846,7 +3838,10 @@ xlog_recover_check_summary(
                }
 
                error = xfs_read_agi(mp, NULL, agno, &agibp);
-               if (!error) {
+               if (error) {
+                       xfs_alert(mp, "%s agi read failed agno %d error %d",
+                                               __func__, agno, error);
+               } else {
                        struct xfs_agi  *agi = XFS_BUF_TO_AGI(agibp);
 
                        itotal += be32_to_cpu(agi->agi_count);
index d447aef84bc3a552fe44fdd1559bbf05d3f5f17f..bb3f9a7b24ed7b6d36ef5536ea9d0b4020d9725e 100644 (file)
@@ -133,9 +133,7 @@ xfs_uuid_mount(
                return 0;
 
        if (uuid_is_nil(uuid)) {
-               cmn_err(CE_WARN,
-                       "XFS: Filesystem %s has nil UUID - can't mount",
-                       mp->m_fsname);
+               xfs_warn(mp, "Filesystem has nil UUID - can't mount");
                return XFS_ERROR(EINVAL);
        }
 
@@ -163,8 +161,7 @@ xfs_uuid_mount(
 
  out_duplicate:
        mutex_unlock(&xfs_uuid_table_mutex);
-       cmn_err(CE_WARN, "XFS: Filesystem %s has duplicate UUID - can't mount",
-                        mp->m_fsname);
+       xfs_warn(mp, "Filesystem has duplicate UUID - can't mount");
        return XFS_ERROR(EINVAL);
 }
 
@@ -311,6 +308,8 @@ xfs_mount_validate_sb(
        xfs_sb_t        *sbp,
        int             flags)
 {
+       int             loud = !(flags & XFS_MFSI_QUIET);
+
        /*
         * If the log device and data device have the
         * same device number, the log is internal.
@@ -319,28 +318,32 @@ xfs_mount_validate_sb(
         * a volume filesystem in a non-volume manner.
         */
        if (sbp->sb_magicnum != XFS_SB_MAGIC) {
-               xfs_fs_mount_cmn_err(flags, "bad magic number");
+               if (loud)
+                       xfs_warn(mp, "bad magic number");
                return XFS_ERROR(EWRONGFS);
        }
 
        if (!xfs_sb_good_version(sbp)) {
-               xfs_fs_mount_cmn_err(flags, "bad version");
+               if (loud)
+                       xfs_warn(mp, "bad version");
                return XFS_ERROR(EWRONGFS);
        }
 
        if (unlikely(
            sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "filesystem is marked as having an external log; "
-                       "specify logdev on the\nmount command line.");
+               if (loud)
+                       xfs_warn(mp,
+               "filesystem is marked as having an external log; "
+               "specify logdev on the mount command line.");
                return XFS_ERROR(EINVAL);
        }
 
        if (unlikely(
            sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "filesystem is marked as having an internal log; "
-                       "do not specify logdev on\nthe mount command line.");
+               if (loud)
+                       xfs_warn(mp,
+               "filesystem is marked as having an internal log; "
+               "do not specify logdev on the mount command line.");
                return XFS_ERROR(EINVAL);
        }
 
@@ -369,7 +372,8 @@ xfs_mount_validate_sb(
            (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE)  ||
            (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE)  ||
            (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) {
-               xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed");
+               if (loud)
+                       xfs_warn(mp, "SB sanity check 1 failed");
                return XFS_ERROR(EFSCORRUPTED);
        }
 
@@ -382,7 +386,8 @@ xfs_mount_validate_sb(
             (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks ||
            sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) *
                              sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) {
-               xfs_fs_mount_cmn_err(flags, "SB sanity check 2 failed");
+               if (loud)
+                       xfs_warn(mp, "SB sanity check 2 failed");
                return XFS_ERROR(EFSCORRUPTED);
        }
 
@@ -390,12 +395,12 @@ xfs_mount_validate_sb(
         * Until this is fixed only page-sized or smaller data blocks work.
         */
        if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "file system with blocksize %d bytes",
-                       sbp->sb_blocksize);
-               xfs_fs_mount_cmn_err(flags,
-                       "only pagesize (%ld) or less will currently work.",
-                       PAGE_SIZE);
+               if (loud) {
+                       xfs_warn(mp,
+               "File system with blocksize %d bytes. "
+               "Only pagesize (%ld) or less will currently work.",
+                               sbp->sb_blocksize, PAGE_SIZE);
+               }
                return XFS_ERROR(ENOSYS);
        }
 
@@ -409,21 +414,23 @@ xfs_mount_validate_sb(
        case 2048:
                break;
        default:
-               xfs_fs_mount_cmn_err(flags,
-                       "inode size of %d bytes not supported",
-                       sbp->sb_inodesize);
+               if (loud)
+                       xfs_warn(mp, "inode size of %d bytes not supported",
+                               sbp->sb_inodesize);
                return XFS_ERROR(ENOSYS);
        }
 
        if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
            xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
-               xfs_fs_mount_cmn_err(flags,
-                       "file system too large to be mounted on this system.");
+               if (loud)
+                       xfs_warn(mp,
+               "file system too large to be mounted on this system.");
                return XFS_ERROR(EFBIG);
        }
 
        if (unlikely(sbp->sb_inprogress)) {
-               xfs_fs_mount_cmn_err(flags, "file system busy");
+               if (loud)
+                       xfs_warn(mp, "file system busy");
                return XFS_ERROR(EFSCORRUPTED);
        }
 
@@ -431,8 +438,9 @@ xfs_mount_validate_sb(
         * Version 1 directory format has never worked on Linux.
         */
        if (unlikely(!xfs_sb_version_hasdirv2(sbp))) {
-               xfs_fs_mount_cmn_err(flags,
-                       "file system using version 1 directory format");
+               if (loud)
+                       xfs_warn(mp,
+                               "file system using version 1 directory format");
                return XFS_ERROR(ENOSYS);
        }
 
@@ -673,6 +681,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
        unsigned int    sector_size;
        xfs_buf_t       *bp;
        int             error;
+       int             loud = !(flags & XFS_MFSI_QUIET);
 
        ASSERT(mp->m_sb_bp == NULL);
        ASSERT(mp->m_ddev_targp != NULL);
@@ -688,7 +697,8 @@ reread:
        bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
                                        XFS_SB_DADDR, sector_size, 0);
        if (!bp) {
-               xfs_fs_mount_cmn_err(flags, "SB buffer read failed");
+               if (loud)
+                       xfs_warn(mp, "SB buffer read failed");
                return EIO;
        }
 
@@ -699,7 +709,8 @@ reread:
        xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
        error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags);
        if (error) {
-               xfs_fs_mount_cmn_err(flags, "SB validate failed");
+               if (loud)
+                       xfs_warn(mp, "SB validate failed");
                goto release_buf;
        }
 
@@ -707,9 +718,9 @@ reread:
         * We must be able to do sector-sized and sector-aligned IO.
         */
        if (sector_size > mp->m_sb.sb_sectsize) {
-               xfs_fs_mount_cmn_err(flags,
-                       "device supports only %u byte sectors (not %u)",
-                       sector_size, mp->m_sb.sb_sectsize);
+               if (loud)
+                       xfs_warn(mp, "device supports %u byte sectors (not %u)",
+                               sector_size, mp->m_sb.sb_sectsize);
                error = ENOSYS;
                goto release_buf;
        }
@@ -853,8 +864,7 @@ xfs_update_alignment(xfs_mount_t *mp)
                if ((BBTOB(mp->m_dalign) & mp->m_blockmask) ||
                    (BBTOB(mp->m_swidth) & mp->m_blockmask)) {
                        if (mp->m_flags & XFS_MOUNT_RETERR) {
-                               cmn_err(CE_WARN,
-                                       "XFS: alignment check 1 failed");
+                               xfs_warn(mp, "alignment check 1 failed");
                                return XFS_ERROR(EINVAL);
                        }
                        mp->m_dalign = mp->m_swidth = 0;
@@ -867,8 +877,9 @@ xfs_update_alignment(xfs_mount_t *mp)
                                if (mp->m_flags & XFS_MOUNT_RETERR) {
                                        return XFS_ERROR(EINVAL);
                                }
-                               xfs_fs_cmn_err(CE_WARN, mp,
-"stripe alignment turned off: sunit(%d)/swidth(%d) incompatible with agsize(%d)",
+                               xfs_warn(mp,
+               "stripe alignment turned off: sunit(%d)/swidth(%d) "
+               "incompatible with agsize(%d)",
                                        mp->m_dalign, mp->m_swidth,
                                        sbp->sb_agblocks);
 
@@ -878,9 +889,9 @@ xfs_update_alignment(xfs_mount_t *mp)
                                mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
                        } else {
                                if (mp->m_flags & XFS_MOUNT_RETERR) {
-                                       xfs_fs_cmn_err(CE_WARN, mp,
-"stripe alignment turned off: sunit(%d) less than bsize(%d)",
-                                               mp->m_dalign,
+                                       xfs_warn(mp,
+               "stripe alignment turned off: sunit(%d) less than bsize(%d)",
+                                               mp->m_dalign,
                                                mp->m_blockmask +1);
                                        return XFS_ERROR(EINVAL);
                                }
@@ -1026,14 +1037,14 @@ xfs_check_sizes(xfs_mount_t *mp)
 
        d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
        if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
-               cmn_err(CE_WARN, "XFS: filesystem size mismatch detected");
+               xfs_warn(mp, "filesystem size mismatch detected");
                return XFS_ERROR(EFBIG);
        }
        bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
                                        d - XFS_FSS_TO_BB(mp, 1),
                                        BBTOB(XFS_FSS_TO_BB(mp, 1)), 0);
        if (!bp) {
-               cmn_err(CE_WARN, "XFS: last sector read failed");
+               xfs_warn(mp, "last sector read failed");
                return EIO;
        }
        xfs_buf_relse(bp);
@@ -1041,14 +1052,14 @@ xfs_check_sizes(xfs_mount_t *mp)
        if (mp->m_logdev_targp != mp->m_ddev_targp) {
                d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
                if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
-                       cmn_err(CE_WARN, "XFS: log size mismatch detected");
+                       xfs_warn(mp, "log size mismatch detected");
                        return XFS_ERROR(EFBIG);
                }
                bp = xfs_buf_read_uncached(mp, mp->m_logdev_targp,
                                        d - XFS_FSB_TO_BB(mp, 1),
                                        XFS_FSB_TO_B(mp, 1), 0);
                if (!bp) {
-                       cmn_err(CE_WARN, "XFS: log device read failed");
+                       xfs_warn(mp, "log device read failed");
                        return EIO;
                }
                xfs_buf_relse(bp);
@@ -1086,7 +1097,7 @@ xfs_mount_reset_sbqflags(
                return 0;
 
 #ifdef QUOTADEBUG
-       xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
+       xfs_notice(mp, "Writing superblock quota changes");
 #endif
 
        tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
@@ -1094,8 +1105,7 @@ xfs_mount_reset_sbqflags(
                                      XFS_DEFAULT_LOG_COUNT);
        if (error) {
                xfs_trans_cancel(tp, 0);
-               xfs_fs_cmn_err(CE_ALERT, mp,
-                       "xfs_mount_reset_sbqflags: Superblock update failed!");
+               xfs_alert(mp, "%s: Superblock update failed!", __func__);
                return error;
        }
 
@@ -1161,8 +1171,7 @@ xfs_mountfs(
         * transaction subsystem is online.
         */
        if (xfs_sb_has_mismatched_features2(sbp)) {
-               cmn_err(CE_WARN,
-                       "XFS: correcting sb_features alignment problem");
+               xfs_warn(mp, "correcting sb_features alignment problem");
                sbp->sb_features2 |= sbp->sb_bad_features2;
                sbp->sb_bad_features2 = sbp->sb_features2;
                mp->m_update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
@@ -1241,7 +1250,7 @@ xfs_mountfs(
         */
        error = xfs_rtmount_init(mp);
        if (error) {
-               cmn_err(CE_WARN, "XFS: RT mount failed");
+               xfs_warn(mp, "RT mount failed");
                goto out_remove_uuid;
        }
 
@@ -1272,12 +1281,12 @@ xfs_mountfs(
        INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC);
        error = xfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi);
        if (error) {
-               cmn_err(CE_WARN, "XFS: Failed per-ag init: %d", error);
+               xfs_warn(mp, "Failed per-ag init: %d", error);
                goto out_remove_uuid;
        }
 
        if (!sbp->sb_logblocks) {
-               cmn_err(CE_WARN, "XFS: no log defined");
+               xfs_warn(mp, "no log defined");
                XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp);
                error = XFS_ERROR(EFSCORRUPTED);
                goto out_free_perag;
@@ -1290,7 +1299,7 @@ xfs_mountfs(
                              XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
                              XFS_FSB_TO_BB(mp, sbp->sb_logblocks));
        if (error) {
-               cmn_err(CE_WARN, "XFS: log mount failed");
+               xfs_warn(mp, "log mount failed");
                goto out_free_perag;
        }
 
@@ -1327,16 +1336,14 @@ xfs_mountfs(
         */
        error = xfs_iget(mp, NULL, sbp->sb_rootino, 0, XFS_ILOCK_EXCL, &rip);
        if (error) {
-               cmn_err(CE_WARN, "XFS: failed to read root inode");
+               xfs_warn(mp, "failed to read root inode");
                goto out_log_dealloc;
        }
 
        ASSERT(rip != NULL);
 
        if (unlikely((rip->i_d.di_mode & S_IFMT) != S_IFDIR)) {
-               cmn_err(CE_WARN, "XFS: corrupted root inode");
-               cmn_err(CE_WARN, "Device %s - root %llu is not a directory",
-                       XFS_BUFTARG_NAME(mp->m_ddev_targp),
+               xfs_warn(mp, "corrupted root inode %llu: not a directory",
                        (unsigned long long)rip->i_ino);
                xfs_iunlock(rip, XFS_ILOCK_EXCL);
                XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW,
@@ -1356,7 +1363,7 @@ xfs_mountfs(
                /*
                 * Free up the root inode.
                 */
-               cmn_err(CE_WARN, "XFS: failed to read RT inodes");
+               xfs_warn(mp, "failed to read RT inodes");
                goto out_rele_rip;
        }
 
@@ -1368,7 +1375,7 @@ xfs_mountfs(
        if (mp->m_update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) {
                error = xfs_mount_log_sb(mp, mp->m_update_flags);
                if (error) {
-                       cmn_err(CE_WARN, "XFS: failed to write sb changes");
+                       xfs_warn(mp, "failed to write sb changes");
                        goto out_rtunmount;
                }
        }
@@ -1389,10 +1396,7 @@ xfs_mountfs(
                 * quotachecked license.
                 */
                if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) {
-                       cmn_err(CE_NOTE,
-                               "XFS: resetting qflags for filesystem %s",
-                               mp->m_fsname);
-
+                       xfs_notice(mp, "resetting quota flags");
                        error = xfs_mount_reset_sbqflags(mp);
                        if (error)
                                return error;
@@ -1406,7 +1410,7 @@ xfs_mountfs(
         */
        error = xfs_log_mount_finish(mp);
        if (error) {
-               cmn_err(CE_WARN, "XFS: log mount finish failed");
+               xfs_warn(mp, "log mount finish failed");
                goto out_rtunmount;
        }
 
@@ -1435,8 +1439,8 @@ xfs_mountfs(
                resblks = xfs_default_resblks(mp);
                error = xfs_reserve_blocks(mp, &resblks, NULL);
                if (error)
-                       cmn_err(CE_WARN, "XFS: Unable to allocate reserve "
-                               "blocks. Continuing without a reserve pool.");
+                       xfs_warn(mp,
+       "Unable to allocate reserve blocks. Continuing without reserve pool.");
        }
 
        return 0;
@@ -1525,12 +1529,12 @@ xfs_unmountfs(
        resblks = 0;
        error = xfs_reserve_blocks(mp, &resblks, NULL);
        if (error)
-               cmn_err(CE_WARN, "XFS: Unable to free reserved block pool. "
+               xfs_warn(mp, "Unable to free reserved block pool. "
                                "Freespace may not be correct on next mount.");
 
        error = xfs_log_sbcount(mp, 1);
        if (error)
-               cmn_err(CE_WARN, "XFS: Unable to update superblock counters. "
+               xfs_warn(mp, "Unable to update superblock counters. "
                                "Freespace may not be correct on next mount.");
        xfs_unmountfs_writesb(mp);
        xfs_unmountfs_wait(mp);                 /* wait for async bufs */
@@ -2013,10 +2017,8 @@ xfs_dev_is_read_only(
        if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
            xfs_readonly_buftarg(mp->m_logdev_targp) ||
            (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
-               cmn_err(CE_NOTE,
-                       "XFS: %s required on read-only device.", message);
-               cmn_err(CE_NOTE,
-                       "XFS: write access unavailable, cannot proceed.");
+               xfs_notice(mp, "%s required on read-only device.", message);
+               xfs_notice(mp, "write access unavailable, cannot proceed.");
                return EROFS;
        }
        return 0;
index 9bb6eda4cd215903077612233bf3b6c0d1577327..a595f29567fedda40964ae11eb1e885859acb238 100644 (file)
@@ -382,7 +382,8 @@ static inline int xfs_qm_sync(struct xfs_mount *mp, int flags)
        xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \
                                f | XFS_QMOPT_RES_REGBLKS)
 
-extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *);
+extern int xfs_qm_dqcheck(struct xfs_mount *, xfs_disk_dquot_t *,
+                               xfs_dqid_t, uint, uint, char *);
 extern int xfs_mount_reset_sbqflags(struct xfs_mount *);
 
 #endif /* __KERNEL__ */
index 12a19138531048555651e28330ade938a1b2b36f..8f76fdff4f4688484fac811a23f97cf23f91d23a 100644 (file)
@@ -76,7 +76,7 @@ xfs_growfs_rt_alloc(
        xfs_mount_t     *mp,            /* file system mount point */
        xfs_extlen_t    oblocks,        /* old count of blocks */
        xfs_extlen_t    nblocks,        /* new count of blocks */
-       xfs_ino_t       ino)            /* inode number (bitmap/summary) */
+       xfs_inode_t     *ip)            /* inode (bitmap/summary) */
 {
        xfs_fileoff_t   bno;            /* block number in file */
        xfs_buf_t       *bp;            /* temporary buffer for zeroing */
@@ -86,7 +86,6 @@ xfs_growfs_rt_alloc(
        xfs_fsblock_t   firstblock;     /* first block allocated in xaction */
        xfs_bmap_free_t flist;          /* list of freed blocks */
        xfs_fsblock_t   fsbno;          /* filesystem block for bno */
-       xfs_inode_t     *ip;            /* pointer to incore inode */
        xfs_bmbt_irec_t map;            /* block map output */
        int             nmap;           /* number of block maps */
        int             resblks;        /* space reservation */
@@ -112,9 +111,9 @@ xfs_growfs_rt_alloc(
                /*
                 * Lock the inode.
                 */
-               if ((error = xfs_trans_iget(mp, tp, ino, 0,
-                                               XFS_ILOCK_EXCL, &ip)))
-                       goto error_cancel;
+               xfs_ilock(ip, XFS_ILOCK_EXCL);
+               xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
+
                xfs_bmap_init(&flist, &firstblock);
                /*
                 * Allocate blocks to the bitmap file.
@@ -155,9 +154,8 @@ xfs_growfs_rt_alloc(
                        /*
                         * Lock the bitmap inode.
                         */
-                       if ((error = xfs_trans_iget(mp, tp, ino, 0,
-                                                       XFS_ILOCK_EXCL, &ip)))
-                               goto error_cancel;
+                       xfs_ilock(ip, XFS_ILOCK_EXCL);
+                       xfs_trans_ijoin_ref(tp, ip, XFS_ILOCK_EXCL);
                        /*
                         * Get a buffer for the block.
                         */
@@ -1854,7 +1852,6 @@ xfs_growfs_rt(
        xfs_rtblock_t   bmbno;          /* bitmap block number */
        xfs_buf_t       *bp;            /* temporary buffer */
        int             error;          /* error return value */
-       xfs_inode_t     *ip;            /* bitmap inode, used as lock */
        xfs_mount_t     *nmp;           /* new (fake) mount structure */
        xfs_drfsbno_t   nrblocks;       /* new number of realtime blocks */
        xfs_extlen_t    nrbmblocks;     /* new number of rt bitmap blocks */
@@ -1918,11 +1915,11 @@ xfs_growfs_rt(
        /*
         * Allocate space to the bitmap and summary files, as necessary.
         */
-       if ((error = xfs_growfs_rt_alloc(mp, rbmblocks, nrbmblocks,
-                       mp->m_sb.sb_rbmino)))
+       error = xfs_growfs_rt_alloc(mp, rbmblocks, nrbmblocks, mp->m_rbmip);
+       if (error)
                return error;
-       if ((error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks,
-                       mp->m_sb.sb_rsumino)))
+       error = xfs_growfs_rt_alloc(mp, rsumblocks, nrsumblocks, mp->m_rsumip);
+       if (error)
                return error;
        /*
         * Allocate a new (fake) mount/sb.
@@ -1972,10 +1969,8 @@ xfs_growfs_rt(
                /*
                 * Lock out other callers by grabbing the bitmap inode lock.
                 */
-               if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
-                                               XFS_ILOCK_EXCL, &ip)))
-                       goto error_cancel;
-               ASSERT(ip == mp->m_rbmip);
+               xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
+               xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
                /*
                 * Update the bitmap inode's size.
                 */
@@ -1986,10 +1981,8 @@ xfs_growfs_rt(
                /*
                 * Get the summary inode into the transaction.
                 */
-               if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rsumino, 0,
-                                               XFS_ILOCK_EXCL, &ip)))
-                       goto error_cancel;
-               ASSERT(ip == mp->m_rsumip);
+               xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL);
+               xfs_trans_ijoin_ref(tp, mp->m_rsumip, XFS_ILOCK_EXCL);
                /*
                 * Update the summary inode's size.
                 */
@@ -2075,15 +2068,15 @@ xfs_rtallocate_extent(
        xfs_extlen_t    prod,           /* extent product factor */
        xfs_rtblock_t   *rtblock)       /* out: start block allocated */
 {
+       xfs_mount_t     *mp = tp->t_mountp;
        int             error;          /* error value */
-       xfs_inode_t     *ip;            /* inode for bitmap file */
-       xfs_mount_t     *mp;            /* file system mount structure */
        xfs_rtblock_t   r;              /* result allocated block */
        xfs_fsblock_t   sb;             /* summary file block number */
        xfs_buf_t       *sumbp;         /* summary file block buffer */
 
+       ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
        ASSERT(minlen > 0 && minlen <= maxlen);
-       mp = tp->t_mountp;
+
        /*
         * If prod is set then figure out what to do to minlen and maxlen.
         */
@@ -2099,12 +2092,7 @@ xfs_rtallocate_extent(
                        return 0;
                }
        }
-       /*
-        * Lock out other callers by grabbing the bitmap inode lock.
-        */
-       if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
-                                       XFS_ILOCK_EXCL, &ip)))
-               return error;
+
        sumbp = NULL;
        /*
         * Allocate by size, or near another block, or exactly at some block.
@@ -2123,11 +2111,12 @@ xfs_rtallocate_extent(
                                len, &sumbp, &sb, prod, &r);
                break;
        default:
+               error = EIO;
                ASSERT(0);
        }
-       if (error) {
+       if (error)
                return error;
-       }
+
        /*
         * If it worked, update the superblock.
         */
@@ -2155,7 +2144,6 @@ xfs_rtfree_extent(
        xfs_extlen_t    len)            /* length of extent freed */
 {
        int             error;          /* error value */
-       xfs_inode_t     *ip;            /* bitmap file inode */
        xfs_mount_t     *mp;            /* file system mount structure */
        xfs_fsblock_t   sb;             /* summary file block number */
        xfs_buf_t       *sumbp;         /* summary file block buffer */
@@ -2164,9 +2152,9 @@ xfs_rtfree_extent(
        /*
         * Synchronize by locking the bitmap inode.
         */
-       if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
-                                       XFS_ILOCK_EXCL, &ip)))
-               return error;
+       xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
+       xfs_trans_ijoin_ref(tp, mp->m_rbmip, XFS_ILOCK_EXCL);
+
 #if defined(__KERNEL__) && defined(DEBUG)
        /*
         * Check to see that this whole range is currently allocated.
@@ -2199,10 +2187,10 @@ xfs_rtfree_extent(
         */
        if (tp->t_frextents_delta + mp->m_sb.sb_frextents ==
            mp->m_sb.sb_rextents) {
-               if (!(ip->i_d.di_flags & XFS_DIFLAG_NEWRTBM))
-                       ip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
-               *(__uint64_t *)&ip->i_d.di_atime = 0;
-               xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+               if (!(mp->m_rbmip->i_d.di_flags & XFS_DIFLAG_NEWRTBM))
+                       mp->m_rbmip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
+               *(__uint64_t *)&mp->m_rbmip->i_d.di_atime = 0;
+               xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE);
        }
        return 0;
 }
@@ -2222,8 +2210,8 @@ xfs_rtmount_init(
        if (sbp->sb_rblocks == 0)
                return 0;
        if (mp->m_rtdev_targp == NULL) {
-               cmn_err(CE_WARN,
-       "XFS: This filesystem has a realtime volume, use rtdev=device option");
+               xfs_warn(mp,
+       "Filesystem has a realtime volume, use rtdev=device option");
                return XFS_ERROR(ENODEV);
        }
        mp->m_rsumlevels = sbp->sb_rextslog + 1;
@@ -2237,7 +2225,7 @@ xfs_rtmount_init(
         */
        d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_rblocks);
        if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_rblocks) {
-               cmn_err(CE_WARN, "XFS: realtime mount -- %llu != %llu",
+               xfs_warn(mp, "realtime mount -- %llu != %llu",
                        (unsigned long long) XFS_BB_TO_FSB(mp, d),
                        (unsigned long long) mp->m_sb.sb_rblocks);
                return XFS_ERROR(EFBIG);
@@ -2246,7 +2234,7 @@ xfs_rtmount_init(
                                        d - XFS_FSB_TO_BB(mp, 1),
                                        XFS_FSB_TO_B(mp, 1), 0);
        if (!bp) {
-               cmn_err(CE_WARN, "XFS: realtime device size check failed");
+               xfs_warn(mp, "realtime device size check failed");
                return EIO;
        }
        xfs_buf_relse(bp);
@@ -2306,20 +2294,16 @@ xfs_rtpick_extent(
        xfs_rtblock_t   *pick)          /* result rt extent */
 {
        xfs_rtblock_t   b;              /* result block */
-       int             error;          /* error return value */
-       xfs_inode_t     *ip;            /* bitmap incore inode */
        int             log2;           /* log of sequence number */
        __uint64_t      resid;          /* residual after log removed */
        __uint64_t      seq;            /* sequence number of file creation */
        __uint64_t      *seqp;          /* pointer to seqno in inode */
 
-       if ((error = xfs_trans_iget(mp, tp, mp->m_sb.sb_rbmino, 0,
-                                       XFS_ILOCK_EXCL, &ip)))
-               return error;
-       ASSERT(ip == mp->m_rbmip);
-       seqp = (__uint64_t *)&ip->i_d.di_atime;
-       if (!(ip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) {
-               ip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
+       ASSERT(xfs_isilocked(mp->m_rbmip, XFS_ILOCK_EXCL));
+
+       seqp = (__uint64_t *)&mp->m_rbmip->i_d.di_atime;
+       if (!(mp->m_rbmip->i_d.di_flags & XFS_DIFLAG_NEWRTBM)) {
+               mp->m_rbmip->i_d.di_flags |= XFS_DIFLAG_NEWRTBM;
                *seqp = 0;
        }
        seq = *seqp;
@@ -2335,7 +2319,7 @@ xfs_rtpick_extent(
                        b = mp->m_sb.sb_rextents - len;
        }
        *seqp = seq + 1;
-       xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+       xfs_trans_log_inode(tp, mp->m_rbmip, XFS_ILOG_CORE);
        *pick = b;
        return 0;
 }
index ff614c29b44142da429bb33db904afdf843469ad..09e1f4f35e971c0e1edf326cfeca9d21f67a6953 100644 (file)
@@ -154,7 +154,7 @@ xfs_rtmount_init(
        if (mp->m_sb.sb_rblocks == 0)
                return 0;
 
-       cmn_err(CE_WARN, "XFS: Not built with CONFIG_XFS_RT");
+       xfs_warn(mp, "Not built with CONFIG_XFS_RT");
        return ENOSYS;
 }
 # define xfs_rtmount_inodes(m)  (((mp)->m_sb.sb_rblocks == 0)? 0 : (ENOSYS))
index 56861d5daaef54432a94a640a7b1e65812030ef7..d6d6fdfe9422b47545de1bbeb9e6713c67be160b 100644 (file)
@@ -49,9 +49,9 @@ xfs_do_force_shutdown(
        logerror = flags & SHUTDOWN_LOG_IO_ERROR;
 
        if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
-               cmn_err(CE_NOTE, "xfs_force_shutdown(%s,0x%x) called from "
-                                "line %d of file %s.  Return address = 0x%p",
-                       mp->m_fsname, flags, lnnum, fname, __return_address);
+               xfs_notice(mp,
+       "%s(0x%x) called from line %d of file %s.  Return address = 0x%p",
+                       __func__, flags, lnnum, fname, __return_address);
        }
        /*
         * No need to duplicate efforts.
@@ -69,30 +69,25 @@ xfs_do_force_shutdown(
                return;
 
        if (flags & SHUTDOWN_CORRUPT_INCORE) {
-               xfs_cmn_err(XFS_PTAG_SHUTDOWN_CORRUPT, CE_ALERT, mp,
-    "Corruption of in-memory data detected.  Shutting down filesystem: %s",
-                       mp->m_fsname);
-               if (XFS_ERRLEVEL_HIGH <= xfs_error_level) {
+               xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_CORRUPT,
+    "Corruption of in-memory data detected.  Shutting down filesystem");
+               if (XFS_ERRLEVEL_HIGH <= xfs_error_level)
                        xfs_stack_trace();
-               }
        } else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
                if (logerror) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_LOGERROR, CE_ALERT, mp,
-               "Log I/O Error Detected.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_LOGERROR,
+               "Log I/O Error Detected.  Shutting down filesystem");
                } else if (flags & SHUTDOWN_DEVICE_REQ) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
-               "All device paths lost.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
+               "All device paths lost.  Shutting down filesystem");
                } else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
-                       xfs_cmn_err(XFS_PTAG_SHUTDOWN_IOERROR, CE_ALERT, mp,
-               "I/O Error Detected.  Shutting down filesystem: %s",
-                               mp->m_fsname);
+                       xfs_alert_tag(mp, XFS_PTAG_SHUTDOWN_IOERROR,
+               "I/O Error Detected. Shutting down filesystem");
                }
        }
        if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
-               cmn_err(CE_ALERT, "Please umount the filesystem, "
-                                 "and rectify the problem(s)");
+               xfs_alert(mp,
+       "Please umount the filesystem and rectify the problem(s)");
        }
 }
 
@@ -106,10 +101,9 @@ xfs_ioerror_alert(
        xfs_buf_t               *bp,
        xfs_daddr_t             blkno)
 {
-       cmn_err(CE_ALERT,
- "I/O error in filesystem (\"%s\") meta-data dev %s block 0x%llx"
- "       (\"%s\") error %d buf count %zd",
-               (!mp || !mp->m_fsname) ? "(fs name not set)" : mp->m_fsname,
+       xfs_alert(mp,
+                "I/O error occurred: meta-data dev %s block 0x%llx"
+                "       (\"%s\") error %d buf count %zd",
                XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
                (__uint64_t)blkno, func,
                XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp));
@@ -173,17 +167,9 @@ xfs_extlen_t
 xfs_get_extsz_hint(
        struct xfs_inode        *ip)
 {
-       xfs_extlen_t            extsz;
-
-       if (unlikely(XFS_IS_REALTIME_INODE(ip))) {
-               extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
-                               ? ip->i_d.di_extsize
-                               : ip->i_mount->m_sb.sb_rextsize;
-               ASSERT(extsz);
-       } else {
-               extsz = (ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE)
-                               ? ip->i_d.di_extsize : 0;
-       }
-
-       return extsz;
+       if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize)
+               return ip->i_d.di_extsize;
+       if (XFS_IS_REALTIME_INODE(ip))
+               return ip->i_mount->m_sb.sb_rextsize;
+       return 0;
 }
index c2042b736b81131a780703d8a5907c848793eebb..06a9759b6352aa497d64396d9ce3fa0900506d3f 100644 (file)
@@ -469,8 +469,6 @@ void                xfs_trans_inode_buf(xfs_trans_t *, struct xfs_buf *);
 void           xfs_trans_stale_inode_buf(xfs_trans_t *, struct xfs_buf *);
 void           xfs_trans_dquot_buf(xfs_trans_t *, struct xfs_buf *, uint);
 void           xfs_trans_inode_alloc_buf(xfs_trans_t *, struct xfs_buf *);
-int            xfs_trans_iget(struct xfs_mount *, xfs_trans_t *,
-                              xfs_ino_t , uint, uint, struct xfs_inode **);
 void           xfs_trans_ichgtime(struct xfs_trans *, struct xfs_inode *, int);
 void           xfs_trans_ijoin_ref(struct xfs_trans *, struct xfs_inode *, uint);
 void           xfs_trans_ijoin(struct xfs_trans *, struct xfs_inode *);
index c5bbbc45db91ed97429a043ba8144cc53509a993..12aff9584e299a2d026a84f1871c669f0fdb9a4c 100644 (file)
@@ -563,7 +563,7 @@ xfs_trans_ail_delete_bulk(
 
                        spin_unlock(&ailp->xa_lock);
                        if (!XFS_FORCED_SHUTDOWN(mp)) {
-                               xfs_cmn_err(XFS_PTAG_AILDELETE, CE_ALERT, mp,
+                               xfs_alert_tag(mp, XFS_PTAG_AILDELETE,
                "%s: attempting to delete a log item that is not in the AIL",
                                                __func__);
                                xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
index c47918c302a50593341de2add8e5072078d9804e..3bea66132334c91e83278a5c581fae7d399e1490 100644 (file)
@@ -305,7 +305,7 @@ xfs_trans_read_buf(
                        if (xfs_error_target == target) {
                                if (((xfs_req_num++) % xfs_error_mod) == 0) {
                                        xfs_buf_relse(bp);
-                                       cmn_err(CE_DEBUG, "Returning error!\n");
+                                       xfs_debug(mp, "Returning error!");
                                        return XFS_ERROR(EIO);
                                }
                        }
@@ -403,7 +403,7 @@ xfs_trans_read_buf(
                                xfs_force_shutdown(tp->t_mountp,
                                                   SHUTDOWN_META_IO_ERROR);
                                xfs_buf_relse(bp);
-                               cmn_err(CE_DEBUG, "Returning trans error!\n");
+                               xfs_debug(mp, "Returning trans error!");
                                return XFS_ERROR(EIO);
                        }
                }
@@ -427,7 +427,7 @@ shutdown_abort:
         */
 #if defined(DEBUG)
        if (XFS_BUF_ISSTALE(bp) && XFS_BUF_ISDELAYWRITE(bp))
-               cmn_err(CE_NOTE, "about to pop assert, bp == 0x%p", bp);
+               xfs_notice(mp, "about to pop assert, bp == 0x%p", bp);
 #endif
        ASSERT((XFS_BUF_BFLAGS(bp) & (XBF_STALE|XBF_DELWRI)) !=
                                     (XBF_STALE|XBF_DELWRI));
index ccb34532768bd65a1c5baa14a4a0a143df1ea2cb..16084d8ea231a0434823ef3c9007333fdbd675f7 100644 (file)
@@ -43,28 +43,6 @@ xfs_trans_inode_broot_debug(
 #define        xfs_trans_inode_broot_debug(ip)
 #endif
 
-/*
- * Get an inode and join it to the transaction.
- */
-int
-xfs_trans_iget(
-       xfs_mount_t     *mp,
-       xfs_trans_t     *tp,
-       xfs_ino_t       ino,
-       uint            flags,
-       uint            lock_flags,
-       xfs_inode_t     **ipp)
-{
-       int                     error;
-
-       error = xfs_iget(mp, tp, ino, flags, lock_flags, ipp);
-       if (!error && tp) {
-               xfs_trans_ijoin(tp, *ipp);
-               (*ipp)->i_itemp->ili_lock_flags = lock_flags;
-       }
-       return error;
-}
-
 /*
  * Add a locked inode to the transaction.
  *
index d8e6f8cd6f0c89782dd0d5df7a2e7a0329688235..37d8146ee15b2022edecce33ffc896ed84c55e59 100644 (file)
@@ -1189,9 +1189,8 @@ xfs_inactive(
                 * inode might be lost for a long time or forever.
                 */
                if (!XFS_FORCED_SHUTDOWN(mp)) {
-                       cmn_err(CE_NOTE,
-               "xfs_inactive:  xfs_ifree() returned an error = %d on %s",
-                               error, mp->m_fsname);
+                       xfs_notice(mp, "%s: xfs_ifree returned error %d",
+                               __func__, error);
                        xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
                }
                xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT);
@@ -1208,12 +1207,12 @@ xfs_inactive(
                 */
                error = xfs_bmap_finish(&tp,  &free_list, &committed);
                if (error)
-                       xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
-                               "xfs_bmap_finish() returned error %d", error);
+                       xfs_notice(mp, "%s: xfs_bmap_finish returned error %d",
+                               __func__, error);
                error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
                if (error)
-                       xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: "
-                               "xfs_trans_commit() returned error %d", error);
+                       xfs_notice(mp, "%s: xfs_trans_commit returned error %d",
+                               __func__, error);
        }
 
        /*
@@ -1310,7 +1309,7 @@ xfs_create(
        error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid,
                        XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp);
        if (error)
-               goto std_return;
+               return error;
 
        if (is_dir) {
                rdev = 0;
@@ -1389,12 +1388,6 @@ xfs_create(
                goto out_trans_abort;
        }
 
-       /*
-        * At this point, we've gotten a newly allocated inode.
-        * It is locked (and joined to the transaction).
-        */
-       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
-
        /*
         * Now we join the directory inode to the transaction.  We do not do it
         * earlier because xfs_dir_ialloc might commit the previous transaction
@@ -1440,22 +1433,13 @@ xfs_create(
         */
        xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp);
 
-       /*
-        * xfs_trans_commit normally decrements the vnode ref count
-        * when it unlocks the inode. Since we want to return the
-        * vnode to the caller, we bump the vnode ref count now.
-        */
-       IHOLD(ip);
-
        error = xfs_bmap_finish(&tp, &free_list, &committed);
        if (error)
-               goto out_abort_rele;
+               goto out_bmap_cancel;
 
        error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
-       if (error) {
-               IRELE(ip);
-               goto out_dqrele;
-       }
+       if (error)
+               goto out_release_inode;
 
        xfs_qm_dqrele(udqp);
        xfs_qm_dqrele(gdqp);
@@ -1469,27 +1453,21 @@ xfs_create(
        cancel_flags |= XFS_TRANS_ABORT;
  out_trans_cancel:
        xfs_trans_cancel(tp, cancel_flags);
- out_dqrele:
+ out_release_inode:
+       /*
+        * Wait until after the current transaction is aborted to
+        * release the inode.  This prevents recursive transactions
+        * and deadlocks from xfs_inactive.
+        */
+       if (ip)
+               IRELE(ip);
+
        xfs_qm_dqrele(udqp);
        xfs_qm_dqrele(gdqp);
 
        if (unlock_dp_on_error)
                xfs_iunlock(dp, XFS_ILOCK_EXCL);
- std_return:
        return error;
-
- out_abort_rele:
-       /*
-        * Wait until after the current transaction is aborted to
-        * release the inode.  This prevents recursive transactions
-        * and deadlocks from xfs_inactive.
-        */
-       xfs_bmap_cancel(&free_list);
-       cancel_flags |= XFS_TRANS_ABORT;
-       xfs_trans_cancel(tp, cancel_flags);
-       IRELE(ip);
-       unlock_dp_on_error = B_FALSE;
-       goto out_dqrele;
 }
 
 #ifdef DEBUG
@@ -2114,9 +2092,8 @@ xfs_symlink(
                                  XFS_BMAPI_WRITE | XFS_BMAPI_METADATA,
                                  &first_block, resblks, mval, &nmaps,
                                  &free_list);
-               if (error) {
-                       goto error1;
-               }
+               if (error)
+                       goto error2;
 
                if (resblks)
                        resblks -= fs_blocks;
@@ -2148,7 +2125,7 @@ xfs_symlink(
        error = xfs_dir_createname(tp, dp, link_name, ip->i_ino,
                                        &first_block, &free_list, resblks);
        if (error)
-               goto error1;
+               goto error2;
        xfs_trans_ichgtime(tp, dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
        xfs_trans_log_inode(tp, dp, XFS_ILOG_CORE);
 
@@ -2161,13 +2138,6 @@ xfs_symlink(
                xfs_trans_set_sync(tp);
        }
 
-       /*
-        * xfs_trans_commit normally decrements the vnode ref count
-        * when it unlocks the inode. Since we want to return the
-        * vnode to the caller, we bump the vnode ref count now.
-        */
-       IHOLD(ip);
-
        error = xfs_bmap_finish(&tp, &free_list, &committed);
        if (error) {
                goto error2;
index 57af0338d2709972d7dfee827f67da05e2efdb7d..176b825add52691cb5abb2b52780dd75923d3377 100644 (file)
@@ -650,9 +650,13 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
 __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
 #define __NR_open_by_handle_at         265
 __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
+#define __NR_clock_adjtime 266
+__SYSCALL(__NR_clock_adjtime, sys_clock_adjtime)
+#define __NR_syncfs 264
+__SYSCALL(__NR_syncfs, sys_syncfs)
 
 #undef __NR_syscalls
-#define __NR_syscalls 266
+#define __NR_syscalls 268
 
 /*
  * All syscalls below here should go away really,
index 1a87760d65322b2d0528886b3232d2707f725532..f2afed4fa9454776c79611d52755121dff749342 100644 (file)
@@ -416,7 +416,6 @@ static inline bool d_mountpoint(struct dentry *dentry)
        return dentry->d_flags & DCACHE_MOUNTED;
 }
 
-extern struct vfsmount *lookup_mnt(struct path *);
 extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
 
 extern int sysctl_vfs_cache_pressure;
index aac3e2eeb4fd626565462379c0acd7fb4d1e1c66..b297f288f6eb837415982d4eef6b3cb3fe2eb1dd 100644 (file)
@@ -13,6 +13,9 @@
 #ifndef _LINUX_ETHTOOL_H
 #define _LINUX_ETHTOOL_H
 
+#ifdef __KERNEL__
+#include <linux/compat.h>
+#endif
 #include <linux/types.h>
 #include <linux/if_ether.h>
 
@@ -450,6 +453,37 @@ struct ethtool_rxnfc {
        __u32                           rule_locs[0];
 };
 
+#ifdef __KERNEL__
+#ifdef CONFIG_COMPAT
+
+struct compat_ethtool_rx_flow_spec {
+       u32             flow_type;
+       union {
+               struct ethtool_tcpip4_spec              tcp_ip4_spec;
+               struct ethtool_tcpip4_spec              udp_ip4_spec;
+               struct ethtool_tcpip4_spec              sctp_ip4_spec;
+               struct ethtool_ah_espip4_spec           ah_ip4_spec;
+               struct ethtool_ah_espip4_spec           esp_ip4_spec;
+               struct ethtool_usrip4_spec              usr_ip4_spec;
+               struct ethhdr                           ether_spec;
+               u8                                      hdata[72];
+       } h_u, m_u;
+       compat_u64      ring_cookie;
+       u32             location;
+};
+
+struct compat_ethtool_rxnfc {
+       u32                             cmd;
+       u32                             flow_type;
+       compat_u64                      data;
+       struct compat_ethtool_rx_flow_spec fs;
+       u32                             rule_cnt;
+       u32                             rule_locs[0];
+};
+
+#endif /* CONFIG_COMPAT */
+#endif /* __KERNEL__ */
+
 /**
  * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
  * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
index fc023d67676f6e18be83551c8543806bc05e08b8..c64f3680d4f154b2bc2959380e0b04ecd5477d52 100644 (file)
@@ -93,7 +93,7 @@ struct fw_card {
        int current_tlabel;
        u64 tlabel_mask;
        struct list_head transaction_list;
-       unsigned long reset_jiffies;
+       u64 reset_jiffies;
 
        u32 split_timeout_hi;
        u32 split_timeout_lo;
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
deleted file mode 100644 (file)
index 4bef5c5..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* ------------------------------------------------------------------------- */
-/*                                                                          */
-/* i2c-id.h - identifier values for i2c drivers and adapters                */
-/*                                                                          */
-/* ------------------------------------------------------------------------- */
-/*   Copyright (C) 1995-1999 Simon G. Vogl
-
-    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 LINUX_I2C_ID_H
-#define LINUX_I2C_ID_H
-
-/* Please note that I2C driver IDs are optional. They are only needed if a
-   legacy chip driver needs to identify a bus or a bus driver needs to
-   identify a legacy client. If you don't need them, just don't set them. */
-
-/*
- * ---- Adapter types ----------------------------------------------------
- */
-
-/* --- Bit algorithm adapters                                          */
-#define I2C_HW_B_CX2388x       0x01001b /* connexant 2388x based tv cards */
-
-#endif /* LINUX_I2C_ID_H */
index 06a8d9c7de98765c3b73e1093c346de452c0fbd5..f1e3ff5880a9f1d6d505f2e1102aeceef10fdb47 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/types.h>
 #ifdef __KERNEL__
 #include <linux/module.h>
-#include <linux/i2c-id.h>
 #include <linux/mod_devicetable.h>
 #include <linux/device.h>      /* for struct device */
 #include <linux/sched.h>       /* for completion */
@@ -105,8 +104,8 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
 /**
  * struct i2c_driver - represent an I2C device driver
  * @class: What kind of i2c device we instantiate (for detect)
- * @attach_adapter: Callback for bus addition (for legacy drivers)
- * @detach_adapter: Callback for bus removal (for legacy drivers)
+ * @attach_adapter: Callback for bus addition (deprecated)
+ * @detach_adapter: Callback for bus removal (deprecated)
  * @probe: Callback for device binding
  * @remove: Callback for device unbinding
  * @shutdown: Callback for device shutdown
@@ -144,11 +143,11 @@ struct i2c_driver {
        unsigned int class;
 
        /* Notifies the driver that a new bus has appeared or is about to be
-        * removed. You should avoid using this if you can, it will probably
-        * be removed in a near future.
+        * removed. You should avoid using this, it will be removed in a
+        * near future.
         */
-       int (*attach_adapter)(struct i2c_adapter *);
-       int (*detach_adapter)(struct i2c_adapter *);
+       int (*attach_adapter)(struct i2c_adapter *) __deprecated;
+       int (*detach_adapter)(struct i2c_adapter *) __deprecated;
 
        /* Standard driver model interfaces */
        int (*probe)(struct i2c_client *, const struct i2c_device_id *);
@@ -354,7 +353,6 @@ struct i2c_algorithm {
  */
 struct i2c_adapter {
        struct module *owner;
-       unsigned int id __deprecated;
        unsigned int class;               /* classes to allow probing for */
        const struct i2c_algorithm *algo; /* the algorithm to access the bus */
        void *algo_data;
@@ -396,6 +394,8 @@ i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
                return NULL;
 }
 
+int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *));
+
 /* Adapter locking functions, exported for shared pin cases */
 void i2c_lock_adapter(struct i2c_adapter *);
 void i2c_unlock_adapter(struct i2c_adapter *);
@@ -447,7 +447,7 @@ extern void i2c_release_client(struct i2c_client *client);
 extern void i2c_clients_command(struct i2c_adapter *adap,
                                unsigned int cmd, void *arg);
 
-extern struct i2c_adapter *i2c_get_adapter(int id);
+extern struct i2c_adapter *i2c_get_adapter(int nr);
 extern void i2c_put_adapter(struct i2c_adapter *adap);
 
 
diff --git a/include/linux/i2c/ads1015.h b/include/linux/i2c/ads1015.h
new file mode 100644 (file)
index 0000000..d5aa2a0
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Platform Data for ADS1015 12-bit 4-input ADC
+ * (C) Copyright 2010
+ * Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.de>
+ *
+ * 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 LINUX_ADS1015_H
+#define LINUX_ADS1015_H
+
+#define ADS1015_CHANNELS 8
+
+struct ads1015_channel_data {
+       bool enabled;
+       unsigned int pga;
+       unsigned int data_rate;
+};
+
+struct ads1015_platform_data {
+       struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
+};
+
+#endif /* LINUX_ADS1015_H */
index fcef103aa3f602cb80c1609432911de1eee0b36b..c9ad383225763abc92d811e0011e4a7b3016f485 100644 (file)
@@ -114,14 +114,14 @@ struct pppol2tp_ioc_stats {
        __u16           tunnel_id;      /* redundant */
        __u16           session_id;     /* if zero, get tunnel stats */
        __u32           using_ipsec:1;  /* valid only for session_id == 0 */
-       aligned_u64     tx_packets;
-       aligned_u64     tx_bytes;
-       aligned_u64     tx_errors;
-       aligned_u64     rx_packets;
-       aligned_u64     rx_bytes;
-       aligned_u64     rx_seq_discards;
-       aligned_u64     rx_oos_packets;
-       aligned_u64     rx_errors;
+       __aligned_u64   tx_packets;
+       __aligned_u64   tx_bytes;
+       __aligned_u64   tx_errors;
+       __aligned_u64   rx_packets;
+       __aligned_u64   rx_bytes;
+       __aligned_u64   rx_seq_discards;
+       __aligned_u64   rx_oos_packets;
+       __aligned_u64   rx_errors;
 };
 
 #define ifr__name       b.ifr_ifrn.ifrn_name
index 3882a81a3b3c8547cbf77354b88868586218dc60..5aebd170f899f76b9f3231d3aaf5c1066c73870a 100644 (file)
@@ -18,4 +18,14 @@ static inline bool ip_set_get_ip6_port(const struct sk_buff *skb, bool src,
 extern bool ip_set_get_ip_port(const struct sk_buff *skb, u8 pf, bool src,
                                __be16 *port);
 
+static inline bool ip_set_proto_with_ports(u8 proto)
+{
+       switch (proto) {
+       case IPPROTO_TCP:
+       case IPPROTO_UDP:
+               return true;
+       }
+       return false;
+}
+
 #endif /*_IP_SET_GETPORT_H*/
index ea9b8d3805272cdf0378374ef59b3ffaeea67876..90c2c9575bac371e95a69874c4b217d66a8b9ea6 100644 (file)
@@ -28,8 +28,8 @@ struct nfulnl_msg_packet_hw {
 };
 
 struct nfulnl_msg_packet_timestamp {
-       aligned_be64    sec;
-       aligned_be64    usec;
+       __aligned_be64  sec;
+       __aligned_be64  usec;
 };
 
 enum nfulnl_attr_type {
index 2455fe5f4e016938a68c63f1626ea633bde1a46e..af94e0014ebdf380262357bf9f679a838a10fe28 100644 (file)
@@ -25,8 +25,8 @@ struct nfqnl_msg_packet_hw {
 };
 
 struct nfqnl_msg_packet_timestamp {
-       aligned_be64    sec;
-       aligned_be64    usec;
+       __aligned_be64  sec;
+       __aligned_be64  usec;
 };
 
 enum nfqnl_attr_type {
index 92fcbb0d193eaca99c62c4362f0bf6b1c2217efb..f1d6c15bd9e37edce2efa073424dee386984367e 100644 (file)
@@ -17,8 +17,8 @@ enum xt_connbytes_direction {
 
 struct xt_connbytes_info {
        struct {
-               aligned_u64 from;       /* count to be matched */
-               aligned_u64 to;         /* count to be matched */
+               __aligned_u64 from;     /* count to be matched */
+               __aligned_u64 to;       /* count to be matched */
        } count;
        __u8 what;              /* ipt_connbytes_what */
        __u8 direction; /* ipt_connbytes_direction */
index ca6e03e47a17ca08bae40f4cf5a66292d4fc38ca..9314723f39ca19bb4f257e60f711ffedaaa52ee1 100644 (file)
@@ -13,7 +13,7 @@ struct xt_quota_priv;
 struct xt_quota_info {
        __u32 flags;
        __u32 pad;
-       aligned_u64 quota;
+       __aligned_u64 quota;
 
        /* Used internally by the kernel */
        struct xt_quota_priv    *master;
index fa9086647eb7aef52284006c575e716703bb17de..ad4dd1c8d30aadcdee4dec8d95524d77df7a74a3 100644 (file)
@@ -105,7 +105,6 @@ void kmem_cache_destroy(struct kmem_cache *);
 int kmem_cache_shrink(struct kmem_cache *);
 void kmem_cache_free(struct kmem_cache *, void *);
 unsigned int kmem_cache_size(struct kmem_cache *);
-const char *kmem_cache_name(struct kmem_cache *);
 
 /*
  * Please use this macro to create slab caches. Simply specify the
index 8b6e8ae5d5cabcd6f267405a1007d56de0070b64..90fbb6d87e11d3408db6cd3d3b6a1eedbcd68fe7 100644 (file)
@@ -35,7 +35,10 @@ enum stat_item {
        NR_SLUB_STAT_ITEMS };
 
 struct kmem_cache_cpu {
-       void **freelist;        /* Pointer to first free per cpu object */
+       void **freelist;        /* Pointer to next available object */
+#ifdef CONFIG_CMPXCHG_LOCAL
+       unsigned long tid;      /* Globally unique transaction id */
+#endif
        struct page *page;      /* The slab from which we are allocating */
        int node;               /* The node of the page (or -1 for debug) */
 #ifdef CONFIG_SLUB_STATS
@@ -70,6 +73,7 @@ struct kmem_cache {
        struct kmem_cache_cpu __percpu *cpu_slab;
        /* Used for retriving partial slabs etc */
        unsigned long flags;
+       unsigned long min_partial;
        int size;               /* The size of an object including meta data */
        int objsize;            /* The size of an object without meta data */
        int offset;             /* Free pointer offset. */
@@ -83,7 +87,7 @@ struct kmem_cache {
        void (*ctor)(void *);
        int inuse;              /* Offset to metadata */
        int align;              /* Alignment */
-       unsigned long min_partial;
+       int reserved;           /* Reserved bytes at the end of slabs */
        const char *name;       /* Name (only for display!) */
        struct list_head list;  /* List of slab caches */
 #ifdef CONFIG_SYSFS
index 1f5c18e6f4f17bedfbd38e64da3cc112d1cb90bb..83ecc1749ef6153581d295706d6c4768c11931e0 100644 (file)
@@ -825,6 +825,7 @@ asmlinkage long sys_fanotify_init(unsigned int flags, unsigned int event_f_flags
 asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
                                  u64 mask, int fd,
                                  const char  __user *pathname);
+asmlinkage long sys_syncfs(int fd);
 
 int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
 
index 272f59336b737d804174cbf849e757fa8a4a8bd5..30b49ed72f0d06bc4e1901273d6148b33d01a7c9 100644 (file)
@@ -801,8 +801,6 @@ struct netns_ipvs {
        struct list_head        rs_table[IP_VS_RTAB_SIZE];
        /* ip_vs_app */
        struct list_head        app_list;
-       struct mutex            app_mutex;
-       struct lock_class_key   app_key;        /* mutex debuging */
 
        /* ip_vs_proto */
        #define IP_VS_PROTO_TAB_SIZE    32      /* must be power of 2 */
index 762e2abce8898cb8988f703b88780de8a5038103..27461d6dd46f2a1ae8976135b68f3e67befc7514 100644 (file)
@@ -150,7 +150,7 @@ struct linux_xfrm_mib {
 #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend)   \
        do { \
                __typeof__(*mib[0]) *ptr = \
-                       __this_cpu_ptr((mib)[!in_softirq()]); \
+                       __this_cpu_ptr((mib)[0]); \
                ptr->mibs[basefield##PKTS]++; \
                ptr->mibs[basefield##OCTETS] += addend;\
        } while (0)
@@ -202,7 +202,7 @@ struct linux_xfrm_mib {
 #define SNMP_UPD_PO_STATS64_BH(mib, basefield, addend)                 \
        do {                                                            \
                __typeof__(*mib[0]) *ptr;                               \
-               ptr = __this_cpu_ptr((mib)[!in_softirq()]);             \
+               ptr = __this_cpu_ptr((mib)[0]);                         \
                u64_stats_update_begin(&ptr->syncp);                    \
                ptr->mibs[basefield##PKTS]++;                           \
                ptr->mibs[basefield##OCTETS] += addend;                 \
index 42a8c32a10e24a7edefd044ea95cf6a24f2cfb37..cffa5dc664492f0b45a54889f91d12fa48cd324f 100644 (file)
@@ -1430,6 +1430,7 @@ extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
 extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
 extern int xfrm_init_replay(struct xfrm_state *x);
 extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
+extern int __xfrm_init_state(struct xfrm_state *x, bool init_replay);
 extern int xfrm_init_state(struct xfrm_state *x);
 extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
 extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi,
index 3f761001d517e2e3ae3b92f24cd85bcd6cd32262..e97ca59e2520dce3a3c0d7b2460d444e1b7591c0 100644 (file)
@@ -1,3 +1,3 @@
-EXTRA_CFLAGS := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"'
+ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"'
 
 obj-$(CONFIG_GCOV_KERNEL) := base.o fs.o gcc_3_4.o
index c350e18b53e3f4d5f7683680634de3f2bf1bf3a3..c5ebc6a9064390583ed4f9cb6c11cf857fd0c318 100644 (file)
@@ -1,4 +1,5 @@
-ccflags-$(CONFIG_PM_DEBUG)     :=      -DDEBUG
+
+ccflags-$(CONFIG_PM_DEBUG)     := -DDEBUG
 
 obj-$(CONFIG_PM)               += main.o
 obj-$(CONFIG_PM_SLEEP)         += console.o
index 4e3cff10fdceda165e8e9f22c0e9b861dba918d8..31751868de8856cbe4ee909ef09915e6a9a9c679 100644 (file)
@@ -2421,9 +2421,13 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,
                return -EFAULT;
 
        /* Not even root can pretend to send signals from the kernel.
-          Nor can they impersonate a kill(), which adds source info.  */
-       if (info.si_code >= 0)
+        * Nor can they impersonate a kill()/tgkill(), which adds source info.
+        */
+       if (info.si_code != SI_QUEUE) {
+               /* We used to allow any < 0 si_code */
+               WARN_ON_ONCE(info.si_code < 0);
                return -EPERM;
+       }
        info.si_signo = sig;
 
        /* POSIX.1b doesn't mention process groups.  */
@@ -2437,9 +2441,13 @@ long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, siginfo_t *info)
                return -EINVAL;
 
        /* Not even root can pretend to send signals from the kernel.
-          Nor can they impersonate a kill(), which adds source info.  */
-       if (info->si_code >= 0)
+        * Nor can they impersonate a kill()/tgkill(), which adds source info.
+        */
+       if (info->si_code != SI_QUEUE) {
+               /* We used to allow any < 0 si_code */
+               WARN_ON_ONCE(info->si_code < 0);
                return -EPERM;
+       }
        info->si_signo = sig;
 
        return do_send_specific(tgid, pid, sig, info);
index 6f440d82b58db05e63d3a2ff9e32918e74974ebc..191c5c4c89fcf92fc18e3728cd382f4f39f8e1ce 100644 (file)
@@ -102,11 +102,6 @@ config HEADERS_CHECK
 
 config DEBUG_SECTION_MISMATCH
        bool "Enable full Section mismatch analysis"
-       depends on UNDEFINED || (BLACKFIN)
-       default y
-       # This option is on purpose disabled for now.
-       # It will be enabled when we are down to a reasonable number
-       # of section mismatch warnings (< 10 for an allyesconfig build)
        help
          The section mismatch analysis checks if there are illegal
          references from one section to another section.
index 37961d1f584fed737f52a9981673bc7be9011efe..a18ba57517af469eac32ef7c572327c6bed7668a 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -190,22 +190,6 @@ typedef unsigned int kmem_bufctl_t;
 #define        BUFCTL_ACTIVE   (((kmem_bufctl_t)(~0U))-2)
 #define        SLAB_LIMIT      (((kmem_bufctl_t)(~0U))-3)
 
-/*
- * struct slab
- *
- * Manages the objs in a slab. Placed either at the beginning of mem allocated
- * for a slab, or allocated from an general cache.
- * Slabs are chained into three list: fully used, partial, fully free slabs.
- */
-struct slab {
-       struct list_head list;
-       unsigned long colouroff;
-       void *s_mem;            /* including colour offset */
-       unsigned int inuse;     /* num of objs active in slab */
-       kmem_bufctl_t free;
-       unsigned short nodeid;
-};
-
 /*
  * struct slab_rcu
  *
@@ -219,8 +203,6 @@ struct slab {
  *
  * rcu_read_lock before reading the address, then rcu_read_unlock after
  * taking the spinlock within the structure expected at that address.
- *
- * We assume struct slab_rcu can overlay struct slab when destroying.
  */
 struct slab_rcu {
        struct rcu_head head;
@@ -228,6 +210,27 @@ struct slab_rcu {
        void *addr;
 };
 
+/*
+ * struct slab
+ *
+ * Manages the objs in a slab. Placed either at the beginning of mem allocated
+ * for a slab, or allocated from an general cache.
+ * Slabs are chained into three list: fully used, partial, fully free slabs.
+ */
+struct slab {
+       union {
+               struct {
+                       struct list_head list;
+                       unsigned long colouroff;
+                       void *s_mem;            /* including colour offset */
+                       unsigned int inuse;     /* num of objs active in slab */
+                       kmem_bufctl_t free;
+                       unsigned short nodeid;
+               };
+               struct slab_rcu __slab_cover_slab_rcu;
+       };
+};
+
 /*
  * struct array_cache
  *
@@ -2147,8 +2150,6 @@ static int __init_refok setup_cpu_cache(struct kmem_cache *cachep, gfp_t gfp)
  *
  * @name must be valid until the cache is destroyed. This implies that
  * the module calling this has to destroy the cache before getting unloaded.
- * Note that kmem_cache_name() is not guaranteed to return the same pointer,
- * therefore applications must manage it themselves.
  *
  * The flags are
  *
@@ -2288,8 +2289,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
        if (ralign < align) {
                ralign = align;
        }
-       /* disable debug if not aligning with REDZONE_ALIGN */
-       if (ralign & (__alignof__(unsigned long long) - 1))
+       /* disable debug if necessary */
+       if (ralign > __alignof__(unsigned long long))
                flags &= ~(SLAB_RED_ZONE | SLAB_STORE_USER);
        /*
         * 4) Store it.
@@ -2315,8 +2316,8 @@ kmem_cache_create (const char *name, size_t size, size_t align,
         */
        if (flags & SLAB_RED_ZONE) {
                /* add space for red zone words */
-               cachep->obj_offset += align;
-               size += align + sizeof(unsigned long long);
+               cachep->obj_offset += sizeof(unsigned long long);
+               size += 2 * sizeof(unsigned long long);
        }
        if (flags & SLAB_STORE_USER) {
                /* user store requires one word storage behind the end of
@@ -3840,12 +3841,6 @@ unsigned int kmem_cache_size(struct kmem_cache *cachep)
 }
 EXPORT_SYMBOL(kmem_cache_size);
 
-const char *kmem_cache_name(struct kmem_cache *cachep)
-{
-       return cachep->name;
-}
-EXPORT_SYMBOL_GPL(kmem_cache_name);
-
 /*
  * This initializes kmem_list3 or resizes various caches for all nodes.
  */
index 3588eaaef7267284ed6fb2a0d6475717ed622db5..46e0aee33a235068bcaf6144dc299ed0ff248991 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -666,12 +666,6 @@ unsigned int kmem_cache_size(struct kmem_cache *c)
 }
 EXPORT_SYMBOL(kmem_cache_size);
 
-const char *kmem_cache_name(struct kmem_cache *c)
-{
-       return c->name;
-}
-EXPORT_SYMBOL(kmem_cache_name);
-
 int kmem_cache_shrink(struct kmem_cache *d)
 {
        return 0;
index e15aa7f193c9734518f3c3508210c70f294e4ad3..7e4f835e32ab21d19378cf27492e415bcbf26a6e 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -281,11 +281,40 @@ static inline int slab_index(void *p, struct kmem_cache *s, void *addr)
        return (p - addr) / s->size;
 }
 
+static inline size_t slab_ksize(const struct kmem_cache *s)
+{
+#ifdef CONFIG_SLUB_DEBUG
+       /*
+        * Debugging requires use of the padding between object
+        * and whatever may come after it.
+        */
+       if (s->flags & (SLAB_RED_ZONE | SLAB_POISON))
+               return s->objsize;
+
+#endif
+       /*
+        * If we have the need to store the freelist pointer
+        * back there or track user information then we can
+        * only use the space before that information.
+        */
+       if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER))
+               return s->inuse;
+       /*
+        * Else we can use all the padding etc for the allocation
+        */
+       return s->size;
+}
+
+static inline int order_objects(int order, unsigned long size, int reserved)
+{
+       return ((PAGE_SIZE << order) - reserved) / size;
+}
+
 static inline struct kmem_cache_order_objects oo_make(int order,
-                                               unsigned long size)
+               unsigned long size, int reserved)
 {
        struct kmem_cache_order_objects x = {
-               (order << OO_SHIFT) + (PAGE_SIZE << order) / size
+               (order << OO_SHIFT) + order_objects(order, size, reserved)
        };
 
        return x;
@@ -617,7 +646,7 @@ static int slab_pad_check(struct kmem_cache *s, struct page *page)
                return 1;
 
        start = page_address(page);
-       length = (PAGE_SIZE << compound_order(page));
+       length = (PAGE_SIZE << compound_order(page)) - s->reserved;
        end = start + length;
        remainder = length % s->size;
        if (!remainder)
@@ -698,7 +727,7 @@ static int check_slab(struct kmem_cache *s, struct page *page)
                return 0;
        }
 
-       maxobj = (PAGE_SIZE << compound_order(page)) / s->size;
+       maxobj = order_objects(compound_order(page), s->size, s->reserved);
        if (page->objects > maxobj) {
                slab_err(s, page, "objects %u > max %u",
                        s->name, page->objects, maxobj);
@@ -748,7 +777,7 @@ static int on_freelist(struct kmem_cache *s, struct page *page, void *search)
                nr++;
        }
 
-       max_objects = (PAGE_SIZE << compound_order(page)) / s->size;
+       max_objects = order_objects(compound_order(page), s->size, s->reserved);
        if (max_objects > MAX_OBJS_PER_PAGE)
                max_objects = MAX_OBJS_PER_PAGE;
 
@@ -800,21 +829,31 @@ static inline int slab_pre_alloc_hook(struct kmem_cache *s, gfp_t flags)
 static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags, void *object)
 {
        flags &= gfp_allowed_mask;
-       kmemcheck_slab_alloc(s, flags, object, s->objsize);
+       kmemcheck_slab_alloc(s, flags, object, slab_ksize(s));
        kmemleak_alloc_recursive(object, s->objsize, 1, s->flags, flags);
 }
 
 static inline void slab_free_hook(struct kmem_cache *s, void *x)
 {
        kmemleak_free_recursive(x, s->flags);
-}
 
-static inline void slab_free_hook_irq(struct kmem_cache *s, void *object)
-{
-       kmemcheck_slab_free(s, object, s->objsize);
-       debug_check_no_locks_freed(object, s->objsize);
-       if (!(s->flags & SLAB_DEBUG_OBJECTS))
-               debug_check_no_obj_freed(object, s->objsize);
+       /*
+        * Trouble is that we may no longer disable interupts in the fast path
+        * So in order to make the debug calls that expect irqs to be
+        * disabled we need to disable interrupts temporarily.
+        */
+#if defined(CONFIG_KMEMCHECK) || defined(CONFIG_LOCKDEP)
+       {
+               unsigned long flags;
+
+               local_irq_save(flags);
+               kmemcheck_slab_free(s, x, s->objsize);
+               debug_check_no_locks_freed(x, s->objsize);
+               if (!(s->flags & SLAB_DEBUG_OBJECTS))
+                       debug_check_no_obj_freed(x, s->objsize);
+               local_irq_restore(flags);
+       }
+#endif
 }
 
 /*
@@ -1101,9 +1140,6 @@ static inline void slab_post_alloc_hook(struct kmem_cache *s, gfp_t flags,
 
 static inline void slab_free_hook(struct kmem_cache *s, void *x) {}
 
-static inline void slab_free_hook_irq(struct kmem_cache *s,
-               void *object) {}
-
 #endif /* CONFIG_SLUB_DEBUG */
 
 /*
@@ -1249,21 +1285,38 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
        __free_pages(page, order);
 }
 
+#define need_reserve_slab_rcu                                          \
+       (sizeof(((struct page *)NULL)->lru) < sizeof(struct rcu_head))
+
 static void rcu_free_slab(struct rcu_head *h)
 {
        struct page *page;
 
-       page = container_of((struct list_head *)h, struct page, lru);
+       if (need_reserve_slab_rcu)
+               page = virt_to_head_page(h);
+       else
+               page = container_of((struct list_head *)h, struct page, lru);
+
        __free_slab(page->slab, page);
 }
 
 static void free_slab(struct kmem_cache *s, struct page *page)
 {
        if (unlikely(s->flags & SLAB_DESTROY_BY_RCU)) {
-               /*
-                * RCU free overloads the RCU head over the LRU
-                */
-               struct rcu_head *head = (void *)&page->lru;
+               struct rcu_head *head;
+
+               if (need_reserve_slab_rcu) {
+                       int order = compound_order(page);
+                       int offset = (PAGE_SIZE << order) - s->reserved;
+
+                       VM_BUG_ON(s->reserved != sizeof(*head));
+                       head = page_address(page) + offset;
+               } else {
+                       /*
+                        * RCU free overloads the RCU head over the LRU
+                        */
+                       head = (void *)&page->lru;
+               }
 
                call_rcu(head, rcu_free_slab);
        } else
@@ -1487,6 +1540,77 @@ static void unfreeze_slab(struct kmem_cache *s, struct page *page, int tail)
        }
 }
 
+#ifdef CONFIG_CMPXCHG_LOCAL
+#ifdef CONFIG_PREEMPT
+/*
+ * Calculate the next globally unique transaction for disambiguiation
+ * during cmpxchg. The transactions start with the cpu number and are then
+ * incremented by CONFIG_NR_CPUS.
+ */
+#define TID_STEP  roundup_pow_of_two(CONFIG_NR_CPUS)
+#else
+/*
+ * No preemption supported therefore also no need to check for
+ * different cpus.
+ */
+#define TID_STEP 1
+#endif
+
+static inline unsigned long next_tid(unsigned long tid)
+{
+       return tid + TID_STEP;
+}
+
+static inline unsigned int tid_to_cpu(unsigned long tid)
+{
+       return tid % TID_STEP;
+}
+
+static inline unsigned long tid_to_event(unsigned long tid)
+{
+       return tid / TID_STEP;
+}
+
+static inline unsigned int init_tid(int cpu)
+{
+       return cpu;
+}
+
+static inline void note_cmpxchg_failure(const char *n,
+               const struct kmem_cache *s, unsigned long tid)
+{
+#ifdef SLUB_DEBUG_CMPXCHG
+       unsigned long actual_tid = __this_cpu_read(s->cpu_slab->tid);
+
+       printk(KERN_INFO "%s %s: cmpxchg redo ", n, s->name);
+
+#ifdef CONFIG_PREEMPT
+       if (tid_to_cpu(tid) != tid_to_cpu(actual_tid))
+               printk("due to cpu change %d -> %d\n",
+                       tid_to_cpu(tid), tid_to_cpu(actual_tid));
+       else
+#endif
+       if (tid_to_event(tid) != tid_to_event(actual_tid))
+               printk("due to cpu running other code. Event %ld->%ld\n",
+                       tid_to_event(tid), tid_to_event(actual_tid));
+       else
+               printk("for unknown reason: actual=%lx was=%lx target=%lx\n",
+                       actual_tid, tid, next_tid(tid));
+#endif
+}
+
+#endif
+
+void init_kmem_cache_cpus(struct kmem_cache *s)
+{
+#if defined(CONFIG_CMPXCHG_LOCAL) && defined(CONFIG_PREEMPT)
+       int cpu;
+
+       for_each_possible_cpu(cpu)
+               per_cpu_ptr(s->cpu_slab, cpu)->tid = init_tid(cpu);
+#endif
+
+}
 /*
  * Remove the cpu slab
  */
@@ -1518,6 +1642,9 @@ static void deactivate_slab(struct kmem_cache *s, struct kmem_cache_cpu *c)
                page->inuse--;
        }
        c->page = NULL;
+#ifdef CONFIG_CMPXCHG_LOCAL
+       c->tid = next_tid(c->tid);
+#endif
        unfreeze_slab(s, page, tail);
 }
 
@@ -1652,6 +1779,19 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
 {
        void **object;
        struct page *new;
+#ifdef CONFIG_CMPXCHG_LOCAL
+       unsigned long flags;
+
+       local_irq_save(flags);
+#ifdef CONFIG_PREEMPT
+       /*
+        * We may have been preempted and rescheduled on a different
+        * cpu before disabling interrupts. Need to reload cpu area
+        * pointer.
+        */
+       c = this_cpu_ptr(s->cpu_slab);
+#endif
+#endif
 
        /* We handle __GFP_ZERO in the caller */
        gfpflags &= ~__GFP_ZERO;
@@ -1678,6 +1818,10 @@ load_freelist:
        c->node = page_to_nid(c->page);
 unlock_out:
        slab_unlock(c->page);
+#ifdef CONFIG_CMPXCHG_LOCAL
+       c->tid = next_tid(c->tid);
+       local_irq_restore(flags);
+#endif
        stat(s, ALLOC_SLOWPATH);
        return object;
 
@@ -1739,23 +1883,76 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
 {
        void **object;
        struct kmem_cache_cpu *c;
+#ifdef CONFIG_CMPXCHG_LOCAL
+       unsigned long tid;
+#else
        unsigned long flags;
+#endif
 
        if (slab_pre_alloc_hook(s, gfpflags))
                return NULL;
 
+#ifndef CONFIG_CMPXCHG_LOCAL
        local_irq_save(flags);
+#else
+redo:
+#endif
+
+       /*
+        * Must read kmem_cache cpu data via this cpu ptr. Preemption is
+        * enabled. We may switch back and forth between cpus while
+        * reading from one cpu area. That does not matter as long
+        * as we end up on the original cpu again when doing the cmpxchg.
+        */
        c = __this_cpu_ptr(s->cpu_slab);
+
+#ifdef CONFIG_CMPXCHG_LOCAL
+       /*
+        * The transaction ids are globally unique per cpu and per operation on
+        * a per cpu queue. Thus they can be guarantee that the cmpxchg_double
+        * occurs on the right processor and that there was no operation on the
+        * linked list in between.
+        */
+       tid = c->tid;
+       barrier();
+#endif
+
        object = c->freelist;
        if (unlikely(!object || !node_match(c, node)))
 
                object = __slab_alloc(s, gfpflags, node, addr, c);
 
        else {
+#ifdef CONFIG_CMPXCHG_LOCAL
+               /*
+                * The cmpxchg will only match if there was no additonal
+                * operation and if we are on the right processor.
+                *
+                * The cmpxchg does the following atomically (without lock semantics!)
+                * 1. Relocate first pointer to the current per cpu area.
+                * 2. Verify that tid and freelist have not been changed
+                * 3. If they were not changed replace tid and freelist
+                *
+                * Since this is without lock semantics the protection is only against
+                * code executing on this cpu *not* from access by other cpus.
+                */
+               if (unlikely(!this_cpu_cmpxchg_double(
+                               s->cpu_slab->freelist, s->cpu_slab->tid,
+                               object, tid,
+                               get_freepointer(s, object), next_tid(tid)))) {
+
+                       note_cmpxchg_failure("slab_alloc", s, tid);
+                       goto redo;
+               }
+#else
                c->freelist = get_freepointer(s, object);
+#endif
                stat(s, ALLOC_FASTPATH);
        }
+
+#ifndef CONFIG_CMPXCHG_LOCAL
        local_irq_restore(flags);
+#endif
 
        if (unlikely(gfpflags & __GFP_ZERO) && object)
                memset(object, 0, s->objsize);
@@ -1833,9 +2030,13 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
 {
        void *prior;
        void **object = (void *)x;
+#ifdef CONFIG_CMPXCHG_LOCAL
+       unsigned long flags;
 
-       stat(s, FREE_SLOWPATH);
+       local_irq_save(flags);
+#endif
        slab_lock(page);
+       stat(s, FREE_SLOWPATH);
 
        if (kmem_cache_debug(s))
                goto debug;
@@ -1865,6 +2066,9 @@ checks_ok:
 
 out_unlock:
        slab_unlock(page);
+#ifdef CONFIG_CMPXCHG_LOCAL
+       local_irq_restore(flags);
+#endif
        return;
 
 slab_empty:
@@ -1876,6 +2080,9 @@ slab_empty:
                stat(s, FREE_REMOVE_PARTIAL);
        }
        slab_unlock(page);
+#ifdef CONFIG_CMPXCHG_LOCAL
+       local_irq_restore(flags);
+#endif
        stat(s, FREE_SLAB);
        discard_slab(s, page);
        return;
@@ -1902,23 +2109,56 @@ static __always_inline void slab_free(struct kmem_cache *s,
 {
        void **object = (void *)x;
        struct kmem_cache_cpu *c;
+#ifdef CONFIG_CMPXCHG_LOCAL
+       unsigned long tid;
+#else
        unsigned long flags;
+#endif
 
        slab_free_hook(s, x);
 
+#ifndef CONFIG_CMPXCHG_LOCAL
        local_irq_save(flags);
+
+#else
+redo:
+#endif
+
+       /*
+        * Determine the currently cpus per cpu slab.
+        * The cpu may change afterward. However that does not matter since
+        * data is retrieved via this pointer. If we are on the same cpu
+        * during the cmpxchg then the free will succedd.
+        */
        c = __this_cpu_ptr(s->cpu_slab);
 
-       slab_free_hook_irq(s, x);
+#ifdef CONFIG_CMPXCHG_LOCAL
+       tid = c->tid;
+       barrier();
+#endif
 
        if (likely(page == c->page && c->node != NUMA_NO_NODE)) {
                set_freepointer(s, object, c->freelist);
+
+#ifdef CONFIG_CMPXCHG_LOCAL
+               if (unlikely(!this_cpu_cmpxchg_double(
+                               s->cpu_slab->freelist, s->cpu_slab->tid,
+                               c->freelist, tid,
+                               object, next_tid(tid)))) {
+
+                       note_cmpxchg_failure("slab_free", s, tid);
+                       goto redo;
+               }
+#else
                c->freelist = object;
+#endif
                stat(s, FREE_FASTPATH);
        } else
                __slab_free(s, page, x, addr);
 
+#ifndef CONFIG_CMPXCHG_LOCAL
        local_irq_restore(flags);
+#endif
 }
 
 void kmem_cache_free(struct kmem_cache *s, void *x)
@@ -1988,13 +2228,13 @@ static int slub_nomerge;
  * the smallest order which will fit the object.
  */
 static inline int slab_order(int size, int min_objects,
-                               int max_order, int fract_leftover)
+                               int max_order, int fract_leftover, int reserved)
 {
        int order;
        int rem;
        int min_order = slub_min_order;
 
-       if ((PAGE_SIZE << min_order) / size > MAX_OBJS_PER_PAGE)
+       if (order_objects(min_order, size, reserved) > MAX_OBJS_PER_PAGE)
                return get_order(size * MAX_OBJS_PER_PAGE) - 1;
 
        for (order = max(min_order,
@@ -2003,10 +2243,10 @@ static inline int slab_order(int size, int min_objects,
 
                unsigned long slab_size = PAGE_SIZE << order;
 
-               if (slab_size < min_objects * size)
+               if (slab_size < min_objects * size + reserved)
                        continue;
 
-               rem = slab_size % size;
+               rem = (slab_size - reserved) % size;
 
                if (rem <= slab_size / fract_leftover)
                        break;
@@ -2016,7 +2256,7 @@ static inline int slab_order(int size, int min_objects,
        return order;
 }
 
-static inline int calculate_order(int size)
+static inline int calculate_order(int size, int reserved)
 {
        int order;
        int min_objects;
@@ -2034,14 +2274,14 @@ static inline int calculate_order(int size)
        min_objects = slub_min_objects;
        if (!min_objects)
                min_objects = 4 * (fls(nr_cpu_ids) + 1);
-       max_objects = (PAGE_SIZE << slub_max_order)/size;
+       max_objects = order_objects(slub_max_order, size, reserved);
        min_objects = min(min_objects, max_objects);
 
        while (min_objects > 1) {
                fraction = 16;
                while (fraction >= 4) {
                        order = slab_order(size, min_objects,
-                                               slub_max_order, fraction);
+                                       slub_max_order, fraction, reserved);
                        if (order <= slub_max_order)
                                return order;
                        fraction /= 2;
@@ -2053,14 +2293,14 @@ static inline int calculate_order(int size)
         * We were unable to place multiple objects in a slab. Now
         * lets see if we can place a single object there.
         */
-       order = slab_order(size, 1, slub_max_order, 1);
+       order = slab_order(size, 1, slub_max_order, 1, reserved);
        if (order <= slub_max_order)
                return order;
 
        /*
         * Doh this slab cannot be placed using slub_max_order.
         */
-       order = slab_order(size, 1, MAX_ORDER, 1);
+       order = slab_order(size, 1, MAX_ORDER, 1, reserved);
        if (order < MAX_ORDER)
                return order;
        return -ENOSYS;
@@ -2110,9 +2350,23 @@ static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
        BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
                        SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
 
+#ifdef CONFIG_CMPXCHG_LOCAL
+       /*
+        * Must align to double word boundary for the double cmpxchg instructions
+        * to work.
+        */
+       s->cpu_slab = __alloc_percpu(sizeof(struct kmem_cache_cpu), 2 * sizeof(void *));
+#else
+       /* Regular alignment is sufficient */
        s->cpu_slab = alloc_percpu(struct kmem_cache_cpu);
+#endif
 
-       return s->cpu_slab != NULL;
+       if (!s->cpu_slab)
+               return 0;
+
+       init_kmem_cache_cpus(s);
+
+       return 1;
 }
 
 static struct kmem_cache *kmem_cache_node;
@@ -2311,7 +2565,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
        if (forced_order >= 0)
                order = forced_order;
        else
-               order = calculate_order(size);
+               order = calculate_order(size, s->reserved);
 
        if (order < 0)
                return 0;
@@ -2329,8 +2583,8 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
        /*
         * Determine the number of objects per slab
         */
-       s->oo = oo_make(order, size);
-       s->min = oo_make(get_order(size), size);
+       s->oo = oo_make(order, size, s->reserved);
+       s->min = oo_make(get_order(size), size, s->reserved);
        if (oo_objects(s->oo) > oo_objects(s->max))
                s->max = s->oo;
 
@@ -2349,6 +2603,10 @@ static int kmem_cache_open(struct kmem_cache *s,
        s->objsize = size;
        s->align = align;
        s->flags = kmem_cache_flags(size, flags, name, ctor);
+       s->reserved = 0;
+
+       if (need_reserve_slab_rcu && (s->flags & SLAB_DESTROY_BY_RCU))
+               s->reserved = sizeof(struct rcu_head);
 
        if (!calculate_sizes(s, -1))
                goto error;
@@ -2399,12 +2657,6 @@ unsigned int kmem_cache_size(struct kmem_cache *s)
 }
 EXPORT_SYMBOL(kmem_cache_size);
 
-const char *kmem_cache_name(struct kmem_cache *s)
-{
-       return s->name;
-}
-EXPORT_SYMBOL(kmem_cache_name);
-
 static void list_slab_objects(struct kmem_cache *s, struct page *page,
                                                        const char *text)
 {
@@ -2696,7 +2948,6 @@ EXPORT_SYMBOL(__kmalloc_node);
 size_t ksize(const void *object)
 {
        struct page *page;
-       struct kmem_cache *s;
 
        if (unlikely(object == ZERO_SIZE_PTR))
                return 0;
@@ -2707,28 +2958,8 @@ size_t ksize(const void *object)
                WARN_ON(!PageCompound(page));
                return PAGE_SIZE << compound_order(page);
        }
-       s = page->slab;
 
-#ifdef CONFIG_SLUB_DEBUG
-       /*
-        * Debugging requires use of the padding between object
-        * and whatever may come after it.
-        */
-       if (s->flags & (SLAB_RED_ZONE | SLAB_POISON))
-               return s->objsize;
-
-#endif
-       /*
-        * If we have the need to store the freelist pointer
-        * back there or track user information then we can
-        * only use the space before that information.
-        */
-       if (s->flags & (SLAB_DESTROY_BY_RCU | SLAB_STORE_USER))
-               return s->inuse;
-       /*
-        * Else we can use all the padding etc for the allocation
-        */
-       return s->size;
+       return slab_ksize(page->slab);
 }
 EXPORT_SYMBOL(ksize);
 
@@ -4017,6 +4248,12 @@ static ssize_t destroy_by_rcu_show(struct kmem_cache *s, char *buf)
 }
 SLAB_ATTR_RO(destroy_by_rcu);
 
+static ssize_t reserved_show(struct kmem_cache *s, char *buf)
+{
+       return sprintf(buf, "%d\n", s->reserved);
+}
+SLAB_ATTR_RO(reserved);
+
 #ifdef CONFIG_SLUB_DEBUG
 static ssize_t slabs_show(struct kmem_cache *s, char *buf)
 {
@@ -4303,6 +4540,7 @@ static struct attribute *slab_attrs[] = {
        &reclaim_account_attr.attr,
        &destroy_by_rcu_attr.attr,
        &shrink_attr.attr,
+       &reserved_attr.attr,
 #ifdef CONFIG_SLUB_DEBUG
        &total_objects_attr.attr,
        &slabs_attr.attr,
index ae610f046de596b0d279f01c0247a68d8aad69c1..e34ea9e5e28bcefbe502fb81a4f23432294b65da 100644 (file)
@@ -720,6 +720,7 @@ static int vlan_dev_init(struct net_device *dev)
        dev->fcoe_ddp_xid = real_dev->fcoe_ddp_xid;
 #endif
 
+       dev->needed_headroom = real_dev->needed_headroom;
        if (real_dev->features & NETIF_F_HW_VLAN_TX) {
                dev->header_ops      = real_dev->header_ops;
                dev->hard_header_len = real_dev->hard_header_len;
index 3d4f4b04340661e94f25c35a8c123e884e8d8922..206e771e82d17ce77b7c99447f12437f4fd300c5 100644 (file)
@@ -1051,6 +1051,7 @@ static int atalk_release(struct socket *sock)
 {
        struct sock *sk = sock->sk;
 
+       sock_hold(sk);
        lock_sock(sk);
        if (sk) {
                sock_orphan(sk);
@@ -1058,6 +1059,8 @@ static int atalk_release(struct socket *sock)
                atalk_destroy_socket(sk);
        }
        release_sock(sk);
+       sock_put(sk);
+
        return 0;
 }
 
index f97af5590ba12c01c9937558469e60ca68dc3864..008ff6c4eecf3da16c55901afd9e9fbde9f5ee2f 100644 (file)
@@ -739,6 +739,9 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
                nf_bridge->mask |= BRNF_PKT_TYPE;
        }
 
+       if (br_parse_ip_options(skb))
+               return NF_DROP;
+
        /* The physdev module checks on this */
        nf_bridge->mask |= BRNF_BRIDGED;
        nf_bridge->physoutdev = skb->dev;
index 36e603c78ce9fd3a5f989716d59bff20a2699293..706502ff64aa884548bf5122bd71085aea098a45 100644 (file)
@@ -350,7 +350,7 @@ static int __init init_net_drop_monitor(void)
        struct per_cpu_dm_data *data;
        int cpu, rc;
 
-       printk(KERN_INFO "Initalizing network drop monitor service\n");
+       printk(KERN_INFO "Initializing network drop monitor service\n");
 
        if (sizeof(void *) > 8) {
                printk(KERN_ERR "Unable to store program counters on this arch, Drop monitor failed\n");
index c1a71bb738da4db6c8cd62b75d36b5d091316fd8..a1086fb0c0c7d0929db5a3f2f9cdae42d540c814 100644 (file)
@@ -1457,6 +1457,9 @@ static int __ethtool_set_sg(struct net_device *dev, u32 data)
 {
        int err;
 
+       if (!dev->ethtool_ops->set_sg)
+               return -EOPNOTSUPP;
+
        if (data && !(dev->features & NETIF_F_ALL_CSUM))
                return -EINVAL;
 
index 0c2826337919a15bbaba98bb14604abdfdbbc67c..116d3fd3d66915fed37f5af7e24143cf1f57af11 100644 (file)
@@ -435,10 +435,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
                udpdest.sin_addr.s_addr = htonl(network | addr.station);
        }
 
+       memset(&ah, 0, sizeof(ah));
        ah.port = port;
        ah.cb = cb & 0x7f;
        ah.code = 2;            /* magic */
-       ah.pad = 0;
 
        /* tack our header on the front of the iovec */
        size = sizeof(struct aunhdr);
index b09ed0d080f9948f81a3733cb9ca45173902e8f1..ffcea0d1678eef1aece342dd6dab60c74e58ebaa 100644 (file)
@@ -387,7 +387,7 @@ ipt_do_table(struct sk_buff *skb,
                                        verdict = (unsigned)(-v) - 1;
                                        break;
                                }
-                               if (*stackptr == 0) {
+                               if (*stackptr <= origptr) {
                                        e = get_entry(table_base,
                                            private->underflow[hook]);
                                        pr_debug("Underflow (this is normal) "
@@ -427,10 +427,10 @@ ipt_do_table(struct sk_buff *skb,
                        /* Verdict */
                        break;
        } while (!acpar.hotdrop);
-       xt_info_rdunlock_bh();
        pr_debug("Exiting %s; resetting sp from %u to %u\n",
                 __func__, *stackptr, origptr);
        *stackptr = origptr;
+       xt_info_rdunlock_bh();
 #ifdef DEBUG_ALLOW_ALL
        return NF_ACCEPT;
 #else
index 403ca57f60118544a99b29028edae70ec160e7de..d609ac3cb9a450e69d47e4d5bdb7365347cbb46a 100644 (file)
@@ -664,8 +664,11 @@ static ssize_t clusterip_proc_write(struct file *file, const char __user *input,
        char buffer[PROC_WRITELEN+1];
        unsigned long nodenum;
 
-       if (copy_from_user(buffer, input, PROC_WRITELEN))
+       if (size > PROC_WRITELEN)
+               return -EIO;
+       if (copy_from_user(buffer, input, size))
                return -EFAULT;
+       buffer[size] = 0;
 
        if (*buffer == '+') {
                nodenum = simple_strtoul(buffer+1, NULL, 10);
index c9598a9067d74393cefdf31a86fc6b69b874dc33..0b2af9b85cecd9ba7a34983f52595ad8849efa1b 100644 (file)
@@ -410,7 +410,7 @@ ip6t_do_table(struct sk_buff *skb,
                                        verdict = (unsigned)(-v) - 1;
                                        break;
                                }
-                               if (*stackptr == 0)
+                               if (*stackptr <= origptr)
                                        e = get_entry(table_base,
                                            private->underflow[hook]);
                                else
@@ -441,8 +441,8 @@ ip6t_do_table(struct sk_buff *skb,
                        break;
        } while (!acpar.hotdrop);
 
-       xt_info_rdunlock_bh();
        *stackptr = origptr;
+       xt_info_rdunlock_bh();
 
 #ifdef DEBUG_ALLOW_ALL
        return NF_ACCEPT;
index 7cb65ef79f9cd722e270b5d711d170035e7df4c7..6dcf5e7d661bd4f463f352788a5461f163e63501 100644 (file)
 
 static struct ctl_table empty[1];
 
+static ctl_table ipv6_static_skeleton[] = {
+       {
+               .procname       = "neigh",
+               .maxlen         = 0,
+               .mode           = 0555,
+               .child          = empty,
+       },
+       { }
+};
+
 static ctl_table ipv6_table_template[] = {
        {
                .procname       = "route",
@@ -37,12 +47,6 @@ static ctl_table ipv6_table_template[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
-       {
-               .procname       = "neigh",
-               .maxlen         = 0,
-               .mode           = 0555,
-               .child          = empty,
-       },
        { }
 };
 
@@ -160,7 +164,7 @@ static struct ctl_table_header *ip6_base;
 
 int ipv6_static_sysctl_register(void)
 {
-       ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty);
+       ip6_base = register_sysctl_paths(net_ipv6_ctl_path, ipv6_static_skeleton);
        if (ip6_base == NULL)
                return -ENOMEM;
        return 0;
index 2731b51923d1f964e3446f0a39ceb5221cd74a56..9680226640ef783c164618f2f2f8fd5504259f4a 100644 (file)
@@ -148,7 +148,6 @@ static void ipx_destroy_socket(struct sock *sk)
        ipx_remove_socket(sk);
        skb_queue_purge(&sk->sk_receive_queue);
        sk_refcnt_debug_dec(sk);
-       sock_put(sk);
 }
 
 /*
@@ -1404,6 +1403,7 @@ static int ipx_release(struct socket *sock)
        sk_refcnt_debug_release(sk);
        ipx_destroy_socket(sk);
        release_sock(sk);
+       sock_put(sk);
 out:
        return 0;
 }
index 8d9ce0accc98229e8255853e18b18c2ea4a2d410..a8193f52c13c28ddb17c3e1c100b009d259a3d8f 100644 (file)
@@ -283,7 +283,7 @@ static __net_init int l2tp_eth_init_net(struct net *net)
        return 0;
 }
 
-static __net_initdata struct pernet_operations l2tp_eth_net_ops = {
+static struct pernet_operations l2tp_eth_net_ops = {
        .init = l2tp_eth_init_net,
        .id   = &l2tp_eth_net_id,
        .size = sizeof(struct l2tp_eth_net),
index 618a615acc9d97ac3722c3830d3e712e7bcdeb16..d6b48230a54015d9b8cac977fe913e36ab07c79e 100644 (file)
@@ -94,16 +94,28 @@ static int
 find_set_type_get(const char *name, u8 family, u8 revision,
                  struct ip_set_type **found)
 {
+       struct ip_set_type *type;
+       int err;
+
        rcu_read_lock();
        *found = find_set_type(name, family, revision);
        if (*found) {
-               int err = !try_module_get((*found)->me);
-               rcu_read_unlock();
-               return err ? -EFAULT : 0;
+               err = !try_module_get((*found)->me) ? -EFAULT : 0;
+               goto unlock;
        }
+       /* Make sure the type is loaded but we don't support the revision */
+       list_for_each_entry_rcu(type, &ip_set_type_list, list)
+               if (STREQ(type->name, name)) {
+                       err = -IPSET_ERR_FIND_TYPE;
+                       goto unlock;
+               }
        rcu_read_unlock();
 
        return try_to_load_type(name);
+
+unlock:
+       rcu_read_unlock();
+       return err;
 }
 
 /* Find a given set type by name and family.
@@ -116,7 +128,7 @@ find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max)
        struct ip_set_type *type;
        bool found = false;
 
-       *min = *max = 0;
+       *min = 255; *max = 0;
        rcu_read_lock();
        list_for_each_entry_rcu(type, &ip_set_type_list, list)
                if (STREQ(type->name, name) &&
@@ -124,7 +136,7 @@ find_set_type_minmax(const char *name, u8 family, u8 *min, u8 *max)
                        found = true;
                        if (type->revision < *min)
                                *min = type->revision;
-                       else if (type->revision > *max)
+                       if (type->revision > *max)
                                *max = type->revision;
                }
        rcu_read_unlock();
index adbe787ea5dcc7210c319b29d49c32c2a9bb4069..b9214145d357ff7b4cfd8731f62f21970d7c8463 100644 (file)
@@ -150,6 +150,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipport4_elem data = { };
        u32 ip, ip_to, p, port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] ||
@@ -172,21 +173,15 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMP:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMP))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -195,7 +190,6 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
            !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
              tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
@@ -219,13 +213,12 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
        } else
                ip_to = ip;
 
-       port = ntohs(data.port);
-       if (tb[IPSET_ATTR_PORT_TO]) {
+       port_to = port = ntohs(data.port);
+       if (with_ports && tb[IPSET_ATTR_PORT_TO]) {
                port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
                if (port > port_to)
                        swap(port, port_to);
-       } else
-               port_to = port;
+       }
 
        for (; !before(ip_to, ip); ip++)
                for (p = port; p <= port_to; p++) {
@@ -361,6 +354,7 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipport6_elem data = { };
        u32 port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] ||
@@ -385,21 +379,15 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMPV6:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMPV6))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -407,9 +395,7 @@ hash_ipport6_uadt(struct ip_set *set, struct nlattr *tb[],
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
-           !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 22e23abb86c6d3a066b9550a56a3e7194399deb7..4642872df6e131818a9486ad99aa215a0b997fc8 100644 (file)
@@ -154,6 +154,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipportip4_elem data = { };
        u32 ip, ip_to, p, port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
@@ -180,21 +181,15 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMP:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMP))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -203,7 +198,6 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
            !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
              tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
@@ -227,13 +221,12 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
        } else
                ip_to = ip;
 
-       port = ntohs(data.port);
-       if (tb[IPSET_ATTR_PORT_TO]) {
+       port_to = port = ntohs(data.port);
+       if (with_ports && tb[IPSET_ATTR_PORT_TO]) {
                port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
                if (port > port_to)
                        swap(port, port_to);
-       } else
-               port_to = port;
+       }
 
        for (; !before(ip_to, ip); ip++)
                for (p = port; p <= port_to; p++) {
@@ -375,6 +368,7 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipportip6_elem data = { };
        u32 port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
@@ -403,21 +397,15 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMPV6:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMPV6))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -425,9 +413,7 @@ hash_ipportip6_uadt(struct ip_set *set, struct nlattr *tb[],
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
-           !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 6033e8b54bbdc3a927e1c972e1d95563ebe3f9c4..2cb84a54b7adbc9d651ed4f8117ad9119419de08 100644 (file)
@@ -174,6 +174,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipportnet4_elem data = { .cidr = HOST_MASK };
        u32 ip, ip_to, p, port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
@@ -208,21 +209,15 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMP:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMP))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -231,7 +226,6 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
        }
 
        if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
            !(tb[IPSET_ATTR_IP_TO] || tb[IPSET_ATTR_CIDR] ||
              tb[IPSET_ATTR_PORT_TO])) {
                ret = adtfn(set, &data, timeout);
@@ -255,13 +249,12 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
        } else
                ip_to = ip;
 
-       port = ntohs(data.port);
-       if (tb[IPSET_ATTR_PORT_TO]) {
+       port_to = port = ntohs(data.port);
+       if (with_ports && tb[IPSET_ATTR_PORT_TO]) {
                port_to = ip_set_get_h16(tb[IPSET_ATTR_PORT_TO]);
                if (port > port_to)
                        swap(port, port_to);
-       } else
-               port_to = port;
+       }
 
        for (; !before(ip_to, ip); ip++)
                for (p = port; p <= port_to; p++) {
@@ -429,6 +422,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_ipportnet6_elem data = { .cidr = HOST_MASK };
        u32 port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] || !tb[IPSET_ATTR_IP2] ||
@@ -465,21 +459,15 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMPV6:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMPV6))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -487,9 +475,7 @@ hash_ipportnet6_uadt(struct ip_set *set, struct nlattr *tb[],
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
-           !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 34a165626ee93d79e57252e2dbd526332ba8ad55..8598676f2a053724f523d800410f72857700f305 100644 (file)
@@ -170,6 +170,7 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_netport4_elem data = { .cidr = HOST_MASK };
        u32 port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] ||
@@ -198,21 +199,15 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMP:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMP))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -220,9 +215,7 @@ hash_netport4_uadt(struct ip_set *set, struct nlattr *tb[],
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
-           !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
@@ -390,6 +383,7 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[],
        struct hash_netport6_elem data = { .cidr = HOST_MASK };
        u32 port, port_to;
        u32 timeout = h->timeout;
+       bool with_ports = false;
        int ret;
 
        if (unlikely(!tb[IPSET_ATTR_IP] ||
@@ -418,21 +412,15 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[],
 
        if (tb[IPSET_ATTR_PROTO]) {
                data.proto = nla_get_u8(tb[IPSET_ATTR_PROTO]);
+               with_ports = ip_set_proto_with_ports(data.proto);
 
                if (data.proto == 0)
                        return -IPSET_ERR_INVALID_PROTO;
        } else
                return -IPSET_ERR_MISSING_PROTO;
 
-       switch (data.proto) {
-       case IPPROTO_UDP:
-       case IPPROTO_TCP:
-       case IPPROTO_ICMPV6:
-               break;
-       default:
+       if (!(with_ports || data.proto == IPPROTO_ICMPV6))
                data.port = 0;
-               break;
-       }
 
        if (tb[IPSET_ATTR_TIMEOUT]) {
                if (!with_timeout(h->timeout))
@@ -440,9 +428,7 @@ hash_netport6_uadt(struct ip_set *set, struct nlattr *tb[],
                timeout = ip_set_timeout_uget(tb[IPSET_ATTR_TIMEOUT]);
        }
 
-       if (adt == IPSET_TEST ||
-           !(data.proto == IPPROTO_TCP || data.proto == IPPROTO_UDP) ||
-           !tb[IPSET_ATTR_PORT_TO]) {
+       if (adt == IPSET_TEST || !with_ports || !tb[IPSET_ATTR_PORT_TO]) {
                ret = adtfn(set, &data, timeout);
                return ip_set_eexist(ret, flags) ? 0 : ret;
        }
index 5c48ffb60c2839a5a50560457f8ffc617819399e..2dc6de13ac1890d586d1e9a3d70817b329afbec8 100644 (file)
@@ -43,6 +43,8 @@ EXPORT_SYMBOL(register_ip_vs_app);
 EXPORT_SYMBOL(unregister_ip_vs_app);
 EXPORT_SYMBOL(register_ip_vs_app_inc);
 
+static DEFINE_MUTEX(__ip_vs_app_mutex);
+
 /*
  *     Get an ip_vs_app object
  */
@@ -167,14 +169,13 @@ int
 register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
                       __u16 port)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        int result;
 
-       mutex_lock(&ipvs->app_mutex);
+       mutex_lock(&__ip_vs_app_mutex);
 
        result = ip_vs_app_inc_new(net, app, proto, port);
 
-       mutex_unlock(&ipvs->app_mutex);
+       mutex_unlock(&__ip_vs_app_mutex);
 
        return result;
 }
@@ -189,11 +190,11 @@ int register_ip_vs_app(struct net *net, struct ip_vs_app *app)
        /* increase the module use count */
        ip_vs_use_count_inc();
 
-       mutex_lock(&ipvs->app_mutex);
+       mutex_lock(&__ip_vs_app_mutex);
 
        list_add(&app->a_list, &ipvs->app_list);
 
-       mutex_unlock(&ipvs->app_mutex);
+       mutex_unlock(&__ip_vs_app_mutex);
 
        return 0;
 }
@@ -205,10 +206,9 @@ int register_ip_vs_app(struct net *net, struct ip_vs_app *app)
  */
 void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app)
 {
-       struct netns_ipvs *ipvs = net_ipvs(net);
        struct ip_vs_app *inc, *nxt;
 
-       mutex_lock(&ipvs->app_mutex);
+       mutex_lock(&__ip_vs_app_mutex);
 
        list_for_each_entry_safe(inc, nxt, &app->incs_list, a_list) {
                ip_vs_app_inc_release(net, inc);
@@ -216,7 +216,7 @@ void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app)
 
        list_del(&app->a_list);
 
-       mutex_unlock(&ipvs->app_mutex);
+       mutex_unlock(&__ip_vs_app_mutex);
 
        /* decrease the module use count */
        ip_vs_use_count_dec();
@@ -501,7 +501,7 @@ static void *ip_vs_app_seq_start(struct seq_file *seq, loff_t *pos)
        struct net *net = seq_file_net(seq);
        struct netns_ipvs *ipvs = net_ipvs(net);
 
-       mutex_lock(&ipvs->app_mutex);
+       mutex_lock(&__ip_vs_app_mutex);
 
        return *pos ? ip_vs_app_idx(ipvs, *pos - 1) : SEQ_START_TOKEN;
 }
@@ -535,9 +535,7 @@ static void *ip_vs_app_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
 static void ip_vs_app_seq_stop(struct seq_file *seq, void *v)
 {
-       struct netns_ipvs *ipvs = net_ipvs(seq_file_net(seq));
-
-       mutex_unlock(&ipvs->app_mutex);
+       mutex_unlock(&__ip_vs_app_mutex);
 }
 
 static int ip_vs_app_seq_show(struct seq_file *seq, void *v)
@@ -583,7 +581,6 @@ static int __net_init __ip_vs_app_init(struct net *net)
        struct netns_ipvs *ipvs = net_ipvs(net);
 
        INIT_LIST_HEAD(&ipvs->app_list);
-       __mutex_init(&ipvs->app_mutex, "ipvs->app_mutex", &ipvs->app_key);
        proc_net_fops_create(net, "ip_vs_app", 0, &ip_vs_app_fops);
        return 0;
 }
index b799cea31f954c89b9d0f97b36d3cf32ec3e18cc..33733c8872e70230587b7d1ef7f34147a3058374 100644 (file)
@@ -3605,7 +3605,7 @@ int __net_init __ip_vs_control_init(struct net *net)
 
        /* procfs stats */
        ipvs->tot_stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats);
-       if (ipvs->tot_stats.cpustats) {
+       if (!ipvs->tot_stats.cpustats) {
                pr_err("%s(): alloc_percpu.\n", __func__);
                return -ENOMEM;
        }
index 937d0fcf74bc67d010d6a7ed1cf47b3a7307adbb..5212447c86e72b44a8ab91fabb05781b1a5026d0 100644 (file)
@@ -2588,23 +2588,123 @@ static int dev_ifconf(struct net *net, struct compat_ifconf __user *uifc32)
 
 static int ethtool_ioctl(struct net *net, struct compat_ifreq __user *ifr32)
 {
+       struct compat_ethtool_rxnfc __user *compat_rxnfc;
+       bool convert_in = false, convert_out = false;
+       size_t buf_size = ALIGN(sizeof(struct ifreq), 8);
+       struct ethtool_rxnfc __user *rxnfc;
        struct ifreq __user *ifr;
+       u32 rule_cnt = 0, actual_rule_cnt;
+       u32 ethcmd;
        u32 data;
-       void __user *datap;
+       int ret;
+
+       if (get_user(data, &ifr32->ifr_ifru.ifru_data))
+               return -EFAULT;
 
-       ifr = compat_alloc_user_space(sizeof(*ifr));
+       compat_rxnfc = compat_ptr(data);
 
-       if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
+       if (get_user(ethcmd, &compat_rxnfc->cmd))
                return -EFAULT;
 
-       if (get_user(data, &ifr32->ifr_ifru.ifru_data))
+       /* Most ethtool structures are defined without padding.
+        * Unfortunately struct ethtool_rxnfc is an exception.
+        */
+       switch (ethcmd) {
+       default:
+               break;
+       case ETHTOOL_GRXCLSRLALL:
+               /* Buffer size is variable */
+               if (get_user(rule_cnt, &compat_rxnfc->rule_cnt))
+                       return -EFAULT;
+               if (rule_cnt > KMALLOC_MAX_SIZE / sizeof(u32))
+                       return -ENOMEM;
+               buf_size += rule_cnt * sizeof(u32);
+               /* fall through */
+       case ETHTOOL_GRXRINGS:
+       case ETHTOOL_GRXCLSRLCNT:
+       case ETHTOOL_GRXCLSRULE:
+               convert_out = true;
+               /* fall through */
+       case ETHTOOL_SRXCLSRLDEL:
+       case ETHTOOL_SRXCLSRLINS:
+               buf_size += sizeof(struct ethtool_rxnfc);
+               convert_in = true;
+               break;
+       }
+
+       ifr = compat_alloc_user_space(buf_size);
+       rxnfc = (void *)ifr + ALIGN(sizeof(struct ifreq), 8);
+
+       if (copy_in_user(&ifr->ifr_name, &ifr32->ifr_name, IFNAMSIZ))
                return -EFAULT;
 
-       datap = compat_ptr(data);
-       if (put_user(datap, &ifr->ifr_ifru.ifru_data))
+       if (put_user(convert_in ? rxnfc : compat_ptr(data),
+                    &ifr->ifr_ifru.ifru_data))
                return -EFAULT;
 
-       return dev_ioctl(net, SIOCETHTOOL, ifr);
+       if (convert_in) {
+               /* We expect there to be holes between fs.m_u and
+                * fs.ring_cookie and at the end of fs, but nowhere else.
+                */
+               BUILD_BUG_ON(offsetof(struct compat_ethtool_rxnfc, fs.m_u) +
+                            sizeof(compat_rxnfc->fs.m_u) !=
+                            offsetof(struct ethtool_rxnfc, fs.m_u) +
+                            sizeof(rxnfc->fs.m_u));
+               BUILD_BUG_ON(
+                       offsetof(struct compat_ethtool_rxnfc, fs.location) -
+                       offsetof(struct compat_ethtool_rxnfc, fs.ring_cookie) !=
+                       offsetof(struct ethtool_rxnfc, fs.location) -
+                       offsetof(struct ethtool_rxnfc, fs.ring_cookie));
+
+               if (copy_in_user(rxnfc, compat_rxnfc,
+                                (void *)(&rxnfc->fs.m_u + 1) -
+                                (void *)rxnfc) ||
+                   copy_in_user(&rxnfc->fs.ring_cookie,
+                                &compat_rxnfc->fs.ring_cookie,
+                                (void *)(&rxnfc->fs.location + 1) -
+                                (void *)&rxnfc->fs.ring_cookie) ||
+                   copy_in_user(&rxnfc->rule_cnt, &compat_rxnfc->rule_cnt,
+                                sizeof(rxnfc->rule_cnt)))
+                       return -EFAULT;
+       }
+
+       ret = dev_ioctl(net, SIOCETHTOOL, ifr);
+       if (ret)
+               return ret;
+
+       if (convert_out) {
+               if (copy_in_user(compat_rxnfc, rxnfc,
+                                (const void *)(&rxnfc->fs.m_u + 1) -
+                                (const void *)rxnfc) ||
+                   copy_in_user(&compat_rxnfc->fs.ring_cookie,
+                                &rxnfc->fs.ring_cookie,
+                                (const void *)(&rxnfc->fs.location + 1) -
+                                (const void *)&rxnfc->fs.ring_cookie) ||
+                   copy_in_user(&compat_rxnfc->rule_cnt, &rxnfc->rule_cnt,
+                                sizeof(rxnfc->rule_cnt)))
+                       return -EFAULT;
+
+               if (ethcmd == ETHTOOL_GRXCLSRLALL) {
+                       /* As an optimisation, we only copy the actual
+                        * number of rules that the underlying
+                        * function returned.  Since Mallory might
+                        * change the rule count in user memory, we
+                        * check that it is less than the rule count
+                        * originally given (as the user buffer size),
+                        * which has been range-checked.
+                        */
+                       if (get_user(actual_rule_cnt, &rxnfc->rule_cnt))
+                               return -EFAULT;
+                       if (actual_rule_cnt < rule_cnt)
+                               rule_cnt = actual_rule_cnt;
+                       if (copy_in_user(&compat_rxnfc->rule_locs[0],
+                                        &rxnfc->rule_locs[0],
+                                        rule_cnt * sizeof(u32)))
+                               return -EFAULT;
+               }
+       }
+
+       return 0;
 }
 
 static int compat_siocwandev(struct net *net, struct compat_ifreq __user *uifr32)
index d575f053486889ad5bc1aae12ffa36e8e5eb3342..f83a3d1da81b90ec382918e4b5b193a150b99211 100644 (file)
@@ -1907,7 +1907,7 @@ int xfrm_state_mtu(struct xfrm_state *x, int mtu)
        return res;
 }
 
-int xfrm_init_state(struct xfrm_state *x)
+int __xfrm_init_state(struct xfrm_state *x, bool init_replay)
 {
        struct xfrm_state_afinfo *afinfo;
        struct xfrm_mode *inner_mode;
@@ -1980,12 +1980,25 @@ int xfrm_init_state(struct xfrm_state *x)
        if (x->outer_mode == NULL)
                goto error;
 
+       if (init_replay) {
+               err = xfrm_init_replay(x);
+               if (err)
+                       goto error;
+       }
+
        x->km.state = XFRM_STATE_VALID;
 
 error:
        return err;
 }
 
+EXPORT_SYMBOL(__xfrm_init_state);
+
+int xfrm_init_state(struct xfrm_state *x)
+{
+       return __xfrm_init_state(x, true);
+}
+
 EXPORT_SYMBOL(xfrm_init_state);
 
 int __net_init xfrm_state_init(struct net *net)
index 706385ae3e4bb1aa4ee86defa50df9a9200c5595..fc152d28753c41df6bd7e26becee2b1657a3ace8 100644 (file)
@@ -511,7 +511,7 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
 
        xfrm_mark_get(attrs, &x->mark);
 
-       err = xfrm_init_state(x);
+       err = __xfrm_init_state(x, false);
        if (err)
                goto error;
 
index 2e088109fbd5238f3e4f6d293848606d0ac95a58..fcea26168bca718afb07cf4a2a71081b309e906e 100644 (file)
@@ -18,6 +18,11 @@ always               := $(hostprogs-y) $(hostprogs-m)
 # The following hostprogs-y programs are only build on demand
 hostprogs-y += unifdef
 
+# This target is used internally to avoid "is up to date" messages
+PHONY += build_unifdef
+build_unifdef: scripts/unifdef FORCE
+       @:
+
 subdir-$(CONFIG_MODVERSIONS) += genksyms
 subdir-y                     += mod
 subdir-$(CONFIG_SECURITY_SELINUX) += selinux
index 4eb99ab34053769f5b2b644594427b2bdc108c82..d5f925abe4d29710ab0b314bf28d29752b35dc8d 100644 (file)
@@ -49,6 +49,40 @@ ifeq ($(KBUILD_NOPEDANTIC),)
                 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
         endif
 endif
+
+#
+# make W=1 settings
+#
+# $(call cc-option... ) handles gcc -W.. options which
+# are not supported by all versions of the compiler
+ifdef KBUILD_ENABLE_EXTRA_GCC_CHECKS
+KBUILD_EXTRA_WARNINGS := -Wextra
+KBUILD_EXTRA_WARNINGS += -Wunused -Wno-unused-parameter
+KBUILD_EXTRA_WARNINGS += -Waggregate-return
+KBUILD_EXTRA_WARNINGS += -Wbad-function-cast
+KBUILD_EXTRA_WARNINGS += -Wcast-qual
+KBUILD_EXTRA_WARNINGS += -Wcast-align
+KBUILD_EXTRA_WARNINGS += -Wconversion
+KBUILD_EXTRA_WARNINGS += -Wdisabled-optimization
+KBUILD_EXTRA_WARNINGS += -Wlogical-op
+KBUILD_EXTRA_WARNINGS += -Wmissing-declarations
+KBUILD_EXTRA_WARNINGS += -Wmissing-format-attribute
+KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wmissing-include-dirs,)
+KBUILD_EXTRA_WARNINGS += -Wmissing-prototypes
+KBUILD_EXTRA_WARNINGS += -Wnested-externs
+KBUILD_EXTRA_WARNINGS += -Wold-style-definition
+KBUILD_EXTRA_WARNINGS += $(call cc-option, -Woverlength-strings,)
+KBUILD_EXTRA_WARNINGS += -Wpacked
+KBUILD_EXTRA_WARNINGS += -Wpacked-bitfield-compat
+KBUILD_EXTRA_WARNINGS += -Wpadded
+KBUILD_EXTRA_WARNINGS += -Wpointer-arith
+KBUILD_EXTRA_WARNINGS += -Wredundant-decls
+KBUILD_EXTRA_WARNINGS += -Wshadow
+KBUILD_EXTRA_WARNINGS += -Wswitch-default
+KBUILD_EXTRA_WARNINGS += $(call cc-option, -Wvla,)
+KBUILD_CFLAGS += $(KBUILD_EXTRA_WARNINGS)
+endif
+
 include scripts/Makefile.lib
 
 ifdef host-progs
@@ -403,7 +437,6 @@ ifneq ($(cmd_files),)
   include $(cmd_files)
 endif
 
-
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable se we can use it in if_changed and friends.
 
index 1512c0a755acea37da3d190c88ae47c04023f883..e1862429ccda55ea41f760acd299ea6747319f0c 100755 (executable)
@@ -56,10 +56,11 @@ trap "rm -f $tmp1 $tmp2" 0
 dump_config "$img"
 
 # That didn't work, so retry after decompression.
-try_decompress '\037\213\010' xy  gunzip
-try_decompress 'BZh'          xy  bunzip2
-try_decompress '\135\0\0\0'   xxx unlzma
-try_decompress '\211\114\132' xy  'lzop -d'
+try_decompress '\037\213\010' xy    gunzip
+try_decompress '\3757zXZ\000' abcde unxz
+try_decompress 'BZh'          xy    bunzip2
+try_decompress '\135\0\0\0'   xxx   unlzma
+try_decompress '\211\114\132' xy    'lzop -d'
 
 # Bail out:
 echo "$me: Cannot find kernel config." >&2
index e420fe440019fd7c1ea8c0a80319f68bd6f4983b..13d03cf05d95115571839e2c791fc87fa1c9612a 100644 (file)
@@ -28,9 +28,9 @@ $(obj)/keywords.c: $(obj)/keywords.gperf FORCE
 # flex
 
 quiet_cmd_lex.c = FLEX    $@
-      cmd_lex.c = flex -o$@ -d $< $(obj)/parse.h
+      cmd_lex.c = flex -o$@ -d $<
 
-$(obj)/lex.c: $(obj)/lex.l $(obj)/parse.h $(obj)/keywords.c FORCE
+$(obj)/lex.c: $(obj)/lex.l $(obj)/keywords.c FORCE
        $(call if_changed,lex.c)
        cp $@ $@_shipped
 
index f99115ebe9254a4ef630eabe127bc7cf25e2195c..f9e75531ea0390836bfdc0fa5c8ad5b42ca12924 100644 (file)
@@ -53,12 +53,22 @@ static int nsyms;
 static struct symbol *expansion_trail;
 static struct symbol *visited_symbols;
 
-static const char *const symbol_type_name[] = {
-       "normal", "typedef", "enum", "struct", "union"
+static const struct {
+       int n;
+       const char *name;
+} symbol_types[] = {
+       [SYM_NORMAL]     = { 0, NULL},
+       [SYM_TYPEDEF]    = {'t', "typedef"},
+       [SYM_ENUM]       = {'e', "enum"},
+       [SYM_STRUCT]     = {'s', "struct"},
+       [SYM_UNION]      = {'u', "union"},
+       [SYM_ENUM_CONST] = {'E', "enum constant"},
 };
 
 static int equal_list(struct string_list *a, struct string_list *b);
 static void print_list(FILE * f, struct string_list *list);
+static struct string_list *concat_list(struct string_list *start, ...);
+static struct string_list *mk_node(const char *string);
 static void print_location(void);
 static void print_type_name(enum symbol_type type, const char *name);
 
@@ -140,14 +150,20 @@ static unsigned long crc32(const char *s)
 
 static enum symbol_type map_to_ns(enum symbol_type t)
 {
-       if (t == SYM_TYPEDEF)
-               t = SYM_NORMAL;
-       else if (t == SYM_UNION)
-               t = SYM_STRUCT;
+       switch (t) {
+       case SYM_ENUM_CONST:
+       case SYM_NORMAL:
+       case SYM_TYPEDEF:
+               return SYM_NORMAL;
+       case SYM_ENUM:
+       case SYM_STRUCT:
+       case SYM_UNION:
+               return SYM_STRUCT;
+       }
        return t;
 }
 
-struct symbol *find_symbol(const char *name, enum symbol_type ns)
+struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact)
 {
        unsigned long h = crc32(name) % HASH_BUCKETS;
        struct symbol *sym;
@@ -158,6 +174,8 @@ struct symbol *find_symbol(const char *name, enum symbol_type ns)
                    sym->is_declared)
                        break;
 
+       if (exact && sym && sym->type != ns)
+               return NULL;
        return sym;
 }
 
@@ -180,10 +198,47 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
                            struct string_list *defn, int is_extern,
                            int is_reference)
 {
-       unsigned long h = crc32(name) % HASH_BUCKETS;
+       unsigned long h;
        struct symbol *sym;
        enum symbol_status status = STATUS_UNCHANGED;
+       /* The parser adds symbols in the order their declaration completes,
+        * so it is safe to store the value of the previous enum constant in
+        * a static variable.
+        */
+       static int enum_counter;
+       static struct string_list *last_enum_expr;
+
+       if (type == SYM_ENUM_CONST) {
+               if (defn) {
+                       free_list(last_enum_expr, NULL);
+                       last_enum_expr = copy_list_range(defn, NULL);
+                       enum_counter = 1;
+               } else {
+                       struct string_list *expr;
+                       char buf[20];
+
+                       snprintf(buf, sizeof(buf), "%d", enum_counter++);
+                       if (last_enum_expr) {
+                               expr = copy_list_range(last_enum_expr, NULL);
+                               defn = concat_list(mk_node("("),
+                                                  expr,
+                                                  mk_node(")"),
+                                                  mk_node("+"),
+                                                  mk_node(buf), NULL);
+                       } else {
+                               defn = mk_node(buf);
+                       }
+               }
+       } else if (type == SYM_ENUM) {
+               free_list(last_enum_expr, NULL);
+               last_enum_expr = NULL;
+               enum_counter = 0;
+               if (!name)
+                       /* Anonymous enum definition, nothing more to do */
+                       return NULL;
+       }
 
+       h = crc32(name) % HASH_BUCKETS;
        for (sym = symtab[h]; sym; sym = sym->hash_next) {
                if (map_to_ns(sym->type) == map_to_ns(type) &&
                    strcmp(name, sym->name) == 0) {
@@ -247,8 +302,12 @@ static struct symbol *__add_symbol(const char *name, enum symbol_type type,
        sym->is_override = 0;
 
        if (flag_debug) {
-               fprintf(debugfile, "Defn for %s %s == <",
-                       symbol_type_name[type], name);
+               if (symbol_types[type].name)
+                       fprintf(debugfile, "Defn for %s %s == <",
+                               symbol_types[type].name, name);
+               else
+                       fprintf(debugfile, "Defn for type%d %s == <",
+                               type, name);
                if (is_extern)
                        fputs("extern ", debugfile);
                print_list(debugfile, defn);
@@ -288,6 +347,35 @@ void free_list(struct string_list *s, struct string_list *e)
        }
 }
 
+static struct string_list *mk_node(const char *string)
+{
+       struct string_list *newnode;
+
+       newnode = xmalloc(sizeof(*newnode));
+       newnode->string = xstrdup(string);
+       newnode->tag = SYM_NORMAL;
+       newnode->next = NULL;
+
+       return newnode;
+}
+
+static struct string_list *concat_list(struct string_list *start, ...)
+{
+       va_list ap;
+       struct string_list *n, *n2;
+
+       if (!start)
+               return NULL;
+       for (va_start(ap, start); (n = va_arg(ap, struct string_list *));) {
+               for (n2 = n; n2->next; n2 = n2->next)
+                       ;
+               n2->next = start;
+               start = n;
+       }
+       va_end(ap);
+       return start;
+}
+
 struct string_list *copy_node(struct string_list *node)
 {
        struct string_list *newnode;
@@ -299,6 +387,22 @@ struct string_list *copy_node(struct string_list *node)
        return newnode;
 }
 
+struct string_list *copy_list_range(struct string_list *start,
+                                   struct string_list *end)
+{
+       struct string_list *res, *n;
+
+       if (start == end)
+               return NULL;
+       n = res = copy_node(start);
+       for (start = start->next; start != end; start = start->next) {
+               n->next = copy_node(start);
+               n = n->next;
+       }
+       n->next = NULL;
+       return res;
+}
+
 static int equal_list(struct string_list *a, struct string_list *b)
 {
        while (a && b) {
@@ -346,8 +450,8 @@ static struct string_list *read_node(FILE *f)
        if (node.string[1] == '#') {
                int n;
 
-               for (n = 0; n < ARRAY_SIZE(symbol_type_name); n++) {
-                       if (node.string[0] == symbol_type_name[n][0]) {
+               for (n = 0; n < ARRAY_SIZE(symbol_types); n++) {
+                       if (node.string[0] == symbol_types[n].n) {
                                node.tag = n;
                                node.string += 2;
                                return copy_node(&node);
@@ -397,8 +501,8 @@ static void read_reference(FILE *f)
 
 static void print_node(FILE * f, struct string_list *list)
 {
-       if (list->tag != SYM_NORMAL) {
-               putc(symbol_type_name[list->tag][0], f);
+       if (symbol_types[list->tag].n) {
+               putc(symbol_types[list->tag].n, f);
                putc('#', f);
        }
        fputs(list->string, f);
@@ -468,8 +572,9 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc)
                        crc = partial_crc32_one(' ', crc);
                        break;
 
+               case SYM_ENUM_CONST:
                case SYM_TYPEDEF:
-                       subsym = find_symbol(cur->string, cur->tag);
+                       subsym = find_symbol(cur->string, cur->tag, 0);
                        /* FIXME: Bad reference files can segfault here. */
                        if (subsym->expansion_trail) {
                                if (flag_dump_defs)
@@ -486,55 +591,30 @@ static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc)
                case SYM_STRUCT:
                case SYM_UNION:
                case SYM_ENUM:
-                       subsym = find_symbol(cur->string, cur->tag);
+                       subsym = find_symbol(cur->string, cur->tag, 0);
                        if (!subsym) {
-                               struct string_list *n, *t = NULL;
+                               struct string_list *n;
 
                                error_with_pos("expand undefined %s %s",
-                                              symbol_type_name[cur->tag],
+                                              symbol_types[cur->tag].name,
                                               cur->string);
-
-                               n = xmalloc(sizeof(*n));
-                               n->string = xstrdup(symbol_type_name[cur->tag]);
-                               n->tag = SYM_NORMAL;
-                               n->next = t;
-                               t = n;
-
-                               n = xmalloc(sizeof(*n));
-                               n->string = xstrdup(cur->string);
-                               n->tag = SYM_NORMAL;
-                               n->next = t;
-                               t = n;
-
-                               n = xmalloc(sizeof(*n));
-                               n->string = xstrdup("{");
-                               n->tag = SYM_NORMAL;
-                               n->next = t;
-                               t = n;
-
-                               n = xmalloc(sizeof(*n));
-                               n->string = xstrdup("UNKNOWN");
-                               n->tag = SYM_NORMAL;
-                               n->next = t;
-                               t = n;
-
-                               n = xmalloc(sizeof(*n));
-                               n->string = xstrdup("}");
-                               n->tag = SYM_NORMAL;
-                               n->next = t;
-                               t = n;
-
+                               n = concat_list(mk_node
+                                               (symbol_types[cur->tag].name),
+                                               mk_node(cur->string),
+                                               mk_node("{"),
+                                               mk_node("UNKNOWN"),
+                                               mk_node("}"), NULL);
                                subsym =
                                    add_symbol(cur->string, cur->tag, n, 0);
                        }
                        if (subsym->expansion_trail) {
                                if (flag_dump_defs) {
                                        fprintf(debugfile, "%s %s ",
-                                               symbol_type_name[cur->tag],
+                                               symbol_types[cur->tag].name,
                                                cur->string);
                                }
 
-                               crc = partial_crc32(symbol_type_name[cur->tag],
+                               crc = partial_crc32(symbol_types[cur->tag].name,
                                                    crc);
                                crc = partial_crc32_one(' ', crc);
                                crc = partial_crc32(cur->string, crc);
@@ -565,7 +645,7 @@ void export_symbol(const char *name)
 {
        struct symbol *sym;
 
-       sym = find_symbol(name, SYM_NORMAL);
+       sym = find_symbol(name, SYM_NORMAL, 0);
        if (!sym)
                error_with_pos("export undefined symbol %s", name);
        else {
@@ -624,8 +704,8 @@ static void print_location(void)
 
 static void print_type_name(enum symbol_type type, const char *name)
 {
-       if (type != SYM_NORMAL)
-               fprintf(stderr, "%s %s", symbol_type_name[type], name);
+       if (symbol_types[type].name)
+               fprintf(stderr, "%s %s", symbol_types[type].name, name);
        else
                fprintf(stderr, "%s", name);
 }
@@ -771,8 +851,8 @@ int main(int argc, char **argv)
 
                        if (sym->is_override)
                                fputs("override ", dumpfile);
-                       if (sym->type != SYM_NORMAL) {
-                               putc(symbol_type_name[sym->type][0], dumpfile);
+                       if (symbol_types[sym->type].n) {
+                               putc(symbol_types[sym->type].n, dumpfile);
                                putc('#', dumpfile);
                        }
                        fputs(sym->name, dumpfile);
index 25c4d40cefc134f2609593ed60546daba55e1aab..7ec52ae3846aa3c2b70837fd652d7e20bbf9dcb0 100644 (file)
@@ -26,7 +26,8 @@
 #include <stdio.h>
 
 enum symbol_type {
-       SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION
+       SYM_NORMAL, SYM_TYPEDEF, SYM_ENUM, SYM_STRUCT, SYM_UNION,
+       SYM_ENUM_CONST
 };
 
 enum symbol_status {
@@ -58,7 +59,7 @@ typedef struct string_list **yystype;
 extern int cur_line;
 extern char *cur_filename;
 
-struct symbol *find_symbol(const char *name, enum symbol_type ns);
+struct symbol *find_symbol(const char *name, enum symbol_type ns, int exact);
 struct symbol *add_symbol(const char *name, enum symbol_type type,
                          struct string_list *defn, int is_extern);
 void export_symbol(const char *);
@@ -66,6 +67,8 @@ void export_symbol(const char *);
 void free_node(struct string_list *list);
 void free_list(struct string_list *s, struct string_list *e);
 struct string_list *copy_node(struct string_list *);
+struct string_list *copy_list_range(struct string_list *start,
+                                   struct string_list *end);
 
 int yylex(void);
 int yyparse(void);
index 2ac23bcca5b537fad4c8b06401404b20adb03e9e..af4939041e4b6f082a446fab07b5d79addf30ef0 100644 (file)
@@ -79,6 +79,7 @@ typedef int flex_int32_t;
 typedef unsigned char flex_uint8_t; 
 typedef unsigned short int flex_uint16_t;
 typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
 
 /* Limits of integral types. */
 #ifndef INT8_MIN
@@ -109,8 +110,6 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
-#endif /* ! C99 */
-
 #endif /* ! FLEXINT_H */
 
 /* %endif */
@@ -456,16 +455,16 @@ struct yy_trans_info
        flex_int32_t yy_verify;
        flex_int32_t yy_nxt;
        };
-static yyconst flex_int16_t yy_accept[76] =
+static yyconst flex_int16_t yy_accept[73] =
     {   0,
-        0,    0,    0,    0,   14,   12,    4,    3,   12,    7,
-       12,   12,    7,   12,   12,   12,   12,   12,    9,    9,
-       12,   12,   12,    4,    0,    5,    0,    7,    0,    6,
-        0,    0,    0,    0,    0,    0,    2,    8,   10,   10,
-        9,    0,    0,    9,    9,    0,    9,    0,    0,   11,
-        0,    0,    0,   10,    0,   10,    9,    9,    0,    0,
-        0,    0,    0,    0,    0,   10,   10,    0,    0,    0,
-        0,    0,    0,    1,    0
+        0,    0,   14,   12,    4,    3,   12,    7,   12,   12,
+       12,   12,   12,    9,    9,   12,   12,    7,   12,   12,
+        4,    0,    5,    0,    7,    8,    0,    6,    0,    0,
+       10,   10,    9,    0,    0,    9,    9,    0,    9,    0,
+        0,    0,    0,    2,    0,    0,   11,    0,   10,    0,
+       10,    9,    9,    0,    0,    0,   10,   10,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        1,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -507,108 +506,104 @@ static yyconst flex_int32_t yy_meta[29] =
         8,    7,    3,    3,    3,    1,    3,    1
     } ;
 
-static yyconst flex_int16_t yy_base[88] =
+static yyconst flex_int16_t yy_base[85] =
     {   0,
-        0,  147,   21,  140,  145,  284,   39,  284,   26,    0,
-       32,  126,   40,   44,  115,   35,   36,   46,   50,   53,
-       39,   61,   54,   79,   65,  284,    0,    0,   66,  284,
-        0,  119,   79,   75,  123,  104,  284,  284,  107,    0,
-       79,   73,   76,   76,   66,    0,    0,   85,   86,  284,
-      133,   83,   91,  284,   99,  147,  284,  114,  122,   70,
-      107,  141,  172,  151,  135,  181,  284,  137,  114,  157,
-      149,   48,   45,  284,  284,  208,  214,  222,  230,  238,
-      246,  250,  255,  256,  261,  267,  275
+        0,  145,  150,  266,   27,  266,   25,    0,  131,   23,
+       23,   16,   23,   39,   31,   25,   39,   60,   22,   65,
+       57,   43,  266,    0,    0,  266,   61,  266,    0,  128,
+       74,    0,  113,   59,   62,  113,   52,    0,    0,   72,
+       66,  110,  100,  266,   73,   74,  266,   70,  266,   90,
+      103,  266,   84,  129,  108,  113,  143,  266,  107,   66,
+      118,  137,  168,  120,   80,   91,  145,  143,   83,   41,
+      266,  266,  190,  196,  204,  212,  220,  228,  232,  237,
+      238,  243,  249,  257
     } ;
 
-static yyconst flex_int16_t yy_def[88] =
+static yyconst flex_int16_t yy_def[85] =
     {   0,
-       75,    1,    1,    3,   75,   75,   75,   75,   76,   77,
-       78,   75,   77,   79,   75,   75,   75,   75,   75,   19,
-       75,   75,   75,   75,   76,   75,   80,   77,   78,   75,
-       81,   75,   76,   78,   79,   79,   75,   75,   75,   39,
-       19,   82,   83,   75,   75,   84,   20,   76,   78,   75,
-       79,   51,   85,   75,   75,   75,   75,   84,   79,   51,
-       79,   79,   79,   51,   75,   75,   75,   86,   79,   63,
-       86,   87,   87,   75,    0,   75,   75,   75,   75,   75,
-       75,   75,   75,   75,   75,   75,   75
+       72,    1,   72,   72,   72,   72,   73,   74,   72,   72,
+       75,   72,   72,   72,   14,   72,   72,   74,   72,   76,
+       72,   73,   72,   77,   74,   72,   75,   72,   78,   72,
+       72,   31,   14,   79,   80,   72,   72,   81,   15,   73,
+       75,   76,   76,   72,   73,   75,   72,   82,   72,   72,
+       72,   72,   81,   76,   54,   72,   72,   72,   76,   54,
+       76,   76,   76,   54,   83,   76,   63,   83,   84,   84,
+       72,    0,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72
     } ;
 
-static yyconst flex_int16_t yy_nxt[313] =
+static yyconst flex_int16_t yy_nxt[295] =
     {   0,
-        6,    7,    8,    7,    9,    6,   10,    6,    6,   11,
-        6,    6,   12,    6,    6,    6,    6,    6,    6,   10,
-       10,   10,   13,   10,   10,    6,   10,    6,   15,   16,
-       26,   15,   17,   18,   19,   20,   20,   21,   15,   22,
-       24,   30,   24,   38,   33,   36,   37,   74,   23,   34,
-       74,   27,   38,   38,   38,   38,   38,   31,   32,   39,
-       39,   39,   40,   41,   41,   42,   47,   47,   47,   26,
-       43,   38,   44,   45,   46,   30,   44,   75,   38,   38,
-       24,   38,   24,   26,   30,   40,   55,   55,   57,   26,
-       27,   31,   57,   43,   35,   30,   64,   64,   64,   57,
-
-       31,   65,   65,   75,   27,   36,   37,   35,   59,   37,
-       27,   31,   56,   56,   56,   59,   37,   51,   52,   52,
-       39,   39,   39,   59,   37,   37,   68,   53,   54,   54,
-       69,   50,   38,   54,   59,   37,   44,   45,   32,   37,
-       44,   35,   59,   37,   75,   14,   60,   60,   66,   66,
-       66,   37,   14,   72,   75,   61,   62,   63,   59,   61,
-       56,   56,   56,   69,   64,   64,   64,   69,   67,   67,
-       75,   75,   75,   67,   37,   35,   75,   75,   75,   61,
-       62,   75,   75,   61,   75,   70,   70,   70,   75,   75,
-       75,   70,   70,   70,   66,   66,   66,   75,   75,   75,
-
-       75,   75,   54,   54,   75,   75,   75,   54,   25,   25,
-       25,   25,   25,   25,   25,   25,   28,   75,   75,   28,
-       28,   28,   29,   29,   29,   29,   29,   29,   29,   29,
-       35,   35,   35,   35,   35,   35,   35,   35,   48,   75,
-       48,   48,   48,   48,   48,   48,   49,   75,   49,   49,
-       49,   49,   49,   49,   42,   42,   75,   42,   56,   75,
-       56,   58,   58,   58,   66,   75,   66,   71,   71,   71,
-       71,   71,   71,   71,   71,   73,   73,   73,   73,   73,
-       73,   73,   73,    5,   75,   75,   75,   75,   75,   75,
-       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-
-       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-       75,   75
+        4,    5,    6,    5,    7,    4,    8,    9,   10,   11,
+        9,   12,   13,   14,   15,   15,   16,    9,   17,    8,
+        8,    8,   18,    8,    8,    4,    8,   19,   21,   23,
+       21,   26,   28,   26,   26,   30,   31,   31,   31,   26,
+       26,   26,   26,   71,   39,   39,   39,   23,   29,   26,
+       24,   32,   33,   33,   34,   72,   26,   26,   21,   35,
+       21,   36,   37,   38,   40,   36,   43,   44,   24,   41,
+       28,   32,   50,   50,   52,   28,   23,   23,   52,   35,
+       56,   56,   44,   28,   42,   71,   29,   31,   31,   31,
+       42,   29,   59,   44,   48,   49,   49,   24,   24,   29,
+
+       49,   43,   44,   51,   51,   51,   36,   37,   59,   44,
+       36,   65,   44,   54,   55,   55,   51,   51,   51,   59,
+       44,   64,   64,   64,   58,   58,   57,   57,   57,   58,
+       59,   44,   42,   64,   64,   64,   52,   72,   59,   44,
+       47,   66,   60,   60,   42,   44,   59,   69,   26,   72,
+       20,   61,   62,   63,   72,   61,   57,   57,   57,   66,
+       72,   72,   72,   66,   49,   49,   72,   61,   62,   49,
+       44,   61,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   67,   67,   67,   72,   72,   72,   67,   67,   67,
+       22,   22,   22,   22,   22,   22,   22,   22,   25,   72,
+
+       72,   25,   25,   25,   27,   27,   27,   27,   27,   27,
+       27,   27,   42,   42,   42,   42,   42,   42,   42,   42,
+       45,   72,   45,   45,   45,   45,   45,   45,   46,   72,
+       46,   46,   46,   46,   46,   46,   34,   34,   72,   34,
+       51,   72,   51,   53,   53,   53,   57,   72,   57,   68,
+       68,   68,   68,   68,   68,   68,   68,   70,   70,   70,
+       70,   70,   70,   70,   70,    3,   72,   72,   72,   72,
+       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72
+
     } ;
 
-static yyconst flex_int16_t yy_chk[313] =
+static yyconst flex_int16_t yy_chk[295] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
-        9,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        7,   11,    7,   16,   13,   14,   14,   73,    3,   13,
-       72,    9,   16,   17,   17,   21,   21,   11,   18,   18,
-       18,   18,   19,   19,   19,   19,   20,   20,   20,   25,
-       19,   23,   19,   19,   19,   29,   19,   20,   22,   22,
-       24,   23,   24,   33,   34,   42,   43,   43,   45,   48,
-       25,   29,   45,   42,   60,   49,   52,   52,   52,   44,
-
-       34,   53,   53,   41,   33,   36,   36,   52,   61,   61,
-       48,   49,   55,   55,   55,   69,   69,   36,   36,   36,
-       39,   39,   39,   59,   59,   35,   59,   39,   39,   39,
-       61,   32,   15,   39,   51,   51,   58,   58,   12,   68,
-       58,   68,   62,   62,    5,    4,   51,   51,   65,   65,
-       65,   71,    2,   71,    0,   51,   51,   51,   70,   51,
-       56,   56,   56,   62,   64,   64,   64,   62,   56,   56,
-        0,    0,    0,   56,   63,   64,    0,    0,    0,   70,
-       70,    0,    0,   70,    0,   63,   63,   63,    0,    0,
-        0,   63,   63,   63,   66,   66,   66,    0,    0,    0,
-
-        0,    0,   66,   66,    0,    0,    0,   66,   76,   76,
-       76,   76,   76,   76,   76,   76,   77,    0,    0,   77,
-       77,   77,   78,   78,   78,   78,   78,   78,   78,   78,
-       79,   79,   79,   79,   79,   79,   79,   79,   80,    0,
-       80,   80,   80,   80,   80,   80,   81,    0,   81,   81,
-       81,   81,   81,   81,   82,   82,    0,   82,   83,    0,
-       83,   84,   84,   84,   85,    0,   85,   86,   86,   86,
-       86,   86,   86,   86,   86,   87,   87,   87,   87,   87,
-       87,   87,   87,   75,   75,   75,   75,   75,   75,   75,
-       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-
-       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
-       75,   75
+        1,    1,    1,    1,    1,    1,    1,    1,    5,    7,
+        5,   10,   11,   12,   12,   13,   13,   13,   13,   19,
+       10,   16,   16,   70,   15,   15,   15,   22,   11,   19,
+        7,   14,   14,   14,   14,   15,   17,   17,   21,   14,
+       21,   14,   14,   14,   18,   14,   20,   20,   22,   18,
+       27,   34,   35,   35,   37,   41,   40,   45,   37,   34,
+       48,   48,   65,   46,   65,   69,   27,   31,   31,   31,
+       60,   41,   66,   66,   31,   31,   31,   40,   45,   46,
+
+       31,   43,   43,   50,   50,   50,   53,   53,   59,   59,
+       53,   59,   42,   43,   43,   43,   51,   51,   51,   61,
+       61,   55,   55,   55,   51,   51,   56,   56,   56,   51,
+       54,   54,   55,   64,   64,   64,   36,   33,   62,   62,
+       30,   61,   54,   54,   64,   68,   67,   68,    9,    3,
+        2,   54,   54,   54,    0,   54,   57,   57,   57,   62,
+        0,    0,    0,   62,   57,   57,    0,   67,   67,   57,
+       63,   67,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   63,   63,   63,    0,    0,    0,   63,   63,   63,
+       73,   73,   73,   73,   73,   73,   73,   73,   74,    0,
+
+        0,   74,   74,   74,   75,   75,   75,   75,   75,   75,
+       75,   75,   76,   76,   76,   76,   76,   76,   76,   76,
+       77,    0,   77,   77,   77,   77,   77,   77,   78,    0,
+       78,   78,   78,   78,   78,   78,   79,   79,    0,   79,
+       80,    0,   80,   81,   81,   81,   82,    0,   82,   83,
+       83,   83,   83,   83,   83,   83,   83,   84,   84,   84,
+       84,   84,   84,   84,   84,   72,   72,   72,   72,   72,
+       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72
+
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -619,8 +614,8 @@ int yy_flex_debug = 1;
 
 static yyconst flex_int16_t yy_rule_linenum[13] =
     {   0,
-       71,   72,   73,   76,   79,   80,   81,   87,   88,   89,
-       91,   94
+       67,   68,   69,   72,   75,   76,   77,   83,   84,   85,
+       87,   90
     } ;
 
 /* The intent behind this definition is that it'll catch
@@ -667,15 +662,11 @@ char *yytext;
    and then we categorize those basic tokens in the second stage.  */
 #define YY_DECL                static int yylex1(void)
 
-/* Version 2 checksumming does proper tokenization; version 1 wasn't
-   quite so pedantic.  */
-
 /* We don't do multiple input files.  */
 #define YY_NO_INPUT 1
-#line 676 "scripts/genksyms/lex.c"
+#line 668 "scripts/genksyms/lex.c"
 
 #define INITIAL 0
-#define V2_TOKENS 1
 
 #ifndef YY_NO_UNISTD_H
 /* Special case for "unistd.h", since it is non-ANSI. We include it way
@@ -808,7 +799,7 @@ static int input (void );
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
                { \
                int c = '*'; \
-               size_t n; \
+               int n; \
                for ( n = 0; n < max_size && \
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
                        buf[n] = (char) c; \
@@ -918,12 +909,12 @@ YY_DECL
        register int yy_act;
     
 /* %% [7.0] user's declarations go here */
-#line 67 "scripts/genksyms/lex.l"
+#line 63 "scripts/genksyms/lex.l"
 
 
 
  /* Keep track of our location in the original source files.  */
-#line 927 "scripts/genksyms/lex.c"
+#line 918 "scripts/genksyms/lex.c"
 
        if ( !(yy_init) )
                {
@@ -987,13 +978,13 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 76 )
+                               if ( yy_current_state >= 73 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_base[yy_current_state] != 284 );
+               while ( yy_base[yy_current_state] != 266 );
 
 yy_find_action:
 /* %% [10.0] code to find the action number goes here */
@@ -1041,42 +1032,42 @@ do_action:      /* This label is used only to access EOF actions. */
 case 1:
 /* rule 1 can match eol */
 YY_RULE_SETUP
-#line 71 "scripts/genksyms/lex.l"
+#line 67 "scripts/genksyms/lex.l"
 return FILENAME;
        YY_BREAK
 case 2:
 /* rule 2 can match eol */
 YY_RULE_SETUP
-#line 72 "scripts/genksyms/lex.l"
+#line 68 "scripts/genksyms/lex.l"
 cur_line++;
        YY_BREAK
 case 3:
 /* rule 3 can match eol */
 YY_RULE_SETUP
-#line 73 "scripts/genksyms/lex.l"
+#line 69 "scripts/genksyms/lex.l"
 cur_line++;
        YY_BREAK
 /* Ignore all other whitespace.  */
 case 4:
 YY_RULE_SETUP
-#line 76 "scripts/genksyms/lex.l"
+#line 72 "scripts/genksyms/lex.l"
 ;
        YY_BREAK
 case 5:
 /* rule 5 can match eol */
 YY_RULE_SETUP
-#line 79 "scripts/genksyms/lex.l"
+#line 75 "scripts/genksyms/lex.l"
 return STRING;
        YY_BREAK
 case 6:
 /* rule 6 can match eol */
 YY_RULE_SETUP
-#line 80 "scripts/genksyms/lex.l"
+#line 76 "scripts/genksyms/lex.l"
 return CHAR;
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 81 "scripts/genksyms/lex.l"
+#line 77 "scripts/genksyms/lex.l"
 return IDENT;
        YY_BREAK
 /* The Pedant requires that the other C multi-character tokens be
@@ -1085,38 +1076,37 @@ return IDENT;
     around them properly.  */
 case 8:
 YY_RULE_SETUP
-#line 87 "scripts/genksyms/lex.l"
+#line 83 "scripts/genksyms/lex.l"
 return OTHER;
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 88 "scripts/genksyms/lex.l"
+#line 84 "scripts/genksyms/lex.l"
 return INT;
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 89 "scripts/genksyms/lex.l"
+#line 85 "scripts/genksyms/lex.l"
 return REAL;
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 91 "scripts/genksyms/lex.l"
+#line 87 "scripts/genksyms/lex.l"
 return DOTS;
        YY_BREAK
 /* All other tokens are single characters.  */
 case 12:
 YY_RULE_SETUP
-#line 94 "scripts/genksyms/lex.l"
+#line 90 "scripts/genksyms/lex.l"
 return yytext[0];
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 97 "scripts/genksyms/lex.l"
+#line 93 "scripts/genksyms/lex.l"
 ECHO;
        YY_BREAK
-#line 1118 "scripts/genksyms/lex.c"
+#line 1109 "scripts/genksyms/lex.c"
 case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(V2_TOKENS):
        yyterminate();
 
        case YY_END_OF_BUFFER:
@@ -1429,7 +1419,7 @@ static int yy_get_next_buffer (void)
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 76 )
+                       if ( yy_current_state >= 73 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1462,11 +1452,11 @@ static int yy_get_next_buffer (void)
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 76 )
+               if ( yy_current_state >= 73 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 75);
+       yy_is_jam = (yy_current_state == 72);
 
        return yy_is_jam ? 0 : yy_current_state;
 }
@@ -2252,7 +2242,7 @@ void yyfree (void * ptr )
 
 /* %ok-for-header */
 
-#line 97 "scripts/genksyms/lex.l"
+#line 93 "scripts/genksyms/lex.l"
 
 
 
@@ -2263,12 +2253,23 @@ void yyfree (void * ptr )
 
 /* Macros to append to our phrase collection list.  */
 
+/*
+ * We mark any token, that that equals to a known enumerator, as
+ * SYM_ENUM_CONST. The parser will change this for struct and union tags later,
+ * the only problem is struct and union members:
+ *    enum e { a, b }; struct s { int a, b; }
+ * but in this case, the only effect will be, that the ABI checksums become
+ * more volatile, which is acceptable. Also, such collisions are quite rare,
+ * so far it was only observed in include/linux/telephony.h.
+ */
 #define _APP(T,L)      do {                                               \
                          cur_node = next_node;                            \
                          next_node = xmalloc(sizeof(*next_node));         \
                          next_node->next = cur_node;                      \
                          cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
-                         cur_node->tag = SYM_NORMAL;                      \
+                         cur_node->tag =                                  \
+                           find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
+                           SYM_ENUM_CONST : SYM_NORMAL ;                  \
                        } while (0)
 
 #define APP            _APP(yytext, yyleng)
@@ -2294,7 +2295,6 @@ yylex(void)
 
   if (lexstate == ST_NOTSTARTED)
     {
-      BEGIN(V2_TOKENS);
       next_node = xmalloc(sizeof(*next_node));
       next_node->next = NULL;
       lexstate = ST_NORMAL;
@@ -2347,8 +2347,8 @@ repeat:
 
                  case STRUCT_KEYW:
                  case UNION_KEYW:
-                   dont_want_brace_phrase = 3;
                  case ENUM_KEYW:
+                   dont_want_brace_phrase = 3;
                    suppress_type_lookup = 2;
                    goto fini;
 
@@ -2358,8 +2358,7 @@ repeat:
              }
            if (!suppress_type_lookup)
              {
-               struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF);
-               if (sym && sym->type == SYM_TYPEDEF)
+               if (find_symbol(yytext, SYM_TYPEDEF, 1))
                  token = TYPE;
              }
          }
@@ -2478,7 +2477,20 @@ repeat:
          ++count;
          APP;
          goto repeat;
-       case ')': case ']': case '}':
+       case '}':
+         /* is this the last line of an enum declaration? */
+         if (count == 0)
+           {
+             /* Put back the token we just read so's we can find it again
+                after registering the expression.  */
+             unput(token);
+
+             lexstate = ST_NORMAL;
+             token = EXPRESSION_PHRASE;
+             break;
+           }
+         /* FALLTHRU */
+       case ')': case ']':
          --count;
          APP;
          goto repeat;
@@ -2567,143 +2579,4 @@ fini:
 
   return token;
 }
-/* A Bison parser, made by GNU Bison 2.3.  */
-
-/* Skeleton interface for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
-
-   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, 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., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     ASM_KEYW = 258,
-     ATTRIBUTE_KEYW = 259,
-     AUTO_KEYW = 260,
-     BOOL_KEYW = 261,
-     CHAR_KEYW = 262,
-     CONST_KEYW = 263,
-     DOUBLE_KEYW = 264,
-     ENUM_KEYW = 265,
-     EXTERN_KEYW = 266,
-     EXTENSION_KEYW = 267,
-     FLOAT_KEYW = 268,
-     INLINE_KEYW = 269,
-     INT_KEYW = 270,
-     LONG_KEYW = 271,
-     REGISTER_KEYW = 272,
-     RESTRICT_KEYW = 273,
-     SHORT_KEYW = 274,
-     SIGNED_KEYW = 275,
-     STATIC_KEYW = 276,
-     STRUCT_KEYW = 277,
-     TYPEDEF_KEYW = 278,
-     UNION_KEYW = 279,
-     UNSIGNED_KEYW = 280,
-     VOID_KEYW = 281,
-     VOLATILE_KEYW = 282,
-     TYPEOF_KEYW = 283,
-     EXPORT_SYMBOL_KEYW = 284,
-     ASM_PHRASE = 285,
-     ATTRIBUTE_PHRASE = 286,
-     BRACE_PHRASE = 287,
-     BRACKET_PHRASE = 288,
-     EXPRESSION_PHRASE = 289,
-     CHAR = 290,
-     DOTS = 291,
-     IDENT = 292,
-     INT = 293,
-     REAL = 294,
-     STRING = 295,
-     TYPE = 296,
-     OTHER = 297,
-     FILENAME = 298
-   };
-#endif
-/* Tokens.  */
-#define ASM_KEYW 258
-#define ATTRIBUTE_KEYW 259
-#define AUTO_KEYW 260
-#define BOOL_KEYW 261
-#define CHAR_KEYW 262
-#define CONST_KEYW 263
-#define DOUBLE_KEYW 264
-#define ENUM_KEYW 265
-#define EXTERN_KEYW 266
-#define EXTENSION_KEYW 267
-#define FLOAT_KEYW 268
-#define INLINE_KEYW 269
-#define INT_KEYW 270
-#define LONG_KEYW 271
-#define REGISTER_KEYW 272
-#define RESTRICT_KEYW 273
-#define SHORT_KEYW 274
-#define SIGNED_KEYW 275
-#define STATIC_KEYW 276
-#define STRUCT_KEYW 277
-#define TYPEDEF_KEYW 278
-#define UNION_KEYW 279
-#define UNSIGNED_KEYW 280
-#define VOID_KEYW 281
-#define VOLATILE_KEYW 282
-#define TYPEOF_KEYW 283
-#define EXPORT_SYMBOL_KEYW 284
-#define ASM_PHRASE 285
-#define ATTRIBUTE_PHRASE 286
-#define BRACE_PHRASE 287
-#define BRACKET_PHRASE 288
-#define EXPRESSION_PHRASE 289
-#define CHAR 290
-#define DOTS 291
-#define IDENT 292
-#define INT 293
-#define REAL 294
-#define STRING 295
-#define TYPE 296
-#define OTHER 297
-#define FILENAME 298
-
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef int YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-extern YYSTYPE yylval;
-
 
index fe50ff9dacd089d56760c79244c3d4cfacb4c32d..e4ddd493fec3eac20061b1d3701a47c0c36c6ab7 100644 (file)
@@ -55,10 +55,6 @@ CHAR                 L?\'([^\\\']*\\.)*[^\\\']*\'
 
 MC_TOKEN               ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
 
-/* Version 2 checksumming does proper tokenization; version 1 wasn't
-   quite so pedantic.  */
-%s V2_TOKENS
-
 /* We don't do multiple input files.  */
 %option noyywrap
 
@@ -84,9 +80,9 @@ MC_TOKEN              ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
     recognized as tokens.  We don't actually use them since we don't
     parse expressions, but we do want whitespace to be arranged
     around them properly.  */
-<V2_TOKENS>{MC_TOKEN}                  return OTHER;
-<V2_TOKENS>{INT}                       return INT;
-<V2_TOKENS>{REAL}                      return REAL;
+{MC_TOKEN}                             return OTHER;
+{INT}                                  return INT;
+{REAL}                                 return REAL;
 
 "..."                                  return DOTS;
 
@@ -103,12 +99,23 @@ MC_TOKEN           ([~%^&*+=|<>/-]=)|(&&)|("||")|(->)|(<<)|(>>)
 
 /* Macros to append to our phrase collection list.  */
 
+/*
+ * We mark any token, that that equals to a known enumerator, as
+ * SYM_ENUM_CONST. The parser will change this for struct and union tags later,
+ * the only problem is struct and union members:
+ *    enum e { a, b }; struct s { int a, b; }
+ * but in this case, the only effect will be, that the ABI checksums become
+ * more volatile, which is acceptable. Also, such collisions are quite rare,
+ * so far it was only observed in include/linux/telephony.h.
+ */
 #define _APP(T,L)      do {                                               \
                          cur_node = next_node;                            \
                          next_node = xmalloc(sizeof(*next_node));         \
                          next_node->next = cur_node;                      \
                          cur_node->string = memcpy(xmalloc(L+1), T, L+1); \
-                         cur_node->tag = SYM_NORMAL;                      \
+                         cur_node->tag =                                  \
+                           find_symbol(cur_node->string, SYM_ENUM_CONST, 1)?\
+                           SYM_ENUM_CONST : SYM_NORMAL ;                  \
                        } while (0)
 
 #define APP            _APP(yytext, yyleng)
@@ -134,7 +141,6 @@ yylex(void)
 
   if (lexstate == ST_NOTSTARTED)
     {
-      BEGIN(V2_TOKENS);
       next_node = xmalloc(sizeof(*next_node));
       next_node->next = NULL;
       lexstate = ST_NORMAL;
@@ -187,8 +193,8 @@ repeat:
 
                  case STRUCT_KEYW:
                  case UNION_KEYW:
-                   dont_want_brace_phrase = 3;
                  case ENUM_KEYW:
+                   dont_want_brace_phrase = 3;
                    suppress_type_lookup = 2;
                    goto fini;
 
@@ -198,8 +204,7 @@ repeat:
              }
            if (!suppress_type_lookup)
              {
-               struct symbol *sym = find_symbol(yytext, SYM_TYPEDEF);
-               if (sym && sym->type == SYM_TYPEDEF)
+               if (find_symbol(yytext, SYM_TYPEDEF, 1))
                  token = TYPE;
              }
          }
@@ -318,7 +323,20 @@ repeat:
          ++count;
          APP;
          goto repeat;
-       case ')': case ']': case '}':
+       case '}':
+         /* is this the last line of an enum declaration? */
+         if (count == 0)
+           {
+             /* Put back the token we just read so's we can find it again
+                after registering the expression.  */
+             unput(token);
+
+             lexstate = ST_NORMAL;
+             token = EXPRESSION_PHRASE;
+             break;
+           }
+         /* FALLTHRU */
+       case ')': case ']':
          --count;
          APP;
          goto repeat;
index 809b949e495b58267a180c31688ffd926e0adb49..1a0b8607fb0e5ff7412626598443bbe6807404a7 100644 (file)
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   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, or (at your option)
-   any later version.
-
+   the Free Software Foundation, either version 3 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., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
@@ -29,7 +28,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -47,7 +46,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Pure parsers.  */
 #define YYPURE 0
 
+/* Push parsers.  */
+#define YYPUSH 0
+
+/* Pull parsers.  */
+#define YYPULL 1
+
 /* Using locations.  */
 #define YYLSP_NEEDED 0
 
 
 
+/* Copy the first part of user declarations.  */
+
+/* Line 189 of yacc.c  */
+#line 24 "scripts/genksyms/parse.y"
+
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include "genksyms.h"
+
+static int is_typedef;
+static int is_extern;
+static char *current_name;
+static struct string_list *decl_spec;
+
+static void yyerror(const char *);
+
+static inline void
+remove_node(struct string_list **p)
+{
+  struct string_list *node = *p;
+  *p = node->next;
+  free_node(node);
+}
+
+static inline void
+remove_list(struct string_list **pb, struct string_list **pe)
+{
+  struct string_list *b = *pb, *e = *pe;
+  *pb = e;
+  free_list(b, e);
+}
+
+
+
+/* Line 189 of yacc.c  */
+#line 106 "scripts/genksyms/parse.c"
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+
+/* Enabling verbose error messages.  */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
      FILENAME = 298
    };
 #endif
-/* Tokens.  */
-#define ASM_KEYW 258
-#define ATTRIBUTE_KEYW 259
-#define AUTO_KEYW 260
-#define BOOL_KEYW 261
-#define CHAR_KEYW 262
-#define CONST_KEYW 263
-#define DOUBLE_KEYW 264
-#define ENUM_KEYW 265
-#define EXTERN_KEYW 266
-#define EXTENSION_KEYW 267
-#define FLOAT_KEYW 268
-#define INLINE_KEYW 269
-#define INT_KEYW 270
-#define LONG_KEYW 271
-#define REGISTER_KEYW 272
-#define RESTRICT_KEYW 273
-#define SHORT_KEYW 274
-#define SIGNED_KEYW 275
-#define STATIC_KEYW 276
-#define STRUCT_KEYW 277
-#define TYPEDEF_KEYW 278
-#define UNION_KEYW 279
-#define UNSIGNED_KEYW 280
-#define VOID_KEYW 281
-#define VOLATILE_KEYW 282
-#define TYPEOF_KEYW 283
-#define EXPORT_SYMBOL_KEYW 284
-#define ASM_PHRASE 285
-#define ATTRIBUTE_PHRASE 286
-#define BRACE_PHRASE 287
-#define BRACKET_PHRASE 288
-#define EXPRESSION_PHRASE 289
-#define CHAR 290
-#define DOTS 291
-#define IDENT 292
-#define INT 293
-#define REAL 294
-#define STRING 295
-#define TYPE 296
-#define OTHER 297
-#define FILENAME 298
-
-
-
-
-/* Copy the first part of user declarations.  */
-#line 24 "scripts/genksyms/parse.y"
-
-
-#include <assert.h>
-#include <stdlib.h>
-#include "genksyms.h"
-
-static int is_typedef;
-static int is_extern;
-static char *current_name;
-static struct string_list *decl_spec;
-
-static void yyerror(const char *);
-
-static inline void
-remove_node(struct string_list **p)
-{
-  struct string_list *node = *p;
-  *p = node->next;
-  free_node(node);
-}
-
-static inline void
-remove_list(struct string_list **pb, struct string_list **pe)
-{
-  struct string_list *b = *pb, *e = *pe;
-  *pb = e;
-  free_list(b, e);
-}
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
 
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
 
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 
-
 /* Copy the second part of user declarations.  */
 
 
-/* Line 216 of yacc.c.  */
-#line 223 "scripts/genksyms/parse.c"
+/* Line 264 of yacc.c  */
+#line 191 "scripts/genksyms/parse.c"
 
 #ifdef short
 # undef short
@@ -294,14 +262,14 @@ typedef short int yytype_int16;
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static int
-YYID (int i)
+YYID (int yyi)
 #else
 static int
-YYID (i)
-    int i;
+YYID (yyi)
+    int yyi;
 #endif
 {
-  return i;
+  return yyi;
 }
 #endif
 
@@ -382,9 +350,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
 {
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-  };
+  yytype_int16 yyss_alloc;
+  YYSTYPE yyvs_alloc;
+};
 
 /* The size of the maximum gap between one aligned stack and the next.  */
 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -418,12 +386,12 @@ union yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack)                                       \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \
     do                                                                 \
       {                                                                        \
        YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack, Stack, yysize);                          \
-       Stack = &yyptr->Stack;                                          \
+       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+       Stack = &yyptr->Stack_alloc;                                    \
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
       }                                                                        \
@@ -434,16 +402,16 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  4
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   523
+#define YYLAST   532
 
 /* YYNTOKENS -- Number of terminals.  */
 #define YYNTOKENS  53
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  46
+#define YYNNTS  49
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  126
+#define YYNRULES  132
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  178
+#define YYNSTATES  188
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -504,7 +472,8 @@ static const yytype_uint16 yyprhs[] =
      239,   242,   245,   247,   248,   250,   252,   257,   262,   265,
      269,   273,   277,   278,   280,   283,   287,   291,   292,   294,
      296,   299,   303,   306,   307,   309,   311,   315,   318,   321,
-     323,   326,   327,   330,   333,   334,   336
+     323,   326,   327,   330,   334,   339,   341,   345,   347,   351,
+     354,   355,   357
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
@@ -512,16 +481,16 @@ static const yytype_int8 yyrhs[] =
 {
       54,     0,    -1,    55,    -1,    54,    55,    -1,    -1,    56,
       57,    -1,    -1,    12,    23,    58,    60,    -1,    -1,    23,
-      59,    60,    -1,    60,    -1,    84,    -1,    96,    -1,    98,
+      59,    60,    -1,    60,    -1,    84,    -1,    99,    -1,   101,
       -1,     1,    44,    -1,     1,    45,    -1,    64,    61,    44,
       -1,    -1,    62,    -1,    63,    -1,    62,    46,    63,    -1,
-      74,    97,    95,    85,    -1,    -1,    65,    -1,    66,    -1,
+      74,   100,    95,    85,    -1,    -1,    65,    -1,    66,    -1,
       65,    66,    -1,    67,    -1,    68,    -1,     5,    -1,    17,
       -1,    21,    -1,    11,    -1,    14,    -1,    69,    -1,    73,
       -1,    28,    47,    65,    48,    49,    -1,    28,    47,    65,
       49,    -1,    22,    37,    -1,    24,    37,    -1,    10,    37,
       -1,    22,    37,    87,    -1,    24,    37,    87,    -1,    10,
-      37,    32,    -1,    10,    32,    -1,    22,    87,    -1,    24,
+      37,    96,    -1,    10,    96,    -1,    22,    87,    -1,    24,
       87,    -1,     7,    -1,    19,    -1,    15,    -1,    16,    -1,
       20,    -1,    25,    -1,    13,    -1,     9,    -1,    26,    -1,
        6,    -1,    41,    -1,    48,    71,    -1,    -1,    72,    -1,
@@ -543,26 +512,29 @@ static const yytype_int8 yyrhs[] =
       91,    44,    -1,     1,    44,    -1,    -1,    92,    -1,    93,
       -1,    92,    46,    93,    -1,    76,    95,    -1,    37,    94,
       -1,    94,    -1,    52,    34,    -1,    -1,    95,    31,    -1,
-      30,    44,    -1,    -1,    30,    -1,    29,    47,    37,    49,
-      44,    -1
+      51,    97,    45,    -1,    51,    97,    46,    45,    -1,    98,
+      -1,    97,    46,    98,    -1,    37,    -1,    37,    50,    34,
+      -1,    30,    44,    -1,    -1,    30,    -1,    29,    47,    37,
+      49,    44,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   103,   103,   104,   108,   108,   114,   114,   116,   116,
-     118,   119,   120,   121,   122,   123,   127,   141,   142,   146,
-     154,   167,   173,   174,   178,   179,   183,   189,   193,   194,
-     195,   196,   197,   201,   202,   203,   204,   208,   210,   212,
-     216,   223,   230,   239,   240,   241,   245,   246,   247,   248,
-     249,   250,   251,   252,   253,   254,   255,   259,   264,   265,
-     269,   270,   274,   274,   274,   275,   283,   284,   288,   297,
-     299,   301,   303,   305,   312,   313,   317,   318,   319,   321,
-     323,   325,   327,   332,   333,   334,   338,   339,   343,   344,
-     349,   354,   356,   360,   361,   369,   373,   375,   377,   379,
-     381,   386,   395,   396,   401,   406,   407,   411,   412,   416,
-     417,   421,   423,   428,   429,   433,   434,   438,   439,   440,
-     444,   448,   449,   453,   457,   458,   462
+       0,   104,   104,   105,   109,   109,   115,   115,   117,   117,
+     119,   120,   121,   122,   123,   124,   128,   142,   143,   147,
+     155,   168,   174,   175,   179,   180,   184,   190,   194,   195,
+     196,   197,   198,   202,   203,   204,   205,   209,   211,   213,
+     217,   224,   231,   241,   244,   245,   249,   250,   251,   252,
+     253,   254,   255,   256,   257,   258,   259,   263,   268,   269,
+     273,   274,   278,   278,   278,   279,   287,   288,   292,   301,
+     303,   305,   307,   309,   316,   317,   321,   322,   323,   325,
+     327,   329,   331,   336,   337,   338,   342,   343,   347,   348,
+     353,   358,   360,   364,   365,   373,   377,   379,   381,   383,
+     385,   390,   399,   400,   405,   410,   411,   415,   416,   420,
+     421,   425,   427,   432,   433,   437,   438,   442,   443,   444,
+     448,   452,   453,   457,   458,   462,   463,   466,   471,   479,
+     483,   484,   488
 };
 #endif
 
@@ -581,8 +553,8 @@ static const char *const yytname[] =
   "ATTRIBUTE_PHRASE", "BRACE_PHRASE", "BRACKET_PHRASE",
   "EXPRESSION_PHRASE", "CHAR", "DOTS", "IDENT", "INT", "REAL", "STRING",
   "TYPE", "OTHER", "FILENAME", "';'", "'}'", "','", "'('", "'*'", "')'",
-  "'='", "'{'", "':'", "$accept", "declaration_seq", "declaration", "@1",
-  "declaration1", "@2", "@3", "simple_declaration",
+  "'='", "'{'", "':'", "$accept", "declaration_seq", "declaration", "$@1",
+  "declaration1", "$@2", "$@3", "simple_declaration",
   "init_declarator_list_opt", "init_declarator_list", "init_declarator",
   "decl_specifier_seq_opt", "decl_specifier_seq", "decl_specifier",
   "storage_class_specifier", "type_specifier", "simple_type_specifier",
@@ -596,7 +568,8 @@ static const char *const yytname[] =
   "member_specification", "member_declaration",
   "member_declarator_list_opt", "member_declarator_list",
   "member_declarator", "member_bitfield_declarator", "attribute_opt",
-  "asm_definition", "asm_phrase_opt", "export_definition", 0
+  "enum_body", "enumerator_list", "enumerator", "asm_definition",
+  "asm_phrase_opt", "export_definition", 0
 };
 #endif
 
@@ -629,7 +602,8 @@ static const yytype_uint8 yyr1[] =
       81,    82,    82,    83,    83,    83,    83,    83,    83,    83,
       83,    84,    85,    85,    86,    87,    87,    88,    88,    89,
       89,    90,    90,    91,    91,    92,    92,    93,    93,    93,
-      94,    95,    95,    96,    97,    97,    98
+      94,    95,    95,    96,    96,    97,    97,    98,    98,    99,
+     100,   100,   101
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -647,7 +621,8 @@ static const yytype_uint8 yyr2[] =
        2,     2,     1,     0,     1,     1,     4,     4,     2,     3,
        3,     3,     0,     1,     2,     3,     3,     0,     1,     1,
        2,     3,     2,     0,     1,     1,     3,     2,     2,     1,
-       2,     0,     2,     2,     0,     1,     5
+       2,     0,     2,     3,     4,     1,     3,     1,     3,     2,
+       0,     1,     5
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -659,17 +634,18 @@ static const yytype_uint8 yydefact[] =
       62,    53,     0,    31,     0,    52,    32,    48,    49,    29,
       65,    47,    50,    30,     0,     8,     0,    51,    54,    63,
        0,     0,     0,    64,    56,     5,    10,    17,    23,    24,
-      26,    27,    33,    34,    11,    12,    13,    14,    15,    43,
-      39,     6,    37,     0,    44,    22,    38,    45,     0,     0,
-     123,    68,     0,    58,     0,    18,    19,     0,   124,    67,
-      25,    42,    22,    40,     0,   113,     0,     0,   109,     9,
-      17,    41,     0,     0,     0,     0,    57,    59,    60,    16,
-       0,    66,   125,   101,   121,    71,     0,     7,   112,   106,
-      76,    77,     0,     0,     0,   121,    75,     0,   114,   115,
-     119,   105,     0,   110,   124,     0,    36,     0,    73,    72,
-      61,    20,   102,     0,    93,     0,    84,    87,    88,   118,
+      26,    27,    33,    34,    11,    12,    13,    14,    15,    39,
+       0,    43,     6,    37,     0,    44,    22,    38,    45,     0,
+       0,   129,    68,     0,    58,     0,    18,    19,     0,   130,
+      67,    25,    42,   127,     0,   125,    22,    40,     0,   113,
+       0,     0,   109,     9,    17,    41,     0,     0,     0,     0,
+      57,    59,    60,    16,     0,    66,   131,   101,   121,    71,
+       0,     0,   123,     0,     7,   112,   106,    76,    77,     0,
+       0,     0,   121,    75,     0,   114,   115,   119,   105,     0,
+     110,   130,     0,    36,     0,    73,    72,    61,    20,   102,
+       0,    93,     0,    84,    87,    88,   128,   124,   126,   118,
        0,    76,     0,   120,    74,   117,    80,     0,   111,     0,
-      35,   126,   122,     0,    21,   103,    70,    94,    56,     0,
+      35,   132,   122,     0,    21,   103,    70,    94,    56,     0,
       93,    90,    92,    69,    83,     0,    82,    81,     0,     0,
      116,   104,     0,    95,     0,    91,    98,     0,    85,    89,
       79,    78,   100,    99,     0,     0,    97,    96
@@ -678,46 +654,47 @@ static const yytype_uint8 yydefact[] =
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     1,     2,     3,    35,    72,    55,    36,    64,    65,
-      66,    75,    38,    39,    40,    41,    42,    67,    86,    87,
-      43,   114,    69,   105,   106,   125,   126,   127,   128,   151,
-     152,    44,   144,   145,    54,    76,    77,    78,   107,   108,
-     109,   110,   122,    45,    94,    46
+      -1,     1,     2,     3,    35,    76,    56,    36,    65,    66,
+      67,    79,    38,    39,    40,    41,    42,    68,    90,    91,
+      43,   121,    70,   112,   113,   132,   133,   134,   135,   161,
+     162,    44,   154,   155,    55,    80,    81,    82,   114,   115,
+     116,   117,   129,    51,    74,    75,    45,    98,    46
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -134
+#define YYPACT_NINF -135
 static const yytype_int16 yypact[] =
 {
-    -134,    16,  -134,   312,  -134,  -134,    20,  -134,  -134,  -134,
-    -134,  -134,   -18,  -134,    -3,  -134,  -134,  -134,  -134,  -134,
-    -134,  -134,  -134,  -134,   -26,  -134,   -25,  -134,  -134,  -134,
-      -7,     5,    27,  -134,  -134,  -134,  -134,    46,   482,  -134,
-    -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,  -134,
-      -8,  -134,    30,    97,  -134,   482,    30,  -134,   482,     7,
-    -134,  -134,    12,    10,    42,    55,  -134,    46,   -15,    15,
-    -134,  -134,   482,  -134,    25,    26,    47,   145,  -134,  -134,
-      46,  -134,   356,    39,    71,    77,  -134,    10,  -134,  -134,
-      46,  -134,  -134,  -134,  -134,  -134,   193,  -134,  -134,  -134,
-      75,  -134,     6,    95,    43,  -134,    28,    86,    85,  -134,
-    -134,  -134,    88,  -134,   103,    87,  -134,    91,  -134,  -134,
-    -134,  -134,   -23,    90,   401,    94,   101,   102,  -134,  -134,
-      98,  -134,   108,  -134,  -134,   109,  -134,   230,  -134,    26,
-    -134,  -134,  -134,   134,  -134,  -134,  -134,  -134,  -134,     9,
-      48,  -134,    35,  -134,  -134,   445,  -134,  -134,   125,   126,
-    -134,  -134,   128,  -134,   129,  -134,  -134,   267,  -134,  -134,
-    -134,  -134,  -134,  -134,   130,   131,  -134,  -134
+    -135,    20,  -135,   321,  -135,  -135,    30,  -135,  -135,  -135,
+    -135,  -135,   -28,  -135,     2,  -135,  -135,  -135,  -135,  -135,
+    -135,  -135,  -135,  -135,    -6,  -135,     9,  -135,  -135,  -135,
+      -5,    15,   -17,  -135,  -135,  -135,  -135,    18,   491,  -135,
+    -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,  -135,   -22,
+      31,  -135,  -135,    19,   106,  -135,   491,    19,  -135,   491,
+      50,  -135,  -135,    11,    -3,    51,    57,  -135,    18,   -14,
+      14,  -135,  -135,    48,    46,  -135,   491,  -135,    33,    32,
+      59,   154,  -135,  -135,    18,  -135,   365,    56,    60,    61,
+    -135,    -3,  -135,  -135,    18,  -135,  -135,  -135,  -135,  -135,
+     202,    74,  -135,   -23,  -135,  -135,  -135,    77,  -135,    16,
+     101,    49,  -135,    34,    92,    93,  -135,  -135,  -135,    94,
+    -135,   110,    95,  -135,    97,  -135,  -135,  -135,  -135,   -20,
+      96,   410,    99,   113,   100,  -135,  -135,  -135,  -135,  -135,
+     103,  -135,   107,  -135,  -135,   111,  -135,   239,  -135,    32,
+    -135,  -135,  -135,   123,  -135,  -135,  -135,  -135,  -135,     3,
+      52,  -135,    38,  -135,  -135,   454,  -135,  -135,   117,   128,
+    -135,  -135,   134,  -135,   135,  -135,  -135,   276,  -135,  -135,
+    -135,  -135,  -135,  -135,   137,   138,  -135,  -135
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -134,  -134,   180,  -134,  -134,  -134,  -134,   -33,  -134,  -134,
-      93,     0,   -58,   -37,  -134,  -134,  -134,   -73,  -134,  -134,
-     -54,   -32,  -134,   -81,  -134,  -133,  -134,  -134,    29,   -50,
-    -134,  -134,  -134,  -134,   -20,  -134,  -134,   110,  -134,  -134,
-      49,    96,    80,  -134,  -134,  -134
+    -135,  -135,   187,  -135,  -135,  -135,  -135,   -50,  -135,  -135,
+      98,     0,   -59,   -37,  -135,  -135,  -135,   -77,  -135,  -135,
+     -54,   -30,  -135,   -90,  -135,  -134,  -135,  -135,    24,   -58,
+    -135,  -135,  -135,  -135,   -18,  -135,  -135,   109,  -135,  -135,
+      44,    87,    84,   148,  -135,   102,  -135,  -135,  -135
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -727,116 +704,118 @@ static const yytype_int16 yypgoto[] =
 #define YYTABLE_NINF -109
 static const yytype_int16 yytable[] =
 {
-      82,    70,   104,    37,   159,    68,    57,   130,   142,    88,
-     162,    52,    56,    84,    49,    92,     4,    93,    10,    50,
-      51,   132,    79,   134,    71,    53,    53,   143,    20,   104,
-      85,   104,    73,   120,   175,    91,    81,    29,   124,    97,
-      58,    33,   -93,   131,    83,    70,   147,   101,    95,    61,
-     163,   150,    59,   102,    63,    80,   149,    63,   -93,    62,
-      63,   136,    96,   100,    47,    48,   104,   101,   166,    98,
-      99,    60,    80,   102,    63,   137,   150,   150,   103,   124,
-     131,    53,   167,    61,   101,   147,    89,    70,   117,   163,
-     102,    63,   111,    62,    63,   149,    63,   124,    74,   164,
-     165,    90,     7,     8,     9,    10,    11,    12,    13,   124,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-     118,    26,    27,    28,    29,    30,   119,   103,    33,   133,
-     138,   139,    98,    92,   -22,   141,   140,   154,    34,   146,
-     142,   -22,  -107,   153,   -22,   -22,   112,   156,   155,   -22,
-       7,     8,     9,    10,    11,    12,    13,   157,    15,    16,
-      17,    18,    19,    20,    21,    22,    23,    24,   161,    26,
-      27,    28,    29,    30,   170,   171,    33,   172,   173,   176,
-     177,     5,   -22,   121,   169,   135,    34,   113,   160,   -22,
-    -108,     0,   -22,   -22,   123,     0,   129,   -22,     7,     8,
-       9,    10,    11,    12,    13,     0,    15,    16,    17,    18,
-      19,    20,    21,    22,    23,    24,     0,    26,    27,    28,
-      29,    30,     0,     0,    33,     0,     0,     0,     0,   -86,
-       0,   158,     0,     0,    34,     7,     8,     9,    10,    11,
-      12,    13,   -86,    15,    16,    17,    18,    19,    20,    21,
-      22,    23,    24,     0,    26,    27,    28,    29,    30,     0,
-       0,    33,     0,     0,     0,     0,   -86,     0,   174,     0,
-       0,    34,     7,     8,     9,    10,    11,    12,    13,   -86,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-       0,    26,    27,    28,    29,    30,     0,     0,    33,     0,
-       0,     0,     0,   -86,     0,     0,     0,     0,    34,     0,
-       0,     0,     0,     6,     0,     0,   -86,     7,     8,     9,
-      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
-      30,    31,    32,    33,     0,     0,     0,     0,     0,   -22,
-       0,     0,     0,    34,     0,     0,   -22,     0,     0,   -22,
-     -22,     7,     8,     9,    10,    11,    12,    13,     0,    15,
+      86,    71,   111,    37,   172,    10,    83,    69,    58,    49,
+      92,   152,    88,   169,    73,    20,    96,   140,    97,   142,
+       4,   144,   137,    50,    29,    52,   104,    61,    33,    50,
+     153,    53,   111,    89,   111,    77,   -93,   127,    95,    85,
+     157,   131,    59,   185,   173,    54,    57,    99,    62,    71,
+     159,    64,   -93,   141,   160,    62,    84,   108,    63,    64,
+      54,   100,    60,   109,    64,    63,    64,   146,    73,   107,
+      54,   176,   111,   108,    47,    48,    84,   105,   106,   109,
+      64,   147,   160,   160,   110,   177,   141,    87,   131,   157,
+     108,   102,   103,   173,    71,    93,   109,    64,   101,   159,
+      64,   174,   175,    94,   118,   124,   131,    78,   136,   125,
+     126,     7,     8,     9,    10,    11,    12,    13,   131,    15,
+      16,    17,    18,    19,    20,    21,    22,    23,    24,   110,
+      26,    27,    28,    29,    30,   143,   148,    33,   105,   149,
+      96,   151,   152,   -22,   150,   156,   165,    34,   163,   164,
+     -22,  -107,   166,   -22,   -22,   119,   167,   171,   -22,     7,
+       8,     9,    10,    11,    12,    13,   180,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,   181,    26,    27,
+      28,    29,    30,   182,   183,    33,   186,   187,     5,   179,
+     120,   -22,   128,   170,   139,    34,   145,    72,   -22,  -108,
+       0,   -22,   -22,   130,     0,   138,   -22,     7,     8,     9,
+      10,    11,    12,    13,     0,    15,    16,    17,    18,    19,
+      20,    21,    22,    23,    24,     0,    26,    27,    28,    29,
+      30,     0,     0,    33,     0,     0,     0,     0,   -86,     0,
+     168,     0,     0,    34,     7,     8,     9,    10,    11,    12,
+      13,   -86,    15,    16,    17,    18,    19,    20,    21,    22,
+      23,    24,     0,    26,    27,    28,    29,    30,     0,     0,
+      33,     0,     0,     0,     0,   -86,     0,   184,     0,     0,
+      34,     7,     8,     9,    10,    11,    12,    13,   -86,    15,
       16,    17,    18,    19,    20,    21,    22,    23,    24,     0,
       26,    27,    28,    29,    30,     0,     0,    33,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    34,     0,     0,
-       0,     0,     0,     0,   115,   116,     7,     8,     9,    10,
-      11,    12,    13,     0,    15,    16,    17,    18,    19,    20,
-      21,    22,    23,    24,     0,    26,    27,    28,    29,    30,
-       0,     0,    33,     0,     0,     0,     0,     0,   147,     0,
-       0,     0,   148,     0,     0,     0,     0,     0,   149,    63,
+       0,     0,   -86,     0,     0,     0,     0,    34,     0,     0,
+       0,     0,     6,     0,     0,   -86,     7,     8,     9,    10,
+      11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
+      31,    32,    33,     0,     0,     0,     0,     0,   -22,     0,
+       0,     0,    34,     0,     0,   -22,     0,     0,   -22,   -22,
        7,     8,     9,    10,    11,    12,    13,     0,    15,    16,
       17,    18,    19,    20,    21,    22,    23,    24,     0,    26,
       27,    28,    29,    30,     0,     0,    33,     0,     0,     0,
-       0,   168,     0,     0,     0,     0,    34,     7,     8,     9,
-      10,    11,    12,    13,     0,    15,    16,    17,    18,    19,
-      20,    21,    22,    23,    24,     0,    26,    27,    28,    29,
-      30,     0,     0,    33,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,    34
+       0,     0,     0,     0,     0,     0,    34,     0,     0,     0,
+       0,     0,     0,   122,   123,     7,     8,     9,    10,    11,
+      12,    13,     0,    15,    16,    17,    18,    19,    20,    21,
+      22,    23,    24,     0,    26,    27,    28,    29,    30,     0,
+       0,    33,     0,     0,     0,     0,     0,   157,     0,     0,
+       0,   158,     0,     0,     0,     0,     0,   159,    64,     7,
+       8,     9,    10,    11,    12,    13,     0,    15,    16,    17,
+      18,    19,    20,    21,    22,    23,    24,     0,    26,    27,
+      28,    29,    30,     0,     0,    33,     0,     0,     0,     0,
+     178,     0,     0,     0,     0,    34,     7,     8,     9,    10,
+      11,    12,    13,     0,    15,    16,    17,    18,    19,    20,
+      21,    22,    23,    24,     0,    26,    27,    28,    29,    30,
+       0,     0,    33,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    34
 };
 
 static const yytype_int16 yycheck[] =
 {
-      58,    38,    75,     3,   137,    37,    26,     1,    31,    63,
-       1,    37,    37,     1,    32,    30,     0,    32,     8,    37,
-      23,   102,    55,   104,    32,    51,    51,    50,    18,   102,
-      62,   104,    52,    87,   167,    67,    56,    27,    96,    72,
-      47,    31,    33,    37,    37,    82,    37,    41,    33,    37,
-      41,   124,    47,    47,    48,    55,    47,    48,    49,    47,
-      48,    33,    47,    37,    44,    45,   139,    41,    33,    44,
-      45,    44,    72,    47,    48,    47,   149,   150,    52,   137,
-      37,    51,    47,    37,    41,    37,    44,   124,    49,    41,
-      47,    48,    45,    47,    48,    47,    48,   155,     1,   149,
-     150,    46,     5,     6,     7,     8,     9,    10,    11,   167,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      49,    24,    25,    26,    27,    28,    49,    52,    31,    34,
-      44,    46,    44,    30,    37,    44,    49,    36,    41,    49,
-      31,    44,    45,    49,    47,    48,     1,    49,    46,    52,
-       5,     6,     7,     8,     9,    10,    11,    49,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    34,    24,
-      25,    26,    27,    28,    49,    49,    31,    49,    49,    49,
-      49,     1,    37,    90,   155,   105,    41,    77,   139,    44,
-      45,    -1,    47,    48,     1,    -1,   100,    52,     5,     6,
-       7,     8,     9,    10,    11,    -1,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    22,    -1,    24,    25,    26,
-      27,    28,    -1,    -1,    31,    -1,    -1,    -1,    -1,    36,
-      -1,     1,    -1,    -1,    41,     5,     6,     7,     8,     9,
-      10,    11,    49,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    22,    -1,    24,    25,    26,    27,    28,    -1,
-      -1,    31,    -1,    -1,    -1,    -1,    36,    -1,     1,    -1,
-      -1,    41,     5,     6,     7,     8,     9,    10,    11,    49,
-      13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
-      -1,    24,    25,    26,    27,    28,    -1,    -1,    31,    -1,
-      -1,    -1,    -1,    36,    -1,    -1,    -1,    -1,    41,    -1,
-      -1,    -1,    -1,     1,    -1,    -1,    49,     5,     6,     7,
-       8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
-      18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
-      28,    29,    30,    31,    -1,    -1,    -1,    -1,    -1,    37,
-      -1,    -1,    -1,    41,    -1,    -1,    44,    -1,    -1,    47,
-      48,     5,     6,     7,     8,     9,    10,    11,    -1,    13,
+      59,    38,    79,     3,     1,     8,    56,    37,    26,    37,
+      64,    31,     1,   147,    37,    18,    30,     1,    32,   109,
+       0,   111,    45,    51,    27,    23,    76,    44,    31,    51,
+      50,    37,   109,    63,   111,    53,    33,    91,    68,    57,
+      37,   100,    47,   177,    41,    51,    37,    33,    37,    86,
+      47,    48,    49,    37,   131,    37,    56,    41,    47,    48,
+      51,    47,    47,    47,    48,    47,    48,    33,    37,    37,
+      51,    33,   149,    41,    44,    45,    76,    44,    45,    47,
+      48,    47,   159,   160,    52,    47,    37,    37,   147,    37,
+      41,    45,    46,    41,   131,    44,    47,    48,    50,    47,
+      48,   159,   160,    46,    45,    49,   165,     1,    34,    49,
+      49,     5,     6,     7,     8,     9,    10,    11,   177,    13,
+      14,    15,    16,    17,    18,    19,    20,    21,    22,    52,
+      24,    25,    26,    27,    28,    34,    44,    31,    44,    46,
+      30,    44,    31,    37,    49,    49,    46,    41,    49,    36,
+      44,    45,    49,    47,    48,     1,    49,    34,    52,     5,
+       6,     7,     8,     9,    10,    11,    49,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    49,    24,    25,
+      26,    27,    28,    49,    49,    31,    49,    49,     1,   165,
+      81,    37,    94,   149,   107,    41,   112,    49,    44,    45,
+      -1,    47,    48,     1,    -1,   103,    52,     5,     6,     7,
+       8,     9,    10,    11,    -1,    13,    14,    15,    16,    17,
+      18,    19,    20,    21,    22,    -1,    24,    25,    26,    27,
+      28,    -1,    -1,    31,    -1,    -1,    -1,    -1,    36,    -1,
+       1,    -1,    -1,    41,     5,     6,     7,     8,     9,    10,
+      11,    49,    13,    14,    15,    16,    17,    18,    19,    20,
+      21,    22,    -1,    24,    25,    26,    27,    28,    -1,    -1,
+      31,    -1,    -1,    -1,    -1,    36,    -1,     1,    -1,    -1,
+      41,     5,     6,     7,     8,     9,    10,    11,    49,    13,
       14,    15,    16,    17,    18,    19,    20,    21,    22,    -1,
       24,    25,    26,    27,    28,    -1,    -1,    31,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,    -1,    -1,
-      -1,    -1,    -1,    -1,    48,    49,     5,     6,     7,     8,
-       9,    10,    11,    -1,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    22,    -1,    24,    25,    26,    27,    28,
-      -1,    -1,    31,    -1,    -1,    -1,    -1,    -1,    37,    -1,
-      -1,    -1,    41,    -1,    -1,    -1,    -1,    -1,    47,    48,
+      -1,    -1,    36,    -1,    -1,    -1,    -1,    41,    -1,    -1,
+      -1,    -1,     1,    -1,    -1,    49,     5,     6,     7,     8,
+       9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
+      19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
+      29,    30,    31,    -1,    -1,    -1,    -1,    -1,    37,    -1,
+      -1,    -1,    41,    -1,    -1,    44,    -1,    -1,    47,    48,
        5,     6,     7,     8,     9,    10,    11,    -1,    13,    14,
       15,    16,    17,    18,    19,    20,    21,    22,    -1,    24,
       25,    26,    27,    28,    -1,    -1,    31,    -1,    -1,    -1,
-      -1,    36,    -1,    -1,    -1,    -1,    41,     5,     6,     7,
-       8,     9,    10,    11,    -1,    13,    14,    15,    16,    17,
-      18,    19,    20,    21,    22,    -1,    24,    25,    26,    27,
-      28,    -1,    -1,    31,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    41
+      -1,    -1,    -1,    -1,    -1,    -1,    41,    -1,    -1,    -1,
+      -1,    -1,    -1,    48,    49,     5,     6,     7,     8,     9,
+      10,    11,    -1,    13,    14,    15,    16,    17,    18,    19,
+      20,    21,    22,    -1,    24,    25,    26,    27,    28,    -1,
+      -1,    31,    -1,    -1,    -1,    -1,    -1,    37,    -1,    -1,
+      -1,    41,    -1,    -1,    -1,    -1,    -1,    47,    48,     5,
+       6,     7,     8,     9,    10,    11,    -1,    13,    14,    15,
+      16,    17,    18,    19,    20,    21,    22,    -1,    24,    25,
+      26,    27,    28,    -1,    -1,    31,    -1,    -1,    -1,    -1,
+      36,    -1,    -1,    -1,    -1,    41,     5,     6,     7,     8,
+       9,    10,    11,    -1,    13,    14,    15,    16,    17,    18,
+      19,    20,    21,    22,    -1,    24,    25,    26,    27,    28,
+      -1,    -1,    31,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    41
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -847,15 +826,16 @@ static const yytype_uint8 yystos[] =
        8,     9,    10,    11,    12,    13,    14,    15,    16,    17,
       18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
       28,    29,    30,    31,    41,    57,    60,    64,    65,    66,
-      67,    68,    69,    73,    84,    96,    98,    44,    45,    32,
-      37,    23,    37,    51,    87,    59,    37,    87,    47,    47,
-      44,    37,    47,    48,    61,    62,    63,    70,    74,    75,
-      66,    32,    58,    87,     1,    64,    88,    89,    90,    60,
-      64,    87,    65,    37,     1,    74,    71,    72,    73,    44,
-      46,    74,    30,    32,    97,    33,    47,    60,    44,    45,
-      37,    41,    47,    52,    70,    76,    77,    91,    92,    93,
-      94,    45,     1,    90,    74,    48,    49,    49,    49,    49,
-      73,    63,    95,     1,    65,    78,    79,    80,    81,    94,
+      67,    68,    69,    73,    84,    99,   101,    44,    45,    37,
+      51,    96,    23,    37,    51,    87,    59,    37,    87,    47,
+      47,    44,    37,    47,    48,    61,    62,    63,    70,    74,
+      75,    66,    96,    37,    97,    98,    58,    87,     1,    64,
+      88,    89,    90,    60,    64,    87,    65,    37,     1,    74,
+      71,    72,    73,    44,    46,    74,    30,    32,   100,    33,
+      47,    50,    45,    46,    60,    44,    45,    37,    41,    47,
+      52,    70,    76,    77,    91,    92,    93,    94,    45,     1,
+      90,    74,    48,    49,    49,    49,    49,    73,    63,    95,
+       1,    65,    78,    79,    80,    81,    34,    45,    98,    94,
        1,    37,    76,    34,    76,    95,    33,    47,    44,    46,
       49,    44,    31,    50,    85,    86,    49,    37,    41,    47,
       70,    82,    83,    49,    36,    46,    49,    49,     1,    78,
@@ -1045,17 +1025,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
 #if (defined __STDC__ || defined __C99__FUNC__ \
      || defined __cplusplus || defined _MSC_VER)
 static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
 #else
 static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
 #endif
 {
   YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
+  for (; yybottom <= yytop; yybottom++)
+    {
+      int yybot = *yybottom;
+      YYFPRINTF (stderr, " %d", yybot);
+    }
   YYFPRINTF (stderr, "\n");
 }
 
@@ -1089,11 +1072,11 @@ yy_reduce_print (yyvsp, yyrule)
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
-      fprintf (stderr, "   $%d = ", yyi + 1);
+      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
                       &(yyvsp[(yyi + 1) - (yynrhs)])
                                       );
-      fprintf (stderr, "\n");
+      YYFPRINTF (stderr, "\n");
     }
 }
 
@@ -1373,10 +1356,8 @@ yydestruct (yymsg, yytype, yyvaluep)
        break;
     }
 }
-\f
 
 /* Prevent warnings from -Wmissing-prototypes.  */
-
 #ifdef YYPARSE_PARAM
 #if defined __STDC__ || defined __cplusplus
 int yyparse (void *YYPARSE_PARAM);
@@ -1392,11 +1373,10 @@ int yyparse ();
 #endif /* ! YYPARSE_PARAM */
 
 
-
-/* The look-ahead symbol.  */
+/* The lookahead symbol.  */
 int yychar;
 
-/* The semantic value of the look-ahead symbol.  */
+/* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
 
 /* Number of syntax errors so far.  */
@@ -1404,9 +1384,9 @@ int yynerrs;
 
 
 
-/*----------.
-| yyparse.  |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse.  |
+`-------------------------*/
 
 #ifdef YYPARSE_PARAM
 #if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1430,66 +1410,68 @@ yyparse ()
 #endif
 #endif
 {
-  
-  int yystate;
-  int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
 
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
 
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
+    int yystate;
+    /* Number of tokens to shift before error messages enabled.  */
+    int yyerrstatus;
 
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
+    /* The stacks and their tools:
+       `yyss': related to states.
+       `yyvs': related to semantic values.
 
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
+       Refer to the stacks thru separate pointers, to allow yyoverflow
+       to reallocate them elsewhere.  */
 
+    /* The state stack.  */
+    yytype_int16 yyssa[YYINITDEPTH];
+    yytype_int16 *yyss;
+    yytype_int16 *yyssp;
 
+    /* The semantic value stack.  */
+    YYSTYPE yyvsa[YYINITDEPTH];
+    YYSTYPE *yyvs;
+    YYSTYPE *yyvsp;
 
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
+    YYSIZE_T yystacksize;
 
+  int yyn;
+  int yyresult;
+  /* Lookahead token as an internal (translated) token number.  */
+  int yytoken;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
 
+#if YYERROR_VERBOSE
+  /* Buffer for error messages, and its allocated size.  */
+  char yymsgbuf[128];
+  char *yymsg = yymsgbuf;
+  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#endif
+
+#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
 
   /* The number of symbols on the RHS of the reduced rule.
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
+  yystacksize = YYINITDEPTH;
+
   YYDPRINTF ((stderr, "Starting parse\n"));
 
   yystate = 0;
   yyerrstatus = 0;
   yynerrs = 0;
-  yychar = YYEMPTY;            /* Cause a token to be read.  */
+  yychar = YYEMPTY; /* Cause a token to be read.  */
 
   /* Initialize stack pointers.
      Waste one element of value and location stack
      so that they stay on the same level as the state stack.
      The wasted elements are never initialized.  */
-
   yyssp = yyss;
   yyvsp = yyvs;
 
@@ -1519,7 +1501,6 @@ yyparse ()
        YYSTYPE *yyvs1 = yyvs;
        yytype_int16 *yyss1 = yyss;
 
-
        /* Each stack pointer address is followed by the size of the
           data in use in that stack, in bytes.  This used to be a
           conditional around just the two extra args, but that might
@@ -1527,7 +1508,6 @@ yyparse ()
        yyoverflow (YY_("memory exhausted"),
                    &yyss1, yysize * sizeof (*yyssp),
                    &yyvs1, yysize * sizeof (*yyvsp),
-
                    &yystacksize);
 
        yyss = yyss1;
@@ -1550,9 +1530,8 @@ yyparse ()
          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
        if (! yyptr)
          goto yyexhaustedlab;
-       YYSTACK_RELOCATE (yyss);
-       YYSTACK_RELOCATE (yyvs);
-
+       YYSTACK_RELOCATE (yyss_alloc, yyss);
+       YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
        if (yyss1 != yyssa)
          YYSTACK_FREE (yyss1);
@@ -1563,7 +1542,6 @@ yyparse ()
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
-
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
                  (unsigned long int) yystacksize));
 
@@ -1573,6 +1551,9 @@ yyparse ()
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
 
+  if (yystate == YYFINAL)
+    YYACCEPT;
+
   goto yybackup;
 
 /*-----------.
@@ -1581,16 +1562,16 @@ yyparse ()
 yybackup:
 
   /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
+     lookahead token if we need one and don't already have one.  */
 
-  /* First try to decide what to do without reference to look-ahead token.  */
+  /* First try to decide what to do without reference to lookahead token.  */
   yyn = yypact[yystate];
   if (yyn == YYPACT_NINF)
     goto yydefault;
 
-  /* Not known => get a look-ahead token if don't already have one.  */
+  /* Not known => get a lookahead token if don't already have one.  */
 
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
+  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
@@ -1622,20 +1603,16 @@ yybackup:
       goto yyreduce;
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   /* Count tokens shifted since error; after three, turn off error
      status.  */
   if (yyerrstatus)
     yyerrstatus--;
 
-  /* Shift the look-ahead token.  */
+  /* Shift the lookahead token.  */
   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
 
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
+  /* Discard the shifted token.  */
+  yychar = YYEMPTY;
 
   yystate = yyn;
   *++yyvsp = yylval;
@@ -1675,47 +1652,65 @@ yyreduce:
   switch (yyn)
     {
         case 4:
-#line 108 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 109 "scripts/genksyms/parse.y"
     { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;}
     break;
 
   case 5:
-#line 110 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 111 "scripts/genksyms/parse.y"
     { free_list(*(yyvsp[(2) - (2)]), NULL); *(yyvsp[(2) - (2)]) = NULL; ;}
     break;
 
   case 6:
-#line 114 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 115 "scripts/genksyms/parse.y"
     { is_typedef = 1; ;}
     break;
 
   case 7:
-#line 115 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 116 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 8:
-#line 116 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 117 "scripts/genksyms/parse.y"
     { is_typedef = 1; ;}
     break;
 
   case 9:
-#line 117 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 118 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 14:
-#line 122 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 123 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 15:
-#line 123 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 124 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 16:
-#line 128 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 129 "scripts/genksyms/parse.y"
     { if (current_name) {
                    struct string_list *decl = (*(yyvsp[(3) - (3)]))->next;
                    (*(yyvsp[(3) - (3)]))->next = NULL;
@@ -1729,12 +1724,16 @@ yyreduce:
     break;
 
   case 17:
-#line 141 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 142 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 19:
-#line 147 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 148 "scripts/genksyms/parse.y"
     { struct string_list *decl = *(yyvsp[(1) - (1)]);
                  *(yyvsp[(1) - (1)]) = NULL;
                  add_symbol(current_name,
@@ -1745,7 +1744,9 @@ yyreduce:
     break;
 
   case 20:
-#line 155 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 156 "scripts/genksyms/parse.y"
     { struct string_list *decl = *(yyvsp[(3) - (3)]);
                  *(yyvsp[(3) - (3)]) = NULL;
                  free_list(*(yyvsp[(2) - (3)]), NULL);
@@ -1758,27 +1759,37 @@ yyreduce:
     break;
 
   case 21:
-#line 168 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 169 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]) ? (yyvsp[(4) - (4)]) : (yyvsp[(3) - (4)]) ? (yyvsp[(3) - (4)]) : (yyvsp[(2) - (4)]) ? (yyvsp[(2) - (4)]) : (yyvsp[(1) - (4)]); ;}
     break;
 
   case 22:
-#line 173 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 174 "scripts/genksyms/parse.y"
     { decl_spec = NULL; ;}
     break;
 
   case 24:
-#line 178 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 179 "scripts/genksyms/parse.y"
     { decl_spec = *(yyvsp[(1) - (1)]); ;}
     break;
 
   case 25:
-#line 179 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 180 "scripts/genksyms/parse.y"
     { decl_spec = *(yyvsp[(2) - (2)]); ;}
     break;
 
   case 26:
-#line 184 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 185 "scripts/genksyms/parse.y"
     { /* Version 2 checksumming ignores storage class, as that
                     is really irrelevant to the linkage.  */
                  remove_node((yyvsp[(1) - (1)]));
@@ -1787,32 +1798,44 @@ yyreduce:
     break;
 
   case 31:
-#line 196 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 197 "scripts/genksyms/parse.y"
     { is_extern = 1; (yyval) = (yyvsp[(1) - (1)]); ;}
     break;
 
   case 32:
-#line 197 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 198 "scripts/genksyms/parse.y"
     { is_extern = 0; (yyval) = (yyvsp[(1) - (1)]); ;}
     break;
 
   case 37:
-#line 209 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 210 "scripts/genksyms/parse.y"
     { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_STRUCT; (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 38:
-#line 211 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 212 "scripts/genksyms/parse.y"
     { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_UNION; (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 39:
-#line 213 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 214 "scripts/genksyms/parse.y"
     { remove_node((yyvsp[(1) - (2)])); (*(yyvsp[(2) - (2)]))->tag = SYM_ENUM; (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 40:
-#line 217 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 218 "scripts/genksyms/parse.y"
     { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r;
                  r = copy_node(i); r->tag = SYM_STRUCT;
                  r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
@@ -1822,7 +1845,9 @@ yyreduce:
     break;
 
   case 41:
-#line 224 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 225 "scripts/genksyms/parse.y"
     { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r;
                  r = copy_node(i); r->tag = SYM_UNION;
                  r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
@@ -1832,7 +1857,9 @@ yyreduce:
     break;
 
   case 42:
-#line 231 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 232 "scripts/genksyms/parse.y"
     { struct string_list *s = *(yyvsp[(3) - (3)]), *i = *(yyvsp[(2) - (3)]), *r;
                  r = copy_node(i); r->tag = SYM_ENUM;
                  r->next = (*(yyvsp[(1) - (3)]))->next; *(yyvsp[(3) - (3)]) = r; (*(yyvsp[(1) - (3)]))->next = NULL;
@@ -1842,42 +1869,58 @@ yyreduce:
     break;
 
   case 43:
-#line 239 "scripts/genksyms/parse.y"
-    { (yyval) = (yyvsp[(2) - (2)]); ;}
+
+/* Line 1455 of yacc.c  */
+#line 242 "scripts/genksyms/parse.y"
+    { add_symbol(NULL, SYM_ENUM, NULL, 0); (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 44:
-#line 240 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 244 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 45:
-#line 241 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 245 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 56:
-#line 255 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 259 "scripts/genksyms/parse.y"
     { (*(yyvsp[(1) - (1)]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[(1) - (1)]); ;}
     break;
 
   case 57:
-#line 260 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 264 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;}
     break;
 
   case 58:
-#line 264 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 268 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 61:
-#line 270 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 274 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 65:
-#line 276 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 280 "scripts/genksyms/parse.y"
     { /* restrict has no effect in prototypes so ignore it */
                  remove_node((yyvsp[(1) - (1)]));
                  (yyval) = (yyvsp[(1) - (1)]);
@@ -1885,12 +1928,16 @@ yyreduce:
     break;
 
   case 66:
-#line 283 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 287 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 68:
-#line 289 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 293 "scripts/genksyms/parse.y"
     { if (current_name != NULL) {
                    error_with_pos("unexpected second declaration name");
                    YYERROR;
@@ -1902,97 +1949,135 @@ yyreduce:
     break;
 
   case 69:
-#line 298 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 302 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 70:
-#line 300 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 304 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 71:
-#line 302 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 306 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 72:
-#line 304 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 308 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 73:
-#line 306 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 310 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 74:
-#line 312 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 316 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 78:
-#line 320 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 324 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 79:
-#line 322 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 326 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 80:
-#line 324 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 328 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 81:
-#line 326 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 330 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 82:
-#line 328 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 332 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 83:
-#line 332 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 336 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 85:
-#line 334 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 338 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 86:
-#line 338 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 342 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 89:
-#line 345 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 349 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 90:
-#line 350 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 354 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;}
     break;
 
   case 91:
-#line 355 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 359 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;}
     break;
 
   case 93:
-#line 360 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 364 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 94:
-#line 362 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 366 "scripts/genksyms/parse.y"
     { /* For version 2 checksums, we don't want to remember
                     private parameter names.  */
                  remove_node((yyvsp[(1) - (1)]));
@@ -2001,39 +2086,53 @@ yyreduce:
     break;
 
   case 95:
-#line 370 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 374 "scripts/genksyms/parse.y"
     { remove_node((yyvsp[(1) - (1)]));
                  (yyval) = (yyvsp[(1) - (1)]);
                ;}
     break;
 
   case 96:
-#line 374 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 378 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 97:
-#line 376 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 380 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(4) - (4)]); ;}
     break;
 
   case 98:
-#line 378 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 382 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 99:
-#line 380 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 384 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 100:
-#line 382 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 386 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 101:
-#line 387 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 391 "scripts/genksyms/parse.y"
     { struct string_list *decl = *(yyvsp[(2) - (3)]);
                  *(yyvsp[(2) - (3)]) = NULL;
                  add_symbol(current_name, SYM_NORMAL, decl, is_extern);
@@ -2042,93 +2141,163 @@ yyreduce:
     break;
 
   case 102:
-#line 395 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 399 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 104:
-#line 402 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 406 "scripts/genksyms/parse.y"
     { remove_list((yyvsp[(2) - (2)]), &(*(yyvsp[(1) - (2)]))->next); (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 105:
-#line 406 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 410 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 106:
-#line 407 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 411 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 107:
-#line 411 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 415 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 110:
-#line 417 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 421 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 111:
-#line 422 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 426 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 112:
-#line 424 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 428 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 113:
-#line 428 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 432 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 116:
-#line 434 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 438 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 117:
-#line 438 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 442 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]) ? (yyvsp[(2) - (2)]) : (yyvsp[(1) - (2)]); ;}
     break;
 
   case 118:
-#line 439 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 443 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 120:
-#line 444 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 448 "scripts/genksyms/parse.y"
     { (yyval) = (yyvsp[(2) - (2)]); ;}
     break;
 
   case 121:
-#line 448 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 452 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
   case 123:
-#line 453 "scripts/genksyms/parse.y"
-    { (yyval) = (yyvsp[(2) - (2)]); ;}
+
+/* Line 1455 of yacc.c  */
+#line 457 "scripts/genksyms/parse.y"
+    { (yyval) = (yyvsp[(3) - (3)]); ;}
     break;
 
   case 124:
-#line 457 "scripts/genksyms/parse.y"
+
+/* Line 1455 of yacc.c  */
+#line 458 "scripts/genksyms/parse.y"
+    { (yyval) = (yyvsp[(4) - (4)]); ;}
+    break;
+
+  case 127:
+
+/* Line 1455 of yacc.c  */
+#line 467 "scripts/genksyms/parse.y"
+    {
+                       const char *name = strdup((*(yyvsp[(1) - (1)]))->string);
+                       add_symbol(name, SYM_ENUM_CONST, NULL, 0);
+               ;}
+    break;
+
+  case 128:
+
+/* Line 1455 of yacc.c  */
+#line 472 "scripts/genksyms/parse.y"
+    {
+                       const char *name = strdup((*(yyvsp[(1) - (3)]))->string);
+                       struct string_list *expr = copy_list_range(*(yyvsp[(3) - (3)]), *(yyvsp[(2) - (3)]));
+                       add_symbol(name, SYM_ENUM_CONST, expr, 0);
+               ;}
+    break;
+
+  case 129:
+
+/* Line 1455 of yacc.c  */
+#line 479 "scripts/genksyms/parse.y"
+    { (yyval) = (yyvsp[(2) - (2)]); ;}
+    break;
+
+  case 130:
+
+/* Line 1455 of yacc.c  */
+#line 483 "scripts/genksyms/parse.y"
     { (yyval) = NULL; ;}
     break;
 
-  case 126:
-#line 463 "scripts/genksyms/parse.y"
+  case 132:
+
+/* Line 1455 of yacc.c  */
+#line 489 "scripts/genksyms/parse.y"
     { export_symbol((*(yyvsp[(3) - (5)]))->string); (yyval) = (yyvsp[(5) - (5)]); ;}
     break;
 
 
-/* Line 1267 of yacc.c.  */
-#line 2132 "scripts/genksyms/parse.c"
+
+/* Line 1455 of yacc.c  */
+#line 2301 "scripts/genksyms/parse.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2139,7 +2308,6 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-
   /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
@@ -2204,7 +2372,7 @@ yyerrlab:
 
   if (yyerrstatus == 3)
     {
-      /* If just tried and failed to reuse look-ahead token after an
+      /* If just tried and failed to reuse lookahead token after an
         error, discard it.  */
 
       if (yychar <= YYEOF)
@@ -2221,7 +2389,7 @@ yyerrlab:
        }
     }
 
-  /* Else will try to reuse look-ahead token after shifting the error
+  /* Else will try to reuse lookahead token after shifting the error
      token.  */
   goto yyerrlab1;
 
@@ -2278,9 +2446,6 @@ yyerrlab1:
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
   *++yyvsp = yylval;
 
 
@@ -2305,7 +2470,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -2316,7 +2481,7 @@ yyexhaustedlab:
 #endif
 
 yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
+  if (yychar != YYEMPTY)
      yydestruct ("Cleanup: discarding lookahead",
                 yytoken, &yylval);
   /* Do not reclaim the symbols of the rule which action triggered
@@ -2342,7 +2507,9 @@ yyreturn:
 }
 
 
-#line 467 "scripts/genksyms/parse.y"
+
+/* Line 1675 of yacc.c  */
+#line 493 "scripts/genksyms/parse.y"
 
 
 static void
index c4eeec652b79958eee113475f7f6b214f23f935f..517523669251b9638ff0e933c7cb9ff9fe97fb00 100644 (file)
@@ -1,24 +1,23 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
 
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1.  */
 
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+   
+      Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
-
-   This program is free software; you can redistribute it and/or modify
+   
+   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, or (at your option)
-   any later version.
-
+   the Free Software Foundation, either version 3 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., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* As a special exception, you may create a larger work that contains
    part or all of the Bison parser skeleton and distribute that work
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+
 /* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
      FILENAME = 298
    };
 #endif
-/* Tokens.  */
-#define ASM_KEYW 258
-#define ATTRIBUTE_KEYW 259
-#define AUTO_KEYW 260
-#define BOOL_KEYW 261
-#define CHAR_KEYW 262
-#define CONST_KEYW 263
-#define DOUBLE_KEYW 264
-#define ENUM_KEYW 265
-#define EXTERN_KEYW 266
-#define EXTENSION_KEYW 267
-#define FLOAT_KEYW 268
-#define INLINE_KEYW 269
-#define INT_KEYW 270
-#define LONG_KEYW 271
-#define REGISTER_KEYW 272
-#define RESTRICT_KEYW 273
-#define SHORT_KEYW 274
-#define SIGNED_KEYW 275
-#define STATIC_KEYW 276
-#define STRUCT_KEYW 277
-#define TYPEDEF_KEYW 278
-#define UNION_KEYW 279
-#define UNSIGNED_KEYW 280
-#define VOID_KEYW 281
-#define VOLATILE_KEYW 282
-#define TYPEOF_KEYW 283
-#define EXPORT_SYMBOL_KEYW 284
-#define ASM_PHRASE 285
-#define ATTRIBUTE_PHRASE 286
-#define BRACE_PHRASE 287
-#define BRACKET_PHRASE 288
-#define EXPRESSION_PHRASE 289
-#define CHAR 290
-#define DOTS 291
-#define IDENT 292
-#define INT 293
-#define REAL 294
-#define STRING 295
-#define TYPE 296
-#define OTHER 297
-#define FILENAME 298
-
 
 
 
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
 typedef int YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
 
 extern YYSTYPE yylval;
 
+
index 09a265cd71939cba93839a53ba3b5ebf23574254..ba5c242866c11b4c0803822bd45b940ad16b8474 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <assert.h>
 #include <stdlib.h>
+#include <string.h>
 #include "genksyms.h"
 
 static int is_typedef;
@@ -227,16 +228,19 @@ type_specifier:
                  add_symbol(i->string, SYM_UNION, s, is_extern);
                  $$ = $3;
                }
-       | ENUM_KEYW IDENT BRACE_PHRASE
+       | ENUM_KEYW IDENT enum_body
                { struct string_list *s = *$3, *i = *$2, *r;
                  r = copy_node(i); r->tag = SYM_ENUM;
                  r->next = (*$1)->next; *$3 = r; (*$1)->next = NULL;
                  add_symbol(i->string, SYM_ENUM, s, is_extern);
                  $$ = $3;
                }
-
-       /* Anonymous s/u/e definitions.  Nothing needs doing.  */
-       | ENUM_KEYW BRACE_PHRASE                        { $$ = $2; }
+       /*
+        * Anonymous enum definition. Tell add_symbol() to restart its counter.
+        */
+       | ENUM_KEYW enum_body
+               { add_symbol(NULL, SYM_ENUM, NULL, 0); $$ = $2; }
+       /* Anonymous s/u definitions.  Nothing needs doing.  */
        | STRUCT_KEYW class_body                        { $$ = $2; }
        | UNION_KEYW class_body                         { $$ = $2; }
        ;
@@ -449,6 +453,28 @@ attribute_opt:
        | attribute_opt ATTRIBUTE_PHRASE
        ;
 
+enum_body:
+       '{' enumerator_list '}'                         { $$ = $3; }
+       | '{' enumerator_list ',' '}'                   { $$ = $4; }
+        ;
+
+enumerator_list:
+       enumerator
+       | enumerator_list ',' enumerator
+
+enumerator:
+       IDENT
+               {
+                       const char *name = strdup((*$1)->string);
+                       add_symbol(name, SYM_ENUM_CONST, NULL, 0);
+               }
+       | IDENT '=' EXPRESSION_PHRASE
+               {
+                       const char *name = strdup((*$1)->string);
+                       struct string_list *expr = copy_list_range(*$3, *$2);
+                       add_symbol(name, SYM_ENUM_CONST, expr, 0);
+               }
+
 asm_definition:
        ASM_PHRASE ';'                                  { $$ = $2; }
        ;
index e8fba959fffb4681f397857288c5aab4d159f895..cd104afcc5f27d8dca823ae33edeece2868e28d5 100644 (file)
@@ -1248,6 +1248,19 @@ static int is_function(Elf_Sym *sym)
                return -1;
 }
 
+static void print_section_list(const char * const list[20])
+{
+       const char *const *s = list;
+
+       while (*s) {
+               fprintf(stderr, "%s", *s);
+               s++;
+               if (*s)
+                       fprintf(stderr, ", ");
+       }
+       fprintf(stderr, "\n");
+}
+
 /*
  * Print a warning about a section mismatch.
  * Try to find symbols near it so user can find it.
@@ -1304,7 +1317,6 @@ static void report_sec_mismatch(const char *modname,
                break;
        case DATA_TO_ANY_INIT: {
                prl_to = sec2annotation(tosec);
-               const char *const *s = mismatch->symbol_white_list;
                fprintf(stderr,
                "The variable %s references\n"
                "the %s %s%s%s\n"
@@ -1312,9 +1324,7 @@ static void report_sec_mismatch(const char *modname,
                "variable with __init* or __refdata (see linux/init.h) "
                "or name the variable:\n",
                fromsym, to, prl_to, tosym, to_p);
-               while (*s)
-                       fprintf(stderr, "%s, ", *s++);
-               fprintf(stderr, "\n");
+               print_section_list(mismatch->symbol_white_list);
                free(prl_to);
                break;
        }
@@ -1329,7 +1339,6 @@ static void report_sec_mismatch(const char *modname,
                break;
        case DATA_TO_ANY_EXIT: {
                prl_to = sec2annotation(tosec);
-               const char *const *s = mismatch->symbol_white_list;
                fprintf(stderr,
                "The variable %s references\n"
                "the %s %s%s%s\n"
@@ -1337,9 +1346,7 @@ static void report_sec_mismatch(const char *modname,
                "variable with __exit* (see linux/init.h) or "
                "name the variable:\n",
                fromsym, to, prl_to, tosym, to_p);
-               while (*s)
-                       fprintf(stderr, "%s, ", *s++);
-               fprintf(stderr, "\n");
+               print_section_list(mismatch->symbol_white_list);
                free(prl_to);
                break;
        }
index d0b931b994fccebc025c1c281c8cfd1573b7f64b..a834b935f5363d80ab56b15a1acf3cb477f21e42 100644 (file)
@@ -127,7 +127,8 @@ rm -r $(perf-tar);                                                  \
 $(if $(findstring tar-src,$@),,                                     \
 $(if $(findstring bz2,$@),bzip2,                                    \
 $(if $(findstring gz,$@),gzip,                                      \
-$(error unknown target $@)))                                       \
+$(if $(findstring xz,$@),xz,                                        \
+$(error unknown target $@))))                                       \
        -f -9 $(perf-tar).tar)
 
 perf-%pkg: FORCE
@@ -142,7 +143,9 @@ help: FORCE
        @echo '  tar-pkg             - Build the kernel as an uncompressed tarball'
        @echo '  targz-pkg           - Build the kernel as a gzip compressed tarball'
        @echo '  tarbz2-pkg          - Build the kernel as a bzip2 compressed tarball'
+       @echo '  tarxz-pkg           - Build the kernel as a xz compressed tarball'
        @echo '  perf-tar-src-pkg    - Build $(perf-tar).tar source tarball'
        @echo '  perf-targz-src-pkg  - Build $(perf-tar).tar.gz source tarball'
        @echo '  perf-tarbz2-src-pkg - Build $(perf-tar).tar.bz2 source tarball'
+       @echo '  perf-tarxz-src-pkg  - Build $(perf-tar).tar.xz source tarball'
 
index 51b2aa0acb82db959b67ca1170439c436ae0ab3b..83c9c04102f2bc9fd06d783d31df60eb5e793c5d 100644 (file)
@@ -35,6 +35,10 @@ case "${1}" in
                compress="bzip2 -c9"
                file_ext=".bz2"
                ;;
+       tarxz-pkg)
+               compress="xz -c9"
+               file_ext=".xz"
+               ;;
        *)
                echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
                exit 1
index ef8729f48586d193d3926d5bd6c4d0b9c34bcb96..4d403844e137a59f53f032bc4972a35e86b2327f 100755 (executable)
@@ -86,12 +86,16 @@ scm_version()
 
        # Check for mercurial and a mercurial repo.
        if test -d .hg && hgid=`hg id 2>/dev/null`; then
-               tag=`printf '%s' "$hgid" | cut -s -d' ' -f2`
-
-               # Do we have an untagged version?
-               if [ -z "$tag" -o "$tag" = tip ]; then
-                       id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+               # Do we have an tagged version?  If so, latesttagdistance == 1
+               if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
+                       id=`hg log -r . --template '{latesttag}'`
                        printf '%s%s' -hg "$id"
+               else
+                       tag=`printf '%s' "$hgid" | cut -d' ' -f2`
+                       if [ -z "$tag" -o "$tag" = tip ]; then
+                               id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+                               printf '%s%s' -hg "$id"
+                       fi
                fi
 
                # Are there uncommitted changes?
index 92fdc4546141125a14410af0b8d4b1ce8464e2fe..bd6185d529cff980e8516429abdc9f3ca2646391 100755 (executable)
@@ -114,6 +114,11 @@ docscope()
        cscope -b -f cscope.out
 }
 
+dogtags()
+{
+       all_sources | gtags -f -
+}
+
 exuberant()
 {
        all_sources | xargs $1 -a                               \
@@ -187,6 +192,10 @@ case "$1" in
                docscope
                ;;
 
+       "gtags")
+               dogtags
+               ;;
+
        "tags")
                rm -f tags
                xtags ctags
index 44d39785e50da4a67bdde65a86e55b6a795e55b3..7493c0ee51cc93e7cc7a7a7a3920a917ab560659 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at>
+ * Copyright (c) 2002 - 2011 Tony Finch <dot@dotat.at>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 /*
+ * unifdef - remove ifdef'ed lines
+ *
  * This code was derived from software contributed to Berkeley by Dave Yost.
  * It was rewritten to support ANSI C by Tony Finch. The original version
  * of unifdef carried the 4-clause BSD copyright licence. None of its code
  * remains in this version (though some of the names remain) so it now
  * carries a more liberal licence.
  *
- * The latest version is available from http://dotat.at/prog/unifdef
- */
-
-static const char * const copyright[] = {
-    "@(#) Copyright (c) 2002 - 2009 Tony Finch <dot@dotat.at>\n",
-    "$dotat: unifdef/unifdef.c,v 1.190 2009/11/27 17:21:26 fanf2 Exp $",
-};
-
-/*
- * unifdef - remove ifdef'ed lines
- *
  *  Wishlist:
  *      provide an option which will append the name of the
  *        appropriate symbol after #else's and #endif's
@@ -48,12 +39,16 @@ static const char * const copyright[] = {
  *        #else's and #endif's to see that they match their
  *        corresponding #ifdef or #ifndef
  *
- *   The first two items above require better buffer handling, which would
- *     also make it possible to handle all "dodgy" directives correctly.
+ *   These require better buffer handling, which would also make
+ *   it possible to handle all "dodgy" directives correctly.
  */
 
+#include <sys/types.h>
+#include <sys/stat.h>
+
 #include <ctype.h>
 #include <err.h>
+#include <errno.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -61,6 +56,12 @@ static const char * const copyright[] = {
 #include <string.h>
 #include <unistd.h>
 
+const char copyright[] =
+    "@(#) $Version: unifdef-2.5 $\n"
+    "@(#) $Author: Tony Finch (dot@dotat.at) $\n"
+    "@(#) $URL: http://dotat.at/prog/unifdef $\n"
+;
+
 /* types of input lines: */
 typedef enum {
        LT_TRUEI,               /* a true #if with ignore flag */
@@ -152,6 +153,11 @@ static char const * const linestate_name[] = {
  */
 #define        EDITSLOP        10
 
+/*
+ * For temporary filenames
+ */
+#define TEMPLATE        "unifdef.XXXXXX"
+
 /*
  * Globals.
  */
@@ -165,6 +171,7 @@ static bool             strictlogic;                /* -K: keep ambiguous #ifs */
 static bool             killconsts;            /* -k: eval constant #ifs */
 static bool             lnnum;                 /* -n: add #line directives */
 static bool             symlist;               /* -s: output symbol list */
+static bool             symdepth;              /* -S: output symbol depth */
 static bool             text;                  /* -t: this is a text file */
 
 static const char      *symname[MAXSYMS];      /* symbol name */
@@ -175,10 +182,18 @@ static int              nsyms;                    /* number of symbols */
 static FILE            *input;                 /* input file pointer */
 static const char      *filename;              /* input file name */
 static int              linenum;               /* current line number */
+static FILE            *output;                        /* output file pointer */
+static const char      *ofilename;             /* output file name */
+static bool             overwriting;           /* output overwrites input */
+static char             tempname[FILENAME_MAX];        /* used when overwriting */
 
 static char             tline[MAXLINE+EDITSLOP];/* input buffer plus space */
 static char            *keyword;               /* used for editing #elif's */
 
+static const char      *newline;               /* input file format */
+static const char       newline_unix[] = "\n";
+static const char       newline_crlf[] = "\r\n";
+
 static Comment_state    incomment;             /* comment parser state */
 static Line_state       linestate;             /* #if line parser state */
 static Ifstate          ifstate[MAXDEPTH];     /* #if processor state */
@@ -189,10 +204,13 @@ static int              delcount;         /* count of deleted lines */
 static unsigned         blankcount;            /* count of blank lines */
 static unsigned         blankmax;              /* maximum recent blankcount */
 static bool             constexpr;             /* constant #if expression */
+static bool             zerosyms = true;       /* to format symdepth output */
+static bool             firstsym;              /* ditto */
 
 static int              exitstat;              /* program exit status */
 
 static void             addsym(bool, bool, char *);
+static void             closeout(void);
 static void             debug(const char *, ...);
 static void             done(void);
 static void             error(const char *);
@@ -212,6 +230,7 @@ static void             state(Ifstate);
 static int              strlcmp(const char *, const char *, size_t);
 static void             unnest(void);
 static void             usage(void);
+static void             version(void);
 
 #define endsym(c) (!isalnum((unsigned char)c) && c != '_')
 
@@ -223,7 +242,7 @@ main(int argc, char *argv[])
 {
        int opt;
 
-       while ((opt = getopt(argc, argv, "i:D:U:I:BbcdeKklnst")) != -1)
+       while ((opt = getopt(argc, argv, "i:D:U:I:o:bBcdeKklnsStV")) != -1)
                switch (opt) {
                case 'i': /* treat stuff controlled by these symbols as text */
                        /*
@@ -245,16 +264,15 @@ main(int argc, char *argv[])
                case 'U': /* undef a symbol */
                        addsym(false, false, optarg);
                        break;
-               case 'I':
-                       /* no-op for compatibility with cpp */
-                       break;
-               case 'B': /* compress blank lines around removed section */
-                       compblank = true;
+               case 'I': /* no-op for compatibility with cpp */
                        break;
                case 'b': /* blank deleted lines instead of omitting them */
                case 'l': /* backwards compatibility */
                        lnblank = true;
                        break;
+               case 'B': /* compress blank lines around removed section */
+                       compblank = true;
+                       break;
                case 'c': /* treat -D as -U and vice versa */
                        complement = true;
                        break;
@@ -273,12 +291,20 @@ main(int argc, char *argv[])
                case 'n': /* add #line directive after deleted lines */
                        lnnum = true;
                        break;
+               case 'o': /* output to a file */
+                       ofilename = optarg;
+                       break;
                case 's': /* only output list of symbols that control #ifs */
                        symlist = true;
                        break;
+               case 'S': /* list symbols with their nesting depth */
+                       symlist = symdepth = true;
+                       break;
                case 't': /* don't parse C comments */
                        text = true;
                        break;
+               case 'V': /* print version */
+                       version();
                default:
                        usage();
                }
@@ -290,21 +316,68 @@ main(int argc, char *argv[])
                errx(2, "can only do one file");
        } else if (argc == 1 && strcmp(*argv, "-") != 0) {
                filename = *argv;
-               input = fopen(filename, "r");
+               input = fopen(filename, "rb");
                if (input == NULL)
                        err(2, "can't open %s", filename);
        } else {
                filename = "[stdin]";
                input = stdin;
        }
+       if (ofilename == NULL) {
+               ofilename = "[stdout]";
+               output = stdout;
+       } else {
+               struct stat ist, ost;
+               if (stat(ofilename, &ost) == 0 &&
+                   fstat(fileno(input), &ist) == 0)
+                       overwriting = (ist.st_dev == ost.st_dev
+                                   && ist.st_ino == ost.st_ino);
+               if (overwriting) {
+                       const char *dirsep;
+                       int ofd;
+
+                       dirsep = strrchr(ofilename, '/');
+                       if (dirsep != NULL)
+                               snprintf(tempname, sizeof(tempname),
+                                   "%.*s/" TEMPLATE,
+                                   (int)(dirsep - ofilename), ofilename);
+                       else
+                               snprintf(tempname, sizeof(tempname),
+                                   TEMPLATE);
+                       ofd = mkstemp(tempname);
+                       if (ofd != -1)
+                               output = fdopen(ofd, "wb+");
+                       if (output == NULL)
+                               err(2, "can't create temporary file");
+                       fchmod(ofd, ist.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO));
+               } else {
+                       output = fopen(ofilename, "wb");
+                       if (output == NULL)
+                               err(2, "can't open %s", ofilename);
+               }
+       }
        process();
        abort(); /* bug */
 }
 
+static void
+version(void)
+{
+       const char *c = copyright;
+       for (;;) {
+               while (*++c != '$')
+                       if (*c == '\0')
+                               exit(0);
+               while (*++c != '$')
+                       putc(*c, stderr);
+               putc('\n', stderr);
+       }
+}
+
 static void
 usage(void)
 {
-       fprintf(stderr, "usage: unifdef [-BbcdeKknst] [-Ipath]"
+       fprintf(stderr, "usage: unifdef [-bBcdeKknsStV] [-Ipath]"
            " [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [file]\n");
        exit(2);
 }
@@ -322,7 +395,8 @@ usage(void)
  * When we have processed a group that starts off with a known-false
  * #if/#elif sequence (which has therefore been deleted) followed by a
  * #elif that we don't understand and therefore must keep, we edit the
- * latter into a #if to keep the nesting correct.
+ * latter into a #if to keep the nesting correct. We use strncpy() to
+ * overwrite the 4 byte token "elif" with "if  " without a '\0' byte.
  *
  * When we find a true #elif in a group, the following block will
  * always be kept and the rest of the sequence after the next #elif or
@@ -375,11 +449,11 @@ static void Oelif (void) { if (!iocccok) Eioccc(); Pelif(); }
 static void Idrop (void) { Fdrop();  ignoreon(); }
 static void Itrue (void) { Ftrue();  ignoreon(); }
 static void Ifalse(void) { Ffalse(); ignoreon(); }
-/* edit this line */
+/* modify this line */
 static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }
-static void Mtrue (void) { keywordedit("else\n");  state(IS_TRUE_MIDDLE); }
-static void Melif (void) { keywordedit("endif\n"); state(IS_FALSE_TRAILER); }
-static void Melse (void) { keywordedit("endif\n"); state(IS_FALSE_ELSE); }
+static void Mtrue (void) { keywordedit("else");  state(IS_TRUE_MIDDLE); }
+static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); }
+static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); }
 
 static state_fn * const trans_table[IS_COUNT][LT_COUNT] = {
 /* IS_OUTSIDE */
@@ -431,13 +505,6 @@ static state_fn * const trans_table[IS_COUNT][LT_COUNT] = {
  * State machine utility functions
  */
 static void
-done(void)
-{
-       if (incomment)
-               error("EOF in comment");
-       exit(exitstat);
-}
-static void
 ignoreoff(void)
 {
        if (depth == 0)
@@ -452,14 +519,8 @@ ignoreon(void)
 static void
 keywordedit(const char *replacement)
 {
-       size_t size = tline + sizeof(tline) - keyword;
-       char *dst = keyword;
-       const char *src = replacement;
-       if (size != 0) {
-               while ((--size != 0) && (*src != '\0'))
-                       *dst++ = *src++;
-               *dst = '\0';
-       }
+       snprintf(keyword, tline + sizeof(tline) - keyword,
+           "%s%s", replacement, newline);
        print();
 }
 static void
@@ -494,24 +555,26 @@ flushline(bool keep)
        if (symlist)
                return;
        if (keep ^ complement) {
-               bool blankline = tline[strspn(tline, " \t\n")] == '\0';
+               bool blankline = tline[strspn(tline, " \t\r\n")] == '\0';
                if (blankline && compblank && blankcount != blankmax) {
                        delcount += 1;
                        blankcount += 1;
                } else {
                        if (lnnum && delcount > 0)
-                               printf("#line %d\n", linenum);
-                       fputs(tline, stdout);
+                               printf("#line %d%s", linenum, newline);
+                       fputs(tline, output);
                        delcount = 0;
                        blankmax = blankcount = blankline ? blankcount + 1 : 0;
                }
        } else {
                if (lnblank)
-                       putc('\n', stdout);
+                       fputs(newline, output);
                exitstat = 1;
                delcount += 1;
                blankcount = 0;
        }
+       if (debugging)
+               fflush(output);
 }
 
 /*
@@ -520,21 +583,54 @@ flushline(bool keep)
 static void
 process(void)
 {
-       Linetype lineval;
-
        /* When compressing blank lines, act as if the file
           is preceded by a large number of blank lines. */
        blankmax = blankcount = 1000;
        for (;;) {
-               linenum++;
-               lineval = parseline();
+               Linetype lineval = parseline();
                trans_table[ifstate[depth]][lineval]();
-               debug("process %s -> %s depth %d",
-                   linetype_name[lineval],
+               debug("process line %d %s -> %s depth %d",
+                   linenum, linetype_name[lineval],
                    ifstate_name[ifstate[depth]], depth);
        }
 }
 
+/*
+ * Flush the output and handle errors.
+ */
+static void
+closeout(void)
+{
+       if (symdepth && !zerosyms)
+               printf("\n");
+       if (fclose(output) == EOF) {
+               warn("couldn't write to %s", ofilename);
+               if (overwriting) {
+                       unlink(tempname);
+                       errx(2, "%s unchanged", filename);
+               } else {
+                       exit(2);
+               }
+       }
+}
+
+/*
+ * Clean up and exit.
+ */
+static void
+done(void)
+{
+       if (incomment)
+               error("EOF in comment");
+       closeout();
+       if (overwriting && rename(tempname, ofilename) == -1) {
+               warn("couldn't rename temporary file");
+               unlink(tempname);
+               errx(2, "%s unchanged", ofilename);
+       }
+       exit(exitstat);
+}
+
 /*
  * Parse a line and determine its type. We keep the preprocessor line
  * parser state between calls in the global variable linestate, with
@@ -549,14 +645,22 @@ parseline(void)
        Linetype retval;
        Comment_state wascomment;
 
+       linenum++;
        if (fgets(tline, MAXLINE, input) == NULL)
                return (LT_EOF);
+       if (newline == NULL) {
+               if (strrchr(tline, '\n') == strrchr(tline, '\r') + 1)
+                       newline = newline_crlf;
+               else
+                       newline = newline_unix;
+       }
        retval = LT_PLAIN;
        wascomment = incomment;
        cp = skipcomment(tline);
        if (linestate == LS_START) {
                if (*cp == '#') {
                        linestate = LS_HASH;
+                       firstsym = true;
                        cp = skipcomment(cp + 1);
                } else if (*cp != '\0')
                        linestate = LS_DIRTY;
@@ -566,7 +670,8 @@ parseline(void)
                cp = skipsym(cp);
                kwlen = cp - keyword;
                /* no way can we deal with a continuation inside a keyword */
-               if (strncmp(cp, "\\\n", 2) == 0)
+               if (strncmp(cp, "\\\r\n", 3) == 0 ||
+                   strncmp(cp, "\\\n", 2) == 0)
                        Eioccc();
                if (strlcmp("ifdef", keyword, kwlen) == 0 ||
                    strlcmp("ifndef", keyword, kwlen) == 0) {
@@ -617,9 +722,8 @@ parseline(void)
                        size_t len = cp - tline;
                        if (fgets(tline + len, MAXLINE - len, input) == NULL) {
                                /* append the missing newline */
-                               tline[len+0] = '\n';
-                               tline[len+1] = '\0';
-                               cp++;
+                               strcpy(tline + len, newline);
+                               cp += strlen(newline);
                                linestate = LS_START;
                        } else {
                                linestate = LS_DIRTY;
@@ -630,7 +734,7 @@ parseline(void)
                while (*cp != '\0')
                        cp = skipcomment(cp + 1);
        }
-       debug("parser %s comment %s line",
+       debug("parser line %d state %s comment %s line", linenum,
            comment_name[incomment], linestate_name[linestate]);
        return (retval);
 }
@@ -875,11 +979,16 @@ skipcomment(const char *cp)
        }
        while (*cp != '\0')
                /* don't reset to LS_START after a line continuation */
-               if (strncmp(cp, "\\\n", 2) == 0)
+               if (strncmp(cp, "\\\r\n", 3) == 0)
+                       cp += 3;
+               else if (strncmp(cp, "\\\n", 2) == 0)
                        cp += 2;
                else switch (incomment) {
                case NO_COMMENT:
-                       if (strncmp(cp, "/\\\n", 3) == 0) {
+                       if (strncmp(cp, "/\\\r\n", 4) == 0) {
+                               incomment = STARTING_COMMENT;
+                               cp += 4;
+                       } else if (strncmp(cp, "/\\\n", 3) == 0) {
                                incomment = STARTING_COMMENT;
                                cp += 3;
                        } else if (strncmp(cp, "/*", 2) == 0) {
@@ -899,7 +1008,7 @@ skipcomment(const char *cp)
                        } else if (strncmp(cp, "\n", 1) == 0) {
                                linestate = LS_START;
                                cp += 1;
-                       } else if (strchr(" \t", *cp) != NULL) {
+                       } else if (strchr(" \r\t", *cp) != NULL) {
                                cp += 1;
                        } else
                                return (cp);
@@ -931,7 +1040,10 @@ skipcomment(const char *cp)
                                cp += 1;
                        continue;
                case C_COMMENT:
-                       if (strncmp(cp, "*\\\n", 3) == 0) {
+                       if (strncmp(cp, "*\\\r\n", 4) == 0) {
+                               incomment = FINISHING_COMMENT;
+                               cp += 4;
+                       } else if (strncmp(cp, "*\\\n", 3) == 0) {
                                incomment = FINISHING_COMMENT;
                                cp += 3;
                        } else if (strncmp(cp, "*/", 2) == 0) {
@@ -1015,7 +1127,13 @@ findsym(const char *str)
        if (cp == str)
                return (-1);
        if (symlist) {
-               printf("%.*s\n", (int)(cp-str), str);
+               if (symdepth && firstsym)
+                       printf("%s%3d", zerosyms ? "" : "\n", depth);
+               firstsym = zerosyms = false;
+               printf("%s%.*s%s",
+                   symdepth ? " " : "",
+                   (int)(cp-str), str,
+                   symdepth ? "" : "\n");
                /* we don't care about the value of the symbol */
                return (0);
        }
@@ -1052,7 +1170,7 @@ addsym(bool ignorethis, bool definethis, char *sym)
                        value[symind] = val+1;
                        *val = '\0';
                } else if (*val == '\0')
-                       value[symind] = "";
+                       value[symind] = "1";
                else
                        usage();
        } else {
@@ -1060,6 +1178,8 @@ addsym(bool ignorethis, bool definethis, char *sym)
                        usage();
                value[symind] = NULL;
        }
+       debug("addsym %s=%s", symname[symind],
+           value[symind] ? value[symind] : "undef");
 }
 
 /*
@@ -1100,5 +1220,6 @@ error(const char *msg)
        else
                warnx("%s: %d: %s (#if line %d depth %d)",
                    filename, linenum, msg, stifline[depth], depth);
+       closeout();
        errx(2, "output may be truncated");
 }
index ba7c63af6f3b2bc8a53a91de50ff9ad669468fb8..8ce792ea08e9f782d3e661dbbb99798839a08ed4 100755 (executable)
@@ -37,6 +37,8 @@ $default{"POWEROFF_ON_SUCCESS"}       = 0;
 $default{"BUILD_OPTIONS"}      = "";
 $default{"BISECT_SLEEP_TIME"}  = 60;   # sleep time between bisects
 $default{"CLEAR_LOG"}          = 0;
+$default{"BISECT_MANUAL"}      = 0;
+$default{"BISECT_SKIP"}                = 1;
 $default{"SUCCESS_LINE"}       = "login:";
 $default{"BOOTED_TIMEOUT"}     = 1;
 $default{"DIE_ON_FAILURE"}     = 1;
@@ -45,6 +47,7 @@ $default{"SCP_TO_TARGET"}     = "scp \$SRC_FILE \$SSH_USER\@\$MACHINE:\$DST_FILE";
 $default{"REBOOT"}             = "ssh \$SSH_USER\@\$MACHINE reboot";
 $default{"STOP_AFTER_SUCCESS"} = 10;
 $default{"STOP_AFTER_FAILURE"} = 60;
+$default{"STOP_TEST_AFTER"}    = 600;
 $default{"LOCALVERSION"}       = "-test";
 
 my $ktest_config;
@@ -81,6 +84,8 @@ my $addconfig;
 my $in_bisect = 0;
 my $bisect_bad = "";
 my $reverse_bisect;
+my $bisect_manual;
+my $bisect_skip;
 my $in_patchcheck = 0;
 my $run_test;
 my $redirect;
@@ -98,6 +103,7 @@ my $console;
 my $success_line;
 my $stop_after_success;
 my $stop_after_failure;
+my $stop_test_after;
 my $build_target;
 my $target_image;
 my $localversion;
@@ -462,6 +468,10 @@ sub dodie {
        `$power_off`;
     }
 
+    if (defined($opt{"LOG_FILE"})) {
+       print " See $opt{LOG_FILE} for more info.\n";
+    }
+
     die @_, "\n";
 }
 
@@ -760,8 +770,10 @@ sub monitor {
 
     my $success_start;
     my $failure_start;
+    my $monitor_start = time;
+    my $done = 0;
 
-    for (;;) {
+    while (!$done) {
 
        if ($booted) {
            $line = wait_for_input($monitor_fp, $booted_timeout);
@@ -796,7 +808,7 @@ sub monitor {
        }
 
        if ($full_line =~ /call trace:/i) {
-           if (!$skip_call_trace) {
+           if (!$bug && !$skip_call_trace) {
                $bug = 1;
                $failure_start = time;
            }
@@ -816,12 +828,19 @@ sub monitor {
        }
 
        if ($full_line =~ /Kernel panic -/) {
+           $failure_start = time;
            $bug = 1;
        }
 
        if ($line =~ /\n/) {
            $full_line = "";
        }
+
+       if ($stop_test_after > 0 && !$booted && !$bug) {
+           if (time - $monitor_start > $stop_test_after) {
+               $done = 1;
+           }
+       }
     }
 
     close(DMESG);
@@ -925,6 +944,18 @@ sub check_buildlog {
     return 1;
 }
 
+sub make_oldconfig {
+    my ($defconfig) = @_;
+
+    if (!run_command "$defconfig $make oldnoconfig") {
+       # Perhaps oldnoconfig doesn't exist in this version of the kernel
+       # try a yes '' | oldconfig
+       doprint "oldnoconfig failed, trying yes '' | make oldconfig\n";
+       run_command "yes '' | $defconfig $make oldconfig" or
+           dodie "failed make config oldconfig";
+    }
+}
+
 sub build {
     my ($type) = @_;
     my $defconfig = "";
@@ -970,8 +1001,12 @@ sub build {
        $defconfig = "KCONFIG_ALLCONFIG=$minconfig";
     }
 
-    run_command "$defconfig $make $type" or
-       dodie "failed make config";
+    if ($type eq "oldnoconfig") {
+       make_oldconfig $defconfig;
+    } else {
+       run_command "$defconfig $make $type" or
+           dodie "failed make config";
+    }
 
     $redirect = "$buildlog";
     if (!run_command "$make $build_options") {
@@ -1025,6 +1060,21 @@ sub get_version {
     doprint "$version\n";
 }
 
+sub answer_bisect {
+    for (;;) {
+       doprint "Pass or fail? [p/f]";
+       my $ans = <STDIN>;
+       chomp $ans;
+       if ($ans eq "p" || $ans eq "P") {
+           return 1;
+       } elsif ($ans eq "f" || $ans eq "F") {
+           return 0;
+       } else {
+           print "Please answer 'P' or 'F'\n";
+       }
+    }
+}
+
 sub child_run_test {
     my $failed = 0;
 
@@ -1070,6 +1120,7 @@ sub do_run_test {
 
            # we are not guaranteed to get a full line
            $full_line .= $line;
+           doprint $line;
 
            if ($full_line =~ /call trace:/i) {
                $bug = 1;
@@ -1086,6 +1137,19 @@ sub do_run_test {
     } while (!$child_done && !$bug);
 
     if ($bug) {
+       my $failure_start = time;
+       my $now;
+       do {
+           $line = wait_for_input($monitor_fp, 1);
+           if (defined($line)) {
+               doprint $line;
+           }
+           $now = time;
+           if ($now - $failure_start >= $stop_after_failure) {
+               last;
+           }
+       } while (defined($line));
+
        doprint "Detected kernel crash!\n";
        # kill the child with extreme prejudice
        kill 9, $child_pid;
@@ -1131,7 +1195,15 @@ sub run_git_bisect {
     return 1;
 }
 
-# returns 1 on success, 0 on failure
+sub bisect_reboot {
+    doprint "Reboot and sleep $bisect_sleep_time seconds\n";
+    reboot;
+    start_monitor;
+    wait_for_monitor $bisect_sleep_time;
+    end_monitor;
+}
+
+# returns 1 on success, 0 on failure, -1 on skip
 sub run_bisect_test {
     my ($type, $buildtype) = @_;
 
@@ -1145,6 +1217,10 @@ sub run_bisect_test {
     build $buildtype or $failed = 1;
 
     if ($type ne "build") {
+       if ($failed && $bisect_skip) {
+           $in_bisect = 0;
+           return -1;
+       }
        dodie "Failed on build" if $failed;
 
        # Now boot the box
@@ -1156,6 +1232,12 @@ sub run_bisect_test {
        monitor or $failed = 1;
 
        if ($type ne "boot") {
+           if ($failed && $bisect_skip) {
+               end_monitor;
+               bisect_reboot;
+               $in_bisect = 0;
+               return -1;
+           }
            dodie "Failed on boot" if $failed;
 
            do_run_test or $failed = 1;
@@ -1168,11 +1250,7 @@ sub run_bisect_test {
 
        # reboot the box to a good kernel
        if ($type ne "build") {
-           doprint "Reboot and sleep $bisect_sleep_time seconds\n";
-           reboot;
-           start_monitor;
-           wait_for_monitor $bisect_sleep_time;
-           end_monitor;
+           bisect_reboot;
        }
     } else {
        $result = 1;
@@ -1193,16 +1271,22 @@ sub run_bisect {
 
     my $ret = run_bisect_test $type, $buildtype;
 
+    if ($bisect_manual) {
+       $ret = answer_bisect;
+    }
 
     # Are we looking for where it worked, not failed?
     if ($reverse_bisect) {
        $ret = !$ret;
     }
 
-    if ($ret) {
+    if ($ret > 0) {
        return "good";
-    } else {
+    } elsif ($ret == 0) {
        return  "bad";
+    } elsif ($bisect_skip) {
+       doprint "HIT A BAD COMMIT ... SKIPPING\n";
+       return "skip";
     }
 }
 
@@ -1220,6 +1304,13 @@ sub bisect {
     my $type = $opt{"BISECT_TYPE[$i]"};
     my $start = $opt{"BISECT_START[$i]"};
     my $replay = $opt{"BISECT_REPLAY[$i]"};
+    my $start_files = $opt{"BISECT_FILES[$i]"};
+
+    if (defined($start_files)) {
+       $start_files = " -- " . $start_files;
+    } else {
+       $start_files = "";
+    }
 
     # convert to true sha1's
     $good = get_sha1($good);
@@ -1273,7 +1364,7 @@ sub bisect {
            die "Failed to checkout $head";
     }
 
-    run_command "git bisect start" or
+    run_command "git bisect start$start_files" or
        dodie "could not start bisect";
 
     run_command "git bisect good $good" or
@@ -1390,9 +1481,7 @@ sub create_config {
     close(OUT);
 
 #    exit;
-    run_command "$make oldnoconfig" or
-       dodie "failed make config oldconfig";
-
+    make_oldconfig "";
 }
 
 sub compare_configs {
@@ -1505,7 +1594,9 @@ sub run_config_bisect {
        }
 
        $ret = run_config_bisect_test $type;
-
+       if ($bisect_manual) {
+           $ret = answer_bisect;
+       }
        if ($ret) {
            process_passed %current_config;
            return 0;
@@ -1536,7 +1627,13 @@ sub run_config_bisect {
        $half = int($#start_list / 2);
     } while ($half > 0);
 
-    # we found a single config, try it again
+    # we found a single config, try it again unless we are running manually
+
+    if ($bisect_manual) {
+       process_failed $start_list[0];
+       return 1;
+    }
+
     my @tophalf = @start_list[0 .. 0];
 
     $ret = run_config_bisect_test $type;
@@ -1594,8 +1691,7 @@ sub config_bisect {
     close(IN);
 
     # Now run oldconfig with the minconfig (and addconfigs)
-    run_command "$defconfig $make oldnoconfig" or
-       dodie "failed make config oldconfig";
+    make_oldconfig $defconfig;
 
     # check to see what we lost (or gained)
     open (IN, $output_config)
@@ -1907,6 +2003,8 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $poweroff_after_halt = set_test_option("POWEROFF_AFTER_HALT", $i);
     $sleep_time = set_test_option("SLEEP_TIME", $i);
     $bisect_sleep_time = set_test_option("BISECT_SLEEP_TIME", $i);
+    $bisect_manual = set_test_option("BISECT_MANUAL", $i);
+    $bisect_skip = set_test_option("BISECT_SKIP", $i);
     $store_failures = set_test_option("STORE_FAILURES", $i);
     $timeout = set_test_option("TIMEOUT", $i);
     $booted_timeout = set_test_option("BOOTED_TIMEOUT", $i);
@@ -1914,6 +2012,7 @@ for (my $i = 1; $i <= $opt{"NUM_TESTS"}; $i++) {
     $success_line = set_test_option("SUCCESS_LINE", $i);
     $stop_after_success = set_test_option("STOP_AFTER_SUCCESS", $i);
     $stop_after_failure = set_test_option("STOP_AFTER_FAILURE", $i);
+    $stop_test_after = set_test_option("STOP_TEST_AFTER", $i);
     $build_target = set_test_option("BUILD_TARGET", $i);
     $ssh_exec = set_test_option("SSH_EXEC", $i);
     $scp_to_target = set_test_option("SCP_TO_TARGET", $i);
index 3408c594b2deceaf5d58cd526a154362c427b6f2..4c5d6bd74a0207b50d8a74ff204270afdb60601a 100644 (file)
 # (default 60)
 #STOP_AFTER_FAILURE = 60
 
+# In case the console constantly fills the screen, having
+# a specified time to stop the test if it never succeeds nor fails
+# is recommended.
+# Note: this is ignored if a success or failure is detected.
+# (in seconds)
+# (default 600, -1 is to never stop)
+#STOP_TEST_AFTER = 600
+
 # Stop testing if a build fails. If set, the script will end if
 # a failure is detected, otherwise it will save off the .config,
 # dmesg and bootlog in a directory called
 #   git bisect good, git bisect bad, and running the git bisect replay
 #   if the BISECT_REPLAY is set.
 #
+# BISECT_SKIP = 1 (optional, default 0)
+#
+#   If BISECT_TYPE is set to test but the build fails, ktest will
+#   simply fail the test and end their. You could use BISECT_REPLAY
+#   and BISECT_START to resume after you found a new starting point,
+#   or you could set BISECT_SKIP to 1. If BISECT_SKIP is set to 1,
+#   when something other than the BISECT_TYPE fails, ktest.pl will
+#   run "git bisect skip" and try again.
+#
+# BISECT_FILES = <path> (optional, default undefined)
+#
+#   To just run the git bisect on a specific path, set BISECT_FILES.
+#   For example:
+#
+#     BISECT_FILES = arch/x86 kernel/time
+#
+#   Will run the bisect with "git bisect start -- arch/x86 kernel/time"
+#
 # BISECT_REVERSE = 1 (optional, default 0)
 #
 #   In those strange instances where it was broken forever
 #   With BISECT_REVERSE = 1, The test will consider failures as
 #   good, and success as bad.
 #
+# BISECT_MANUAL = 1 (optional, default 0)
+#
+#   In case there's a problem with automating the bisect for
+#   whatever reason. (Can't reboot, want to inspect each iteration)
+#   Doing a BISECT_MANUAL will have the test wait for you to
+#   tell it if the test passed or failed after each iteration.
+#   This is basicall the same as running git bisect yourself
+#   but ktest will rebuild and install the kernel for you.
+#
 # BISECT_CHECK = 1 (optional, default 0)
 #
 #   Just to be sure the good is good and bad is bad, setting
 #
 #   CONFIG_BISECT is the config that failed to boot
 #
+#   If BISECT_MANUAL is set, it will pause between iterations.
+#   This is useful to use just ktest.pl just for the config bisect.
+#   If you set it to build, it will run the bisect and you can
+#   control what happens in between iterations. It will ask you if
+#   the test succeeded or not and continue the config bisect.
+#
 # Example:
 #   TEST_START
 #   TEST_TYPE = config_bisect
 #   CONFIG_BISECT_TYPE = build
 #   CONFIG_BISECT = /home/test/Ā¢onfig-bad
 #   MIN_CONFIG = /home/test/config-min
+#   BISECT_MANUAL = 1
 #