]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'cpumask-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2009 03:03:50 +0000 (13:33 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Mar 2009 03:03:50 +0000 (13:33 +1030)
Conflicts:

arch/x86/include/asm/topology.h
drivers/oprofile/buffer_sync.c
(Both cases: changed in Linus' tree, removed in Ingo's).

231 files changed:
Documentation/DocBook/procfs_example.c
Documentation/hwmon/ds1621
Documentation/hwmon/pcf8591 [moved from Documentation/i2c/chips/pcf8591 with 100% similarity]
Documentation/hwmon/sysfs-interface
Documentation/hwmon/w83627ehf
Documentation/lguest/lguest.c
Documentation/lockdep-design.txt
arch/alpha/kernel/srm_env.c
arch/blackfin/mm/sram-alloc.c
arch/cris/arch-v10/kernel/time.c
arch/cris/arch-v32/kernel/smp.c
arch/cris/arch-v32/kernel/time.c
arch/frv/kernel/irq-mb93091.c
arch/frv/kernel/irq-mb93093.c
arch/frv/kernel/irq-mb93493.c
arch/frv/kernel/time.c
arch/h8300/kernel/timer/itu.c
arch/h8300/kernel/timer/timer16.c
arch/h8300/kernel/timer/timer8.c
arch/h8300/kernel/timer/tpu.c
arch/ia64/include/asm/topology.h
arch/ia64/kernel/palinfo.c
arch/ia64/sn/kernel/sn2/prominfo_proc.c
arch/m32r/kernel/time.c
arch/mips/cobalt/irq.c
arch/mips/emma/markeins/irq.c
arch/mips/include/asm/mach-ip27/topology.h
arch/mips/jazz/irq.c
arch/mips/kernel/cevt-bcm1480.c
arch/mips/kernel/cevt-sb1250.c
arch/mips/kernel/i8253.c
arch/mips/kernel/i8259.c
arch/mips/lasat/interrupt.c
arch/mips/lemote/lm2e/irq.c
arch/mips/sgi-ip27/ip27-nmi.c
arch/mips/sgi-ip32/ip32-irq.c
arch/mips/sni/rm200.c
arch/mips/vr41xx/common/irq.c
arch/mn10300/kernel/time.c
arch/powerpc/include/asm/topology.h
arch/powerpc/kernel/rtas_flash.c
arch/powerpc/platforms/85xx/mpc85xx_cds.c
arch/powerpc/platforms/8xx/m8xx_setup.c
arch/powerpc/platforms/chrp/setup.c
arch/powerpc/platforms/powermac/pic.c
arch/powerpc/platforms/powermac/smp.c
arch/powerpc/sysdev/cpm1.c
arch/sh/include/asm/topology.h
arch/sh/kernel/time_64.c
arch/sh/kernel/timers/timer-cmt.c
arch/sh/kernel/timers/timer-mtu2.c
arch/sh/kernel/timers/timer-tmu.c
arch/sparc/include/asm/mmu_context_64.h
arch/sparc/include/asm/smp_64.h
arch/sparc/include/asm/system_32.h
arch/sparc/include/asm/topology_64.h
arch/sparc/kernel/ds.c
arch/sparc/kernel/irq_32.c
arch/sparc/kernel/irq_64.c
arch/sparc/kernel/led.c
arch/sparc/kernel/mdesc.c
arch/sparc/kernel/nmi.c
arch/sparc/kernel/prom_64.c
arch/sparc/kernel/smp_32.c
arch/sparc/kernel/smp_64.c
arch/sparc/kernel/sun4d_irq.c
arch/sparc/kernel/sun4d_smp.c
arch/sparc/kernel/sun4m_smp.c
arch/sparc/mm/init_64.c
arch/sparc/mm/srmmu.c
arch/x86/include/asm/lguest_hcall.h
arch/x86/include/asm/topology.h
arch/x86/kernel/apm_32.c
arch/x86/kernel/cpu/mtrr/if.c
arch/x86/kernel/irqinit_32.c
arch/x86/kernel/irqinit_64.c
arch/x86/kernel/mfgpt_32.c
arch/x86/kernel/setup.c
arch/x86/kernel/time_64.c
arch/x86/kernel/vmiclock_32.c
arch/x86/lguest/boot.c
arch/x86/lguest/i386_head.S
drivers/acpi/ac.c
drivers/acpi/battery.c
drivers/acpi/button.c
drivers/acpi/fan.c
drivers/acpi/processor_core.c
drivers/acpi/sbs.c
drivers/acpi/thermal.c
drivers/acpi/video.c
drivers/base/cpu.c
drivers/base/power/main.c
drivers/base/sys.c
drivers/block/ps3vram.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/firmware/dmi_scan.c
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/ds1621.c
drivers/hwmon/fschmd.c
drivers/hwmon/hdaps.c
drivers/hwmon/pcf8591.c [moved from drivers/i2c/chips/pcf8591.c with 96% similarity]
drivers/hwmon/w83627ehf.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/chips/Kconfig
drivers/i2c/chips/Makefile
drivers/input/input.c
drivers/isdn/hardware/eicon/divasi.c
drivers/lguest/core.c
drivers/lguest/interrupts_and_traps.c
drivers/lguest/lg.h
drivers/lguest/lguest_device.c
drivers/lguest/page_tables.c
drivers/lguest/segments.c
drivers/lguest/x86/core.c
drivers/media/video/cpia.c
drivers/message/i2o/i2o_proc.c
drivers/net/bonding/bond_main.c
drivers/net/gianfar.c
drivers/net/hamradio/dmascc.c
drivers/net/irda/vlsi_ir.c
drivers/net/netconsole.c
drivers/net/ni5010.c
drivers/net/niu.c
drivers/net/tg3.c
drivers/net/ucc_geth.c
drivers/net/wireless/airo.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/prism54/islpci_dev.c
drivers/net/wireless/zd1201.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/dell-laptop.c
drivers/platform/x86/thinkpad_acpi.c
drivers/platform/x86/toshiba_acpi.c
drivers/rtc/rtc-proc.c
drivers/s390/block/dasd_proc.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_proc.c
drivers/video/aty/radeon_pm.c
drivers/video/via/viafbdev.c
drivers/virtio/virtio_ring.c
drivers/watchdog/hpwdt.c
drivers/xen/manage.c
fs/afs/proc.c
fs/cifs/cifs_debug.c
fs/jfs/jfs_debug.c
fs/nfs/client.c
fs/proc/generic.c
fs/proc/inode-alloc.txt [deleted file]
fs/proc/inode.c
fs/proc/internal.h
fs/proc/proc_tty.c
fs/proc/task_mmu.c
fs/proc/uptime.c
fs/reiserfs/procfs.c
fs/reiserfs/xattr.c
fs/seq_file.c
include/asm-generic/topology.h
include/linux/cpuset.h
include/linux/dmi.h
include/linux/interrupt.h
include/linux/ipmi_smi.h
include/linux/irq.h
include/linux/kernel.h
include/linux/lockdep.h
include/linux/mutex.h
include/linux/netpoll.h
include/linux/pci.h
include/linux/proc_fs.h
include/linux/reiserfs_acl.h
include/linux/sched.h
include/linux/seq_file.h
include/linux/skbuff.h
include/linux/timer.h
init/main.c
kernel/cpu.c
kernel/fork.c
kernel/irq/Makefile
kernel/irq/internals.h
kernel/irq/manage.c
kernel/irq/pm.c [new file with mode: 0644]
kernel/kexec.c
kernel/kmod.c
kernel/kthread.c
kernel/lockdep.c
kernel/lockdep_internals.h
kernel/lockdep_proc.c
kernel/lockdep_states.h [new file with mode: 0644]
kernel/mutex-debug.c
kernel/mutex-debug.h
kernel/mutex.c
kernel/mutex.h
kernel/power/disk.c
kernel/power/main.c
kernel/rcutorture.c
kernel/sched.c
kernel/sched_cpupri.h
kernel/sched_features.h
kernel/stop_machine.c
kernel/timer.c
kernel/workqueue.c
lib/dma-debug.c
mm/allocpercpu.c
mm/page_alloc.c
mm/pdflush.c
mm/slab.c
mm/slob.c
mm/slub.c
mm/vmscan.c
mm/vmstat.c
net/appletalk/atalk_proc.c
net/atm/mpoa_proc.c
net/atm/proc.c
net/can/bcm.c
net/can/proc.c
net/core/netpoll.c
net/core/pktgen.c
net/core/skbuff.c
net/irda/irproc.c
net/llc/llc_proc.c
net/netfilter/nf_conntrack_irc.c
net/netfilter/xt_cluster.c
net/sctp/protocol.c
net/sunrpc/cache.c
net/sunrpc/stats.c
net/sunrpc/svc.c
sound/core/info.c

index 8c6396e4bf311901a19fd717500c422eeba4869a..a5b11793b1e0167bf32d1b1a19d13aca7a424aa5 100644 (file)
@@ -117,9 +117,6 @@ static int __init init_procfs_example(void)
                rv = -ENOMEM;
                goto out;
        }
-       
-       example_dir->owner = THIS_MODULE;
-       
        /* create jiffies using convenience function */
        jiffies_file = create_proc_read_entry("jiffies", 
                                              0444, example_dir, 
@@ -130,8 +127,6 @@ static int __init init_procfs_example(void)
                goto no_jiffies;
        }
 
-       jiffies_file->owner = THIS_MODULE;
-
        /* create foo and bar files using same callback
         * functions 
         */
@@ -146,7 +141,6 @@ static int __init init_procfs_example(void)
        foo_file->data = &foo_data;
        foo_file->read_proc = proc_read_foobar;
        foo_file->write_proc = proc_write_foobar;
-       foo_file->owner = THIS_MODULE;
                
        bar_file = create_proc_entry("bar", 0644, example_dir);
        if(bar_file == NULL) {
@@ -159,7 +153,6 @@ static int __init init_procfs_example(void)
        bar_file->data = &bar_data;
        bar_file->read_proc = proc_read_foobar;
        bar_file->write_proc = proc_write_foobar;
-       bar_file->owner = THIS_MODULE;
                
        /* create symlink */
        symlink = proc_symlink("jiffies_too", example_dir, 
@@ -169,8 +162,6 @@ static int __init init_procfs_example(void)
                goto no_symlink;
        }
 
-       symlink->owner = THIS_MODULE;
-
        /* everything OK */
        printk(KERN_INFO "%s %s initialised\n",
               MODULE_NAME, MODULE_VERS);
index 1fee6f1e6bc5574102b04d13d5ed1fd1396f0641..5e97f333c4df547e79507631a5b848578409f3d6 100644 (file)
@@ -49,12 +49,9 @@ of up to +/- 0.5 degrees even when compared against precise temperature
 readings. Be sure to have a high vs. low temperature limit gap of al least
 1.0 degree Celsius to avoid Tout "bouncing", though!
 
-As for alarms, you can read the alarm status of the DS1621 via the 'alarms'
-/sys file interface. The result consists mainly of bit 6 and 5 of the
-configuration register of the chip; bit 6 (0x40 or 64) is the high alarm
-bit and bit 5 (0x20 or 32) the low one. These bits are set when the high or
-low limits are met or exceeded and are reset by the module as soon as the
-respective temperature ranges are left.
+The alarm bits are set when the high or low limits are met or exceeded and
+are reset by the module as soon as the respective temperature ranges are
+left.
 
 The alarm registers are in no way suitable to find out about the actual
 status of Tout. They will only tell you about its history, whether or not
@@ -64,45 +61,3 @@ with neither of the alarms set.
 
 Temperature conversion of the DS1621 takes up to 1000ms; internal access to
 non-volatile registers may last for 10ms or below.
-
-High Accuracy Temperature Reading
----------------------------------
-
-As said before, the temperature issued via the 9-bit i2c-bus data is
-somewhat arbitrary. Internally, the temperature conversion is of a
-different kind that is explained (not so...) well in the DS1621 data sheet.
-To cut the long story short: Inside the DS1621 there are two oscillators,
-both of them biassed by a temperature coefficient.
-
-Higher resolution of the temperature reading can be achieved using the
-internal projection, which means taking account of REG_COUNT and REG_SLOPE
-(the driver manages them):
-
-Taken from Dallas Semiconductors App Note 068: 'Increasing Temperature
-Resolution on the DS1620' and App Note 105: 'High Resolution Temperature
-Measurement with Dallas Direct-to-Digital Temperature Sensors'
-
-- Read the 9-bit temperature and strip the LSB (Truncate the .5 degs)
-- The resulting value is TEMP_READ.
-- Then, read REG_COUNT.
-- And then, REG_SLOPE.
-
-      TEMP = TEMP_READ - 0.25 + ((REG_SLOPE - REG_COUNT) / REG_SLOPE)
-
-Note that this is what the DONE bit in the DS1621 configuration register is
-good for: Internally, one temperature conversion takes up to 1000ms. Before
-that conversion is complete you will not be able to read valid things out
-of REG_COUNT and REG_SLOPE. The DONE bit, as you may have guessed by now,
-tells you whether the conversion is complete ("done", in plain English) and
-thus, whether the values you read are good or not.
-
-The DS1621 has two modes of operation: "Continuous" conversion, which can
-be understood as the default stand-alone mode where the chip gets the
-temperature and controls external devices via its Tout pin or tells other
-i2c's about it if they care. The other mode is called "1SHOT", that means
-that it only figures out about the temperature when it is explicitly told
-to do so; this can be seen as power saving mode.
-
-Now if you want to read REG_COUNT and REG_SLOPE, you have to either stop
-the continuous conversions until the contents of these registers are valid,
-or, in 1SHOT mode, you have to have one conversion made.
index 6dbfd5efd991de9f6a69eaa831d1a45634ba5979..2f10ce6a879f7276f635cd1ac51c03d8c004d8c1 100644 (file)
@@ -365,6 +365,7 @@ energy[1-*]_input           Cumulative energy use
                                Unit: microJoule
                                RO
 
+
 **********
 * Alarms *
 **********
@@ -453,6 +454,27 @@ beep_mask  Bitmask for beep.
                RW
 
 
+***********************
+* Intrusion detection *
+***********************
+
+intrusion[0-*]_alarm
+               Chassis intrusion detection
+               0: OK
+               1: intrusion detected
+               RW
+               Contrary to regular alarm flags which clear themselves
+               automatically when read, this one sticks until cleared by
+               the user. This is done by writing 0 to the file. Writing
+               other values is unsupported.
+
+intrusion[0-*]_beep
+               Chassis intrusion beep
+               0: disable
+               1: enable
+               RW
+
+
 sysfs attribute writes interpretation
 -------------------------------------
 
index d6e1ae30fa6e61f3da3e523befa708dcfbedb627..b6eb59384bb39c1b67d0c99a1ade601269a64d05 100644 (file)
@@ -2,30 +2,40 @@ Kernel driver w83627ehf
 =======================
 
 Supported chips:
-  * Winbond W83627EHF/EHG/DHG (ISA access ONLY)
+  * Winbond W83627EHF/EHG (ISA access ONLY)
     Prefix: 'w83627ehf'
     Addresses scanned: ISA address retrieved from Super I/O registers
     Datasheet:
-        http://www.winbond-usa.com/products/winbond_products/pdfs/PCIC/W83627EHF_%20W83627EHGb.pdf
-        DHG datasheet confidential.
+        http://www.nuvoton.com.tw/NR/rdonlyres/A6A258F0-F0C9-4F97-81C0-C4D29E7E943E/0/W83627EHF.pdf
+  * Winbond W83627DHG
+    Prefix: 'w83627dhg'
+    Addresses scanned: ISA address retrieved from Super I/O registers
+    Datasheet:
+        http://www.nuvoton.com.tw/NR/rdonlyres/7885623D-A487-4CF9-A47F-30C5F73D6FE6/0/W83627DHG.pdf
+  * Winbond W83667HG
+    Prefix: 'w83667hg'
+    Addresses scanned: ISA address retrieved from Super I/O registers
+    Datasheet: not available
 
 Authors:
         Jean Delvare <khali@linux-fr.org>
         Yuan Mu (Winbond)
         Rudolf Marek <r.marek@assembler.cz>
         David Hubbard <david.c.hubbard@gmail.com>
+        Gong Jun <JGong@nuvoton.com>
 
 Description
 -----------
 
-This driver implements support for the Winbond W83627EHF, W83627EHG, and
-W83627DHG super I/O chips. We will refer to them collectively as Winbond chips.
+This driver implements support for the Winbond W83627EHF, W83627EHG,
+W83627DHG and W83667HG super I/O chips. We will refer to them collectively
+as Winbond chips.
 
 The chips implement three temperature sensors, five fan rotation
 speed sensors, ten analog voltage sensors (only nine for the 627DHG), one
-VID (6 pins for the 627EHF/EHG, 8 pins for the 627DHG), alarms with beep
-warnings (control unimplemented), and some automatic fan regulation
-strategies (plus manual fan control mode).
+VID (6 pins for the 627EHF/EHG, 8 pins for the 627DHG and 667HG), alarms
+with beep warnings (control unimplemented), and some automatic fan
+regulation strategies (plus manual fan control mode).
 
 Temperatures are measured in degrees Celsius and measurement resolution is 1
 degC for temp1 and 0.5 degC for temp2 and temp3. An alarm is triggered when
@@ -54,7 +64,8 @@ follows:
 temp1 -> pwm1
 temp2 -> pwm2
 temp3 -> pwm3
-prog  -> pwm4 (the programmable setting is not supported by the driver)
+prog  -> pwm4 (not on 667HG; the programmable setting is not supported by
+              the driver)
 
 /sys files
 ----------
index f2dbbf3bdeaba7a5c6d58e1ccb3f8a686ade88ed..d36fcc0f2715c705d0f70d1aa9c13e20b8aaa917 100644 (file)
@@ -1630,6 +1630,13 @@ static bool service_io(struct device *dev)
                }
        }
 
+       /* OK, so we noted that it was pretty poor to use an fdatasync as a
+        * barrier.  But Christoph Hellwig points out that we need a sync
+        * *afterwards* as well: "Barriers specify no reordering to the front
+        * or the back."  And Jens Axboe confirmed it, so here we are: */
+       if (out->type & VIRTIO_BLK_T_BARRIER)
+               fdatasync(vblk->fd);
+
        /* We can't trigger an IRQ, because we're not the Launcher.  It does
         * that when we tell it we're done. */
        add_used(dev->vq, head, wlen);
index 488773018152056ea159685e732e42452a7ae142..938ea22f2cc096f6838a678217e463bf9ec0cd4d 100644 (file)
@@ -27,33 +27,37 @@ lock-class.
 State
 -----
 
-The validator tracks lock-class usage history into 5 separate state bits:
+The validator tracks lock-class usage history into 4n + 1 separate state bits:
 
-- 'ever held in hardirq context'                    [ == hardirq-safe   ]
-- 'ever held in softirq context'                    [ == softirq-safe   ]
-- 'ever held with hardirqs enabled'                 [ == hardirq-unsafe ]
-- 'ever held with softirqs and hardirqs enabled'    [ == softirq-unsafe ]
+- 'ever held in STATE context'
+- 'ever head as readlock in STATE context'
+- 'ever head with STATE enabled'
+- 'ever head as readlock with STATE enabled'
+
+Where STATE can be either one of (kernel/lockdep_states.h)
+ - hardirq
+ - softirq
+ - reclaim_fs
 
 - 'ever used'                                       [ == !unused        ]
 
-When locking rules are violated, these state bits are presented in the
-locking error messages, inside curlies.  A contrived example:
+When locking rules are violated, these state bits are presented in the
+locking error messages, inside curlies. A contrived example:
 
    modprobe/2287 is trying to acquire lock:
-    (&sio_locks[i].lock){--..}, at: [<c02867fd>] mutex_lock+0x21/0x24
+    (&sio_locks[i].lock){-.-...}, at: [<c02867fd>] mutex_lock+0x21/0x24
 
    but task is already holding lock:
-    (&sio_locks[i].lock){--..}, at: [<c02867fd>] mutex_lock+0x21/0x24
+    (&sio_locks[i].lock){-.-...}, at: [<c02867fd>] mutex_lock+0x21/0x24
 
 
-The bit position indicates hardirq, softirq, hardirq-read,
-softirq-read respectively, and the character displayed in each
-indicates:
+The bit position indicates STATE, STATE-read, for each of the states listed
+above, and the character displayed in each indicates:
 
    '.'  acquired while irqs disabled
    '+'  acquired in irq context
    '-'  acquired with irqs enabled
-   '?' read acquired in irq context with irqs enabled.
+   '?'  acquired in irq context with irqs enabled.
 
 Unused mutexes cannot be part of the cause of an error.
 
index 78ad7cd1bbd60326d38bee8f00c8beb6a55f03eb..d12af472e1c0ec4aa380e8bdc73aab15627d7a2c 100644 (file)
@@ -218,7 +218,6 @@ srm_env_init(void)
                                BASE_DIR);
                goto cleanup;
        }
-       base_dir->owner = THIS_MODULE;
 
        /*
         * Create per-name subdirectory
@@ -229,7 +228,6 @@ srm_env_init(void)
                                BASE_DIR, NAMED_DIR);
                goto cleanup;
        }
-       named_dir->owner = THIS_MODULE;
 
        /*
         * Create per-number subdirectory
@@ -241,7 +239,6 @@ srm_env_init(void)
                goto cleanup;
 
        }
-       numbered_dir->owner = THIS_MODULE;
 
        /*
         * Create all named nodes
@@ -254,7 +251,6 @@ srm_env_init(void)
                        goto cleanup;
 
                entry->proc_entry->data         = (void *) entry;
-               entry->proc_entry->owner        = THIS_MODULE;
                entry->proc_entry->read_proc    = srm_env_read;
                entry->proc_entry->write_proc   = srm_env_write;
 
@@ -275,7 +271,6 @@ srm_env_init(void)
 
                entry->id                       = var_num;
                entry->proc_entry->data         = (void *) entry;
-               entry->proc_entry->owner        = THIS_MODULE;
                entry->proc_entry->read_proc    = srm_env_read;
                entry->proc_entry->write_proc   = srm_env_write;
        }
index 834cab7438a8fa3293f2c8e1ef4269c6740d8e13..530d1393a23226926c80ef833dd6b32230405214 100644 (file)
@@ -854,7 +854,6 @@ static int __init sram_proc_init(void)
                printk(KERN_WARNING "unable to create /proc/sram\n");
                return -1;
        }
-       ptr->owner = THIS_MODULE;
        ptr->read_proc = sram_proc_read;
        return 0;
 }
index c685ba4c33875c978abb599ce82c132ed3527f1e..2b73c7a5b6499a195a66badd8ef97b4d0c84b413 100644 (file)
@@ -261,7 +261,6 @@ timer_interrupt(int irq, void *dev_id)
 static struct irqaction irq2  = {
        .handler = timer_interrupt,
        .flags = IRQF_SHARED | IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "timer",
 };
 
index 9dac17334640a9cf3eda77c0c0a22b53e817f0a1..f59a973c97ee31893595b2a6c6e2e7778ce15e10 100644 (file)
@@ -65,7 +65,6 @@ static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
 static struct irqaction irq_ipi  = {
        .handler = crisv32_ipi_interrupt,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "ipi",
 };
 
index 3a13dd6e0a9a0d7e7eb40aaaff2ada62a2033239..65633d0dab860847b1367455b275a535448b6ee3 100644 (file)
@@ -267,7 +267,6 @@ timer_interrupt(int irq, void *dev_id)
 static struct irqaction irq_timer = {
        .handler = timer_interrupt,
        .flags = IRQF_SHARED | IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "timer"
 };
 
index 9e38f99bbab89c7e0677e5da0f38f09d9d6590ea..4dd9adaf115a4de8083ce7bfde075e5f3ac82123 100644 (file)
@@ -109,28 +109,24 @@ static struct irqaction fpga_irq[4]  = {
        [0] = {
                .handler        = fpga_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "fpga.0",
                .dev_id         = (void *) 0x0028UL,
        },
        [1] = {
                .handler        = fpga_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "fpga.1",
                .dev_id         = (void *) 0x0050UL,
        },
        [2] = {
                .handler        = fpga_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "fpga.2",
                .dev_id         = (void *) 0x1c00UL,
        },
        [3] = {
                .handler        = fpga_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "fpga.3",
                .dev_id         = (void *) 0x6386UL,
        }
index 3c2752ca97754eb881d5fef6ceeeb576ee679df1..e45209031873e63de6e0202bbd3e831a29ff27bb 100644 (file)
@@ -108,7 +108,6 @@ static struct irqaction fpga_irq[1]  = {
        [0] = {
                .handler        = fpga_interrupt,
                .flags          = IRQF_DISABLED,
-               .mask           = CPU_MASK_NONE,
                .name           = "fpga.0",
                .dev_id         = (void *) 0x0700UL,
        }
index 7754c7338e4b42cfaeb4c3a76158665f3b05d275..ba55ecdfb245a5c201bf34583bcad836677ea26e 100644 (file)
@@ -120,14 +120,12 @@ static struct irqaction mb93493_irq[2]  = {
        [0] = {
                .handler        = mb93493_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "mb93493.0",
                .dev_id         = (void *) __addr_MB93493_IQSR(0),
        },
        [1] = {
                .handler        = mb93493_interrupt,
                .flags          = IRQF_DISABLED | IRQF_SHARED,
-               .mask           = CPU_MASK_NONE,
                .name           = "mb93493.1",
                .dev_id         = (void *) __addr_MB93493_IQSR(1),
        }
index 69f6a4ef5d61b35c67323a85485e1cebedff7a43..fb0ce75772256568bc2195ba08cbfb9a652def94 100644 (file)
@@ -45,7 +45,6 @@ static irqreturn_t timer_interrupt(int irq, void *dummy);
 static struct irqaction timer_irq  = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "timer",
 };
 
index d1c926596b087ace1359ac7504303296e31f9b9b..4883ba7103a84d8b391a290fc64198949f2c3ca9 100644 (file)
@@ -60,7 +60,6 @@ static struct irqaction itu_irq = {
        .name           = "itu",
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
 };
 
 static const int __initdata divide_rate[] = {1, 2, 4, 8};
index e14271b7211943b183b23dc7076c78cdd280ba9c..042dbb53f3fb372707ab7a533a884e7ccb6b8dd3 100644 (file)
@@ -55,7 +55,6 @@ static struct irqaction timer16_irq = {
        .name           = "timer-16",
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
 };
 
 static const int __initdata divide_rate[] = {1, 2, 4, 8};
index 0556d7c7bea62c620377b82ca3b35f92d46f5712..38be0cabef0da0c4433d9d52924eef8f199e5b0b 100644 (file)
@@ -75,7 +75,6 @@ static struct irqaction timer8_irq = {
        .name           = "timer-8",
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
 };
 
 static const int __initdata divide_rate[] = {8, 64, 8192};
index df7f453a9673c6cdddd0e4f5b24d6cca49be7ceb..ad383caae196c282583d57e54d6e467dca9fcc62 100644 (file)
@@ -65,7 +65,6 @@ static struct irqaction tpu_irq = {
        .name           = "tpu",
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
 };
 
 const static int __initdata divide_rate[] = {
index 3193f4417e16c8ea919016f05aa904215f6eeae9..f260dcf215154078bf72752eb7991895a9b03fa8 100644 (file)
  */
 #define parent_node(nid) (nid)
 
-/*
- * Returns the number of the first CPU on Node 'node'.
- */
-#define node_to_first_cpu(node) (cpumask_first(cpumask_of_node(node)))
-
 /*
  * Determines the node for a given pci bus
  */
index e5c57f413ca27b197ef0edeb2166efde99d113cb..a4f19c70aadd39d95878740ecc92905c94d4270e 100644 (file)
@@ -1002,8 +1002,6 @@ create_palinfo_proc_entries(unsigned int cpu)
                *pdir = create_proc_read_entry(
                                palinfo_entries[j].name, 0, cpu_dir,
                                palinfo_read_entry, (void *)f.value);
-               if (*pdir)
-                       (*pdir)->owner = THIS_MODULE;
                pdir++;
        }
 }
index 4dcce3d0e04ca1c9bc0e10d10cf4d7fcab6f7723..e6332881864374111440c339a0da72e55130ff40 100644 (file)
@@ -225,7 +225,6 @@ static struct proc_dir_entry *sgi_prominfo_entry;
 int __init prominfo_init(void)
 {
        struct proc_dir_entry **entp;
-       struct proc_dir_entry *p;
        cnodeid_t cnodeid;
        unsigned long nasid;
        int size;
@@ -246,14 +245,10 @@ int __init prominfo_init(void)
                sprintf(name, "node%d", cnodeid);
                *entp = proc_mkdir(name, sgi_prominfo_entry);
                nasid = cnodeid_to_nasid(cnodeid);
-               p = create_proc_read_entry("fit", 0, *entp, read_fit_entry,
+               create_proc_read_entry("fit", 0, *entp, read_fit_entry,
                                           (void *)nasid);
-               if (p)
-                       p->owner = THIS_MODULE;
-               p = create_proc_read_entry("version", 0, *entp,
+               create_proc_read_entry("version", 0, *entp,
                                           read_version_entry, (void *)nasid);
-               if (p)
-                       p->owner = THIS_MODULE;
                entp++;
        }
 
index 6ea017727cced935c638a876dc193e7ef4e3288e..cada3ba4b9902f23bb13620e726a2625897e5d8a 100644 (file)
@@ -230,7 +230,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 static struct irqaction irq0 = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "MFT2",
 };
 
index ac4fb912649d4e2397083864e06e62169f77a1d6..cb9bf820fe53b4640a7b72264be61deacf998fa7 100644 (file)
@@ -47,7 +47,6 @@ asmlinkage void plat_irq_dispatch(void)
 
 static struct irqaction cascade = {
        .handler        = no_action,
-       .mask           = CPU_MASK_NONE,
        .name           = "cascade",
 };
 
index 2bbc41a1623cae2a3972084af3ce8118b85adc93..43828ae796ec9d0d3276b50ffe5b8f0c29ea1b2f 100644 (file)
@@ -186,7 +186,6 @@ void emma2rh_gpio_irq_init(void)
 static struct irqaction irq_cascade = {
           .handler = no_action,
           .flags = 0,
-          .mask = CPU_MASK_NONE,
           .name = "cascade",
           .dev_id = NULL,
           .next = NULL,
index 55d481569a1f494e1c33a71fe22bbfb8b88f9af4..07547231e078dd3ecd35a988b3cd73bfc30c3683 100644 (file)
@@ -26,7 +26,6 @@ extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
 #define parent_node(node)      (node)
 #define node_to_cpumask(node)  (hub_data(node)->h_cpus)
 #define cpumask_of_node(node)  (&hub_data(node)->h_cpus)
-#define node_to_first_cpu(node)        (cpumask_first(cpumask_of_node(node)))
 struct pci_bus;
 extern int pcibus_to_node(struct pci_bus *);
 
index 03965cb1b2527e23fd60a003284f51279b42a758..d9b6a5b5399d25b3959921288e84b08074571965 100644 (file)
@@ -134,7 +134,6 @@ static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
 static struct irqaction r4030_timer_irqaction = {
        .handler        = r4030_timer_interrupt,
        .flags          = IRQF_DISABLED,
-       .mask           = CPU_MASK_CPU0,
        .name           = "R4030 timer",
 };
 
index b820661678b0b948e7fb56e8332a28277df07a98..a5182a20769619dda6bc81a216f89e2059769052 100644 (file)
@@ -144,7 +144,6 @@ void __cpuinit sb1480_clockevent_init(void)
 
        action->handler = sibyte_counter_handler;
        action->flags   = IRQF_DISABLED | IRQF_PERCPU;
-       action->mask    = cpumask_of_cpu(cpu);
        action->name    = name;
        action->dev_id  = cd;
 
index a2eebaafda52c224ee385193bcb998984d9d790d..340f53e5c6b19cd686f2a45bd69dc3f139d581d1 100644 (file)
@@ -143,7 +143,6 @@ void __cpuinit sb1250_clockevent_init(void)
 
        action->handler = sibyte_counter_handler;
        action->flags   = IRQF_DISABLED | IRQF_PERCPU;
-       action->mask    = cpumask_of_cpu(cpu);
        action->name    = name;
        action->dev_id  = cd;
 
index f4d187825f96406612d16a6016ab8defcf997658..689719e34f085db04c1c09f8d18b89f1b9da91cd 100644 (file)
@@ -98,7 +98,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 static struct irqaction irq0  = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED | IRQF_NOBALANCING,
-       .mask = CPU_MASK_NONE,
        .name = "timer"
 };
 
@@ -121,7 +120,6 @@ void __init setup_pit_timer(void)
        cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
        clockevents_register_device(cd);
 
-       irq0.mask = cpumask_of_cpu(cpu);
        setup_irq(0, &irq0);
 }
 
index 413bd1d37f5499171e4337b78ee62f387152d811..01c0885a8061569dffe59d31e7ec7aee97588773 100644 (file)
@@ -306,7 +306,6 @@ static void init_8259A(int auto_eoi)
  */
 static struct irqaction irq2 = {
        .handler = no_action,
-       .mask = CPU_MASK_NONE,
        .name = "cascade",
 };
 
index d1ac7a25c85613635cdc14dc7858ff44d921e099..1353fb135ed370969d9b2b7628a13cd041470542 100644 (file)
@@ -104,7 +104,6 @@ asmlinkage void plat_irq_dispatch(void)
 
 static struct irqaction cascade = {
        .handler        = no_action,
-       .mask           = CPU_MASK_NONE,
        .name           = "cascade",
 };
 
index 3e0b7beb1009b336c0eee30f2da22428d6196db2..1d0a09f3b832a69d4617f37222209fc1a569cc0b 100644 (file)
@@ -92,7 +92,6 @@ asmlinkage void plat_irq_dispatch(void)
 
 static struct irqaction cascade_irqaction = {
        .handler = no_action,
-       .mask = CPU_MASK_NONE,
        .name = "cascade",
 };
 
index a1f21d9421e86e7002f99946864118de9d5000dc..6c5a630566f93d77997839577fbc5386c5830c97 100644 (file)
@@ -219,7 +219,7 @@ cont_nmi_dump(void)
                if (i == 1000) {
                        for_each_online_node(node)
                                if (NODEPDA(node)->dump_count == 0) {
-                                       cpu = node_to_first_cpu(node);
+                                       cpu = cpumask_first(cpumask_of_node(node));
                                        for (n=0; n < CNODE_NUM_CPUS(node); cpu++, n++) {
                                                CPUMASK_SETB(nmied_cpus, cpu);
                                                /*
index 0aefc5319a036c938d2db3cff9989ac72b12fa3e..83a0b3c359daecee88c87223beef876d9b35aab9 100644 (file)
@@ -115,14 +115,12 @@ extern irqreturn_t crime_cpuerr_intr(int irq, void *dev_id);
 struct irqaction memerr_irq = {
        .handler = crime_memerr_intr,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "CRIME memory error",
 };
 
 struct irqaction cpuerr_irq = {
        .handler = crime_cpuerr_intr,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "CRIME CPU error",
 };
 
index b4352a0c815178f09a90e7561b5fc966fd64eba4..5e687819cbc2aec4aec85dbada30184a345a6551 100644 (file)
@@ -359,7 +359,8 @@ void sni_rm200_init_8259A(void)
  * IRQ2 is cascade interrupt to second interrupt controller
  */
 static struct irqaction sni_rm200_irq2 = {
-       no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL
+       .handler = no_action,
+       .name = "cascade",
 };
 
 static struct resource sni_rm200_pic1_resource = {
index 92dd1a0ca3523023a30d887067c9e280864cfce5..9cc389109b19f42ee82f5d09f69b8d3e8de27024 100644 (file)
@@ -32,7 +32,6 @@ static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned;
 
 static struct irqaction cascade_irqaction = {
        .handler        = no_action,
-       .mask           = CPU_MASK_NONE,
        .name           = "cascade",
 };
 
index e4606586f94ce5e08d35720ca8b4f7512db4aa34..395caf01b9099cc42c2b2e3b0148765df3de0ed9 100644 (file)
@@ -37,7 +37,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id);
 static struct irqaction timer_irq = {
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_SHARED | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
        .name           = "timer",
 };
 
index 375258559ae64fa26e09452c4e80ca978b2a3fe3..054a16d68082a852c460d96436e9f3b7bb3ce41c 100644 (file)
@@ -24,11 +24,6 @@ static inline cpumask_t node_to_cpumask(int node)
 
 #define cpumask_of_node(node) (&numa_cpumask_lookup_table[node])
 
-static inline int node_to_first_cpu(int node)
-{
-       return cpumask_first(cpumask_of_node(node));
-}
-
 int of_node_to_nid(struct device_node *device);
 
 struct pci_bus;
index 149cb112cd1ad398357d33ae766e3add6c6cfc01..13011a96a9779b274e77447dd5b72dae4e56142a 100644 (file)
@@ -669,7 +669,6 @@ static void remove_flash_pde(struct proc_dir_entry *dp)
 {
        if (dp) {
                kfree(dp->data);
-               dp->owner = NULL;
                remove_proc_entry(dp->name, dp->parent);
        }
 }
index 0a9e49104bdc42ccd506946e607dfa3361608768..458d91fba91d5f80ba7296c55752b0960eaca11d 100644 (file)
@@ -179,7 +179,6 @@ static irqreturn_t mpc85xx_8259_cascade_action(int irq, void *dev_id)
 static struct irqaction mpc85xxcds_8259_irqaction = {
        .handler = mpc85xx_8259_cascade_action,
        .flags = IRQF_SHARED,
-       .mask = CPU_MASK_NONE,
        .name = "8259 cascade",
 };
 #endif /* PPC_I8259 */
index 0d9f75c74f8cdf22e83f13ba342c45f5b12a0d66..385acfc48397b8f2d2577326b78b49bb68b100f1 100644 (file)
@@ -44,7 +44,6 @@ static irqreturn_t timebase_interrupt(int irq, void *dev)
 
 static struct irqaction tbint_irqaction = {
        .handler = timebase_interrupt,
-       .mask = CPU_MASK_NONE,
        .name = "tbint",
 };
 
index 272d79a8d2896ade7f8f36e22f2b6279077f6793..cd4ad9aea760d966505a977d9d92e5a7f1f33e38 100644 (file)
@@ -472,7 +472,6 @@ static void __init chrp_find_openpic(void)
 #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON)
 static struct irqaction xmon_irqaction = {
        .handler = xmon_irq,
-       .mask = CPU_MASK_NONE,
        .name = "XMON break",
 };
 #endif
index 6d149ae8ffa71c02928e3bdf52d9b6573e65283b..7039d8f1d3baa1dfdd73e2f9ac80a15fb1c9fb11 100644 (file)
@@ -266,7 +266,6 @@ static unsigned int pmac_pic_get_irq(void)
 static struct irqaction xmon_action = {
        .handler        = xmon_irq,
        .flags          = 0,
-       .mask           = CPU_MASK_NONE,
        .name           = "NMI - XMON"
 };
 #endif
@@ -274,7 +273,6 @@ static struct irqaction xmon_action = {
 static struct irqaction gatwick_cascade_action = {
        .handler        = gatwick_action,
        .flags          = IRQF_DISABLED,
-       .mask           = CPU_MASK_NONE,
        .name           = "cascade",
 };
 
index bd8817b00fa4a80f3d2ab4649e6ef917ec9db8aa..cf1dbe758890df60d441cfbd79421db63e40834f 100644 (file)
@@ -385,7 +385,6 @@ static void __init psurge_dual_sync_tb(int cpu_nr)
 static struct irqaction psurge_irqaction = {
        .handler = psurge_primary_intr,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "primary IPI",
 };
 
index 490473ce81030475fbfa6075a2c76612dcd48b0e..82424cd7e1287bcc009b81f2327b078229a6050f 100644 (file)
@@ -119,7 +119,6 @@ static irqreturn_t cpm_error_interrupt(int irq, void *dev)
 
 static struct irqaction cpm_error_irqaction = {
        .handler = cpm_error_interrupt,
-       .mask = CPU_MASK_NONE,
        .name = "error",
 };
 
index 066f0fba590e228e0467681dd8b1c4c5c22f6e36..a3f239545897ea5ed72b68714bfc1f8d2f9426c1 100644 (file)
@@ -33,7 +33,6 @@
 
 #define node_to_cpumask(node)  ((void)node, cpu_online_map)
 #define cpumask_of_node(node)  ((void)node, cpu_online_mask)
-#define node_to_first_cpu(node)        ((void)(node),0)
 
 #define pcibus_to_node(bus)    ((void)(bus), -1)
 #define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
index 59d2a03e8b3c475763ff1d228e6177454f27fe1d..988c77c3723124507ca8f772c1139cefc0925140 100644 (file)
@@ -284,7 +284,6 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 static struct irqaction irq0  = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED,
-       .mask = CPU_MASK_NONE,
        .name = "timer",
 };
 
index c127293271e1f4072140e334697346bb0ab24779..9aa348658ae33905fe8b821bc3066d5e90a00d79 100644 (file)
@@ -109,7 +109,6 @@ static struct irqaction cmt_irq = {
        .name           = "timer",
        .handler        = cmt_timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-       .mask           = CPU_MASK_NONE,
 };
 
 static void cmt_clk_init(struct clk *clk)
index 9a77ae86b403132a0483c964d2bf83af53794f72..9b0ef01264794f6c2a04054b06a906dcb547c2c0 100644 (file)
@@ -115,7 +115,6 @@ static struct irqaction mtu2_irq = {
        .name           = "timer",
        .handler        = mtu2_timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-       .mask           = CPU_MASK_NONE,
 };
 
 static unsigned int divisors[] = { 1, 4, 16, 64, 1, 1, 256 };
index 10b5a6f17cc0a197341458412ba4d5bc906295ac..c5d3396f596012941853134d726244f504887939 100644 (file)
@@ -162,7 +162,6 @@ static struct irqaction tmu0_irq = {
        .name           = "periodic/oneshot timer",
        .handler        = tmu_timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
-       .mask           = CPU_MASK_NONE,
 };
 
 static void __init tmu_clk_init(struct clk *clk)
index 5693ab4826067056873803b6324b437e6275453f..666a73fef28dad76765a89eab95bb93c3eee232c 100644 (file)
@@ -121,8 +121,8 @@ static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, str
         * local TLB.
         */
        cpu = smp_processor_id();
-       if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) {
-               cpu_set(cpu, mm->cpu_vm_mask);
+       if (!ctx_valid || !cpumask_test_cpu(cpu, mm_cpumask(mm))) {
+               cpumask_set_cpu(cpu, mm_cpumask(mm));
                __flush_tlb_mm(CTX_HWBITS(mm->context),
                               SECONDARY_CONTEXT);
        }
@@ -141,8 +141,8 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm
        if (!CTX_VALID(mm->context))
                get_new_mmu_context(mm);
        cpu = smp_processor_id();
-       if (!cpu_isset(cpu, mm->cpu_vm_mask))
-               cpu_set(cpu, mm->cpu_vm_mask);
+       if (!cpumask_test_cpu(cpu, mm_cpumask(mm)))
+               cpumask_set_cpu(cpu, mm_cpumask(mm));
 
        load_secondary_context(mm);
        __flush_tlb_mm(CTX_HWBITS(mm->context), SECONDARY_CONTEXT);
index 57224dd37b3a59967bdf5ee7e527f551ec700229..becb6bf353a9c36de3b40c3d7dcbc4b80a5e6c47 100644 (file)
@@ -35,7 +35,8 @@ extern cpumask_t cpu_core_map[NR_CPUS];
 extern int sparc64_multi_core;
 
 extern void arch_send_call_function_single_ipi(int cpu);
-extern void arch_send_call_function_ipi(cpumask_t mask);
+extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
+#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
 
 /*
  *     General functions that each host system must provide.
index 79c1ae2b42a346ec11aa284a9719a926212741f3..751c8c17f5a037df797dbb148cf72d39f0521c93 100644 (file)
@@ -126,7 +126,7 @@ extern void flushw_all(void);
 #define switch_to(prev, next, last) do {                                               \
        SWITCH_ENTER(prev);                                                             \
        SWITCH_DO_LAZY_FPU(next);                                                       \
-       cpu_set(smp_processor_id(), next->active_mm->cpu_vm_mask);                      \
+       cpumask_set_cpu(smp_processor_id(), mm_cpumask(next->active_mm));               \
        __asm__ __volatile__(                                                           \
        "sethi  %%hi(here - 0x8), %%o7\n\t"                                             \
        "mov    %%g6, %%g3\n\t"                                                         \
index 5bc0b8fd63744f477f7ade478e42922175649c28..e5ea8d332421d1ad1441541c8e013d62d099e444 100644 (file)
@@ -28,11 +28,6 @@ static inline cpumask_t node_to_cpumask(int node)
 #define node_to_cpumask_ptr_next(v, node)      \
                           v = &(numa_cpumask_lookup_table[node])
 
-static inline int node_to_first_cpu(int node)
-{
-       return cpumask_first(cpumask_of_node(node));
-}
-
 struct pci_bus;
 #ifdef CONFIG_PCI
 extern int pcibus_to_node(struct pci_bus *pbus);
@@ -43,13 +38,9 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 }
 #endif
 
-#define pcibus_to_cpumask(bus) \
-       (pcibus_to_node(bus) == -1 ? \
-        CPU_MASK_ALL : \
-        node_to_cpumask(pcibus_to_node(bus)))
 #define cpumask_of_pcibus(bus) \
        (pcibus_to_node(bus) == -1 ? \
-        CPU_MASK_ALL_PTR : \
+        cpu_all_mask : \
         cpumask_of_node(pcibus_to_node(bus)))
 
 #define SD_NODE_INIT (struct sched_domain) {           \
@@ -89,7 +80,6 @@ static inline int pcibus_to_node(struct pci_bus *pbus)
 #define smt_capable()                          (sparc64_multi_core)
 #endif /* CONFIG_SMP */
 
-#define cpu_coregroup_map(cpu)                 (cpu_core_map[cpu])
 #define cpu_coregroup_mask(cpu)                        (&cpu_core_map[cpu])
 
 #endif /* _ASM_SPARC64_TOPOLOGY_H */
index 57c39843fb2a446c68849e5326496d4e5756cd0d..90350f838f05efa92a9739d4e4a03079f5f0ae55 100644 (file)
@@ -653,7 +653,7 @@ static void __cpuinit dr_cpu_data(struct ds_info *dp,
                if (cpu_list[i] == CPU_SENTINEL)
                        continue;
 
-               if (cpu_list[i] < NR_CPUS)
+               if (cpu_list[i] < nr_cpu_ids)
                        cpu_set(cpu_list[i], mask);
        }
 
index 44dd5ee64339219257a2457d85afd364f2526f58..ad800b80c718285e046d47d8c652c54aa22049da 100644 (file)
@@ -439,7 +439,6 @@ static int request_fast_irq(unsigned int irq,
        flush_cache_all();
 
        action->flags = irqflags;
-       cpus_clear(action->mask);
        action->name = devname;
        action->dev_id = NULL;
        action->next = NULL;
@@ -574,7 +573,6 @@ int request_irq(unsigned int irq,
 
        action->handler = handler;
        action->flags = irqflags;
-       cpus_clear(action->mask);
        action->name = devname;
        action->next = NULL;
        action->dev_id = dev_id;
index d0d6a515499ac952f487a49e389b2bdd5519bd02..5deabe921a47b6ebdcd5f6371faf7eaab3c135e4 100644 (file)
@@ -266,12 +266,12 @@ static int irq_choose_cpu(unsigned int virt_irq)
                spin_lock_irqsave(&irq_rover_lock, flags);
 
                while (!cpu_online(irq_rover)) {
-                       if (++irq_rover >= NR_CPUS)
+                       if (++irq_rover >= nr_cpu_ids)
                                irq_rover = 0;
                }
                cpuid = irq_rover;
                do {
-                       if (++irq_rover >= NR_CPUS)
+                       if (++irq_rover >= nr_cpu_ids)
                                irq_rover = 0;
                } while (!cpu_online(irq_rover));
 
index adaaed4ea2fb6821ca2a85c7afe61d2a07208f1d..00d034ea2164d63148d7b0ff04538420b163c513 100644 (file)
@@ -126,7 +126,6 @@ static int __init led_init(void)
        led = proc_create("led", 0, NULL, &led_proc_fops);
        if (!led)
                return -ENOMEM;
-       led->owner = THIS_MODULE;
 
        printk(KERN_INFO
               "led: version %s, Lars Kotthoff <metalhead@metalhead.ws>\n",
index 3f79f0c23a084d4a80ae572be79db9e0f747d66c..f0e6ed23a468ec10c6b7ba78ad8d5890295f7f82 100644 (file)
@@ -567,7 +567,7 @@ static void __init report_platform_properties(void)
                        max_cpu = NR_CPUS;
                }
                for (i = 0; i < max_cpu; i++)
-                       cpu_set(i, cpu_possible_map);
+                       set_cpu_possible(i, true);
        }
 #endif
 
index f3577223c8630e2d40002c72026755c72bb3bcfe..2c0cc72d295b079cfab695197eff38fcbd54d586 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/kprobes.h>
 #include <linux/kernel_stat.h>
+#include <linux/reboot.h>
 #include <linux/slab.h>
 #include <linux/kdebug.h>
 #include <linux/delay.h>
@@ -206,13 +207,33 @@ void nmi_adjust_hz(unsigned int new_hz)
 }
 EXPORT_SYMBOL_GPL(nmi_adjust_hz);
 
+static int nmi_shutdown(struct notifier_block *nb, unsigned long cmd, void *p)
+{
+       on_each_cpu(stop_watchdog, NULL, 1);
+       return 0;
+}
+
+static struct notifier_block nmi_reboot_notifier = {
+       .notifier_call = nmi_shutdown,
+};
+
 int __init nmi_init(void)
 {
+       int err;
+
        nmi_usable = 1;
 
        on_each_cpu(start_watchdog, NULL, 1);
 
-       return check_nmi_watchdog();
+       err = check_nmi_watchdog();
+       if (!err) {
+               err = register_reboot_notifier(&nmi_reboot_notifier);
+               if (err) {
+                       nmi_usable = 0;
+                       on_each_cpu(stop_watchdog, NULL, 1);
+               }
+       }
+       return err;
 }
 
 static int __init setup_nmi_watchdog(char *str)
index edecca7b811655546a7aba9d108414ae36c31703..ca55c7012f7751d4338a1c6fc1153124ef0f6966 100644 (file)
@@ -518,8 +518,8 @@ void __init of_fill_in_cpu_data(void)
                }
 
 #ifdef CONFIG_SMP
-               cpu_set(cpuid, cpu_present_map);
-               cpu_set(cpuid, cpu_possible_map);
+               set_cpu_present(cpuid, true);
+               set_cpu_possible(cpuid, true);
 #endif
        }
 
index 1e5ac4e282e1285030aaa43380b91c01b7bcff48..132d81fb26162657b0391a11e56e23fce9bf604d 100644 (file)
@@ -70,13 +70,12 @@ void __init smp_cpus_done(unsigned int max_cpus)
        extern void smp4m_smp_done(void);
        extern void smp4d_smp_done(void);
        unsigned long bogosum = 0;
-       int cpu, num;
+       int cpu, num = 0;
 
-       for (cpu = 0, num = 0; cpu < NR_CPUS; cpu++)
-               if (cpu_online(cpu)) {
-                       num++;
-                       bogosum += cpu_data(cpu).udelay_val;
-               }
+       for_each_online_cpu(cpu) {
+               num++;
+               bogosum += cpu_data(cpu).udelay_val;
+       }
 
        printk("Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
                num, bogosum/(500000/HZ),
@@ -144,7 +143,7 @@ void smp_flush_tlb_all(void)
 void smp_flush_cache_mm(struct mm_struct *mm)
 {
        if(mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask))
                        xc1((smpfunc_t) BTFIXUP_CALL(local_flush_cache_mm), (unsigned long) mm);
@@ -155,12 +154,13 @@ void smp_flush_cache_mm(struct mm_struct *mm)
 void smp_flush_tlb_mm(struct mm_struct *mm)
 {
        if(mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask)) {
                        xc1((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_mm), (unsigned long) mm);
                        if(atomic_read(&mm->mm_users) == 1 && current->active_mm == mm)
-                               mm->cpu_vm_mask = cpumask_of_cpu(smp_processor_id());
+                               cpumask_copy(mm_cpumask(mm),
+                                            cpumask_of(smp_processor_id()));
                }
                local_flush_tlb_mm(mm);
        }
@@ -172,7 +172,7 @@ void smp_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
        struct mm_struct *mm = vma->vm_mm;
 
        if (mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask))
                        xc3((smpfunc_t) BTFIXUP_CALL(local_flush_cache_range), (unsigned long) vma, start, end);
@@ -186,7 +186,7 @@ void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
        struct mm_struct *mm = vma->vm_mm;
 
        if (mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask))
                        xc3((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_range), (unsigned long) vma, start, end);
@@ -199,7 +199,7 @@ void smp_flush_cache_page(struct vm_area_struct *vma, unsigned long page)
        struct mm_struct *mm = vma->vm_mm;
 
        if(mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask))
                        xc2((smpfunc_t) BTFIXUP_CALL(local_flush_cache_page), (unsigned long) vma, page);
@@ -212,7 +212,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
        struct mm_struct *mm = vma->vm_mm;
 
        if(mm->context != NO_CONTEXT) {
-               cpumask_t cpu_mask = mm->cpu_vm_mask;
+               cpumask_t cpu_mask = *mm_cpumask(mm);
                cpu_clear(smp_processor_id(), cpu_mask);
                if (!cpus_empty(cpu_mask))
                        xc2((smpfunc_t) BTFIXUP_CALL(local_flush_tlb_page), (unsigned long) vma, page);
@@ -241,7 +241,7 @@ void smp_flush_page_to_ram(unsigned long page)
 
 void smp_flush_sig_insns(struct mm_struct *mm, unsigned long insn_addr)
 {
-       cpumask_t cpu_mask = mm->cpu_vm_mask;
+       cpumask_t cpu_mask = *mm_cpumask(mm);
        cpu_clear(smp_processor_id(), cpu_mask);
        if (!cpus_empty(cpu_mask))
                xc2((smpfunc_t) BTFIXUP_CALL(local_flush_sig_insns), (unsigned long) mm, insn_addr);
@@ -332,8 +332,8 @@ void __init smp_setup_cpu_possible_map(void)
        instance = 0;
        while (!cpu_find_by_instance(instance, NULL, &mid)) {
                if (mid < NR_CPUS) {
-                       cpu_set(mid, cpu_possible_map);
-                       cpu_set(mid, cpu_present_map);
+                       set_cpu_possible(mid, true);
+                       set_cpu_present(mid, true);
                }
                instance++;
        }
@@ -351,8 +351,8 @@ void __init smp_prepare_boot_cpu(void)
                printk("boot cpu id != 0, this could work but is untested\n");
 
        current_thread_info()->cpu = cpuid;
-       cpu_set(cpuid, cpu_online_map);
-       cpu_set(cpuid, cpu_possible_map);
+       set_cpu_online(cpuid, true);
+       set_cpu_possible(cpuid, true);
 }
 
 int __cpuinit __cpu_up(unsigned int cpu)
index 79457f682b5ac05b693d185223ddd7ea8f9335b6..708e12a26b0528919065429d66c1bdf32ab4a5aa 100644 (file)
@@ -808,9 +808,9 @@ static void smp_start_sync_tick_client(int cpu)
 
 extern unsigned long xcall_call_function;
 
-void arch_send_call_function_ipi(cpumask_t mask)
+void arch_send_call_function_ipi_mask(const struct cpumask *mask)
 {
-       xcall_deliver((u64) &xcall_call_function, 0, 0, &mask);
+       xcall_deliver((u64) &xcall_call_function, 0, 0, mask);
 }
 
 extern unsigned long xcall_call_function_single;
@@ -850,7 +850,7 @@ static void tsb_sync(void *info)
 
 void smp_tsb_sync(struct mm_struct *mm)
 {
-       smp_call_function_mask(mm->cpu_vm_mask, tsb_sync, mm, 1);
+       smp_call_function_many(mm_cpumask(mm), tsb_sync, mm, 1);
 }
 
 extern unsigned long xcall_flush_tlb_mm;
@@ -1055,13 +1055,13 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
        int cpu = get_cpu();
 
        if (atomic_read(&mm->mm_users) == 1) {
-               mm->cpu_vm_mask = cpumask_of_cpu(cpu);
+               cpumask_copy(mm_cpumask(mm), cpumask_of(cpu));
                goto local_flush_and_out;
        }
 
        smp_cross_call_masked(&xcall_flush_tlb_mm,
                              ctx, 0, 0,
-                             &mm->cpu_vm_mask);
+                             mm_cpumask(mm));
 
 local_flush_and_out:
        __flush_tlb_mm(ctx, SECONDARY_CONTEXT);
@@ -1075,11 +1075,11 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long
        int cpu = get_cpu();
 
        if (mm == current->mm && atomic_read(&mm->mm_users) == 1)
-               mm->cpu_vm_mask = cpumask_of_cpu(cpu);
+               cpumask_copy(mm_cpumask(mm), cpumask_of(cpu));
        else
                smp_cross_call_masked(&xcall_flush_tlb_pending,
                                      ctx, nr, (unsigned long) vaddrs,
-                                     &mm->cpu_vm_mask);
+                                     mm_cpumask(mm));
 
        __flush_tlb_pending(ctx, nr, vaddrs);
 
index 3369fef5b4b3acd2749ddcbefd1befd37df2e15b..ab036a72de5a16460cdb8b548dbcf15bb2e04db6 100644 (file)
@@ -326,7 +326,6 @@ int sun4d_request_irq(unsigned int irq,
 
        action->handler = handler;
        action->flags = irqflags;
-       cpus_clear(action->mask);
        action->name = devname;
        action->next = NULL;
        action->dev_id = dev_id;
index 50afaed99c8a13d74b4e873eca58c5528563ba48..54fb02468f0d57ef00ce78c610609ba43d0c1702 100644 (file)
@@ -150,7 +150,7 @@ void __cpuinit smp4d_callin(void)
        spin_lock_irqsave(&sun4d_imsk_lock, flags);
        cc_set_imsk(cc_get_imsk() & ~0x4000); /* Allow PIL 14 as well */
        spin_unlock_irqrestore(&sun4d_imsk_lock, flags);
-       cpu_set(cpuid, cpu_online_map);
+       set_cpu_online(cpuid, true);
 
 }
 
@@ -228,11 +228,10 @@ void __init smp4d_smp_done(void)
        /* setup cpu list for irq rotation */
        first = 0;
        prev = &first;
-       for (i = 0; i < NR_CPUS; i++)
-               if (cpu_online(i)) {
-                       *prev = i;
-                       prev = &cpu_data(i).next;
-               }
+       for_each_online_cpu(i) {
+               *prev = i;
+               prev = &cpu_data(i).next;
+       }
        *prev = first;
        local_flush_cache_all();
 
index 8040376c4890cc11c95e7c783f331abc7becb456..960b113d0006f4ff61de665c2383dd4b522a4622 100644 (file)
@@ -113,7 +113,7 @@ void __cpuinit smp4m_callin(void)
 
        local_irq_enable();
 
-       cpu_set(cpuid, cpu_online_map);
+       set_cpu_online(cpuid, true);
 }
 
 /*
@@ -186,11 +186,9 @@ void __init smp4m_smp_done(void)
        /* setup cpu list for irq rotation */
        first = 0;
        prev = &first;
-       for (i = 0; i < NR_CPUS; i++) {
-               if (cpu_online(i)) {
-                       *prev = i;
-                       prev = &cpu_data(i).next;
-               }
+       for_each_online_cpu(i) {
+               *prev = i;
+               prev = &cpu_data(i).next;
        }
        *prev = first;
        local_flush_cache_all();
index 00373ce2d8fbd872f838ece2de6cd49afd6e45a7..2c8dfeb7ab04b24634bba62532f6ac62a510059b 100644 (file)
@@ -1092,7 +1092,7 @@ static void __init numa_parse_mdesc_group_cpus(struct mdesc_handle *md,
                if (strcmp(name, "cpu"))
                        continue;
                id = mdesc_get_property(md, target, "id", NULL);
-               if (*id < NR_CPUS)
+               if (*id < nr_cpu_ids)
                        cpu_set(*id, *mask);
        }
 }
index fe7ed08390bb720e1c4be141aa5a072f58b843ec..06c9a7d98206f0256c23a281381bf2d6ab7ca441 100644 (file)
@@ -1425,7 +1425,7 @@ static void __init init_vac_layout(void)
                                min_line_size = vac_line_size;
                        //FIXME: cpus not contiguous!!
                        cpu++;
-                       if (cpu >= NR_CPUS || !cpu_online(cpu))
+                       if (cpu >= nr_cpu_ids || !cpu_online(cpu))
                                break;
 #else
                        break;
index 43894428c3c2a7d871bd5d49bcc0b2e136405e13..0f4ee7148afe2e0b7648ab8f89a544508bdf3309 100644 (file)
 
 #ifndef __ASSEMBLY__
 #include <asm/hw_irq.h>
+#include <asm/kvm_para.h>
 
 /*G:031 But first, how does our Guest contact the Host to ask for privileged
  * operations?  There are two ways: the direct way is to make a "hypercall",
  * to make requests of the Host Itself.
  *
- * Our hypercall mechanism uses the highest unused trap code (traps 32 and
- * above are used by real hardware interrupts).  Fifteen hypercalls are
+ * We use the KVM hypercall mechanism. Eighteen hypercalls are
  * available: the hypercall number is put in the %eax register, and the
- * arguments (when required) are placed in %edx, %ebx and %ecx.  If a return
+ * arguments (when required) are placed in %ebx, %ecx and %edx.  If a return
  * value makes sense, it's returned in %eax.
  *
  * Grossly invalid calls result in Sudden Death at the hands of the vengeful
  * Host, rather than returning failure.  This reflects Winston Churchill's
  * definition of a gentleman: "someone who is only rude intentionally". */
-static inline unsigned long
-hcall(unsigned long call,
-      unsigned long arg1, unsigned long arg2, unsigned long arg3)
-{
-       /* "int" is the Intel instruction to trigger a trap. */
-       asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
-                    /* The call in %eax (aka "a") might be overwritten */
-                    : "=a"(call)
-                      /* The arguments are in %eax, %edx, %ebx & %ecx */
-                    : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
-                      /* "memory" means this might write somewhere in memory.
-                       * This isn't true for all calls, but it's safe to tell
-                       * gcc that it might happen so it doesn't get clever. */
-                    : "memory");
-       return call;
-}
 /*:*/
 
 /* Can't use our min() macro here: needs to be a constant */
@@ -64,7 +48,7 @@ hcall(unsigned long call,
 #define LHCALL_RING_SIZE 64
 struct hcall_args {
        /* These map directly onto eax, ebx, ecx, edx in struct lguest_regs */
-       unsigned long arg0, arg2, arg3, arg1;
+       unsigned long arg0, arg1, arg2, arg3;
 };
 
 #endif /* !__ASSEMBLY__ */
index e3f4198371a9a46e4556241d2cb95d5cad78263d..892b119dba6ff8c64c99c8c3432e812de860ef98 100644 (file)
@@ -176,10 +176,6 @@ static inline const struct cpumask *cpumask_of_node(int node)
 {
        return cpu_online_mask;
 }
-static inline int node_to_first_cpu(int node)
-{
-       return cpumask_first(cpu_online_mask);
-}
 
 static inline void setup_node_to_cpumask_map(void) { }
 
@@ -187,14 +183,6 @@ static inline void setup_node_to_cpumask_map(void) { }
 
 #include <asm-generic/topology.h>
 
-#ifdef CONFIG_NUMA
-/* Returns the number of the first CPU on Node 'node'. */
-static inline int node_to_first_cpu(int node)
-{
-       return cpumask_first(cpumask_of_node(node));
-}
-#endif
-
 extern const struct cpumask *cpu_coregroup_mask(int cpu);
 
 #ifdef ENABLE_TOPO_DEFINES
index c1941be9fb1777e57cb09190023422e8d17af2e8..49e0939bac4211ba35f32240af5e92ed905ec578 100644 (file)
@@ -1234,8 +1234,10 @@ static int suspend(int vetoable)
        struct apm_user *as;
 
        device_suspend(PMSG_SUSPEND);
-       local_irq_disable();
+
        device_power_down(PMSG_SUSPEND);
+
+       local_irq_disable();
        sysdev_suspend(PMSG_SUSPEND);
 
        local_irq_enable();
@@ -1253,9 +1255,12 @@ static int suspend(int vetoable)
        if (err != APM_SUCCESS)
                apm_error("suspend", err);
        err = (err == APM_SUCCESS) ? 0 : -EIO;
+
        sysdev_resume();
-       device_power_up(PMSG_RESUME);
        local_irq_enable();
+
+       device_power_up(PMSG_RESUME);
+
        device_resume(PMSG_RESUME);
        queue_event(APM_NORMAL_RESUME, NULL);
        spin_lock(&user_list_lock);
@@ -1272,8 +1277,9 @@ static void standby(void)
 {
        int err;
 
-       local_irq_disable();
        device_power_down(PMSG_SUSPEND);
+
+       local_irq_disable();
        sysdev_suspend(PMSG_SUSPEND);
        local_irq_enable();
 
@@ -1283,8 +1289,9 @@ static void standby(void)
 
        local_irq_disable();
        sysdev_resume();
-       device_power_up(PMSG_RESUME);
        local_irq_enable();
+
+       device_power_up(PMSG_RESUME);
 }
 
 static apm_event_t get_event(void)
index 4c4214690dd10a4c32fc787e03bce6e7cba315d9..fb73a52913a4f883ca42010de302e3e909189fe7 100644 (file)
@@ -377,10 +377,6 @@ static const struct file_operations mtrr_fops = {
        .release = mtrr_close,
 };
 
-
-static struct proc_dir_entry *proc_root_mtrr;
-
-
 static int mtrr_seq_show(struct seq_file *seq, void *offset)
 {
        char factor;
@@ -423,11 +419,7 @@ static int __init mtrr_if_init(void)
            (!cpu_has(c, X86_FEATURE_CENTAUR_MCR)))
                return -ENODEV;
 
-       proc_root_mtrr =
-               proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
-
-       if (proc_root_mtrr)
-               proc_root_mtrr->owner = THIS_MODULE;
+       proc_create("mtrr", S_IWUSR | S_IRUGO, NULL, &mtrr_fops);
        return 0;
 }
 
index bc132610544829de0f38a12dd8461d73104b39a2..368b0a8836f902be69531754a72fb75e7b9a4e24 100644 (file)
@@ -50,7 +50,6 @@ static irqreturn_t math_error_irq(int cpl, void *dev_id)
  */
 static struct irqaction fpu_irq = {
        .handler = math_error_irq,
-       .mask = CPU_MASK_NONE,
        .name = "fpu",
 };
 
@@ -83,7 +82,6 @@ void __init init_ISA_irqs(void)
  */
 static struct irqaction irq2 = {
        .handler = no_action,
-       .mask = CPU_MASK_NONE,
        .name = "cascade",
 };
 
index c7a49e0ffbfbc0b4b2b0cd12b01d5294ca73745c..8cd10537fd46f7480b6db9807db276ada5b390af 100644 (file)
@@ -45,7 +45,6 @@
 
 static struct irqaction irq2 = {
        .handler = no_action,
-       .mask = CPU_MASK_NONE,
        .name = "cascade",
 };
 DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
index 8815f3c7fec75e5d4a4d1cb17609ef0eed004515..846510b78a092324bfa7adc61ee72ee25e8792cc 100644 (file)
@@ -348,7 +348,6 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
 static struct irqaction mfgptirq  = {
        .handler = mfgpt_tick,
        .flags = IRQF_DISABLED | IRQF_NOBALANCING,
-       .mask = CPU_MASK_NONE,
        .name = "mfgpt-timer"
 };
 
index a0d26237d7cf141462a2d20941f8bd99d4195e57..b4158439bf634d254852cceab2c30d26f943f7ea 100644 (file)
@@ -1049,7 +1049,6 @@ void __init x86_quirk_trap_init(void)
 static struct irqaction irq0  = {
        .handler = timer_interrupt,
        .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
-       .mask = CPU_MASK_NONE,
        .name = "timer"
 };
 
index 241ec3923f611bf03cb266362409924daabf1f6f..5ba343e6184449775c51f21717ef985f8d7249d0 100644 (file)
@@ -116,7 +116,6 @@ unsigned long __init calibrate_cpu(void)
 static struct irqaction irq0 = {
        .handler        = timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER,
-       .mask           = CPU_MASK_NONE,
        .name           = "timer"
 };
 
@@ -125,7 +124,6 @@ void __init hpet_time_init(void)
        if (!hpet_enable())
                setup_pit_timer();
 
-       irq0.mask = cpumask_of_cpu(0);
        setup_irq(0, &irq0);
 }
 
index 33a788d5879c3186182201736330723fa3669164..d303369a7baddc48966443fff136f2266f010810 100644 (file)
@@ -202,7 +202,6 @@ static struct irqaction vmi_clock_action  = {
        .name           = "vmi-timer",
        .handler        = vmi_timer_interrupt,
        .flags          = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
-       .mask           = CPU_MASK_ALL,
 };
 
 static void __devinit vmi_time_init_clockevent(void)
index 90e44a10e68a6b5eb252655490be4b1e6c6d4941..e94a11e42f9864a35e197d9fdf7919accc8ba095 100644 (file)
@@ -107,7 +107,7 @@ static void async_hcall(unsigned long call, unsigned long arg1,
        local_irq_save(flags);
        if (lguest_data.hcall_status[next_call] != 0xFF) {
                /* Table full, so do normal hcall which will flush table. */
-               hcall(call, arg1, arg2, arg3);
+               kvm_hypercall3(call, arg1, arg2, arg3);
        } else {
                lguest_data.hcalls[next_call].arg0 = call;
                lguest_data.hcalls[next_call].arg1 = arg1;
@@ -134,13 +134,32 @@ static void async_hcall(unsigned long call, unsigned long arg1,
  *
  * So, when we're in lazy mode, we call async_hcall() to store the call for
  * future processing: */
-static void lazy_hcall(unsigned long call,
+static void lazy_hcall1(unsigned long call,
+                      unsigned long arg1)
+{
+       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
+               kvm_hypercall1(call, arg1);
+       else
+               async_hcall(call, arg1, 0, 0);
+}
+
+static void lazy_hcall2(unsigned long call,
+                      unsigned long arg1,
+                      unsigned long arg2)
+{
+       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
+               kvm_hypercall2(call, arg1, arg2);
+       else
+               async_hcall(call, arg1, arg2, 0);
+}
+
+static void lazy_hcall3(unsigned long call,
                       unsigned long arg1,
                       unsigned long arg2,
                       unsigned long arg3)
 {
        if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_NONE)
-               hcall(call, arg1, arg2, arg3);
+               kvm_hypercall3(call, arg1, arg2, arg3);
        else
                async_hcall(call, arg1, arg2, arg3);
 }
@@ -150,7 +169,7 @@ static void lazy_hcall(unsigned long call,
 static void lguest_leave_lazy_mode(void)
 {
        paravirt_leave_lazy(paravirt_get_lazy_mode());
-       hcall(LHCALL_FLUSH_ASYNC, 0, 0, 0);
+       kvm_hypercall0(LHCALL_FLUSH_ASYNC);
 }
 
 /*G:033
@@ -229,7 +248,7 @@ static void lguest_write_idt_entry(gate_desc *dt,
        /* Keep the local copy up to date. */
        native_write_idt_entry(dt, entrynum, g);
        /* Tell Host about this new entry. */
-       hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]);
+       kvm_hypercall3(LHCALL_LOAD_IDT_ENTRY, entrynum, desc[0], desc[1]);
 }
 
 /* Changing to a different IDT is very rare: we keep the IDT up-to-date every
@@ -241,7 +260,7 @@ static void lguest_load_idt(const struct desc_ptr *desc)
        struct desc_struct *idt = (void *)desc->address;
 
        for (i = 0; i < (desc->size+1)/8; i++)
-               hcall(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b);
+               kvm_hypercall3(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b);
 }
 
 /*
@@ -261,8 +280,8 @@ static void lguest_load_idt(const struct desc_ptr *desc)
  */
 static void lguest_load_gdt(const struct desc_ptr *desc)
 {
-       BUG_ON((desc->size+1)/8 != GDT_ENTRIES);
-       hcall(LHCALL_LOAD_GDT, __pa(desc->address), GDT_ENTRIES, 0);
+       BUG_ON((desc->size + 1) / 8 != GDT_ENTRIES);
+       kvm_hypercall2(LHCALL_LOAD_GDT, __pa(desc->address), GDT_ENTRIES);
 }
 
 /* For a single GDT entry which changes, we do the lazy thing: alter our GDT,
@@ -272,7 +291,7 @@ static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum,
                                   const void *desc, int type)
 {
        native_write_gdt_entry(dt, entrynum, desc, type);
-       hcall(LHCALL_LOAD_GDT, __pa(dt), GDT_ENTRIES, 0);
+       kvm_hypercall2(LHCALL_LOAD_GDT, __pa(dt), GDT_ENTRIES);
 }
 
 /* OK, I lied.  There are three "thread local storage" GDT entries which change
@@ -284,7 +303,7 @@ static void lguest_load_tls(struct thread_struct *t, unsigned int cpu)
         * can't handle us removing entries we're currently using.  So we clear
         * the GS register here: if it's needed it'll be reloaded anyway. */
        lazy_load_gs(0);
-       lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0);
+       lazy_hcall2(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu);
 }
 
 /*G:038 That's enough excitement for now, back to ploughing through each of
@@ -382,7 +401,7 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx,
 static unsigned long current_cr0;
 static void lguest_write_cr0(unsigned long val)
 {
-       lazy_hcall(LHCALL_TS, val & X86_CR0_TS, 0, 0);
+       lazy_hcall1(LHCALL_TS, val & X86_CR0_TS);
        current_cr0 = val;
 }
 
@@ -396,7 +415,7 @@ static unsigned long lguest_read_cr0(void)
  * the vowels have been optimized out. */
 static void lguest_clts(void)
 {
-       lazy_hcall(LHCALL_TS, 0, 0, 0);
+       lazy_hcall1(LHCALL_TS, 0);
        current_cr0 &= ~X86_CR0_TS;
 }
 
@@ -418,7 +437,7 @@ static bool cr3_changed = false;
 static void lguest_write_cr3(unsigned long cr3)
 {
        lguest_data.pgdir = cr3;
-       lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0);
+       lazy_hcall1(LHCALL_NEW_PGTABLE, cr3);
        cr3_changed = true;
 }
 
@@ -490,11 +509,17 @@ static void lguest_write_cr4(unsigned long val)
  * into a process' address space.  We set the entry then tell the Host the
  * toplevel and address this corresponds to.  The Guest uses one pagetable per
  * process, so we need to tell the Host which one we're changing (mm->pgd). */
+static void lguest_pte_update(struct mm_struct *mm, unsigned long addr,
+                              pte_t *ptep)
+{
+       lazy_hcall3(LHCALL_SET_PTE, __pa(mm->pgd), addr, ptep->pte_low);
+}
+
 static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr,
                              pte_t *ptep, pte_t pteval)
 {
        *ptep = pteval;
-       lazy_hcall(LHCALL_SET_PTE, __pa(mm->pgd), addr, pteval.pte_low);
+       lguest_pte_update(mm, addr, ptep);
 }
 
 /* The Guest calls this to set a top-level entry.  Again, we set the entry then
@@ -503,8 +528,8 @@ static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr,
 static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
 {
        *pmdp = pmdval;
-       lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK,
-                  (__pa(pmdp)&(PAGE_SIZE-1))/4, 0);
+       lazy_hcall2(LHCALL_SET_PMD, __pa(pmdp) & PAGE_MASK,
+                  (__pa(pmdp) & (PAGE_SIZE - 1)) / 4);
 }
 
 /* There are a couple of legacy places where the kernel sets a PTE, but we
@@ -520,7 +545,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval)
 {
        *ptep = pteval;
        if (cr3_changed)
-               lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
+               lazy_hcall1(LHCALL_FLUSH_TLB, 1);
 }
 
 /* Unfortunately for Lguest, the pv_mmu_ops for page tables were based on
@@ -536,7 +561,7 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval)
 static void lguest_flush_tlb_single(unsigned long addr)
 {
        /* Simply set it to zero: if it was not, it will fault back in. */
-       lazy_hcall(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0);
+       lazy_hcall3(LHCALL_SET_PTE, lguest_data.pgdir, addr, 0);
 }
 
 /* This is what happens after the Guest has removed a large number of entries.
@@ -544,7 +569,7 @@ static void lguest_flush_tlb_single(unsigned long addr)
  * have changed, ie. virtual addresses below PAGE_OFFSET. */
 static void lguest_flush_tlb_user(void)
 {
-       lazy_hcall(LHCALL_FLUSH_TLB, 0, 0, 0);
+       lazy_hcall1(LHCALL_FLUSH_TLB, 0);
 }
 
 /* This is called when the kernel page tables have changed.  That's not very
@@ -552,7 +577,7 @@ static void lguest_flush_tlb_user(void)
  * slow), so it's worth separating this from the user flushing above. */
 static void lguest_flush_tlb_kernel(void)
 {
-       lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
+       lazy_hcall1(LHCALL_FLUSH_TLB, 1);
 }
 
 /*
@@ -689,7 +714,7 @@ static int lguest_clockevent_set_next_event(unsigned long delta,
        }
 
        /* Please wake us this far in the future. */
-       hcall(LHCALL_SET_CLOCKEVENT, delta, 0, 0);
+       kvm_hypercall1(LHCALL_SET_CLOCKEVENT, delta);
        return 0;
 }
 
@@ -700,7 +725,7 @@ static void lguest_clockevent_set_mode(enum clock_event_mode mode,
        case CLOCK_EVT_MODE_UNUSED:
        case CLOCK_EVT_MODE_SHUTDOWN:
                /* A 0 argument shuts the clock down. */
-               hcall(LHCALL_SET_CLOCKEVENT, 0, 0, 0);
+               kvm_hypercall0(LHCALL_SET_CLOCKEVENT);
                break;
        case CLOCK_EVT_MODE_ONESHOT:
                /* This is what we expect. */
@@ -775,8 +800,8 @@ static void lguest_time_init(void)
 static void lguest_load_sp0(struct tss_struct *tss,
                            struct thread_struct *thread)
 {
-       lazy_hcall(LHCALL_SET_STACK, __KERNEL_DS|0x1, thread->sp0,
-                  THREAD_SIZE/PAGE_SIZE);
+       lazy_hcall3(LHCALL_SET_STACK, __KERNEL_DS | 0x1, thread->sp0,
+                  THREAD_SIZE / PAGE_SIZE);
 }
 
 /* Let's just say, I wouldn't do debugging under a Guest. */
@@ -849,7 +874,7 @@ static void set_lguest_basic_apic_ops(void)
 /* STOP!  Until an interrupt comes in. */
 static void lguest_safe_halt(void)
 {
-       hcall(LHCALL_HALT, 0, 0, 0);
+       kvm_hypercall0(LHCALL_HALT);
 }
 
 /* The SHUTDOWN hypercall takes a string to describe what's happening, and
@@ -859,7 +884,8 @@ static void lguest_safe_halt(void)
  * rather than virtual addresses, so we use __pa() here. */
 static void lguest_power_off(void)
 {
-       hcall(LHCALL_SHUTDOWN, __pa("Power down"), LGUEST_SHUTDOWN_POWEROFF, 0);
+       kvm_hypercall2(LHCALL_SHUTDOWN, __pa("Power down"),
+                                       LGUEST_SHUTDOWN_POWEROFF);
 }
 
 /*
@@ -869,7 +895,7 @@ static void lguest_power_off(void)
  */
 static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p)
 {
-       hcall(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF, 0);
+       kvm_hypercall2(LHCALL_SHUTDOWN, __pa(p), LGUEST_SHUTDOWN_POWEROFF);
        /* The hcall won't return, but to keep gcc happy, we're "done". */
        return NOTIFY_DONE;
 }
@@ -910,7 +936,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
                len = sizeof(scratch) - 1;
        scratch[len] = '\0';
        memcpy(scratch, buf, len);
-       hcall(LHCALL_NOTIFY, __pa(scratch), 0, 0);
+       kvm_hypercall1(LHCALL_NOTIFY, __pa(scratch));
 
        /* This routine returns the number of bytes actually written. */
        return len;
@@ -920,7 +946,7 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
  * Launcher to reboot us. */
 static void lguest_restart(char *reason)
 {
-       hcall(LHCALL_SHUTDOWN, __pa(reason), LGUEST_SHUTDOWN_RESTART, 0);
+       kvm_hypercall2(LHCALL_SHUTDOWN, __pa(reason), LGUEST_SHUTDOWN_RESTART);
 }
 
 /*G:050
@@ -1040,6 +1066,8 @@ __init void lguest_init(void)
        pv_mmu_ops.read_cr3 = lguest_read_cr3;
        pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu;
        pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mode;
+       pv_mmu_ops.pte_update = lguest_pte_update;
+       pv_mmu_ops.pte_update_defer = lguest_pte_update;
 
 #ifdef CONFIG_X86_LOCAL_APIC
        /* apic read/write intercepts */
index 10b9bd35a8ff9fbfb233883f23b970264eeb34d9..f795419894718796d48050f80a6b279a6a875dff 100644 (file)
@@ -27,8 +27,8 @@ ENTRY(lguest_entry)
        /* We make the "initialization" hypercall now to tell the Host about
         * us, and also find out where it put our page tables. */
        movl $LHCALL_LGUEST_INIT, %eax
-       movl $lguest_data - __PAGE_OFFSET, %edx
-       int $LGUEST_TRAP_ENTRY
+       movl $lguest_data - __PAGE_OFFSET, %ebx
+       .byte 0x0f,0x01,0xc1 /* KVM_HYPERCALL */
 
        /* Set up the initial stack so we can run C code. */
        movl $(init_thread_union+THREAD_SIZE),%esp
index 9b917dac77322b4aa397549aa4874ed0c4ad8dab..88e42abf5d881b8bf443ecc4f58e3b4e76b3ecd3 100644 (file)
@@ -191,7 +191,6 @@ static int acpi_ac_add_fs(struct acpi_device *device)
                                                     acpi_ac_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'state' [R] */
index 69cbc57c2d1cd248e7431bb40661e9ea139efbb7..3bcb5bfc45d3366645bfdf6a417d6c140e30107d 100644 (file)
@@ -760,7 +760,6 @@ static int acpi_battery_add_fs(struct acpi_device *device)
                                                     acpi_battery_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        for (i = 0; i < ACPI_BATTERY_NUMFILES; ++i) {
index 171fd914f43533f46bf417dd4d4a7b6936fc6e50..c2f06069dcd40d614a20c0a5e3a2883d47535a9a 100644 (file)
@@ -200,12 +200,10 @@ static int acpi_button_add_fs(struct acpi_device *device)
 
        if (!entry)
                return -ENODEV;
-       entry->owner = THIS_MODULE;
 
        acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
        if (!acpi_device_dir(device))
                return -ENODEV;
-       acpi_device_dir(device)->owner = THIS_MODULE;
 
        /* 'info' [R] */
        entry = proc_create_data(ACPI_BUTTON_FILE_INFO,
@@ -522,7 +520,6 @@ static int __init acpi_button_init(void)
        acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
        if (!acpi_button_dir)
                return -ENODEV;
-       acpi_button_dir->owner = THIS_MODULE;
        result = acpi_bus_register_driver(&acpi_button_driver);
        if (result < 0) {
                remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
index eaaee1660bdf41ec490696b812b2c17869daffe9..8a02944bf92d687e4b1cf5c3e79b8efce59c9d6a 100644 (file)
@@ -193,7 +193,6 @@ static int acpi_fan_add_fs(struct acpi_device *device)
                                                     acpi_fan_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'status' [R/W] */
@@ -347,7 +346,6 @@ static int __init acpi_fan_init(void)
        acpi_fan_dir = proc_mkdir(ACPI_FAN_CLASS, acpi_root_dir);
        if (!acpi_fan_dir)
                return -ENODEV;
-       acpi_fan_dir->owner = THIS_MODULE;
 #endif
 
        result = acpi_bus_register_driver(&acpi_fan_driver);
index 0cc2fd31e3765f7c9b945460345533dfebf1424b..fa2f7422d23de1e2bec5ee3702fa15e2a5ca284c 100644 (file)
@@ -359,7 +359,6 @@ static int acpi_processor_add_fs(struct acpi_device *device)
                if (!acpi_device_dir(device))
                        return -ENODEV;
        }
-       acpi_device_dir(device)->owner = THIS_MODULE;
 
        /* 'info' [R] */
        entry = proc_create_data(ACPI_PROCESSOR_FILE_INFO,
@@ -1137,7 +1136,6 @@ static int __init acpi_processor_init(void)
        acpi_processor_dir = proc_mkdir(ACPI_PROCESSOR_CLASS, acpi_root_dir);
        if (!acpi_processor_dir)
                return -ENOMEM;
-       acpi_processor_dir->owner = THIS_MODULE;
 
        /*
         * Check whether the system is DMI table. If yes, OSPM
index 6050ce4818731fd2bcf8c6891d5a343414d0133a..59afd52ccc121aace5b3d47b56442d718901a090 100644 (file)
@@ -488,7 +488,6 @@ acpi_sbs_add_fs(struct proc_dir_entry **dir,
                if (!*dir) {
                        return -ENODEV;
                }
-               (*dir)->owner = THIS_MODULE;
        }
 
        /* 'info' [R] */
index 99e6f1f8ea457677e1b989c711e37e1b339e60c3..c11f9aeca706f88b164d932d15e88886b070615b 100644 (file)
@@ -1506,7 +1506,6 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
                                                     acpi_thermal_dir);
                if (!acpi_device_dir(device))
                        return -ENODEV;
-               acpi_device_dir(device)->owner = THIS_MODULE;
        }
 
        /* 'state' [R] */
@@ -1875,7 +1874,6 @@ static int __init acpi_thermal_init(void)
        acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
        if (!acpi_thermal_dir)
                return -ENODEV;
-       acpi_thermal_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&acpi_thermal_driver);
        if (result < 0) {
index bb5ed059114aa296e826b91f8b35083ccc773028..67cc36dc9b82fe94b7430628076191e3a6246894 100644 (file)
@@ -1125,8 +1125,6 @@ static int acpi_video_device_add_fs(struct acpi_device *device)
        if (!device_dir)
                return -ENOMEM;
 
-       device_dir->owner = THIS_MODULE;
-
        /* 'info' [R] */
        entry = proc_create_data("info", S_IRUGO, device_dir,
                        &acpi_video_device_info_fops, acpi_driver_data(device));
@@ -1403,8 +1401,6 @@ static int acpi_video_bus_add_fs(struct acpi_device *device)
        if (!device_dir)
                return -ENOMEM;
 
-       device_dir->owner = THIS_MODULE;
-
        /* 'info' [R] */
        entry = proc_create_data("info", S_IRUGO, device_dir,
                                 &acpi_video_bus_info_fops,
@@ -2131,7 +2127,6 @@ static int __init acpi_video_init(void)
        acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
        if (!acpi_video_dir)
                return -ENODEV;
-       acpi_video_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&acpi_video_bus);
        if (result < 0) {
index 5b257a57bc57ae60e369950b60126f3d43f43e04..e62a4ccea54d0c4a3dc6dcd84eb107e557bcb54c 100644 (file)
@@ -119,7 +119,7 @@ static ssize_t print_cpus_map(char *buf, const struct cpumask *map)
 #define        print_cpus_func(type) \
 static ssize_t print_cpus_##type(struct sysdev_class *class, char *buf)        \
 {                                                                      \
-       return print_cpus_map(buf, &cpu_##type##_map);                  \
+       return print_cpus_map(buf, cpu_##type##_mask);                  \
 }                                                                      \
 static struct sysdev_class_attribute attr_##type##_map =               \
        _SYSDEV_CLASS_ATTR(type, 0444, print_cpus_##type, NULL)
index e255341682c88d4a0955f1151595c1334e005dd5..69b4ddb7de3b8c00d59a34fd16af5dc789e7b109 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/pm.h>
 #include <linux/resume-trace.h>
 #include <linux/rwsem.h>
+#include <linux/interrupt.h>
 
 #include "../base.h"
 #include "power.h"
@@ -349,7 +350,8 @@ static int resume_device_noirq(struct device *dev, pm_message_t state)
  *     Execute the appropriate "noirq resume" callback for all devices marked
  *     as DPM_OFF_IRQ.
  *
- *     Must be called with interrupts disabled and only one CPU running.
+ *     Must be called under dpm_list_mtx.  Device drivers should not receive
+ *     interrupts while it's being executed.
  */
 static void dpm_power_up(pm_message_t state)
 {
@@ -370,14 +372,13 @@ static void dpm_power_up(pm_message_t state)
  *     device_power_up - Turn on all devices that need special attention.
  *     @state: PM transition of the system being carried out.
  *
- *     Power on system devices, then devices that required we shut them down
- *     with interrupts disabled.
- *
- *     Must be called with interrupts disabled.
+ *     Call the "early" resume handlers and enable device drivers to receive
+ *     interrupts.
  */
 void device_power_up(pm_message_t state)
 {
        dpm_power_up(state);
+       resume_device_irqs();
 }
 EXPORT_SYMBOL_GPL(device_power_up);
 
@@ -602,16 +603,17 @@ static int suspend_device_noirq(struct device *dev, pm_message_t state)
  *     device_power_down - Shut down special devices.
  *     @state: PM transition of the system being carried out.
  *
- *     Power down devices that require interrupts to be disabled.
- *     Then power down system devices.
+ *     Prevent device drivers from receiving interrupts and call the "late"
+ *     suspend handlers.
  *
- *     Must be called with interrupts disabled and only one CPU running.
+ *     Must be called under dpm_list_mtx.
  */
 int device_power_down(pm_message_t state)
 {
        struct device *dev;
        int error = 0;
 
+       suspend_device_irqs();
        list_for_each_entry_reverse(dev, &dpm_list, power.entry) {
                error = suspend_device_noirq(dev, state);
                if (error) {
@@ -621,7 +623,7 @@ int device_power_down(pm_message_t state)
                dev->power.status = DPM_OFF_IRQ;
        }
        if (error)
-               dpm_power_up(resume_event(state));
+               device_power_up(resume_event(state));
        return error;
 }
 EXPORT_SYMBOL_GPL(device_power_down);
index cbd36cf59a0f2e2af74ddc9255f64380299a6666..76ce75bad91eb56e897012494a0bdbafde24b9a6 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/pm.h>
 #include <linux/device.h>
 #include <linux/mutex.h>
+#include <linux/interrupt.h>
 
 #include "base.h"
 
@@ -369,6 +370,13 @@ int sysdev_suspend(pm_message_t state)
        struct sysdev_driver *drv, *err_drv;
        int ret;
 
+       pr_debug("Checking wake-up interrupts\n");
+
+       /* Return error code if there are any wake-up interrupts pending */
+       ret = check_wakeup_irqs();
+       if (ret)
+               return ret;
+
        pr_debug("Suspending System Devices\n");
 
        list_for_each_entry_reverse(cls, &system_kset->list, kset.kobj.entry) {
index 393ed6760d783c155a2a0846d8de03c505167057..8eddef373a9197d9db8834d5ba15d1f743b85ee2 100644 (file)
@@ -551,8 +551,6 @@ static void __devinit ps3vram_proc_init(struct ps3_system_bus_device *dev)
                dev_warn(&dev->core, "failed to create /proc entry\n");
                return;
        }
-
-       pde->owner = THIS_MODULE;
        pde->data = priv;
 }
 
index 7a88dfd4427b136c6e034b06d4f6e6e3a416cd39..e93fc8d22fb2b839413dacd50fda823c060f7989 100644 (file)
@@ -1944,7 +1944,7 @@ static int stat_file_read_proc(char *page, char **start, off_t off,
 
 int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
                            read_proc_t *read_proc,
-                           void *data, struct module *owner)
+                           void *data)
 {
        int                    rv = 0;
 #ifdef CONFIG_PROC_FS
@@ -1970,7 +1970,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
        } else {
                file->data = data;
                file->read_proc = read_proc;
-               file->owner = owner;
 
                mutex_lock(&smi->proc_entry_lock);
                /* Stick it on the list. */
@@ -1993,23 +1992,21 @@ static int add_proc_entries(ipmi_smi_t smi, int num)
        smi->proc_dir = proc_mkdir(smi->proc_dir_name, proc_ipmi_root);
        if (!smi->proc_dir)
                rv = -ENOMEM;
-       else
-               smi->proc_dir->owner = THIS_MODULE;
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "stats",
                                             stat_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "ipmb",
                                             ipmb_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 
        if (rv == 0)
                rv = ipmi_smi_add_proc_entry(smi, "version",
                                             version_file_read_proc,
-                                            smi, THIS_MODULE);
+                                            smi);
 #endif /* CONFIG_PROC_FS */
 
        return rv;
@@ -4265,7 +4262,6 @@ static int ipmi_init_msghandler(void)
            return -ENOMEM;
        }
 
-       proc_ipmi_root->owner = THIS_MODULE;
 #endif /* CONFIG_PROC_FS */
 
        setup_timer(&ipmi_timer, ipmi_timeout, 0);
index 3000135f2ead3bcd98cd505b7fa89f11d0d2ab5e..e58ea4cd55ce02a101f282dd5977be4417b41bf4 100644 (file)
@@ -2899,7 +2899,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "type",
                                     type_file_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
@@ -2909,7 +2909,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "si_stats",
                                     stat_file_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
@@ -2919,7 +2919,7 @@ static int try_smi_init(struct smi_info *new_smi)
 
        rv = ipmi_smi_add_proc_entry(new_smi->intf, "params",
                                     param_read_proc,
-                                    new_smi, THIS_MODULE);
+                                    new_smi);
        if (rv) {
                printk(KERN_ERR
                       "ipmi_si: Unable to create proc entry: %d\n",
index 8f0f7c44930540aa6829fdbe92b085d7c4009a46..5f1b5400d96abf6cd741165ffc9bfcf1d781406e 100644 (file)
@@ -68,7 +68,8 @@ static char * __init dmi_string(const struct dmi_header *dm, u8 s)
  *     pointing to completely the wrong place for example
  */
 static void dmi_table(u8 *buf, int len, int num,
-                     void (*decode)(const struct dmi_header *))
+                     void (*decode)(const struct dmi_header *, void *),
+                     void *private_data)
 {
        u8 *data = buf;
        int i = 0;
@@ -89,7 +90,7 @@ static void dmi_table(u8 *buf, int len, int num,
                while ((data - buf < len - 1) && (data[0] || data[1]))
                        data++;
                if (data - buf < len - 1)
-                       decode(dm);
+                       decode(dm, private_data);
                data += 2;
                i++;
        }
@@ -99,7 +100,8 @@ static u32 dmi_base;
 static u16 dmi_len;
 static u16 dmi_num;
 
-static int __init dmi_walk_early(void (*decode)(const struct dmi_header *))
+static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
+               void *))
 {
        u8 *buf;
 
@@ -107,7 +109,7 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *))
        if (buf == NULL)
                return -1;
 
-       dmi_table(buf, dmi_len, dmi_num, decode);
+       dmi_table(buf, dmi_len, dmi_num, decode, NULL);
 
        dmi_iounmap(buf, dmi_len);
        return 0;
@@ -295,7 +297,7 @@ static void __init dmi_save_extended_devices(const struct dmi_header *dm)
  *     and machine entries. For 2.5 we should pull the smbus controller info
  *     out of here.
  */
-static void __init dmi_decode(const struct dmi_header *dm)
+static void __init dmi_decode(const struct dmi_header *dm, void *dummy)
 {
        switch(dm->type) {
        case 0:         /* BIOS Information */
@@ -598,10 +600,12 @@ int dmi_get_year(int field)
 /**
  *     dmi_walk - Walk the DMI table and get called back for every record
  *     @decode: Callback function
+ *     @private_data: Private data to be passed to the callback function
  *
  *     Returns -1 when the DMI table can't be reached, 0 on success.
  */
-int dmi_walk(void (*decode)(const struct dmi_header *))
+int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+            void *private_data)
 {
        u8 *buf;
 
@@ -612,7 +616,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *))
        if (buf == NULL)
                return -1;
 
-       dmi_table(buf, dmi_len, dmi_num, decode);
+       dmi_table(buf, dmi_len, dmi_num, decode, private_data);
 
        iounmap(buf);
        return 0;
index b4eea0292c1a240cc8d7c71cfd6772baaa51537b..51ff9b3d7ea2d1ec5582a0fcfa7f601407a012b7 100644 (file)
@@ -343,12 +343,13 @@ config SENSORS_FSCPOS
          will be called fscpos.
 
 config SENSORS_FSCHMD
-       tristate "FSC Poseidon, Scylla, Hermes, Heimdall and Heracles"
+       tristate "Fujitsu Siemens Computers sensor chips"
        depends on X86 && I2C
        help
-         If you say yes here you get support for various Fujitsu Siemens
-         Computers sensor chips, including support for the integrated
-         watchdog.
+         If you say yes here you get support for the following Fujitsu
+         Siemens Computers (FSC) sensor chips: Poseidon, Scylla, Hermes,
+         Heimdall, Heracles, Hades and Syleus including support for the
+         integrated watchdog.
 
          This is a merged driver for FSC sensor chips replacing the fscpos,
          fscscy and fscher drivers and adding support for several other FSC
@@ -635,6 +636,20 @@ config SENSORS_PC87427
          This driver can also be built as a module.  If so, the module
          will be called pc87427.
 
+config SENSORS_PCF8591
+       tristate "Philips PCF8591 ADC/DAC"
+       depends on I2C
+       default n
+       help
+         If you say yes here you get support for Philips PCF8591 4-channel
+         ADC, 1-channel DAC chips.
+
+         This driver can also be built as a module.  If so, the module
+         will be called pcf8591.
+
+         These devices are hard to detect and rarely found on mainstream
+         hardware.  If unsure, say N.
+
 config SENSORS_SIS5595
        tristate "Silicon Integrated Systems Corp. SiS5595"
        depends on PCI
@@ -827,7 +842,7 @@ config SENSORS_W83627HF
          will be called w83627hf.
 
 config SENSORS_W83627EHF
-       tristate "Winbond W83627EHF/DHG"
+       tristate "Winbond W83627EHF/EHG/DHG, W83667HG"
        select HWMON_VID
        help
          If you say yes here you get support for the hardware
@@ -838,6 +853,8 @@ config SENSORS_W83627EHF
          chip suited for specific Intel processors that use PECI such as
          the Core 2 Duo.
 
+         This driver also supports the W83667HG chip.
+
          This driver can also be built as a module.  If so, the module
          will be called w83627ehf.
 
index 2e80f37f39eb4e03676b21ae20ec6e0db1b6a0ed..e332d6267920fe8b38ad480ed3f63091a85ed2d8 100644 (file)
@@ -70,6 +70,7 @@ obj-$(CONFIG_SENSORS_MAX1619) += max1619.o
 obj-$(CONFIG_SENSORS_MAX6650)  += max6650.o
 obj-$(CONFIG_SENSORS_PC87360)  += pc87360.o
 obj-$(CONFIG_SENSORS_PC87427)  += pc87427.o
+obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
 obj-$(CONFIG_SENSORS_SIS5595)  += sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
index 7415381601c3f40fdc77481485553606712728d2..53f88f5118167a8e3ebfb392ed199fb3f3c31175 100644 (file)
@@ -81,71 +81,84 @@ struct ds1621_data {
        u8 conf;                        /* Register encoding, combined */
 };
 
-static int ds1621_probe(struct i2c_client *client,
-                       const struct i2c_device_id *id);
-static int ds1621_detect(struct i2c_client *client, int kind,
-                        struct i2c_board_info *info);
-static void ds1621_init_client(struct i2c_client *client);
-static int ds1621_remove(struct i2c_client *client);
-static struct ds1621_data *ds1621_update_client(struct device *dev);
-
-static const struct i2c_device_id ds1621_id[] = {
-       { "ds1621", ds1621 },
-       { "ds1625", ds1621 },
-       { }
-};
-MODULE_DEVICE_TABLE(i2c, ds1621_id);
-
-/* This is the driver that will be inserted */
-static struct i2c_driver ds1621_driver = {
-       .class          = I2C_CLASS_HWMON,
-       .driver = {
-               .name   = "ds1621",
-       },
-       .probe          = ds1621_probe,
-       .remove         = ds1621_remove,
-       .id_table       = ds1621_id,
-       .detect         = ds1621_detect,
-       .address_data   = &addr_data,
-};
-
-/* All registers are word-sized, except for the configuration register.
+/* Temperature registers are word-sized.
    DS1621 uses a high-byte first convention, which is exactly opposite to
    the SMBus standard. */
-static int ds1621_read_value(struct i2c_client *client, u8 reg)
+static int ds1621_read_temp(struct i2c_client *client, u8 reg)
 {
-       if (reg == DS1621_REG_CONF)
-               return i2c_smbus_read_byte_data(client, reg);
-       else
-               return swab16(i2c_smbus_read_word_data(client, reg));
+       int ret;
+
+       ret = i2c_smbus_read_word_data(client, reg);
+       if (ret < 0)
+               return ret;
+       return swab16(ret);
 }
 
-static int ds1621_write_value(struct i2c_client *client, u8 reg, u16 value)
+static int ds1621_write_temp(struct i2c_client *client, u8 reg, u16 value)
 {
-       if (reg == DS1621_REG_CONF)
-               return i2c_smbus_write_byte_data(client, reg, value);
-       else
-               return i2c_smbus_write_word_data(client, reg, swab16(value));
+       return i2c_smbus_write_word_data(client, reg, swab16(value));
 }
 
 static void ds1621_init_client(struct i2c_client *client)
 {
-       int reg = ds1621_read_value(client, DS1621_REG_CONF);
+       u8 conf, new_conf;
+
+       new_conf = conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
        /* switch to continuous conversion mode */
-       reg &= ~ DS1621_REG_CONFIG_1SHOT;
+       new_conf &= ~DS1621_REG_CONFIG_1SHOT;
 
        /* setup output polarity */
        if (polarity == 0)
-               reg &= ~DS1621_REG_CONFIG_POLARITY;
+               new_conf &= ~DS1621_REG_CONFIG_POLARITY;
        else if (polarity == 1)
-               reg |= DS1621_REG_CONFIG_POLARITY;
+               new_conf |= DS1621_REG_CONFIG_POLARITY;
        
-       ds1621_write_value(client, DS1621_REG_CONF, reg);
+       if (conf != new_conf)
+               i2c_smbus_write_byte_data(client, DS1621_REG_CONF, new_conf);
        
        /* start conversion */
        i2c_smbus_write_byte(client, DS1621_COM_START);
 }
 
+static struct ds1621_data *ds1621_update_client(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct ds1621_data *data = i2c_get_clientdata(client);
+       u8 new_conf;
+
+       mutex_lock(&data->update_lock);
+
+       if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+           || !data->valid) {
+               int i;
+
+               dev_dbg(&client->dev, "Starting ds1621 update\n");
+
+               data->conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
+
+               for (i = 0; i < ARRAY_SIZE(data->temp); i++)
+                       data->temp[i] = ds1621_read_temp(client,
+                                                        DS1621_REG_TEMP[i]);
+
+               /* reset alarms if necessary */
+               new_conf = data->conf;
+               if (data->temp[0] > data->temp[1])      /* input > min */
+                       new_conf &= ~DS1621_ALARM_TEMP_LOW;
+               if (data->temp[0] < data->temp[2])      /* input < max */
+                       new_conf &= ~DS1621_ALARM_TEMP_HIGH;
+               if (data->conf != new_conf)
+                       i2c_smbus_write_byte_data(client, DS1621_REG_CONF,
+                                                 new_conf);
+
+               data->last_updated = jiffies;
+               data->valid = 1;
+       }
+
+       mutex_unlock(&data->update_lock);
+
+       return data;
+}
+
 static ssize_t show_temp(struct device *dev, struct device_attribute *da,
                         char *buf)
 {
@@ -160,13 +173,13 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
 {
        struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
        struct i2c_client *client = to_i2c_client(dev);
-       struct ds1621_data *data = ds1621_update_client(dev);
+       struct ds1621_data *data = i2c_get_clientdata(client);
        u16 val = LM75_TEMP_TO_REG(simple_strtol(buf, NULL, 10));
 
        mutex_lock(&data->update_lock);
        data->temp[attr->index] = val;
-       ds1621_write_value(client, DS1621_REG_TEMP[attr->index],
-                          data->temp[attr->index]);
+       ds1621_write_temp(client, DS1621_REG_TEMP[attr->index],
+                         data->temp[attr->index]);
        mutex_unlock(&data->update_lock);
        return count;
 }
@@ -228,13 +241,14 @@ static int ds1621_detect(struct i2c_client *client, int kind,
                /* The NVB bit should be low if no EEPROM write has been 
                   requested during the latest 10ms, which is highly 
                   improbable in our case. */
-               conf = ds1621_read_value(client, DS1621_REG_CONF);
-               if (conf & DS1621_REG_CONFIG_NVB)
+               conf = i2c_smbus_read_byte_data(client, DS1621_REG_CONF);
+               if (conf < 0 || conf & DS1621_REG_CONFIG_NVB)
                        return -ENODEV;
                /* The 7 lowest bits of a temperature should always be 0. */
                for (i = 0; i < ARRAY_SIZE(DS1621_REG_TEMP); i++) {
-                       temp = ds1621_read_value(client, DS1621_REG_TEMP[i]);
-                       if (temp & 0x007f)
+                       temp = i2c_smbus_read_word_data(client,
+                                                       DS1621_REG_TEMP[i]);
+                       if (temp < 0 || (temp & 0x7f00))
                                return -ENODEV;
                }
        }
@@ -294,45 +308,25 @@ static int ds1621_remove(struct i2c_client *client)
        return 0;
 }
 
+static const struct i2c_device_id ds1621_id[] = {
+       { "ds1621", ds1621 },
+       { "ds1625", ds1621 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, ds1621_id);
 
-static struct ds1621_data *ds1621_update_client(struct device *dev)
-{
-       struct i2c_client *client = to_i2c_client(dev);
-       struct ds1621_data *data = i2c_get_clientdata(client);
-       u8 new_conf;
-
-       mutex_lock(&data->update_lock);
-
-       if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
-           || !data->valid) {
-               int i;
-
-               dev_dbg(&client->dev, "Starting ds1621 update\n");
-
-               data->conf = ds1621_read_value(client, DS1621_REG_CONF);
-
-               for (i = 0; i < ARRAY_SIZE(data->temp); i++)
-                       data->temp[i] = ds1621_read_value(client,
-                                                         DS1621_REG_TEMP[i]);
-
-               /* reset alarms if necessary */
-               new_conf = data->conf;
-               if (data->temp[0] > data->temp[1])      /* input > min */
-                       new_conf &= ~DS1621_ALARM_TEMP_LOW;
-               if (data->temp[0] < data->temp[2])      /* input < max */
-                       new_conf &= ~DS1621_ALARM_TEMP_HIGH;
-               if (data->conf != new_conf)
-                       ds1621_write_value(client, DS1621_REG_CONF,
-                                          new_conf);
-
-               data->last_updated = jiffies;
-               data->valid = 1;
-       }
-
-       mutex_unlock(&data->update_lock);
-
-       return data;
-}
+/* This is the driver that will be inserted */
+static struct i2c_driver ds1621_driver = {
+       .class          = I2C_CLASS_HWMON,
+       .driver = {
+               .name   = "ds1621",
+       },
+       .probe          = ds1621_probe,
+       .remove         = ds1621_remove,
+       .id_table       = ds1621_id,
+       .detect         = ds1621_detect,
+       .address_data   = &addr_data,
+};
 
 static int __init ds1621_init(void)
 {
index d07f4ef750923ca728556ed353ca6eb8ae052873..ea955edde87e5127fc4c7f57d7d0c0b51ed3b1e4 100644 (file)
@@ -1,6 +1,6 @@
 /* fschmd.c
  *
- * Copyright (C) 2007,2008 Hans de Goede <hdegoede@redhat.com>
+ * Copyright (C) 2007 - 2009 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
@@ -19,7 +19,7 @@
 
 /*
  *  Merged Fujitsu Siemens hwmon driver, supporting the Poseidon, Hermes,
- *  Scylla, Heracles and Heimdall chips
+ *  Scylla, Heracles, Heimdall, Hades and Syleus chips
  *
  *  Based on the original 2.4 fscscy, 2.6 fscpos, 2.6 fscher and 2.6
  *  (candidate) fschmd drivers:
@@ -56,7 +56,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
        __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
+I2C_CLIENT_INSMOD_7(fscpos, fscher, fscscy, fschrc, fschmd, fschds, fscsyl);
 
 /*
  * The FSCHMD registers and other defines
@@ -75,9 +75,12 @@ I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
 #define FSCHMD_CONTROL_ALERT_LED       0x01
 
 /* watchdog */
-#define FSCHMD_REG_WDOG_PRESET         0x28
-#define FSCHMD_REG_WDOG_STATE          0x23
-#define FSCHMD_REG_WDOG_CONTROL                0x21
+static const u8 FSCHMD_REG_WDOG_CONTROL[7] =
+       { 0x21, 0x21, 0x21, 0x21, 0x21, 0x28, 0x28 };
+static const u8 FSCHMD_REG_WDOG_STATE[7] =
+       { 0x23, 0x23, 0x23, 0x23, 0x23, 0x29, 0x29 };
+static const u8 FSCHMD_REG_WDOG_PRESET[7] =
+       { 0x28, 0x28, 0x28, 0x28, 0x28, 0x2a, 0x2a };
 
 #define FSCHMD_WDOG_CONTROL_TRIGGER    0x10
 #define FSCHMD_WDOG_CONTROL_STARTED    0x10 /* the same as trigger */
@@ -87,70 +90,95 @@ I2C_CLIENT_INSMOD_5(fscpos, fscher, fscscy, fschrc, fschmd);
 #define FSCHMD_WDOG_STATE_CARDRESET    0x02
 
 /* voltages, weird order is to keep the same order as the old drivers */
-static const u8 FSCHMD_REG_VOLT[3] = { 0x45, 0x42, 0x48 };
+static const u8 FSCHMD_REG_VOLT[7][6] = {
+       { 0x45, 0x42, 0x48 },                           /* pos */
+       { 0x45, 0x42, 0x48 },                           /* her */
+       { 0x45, 0x42, 0x48 },                           /* scy */
+       { 0x45, 0x42, 0x48 },                           /* hrc */
+       { 0x45, 0x42, 0x48 },                           /* hmd */
+       { 0x21, 0x20, 0x22 },                           /* hds */
+       { 0x21, 0x20, 0x22, 0x23, 0x24, 0x25 },         /* syl */
+};
+
+static const int FSCHMD_NO_VOLT_SENSORS[7] = { 3, 3, 3, 3, 3, 3, 6 };
 
 /* minimum pwm at which the fan is driven (pwm can by increased depending on
    the temp. Notice that for the scy some fans share there minimum speed.
    Also notice that with the scy the sensor order is different than with the
    other chips, this order was in the 2.4 driver and kept for consistency. */
-static const u8 FSCHMD_REG_FAN_MIN[5][6] = {
+static const u8 FSCHMD_REG_FAN_MIN[7][7] = {
        { 0x55, 0x65 },                                 /* pos */
        { 0x55, 0x65, 0xb5 },                           /* her */
        { 0x65, 0x65, 0x55, 0xa5, 0x55, 0xa5 },         /* scy */
        { 0x55, 0x65, 0xa5, 0xb5 },                     /* hrc */
        { 0x55, 0x65, 0xa5, 0xb5, 0xc5 },               /* hmd */
+       { 0x55, 0x65, 0xa5, 0xb5, 0xc5 },               /* hds */
+       { 0x54, 0x64, 0x74, 0x84, 0x94, 0xa4, 0xb4 },   /* syl */
 };
 
 /* actual fan speed */
-static const u8 FSCHMD_REG_FAN_ACT[5][6] = {
+static const u8 FSCHMD_REG_FAN_ACT[7][7] = {
        { 0x0e, 0x6b, 0xab },                           /* pos */
        { 0x0e, 0x6b, 0xbb },                           /* her */
        { 0x6b, 0x6c, 0x0e, 0xab, 0x5c, 0xbb },         /* scy */
        { 0x0e, 0x6b, 0xab, 0xbb },                     /* hrc */
        { 0x5b, 0x6b, 0xab, 0xbb, 0xcb },               /* hmd */
+       { 0x5b, 0x6b, 0xab, 0xbb, 0xcb },               /* hds */
+       { 0x57, 0x67, 0x77, 0x87, 0x97, 0xa7, 0xb7 },   /* syl */
 };
 
 /* fan status registers */
-static const u8 FSCHMD_REG_FAN_STATE[5][6] = {
+static const u8 FSCHMD_REG_FAN_STATE[7][7] = {
        { 0x0d, 0x62, 0xa2 },                           /* pos */
        { 0x0d, 0x62, 0xb2 },                           /* her */
        { 0x62, 0x61, 0x0d, 0xa2, 0x52, 0xb2 },         /* scy */
        { 0x0d, 0x62, 0xa2, 0xb2 },                     /* hrc */
        { 0x52, 0x62, 0xa2, 0xb2, 0xc2 },               /* hmd */
+       { 0x52, 0x62, 0xa2, 0xb2, 0xc2 },               /* hds */
+       { 0x50, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0 },   /* syl */
 };
 
 /* fan ripple / divider registers */
-static const u8 FSCHMD_REG_FAN_RIPPLE[5][6] = {
+static const u8 FSCHMD_REG_FAN_RIPPLE[7][7] = {
        { 0x0f, 0x6f, 0xaf },                           /* pos */
        { 0x0f, 0x6f, 0xbf },                           /* her */
        { 0x6f, 0x6f, 0x0f, 0xaf, 0x0f, 0xbf },         /* scy */
        { 0x0f, 0x6f, 0xaf, 0xbf },                     /* hrc */
        { 0x5f, 0x6f, 0xaf, 0xbf, 0xcf },               /* hmd */
+       { 0x5f, 0x6f, 0xaf, 0xbf, 0xcf },               /* hds */
+       { 0x56, 0x66, 0x76, 0x86, 0x96, 0xa6, 0xb6 },   /* syl */
 };
 
-static const int FSCHMD_NO_FAN_SENSORS[5] = { 3, 3, 6, 4, 5 };
+static const int FSCHMD_NO_FAN_SENSORS[7] = { 3, 3, 6, 4, 5, 5, 7 };
 
 /* Fan status register bitmasks */
 #define FSCHMD_FAN_ALARM       0x04 /* called fault by FSC! */
-#define FSCHMD_FAN_NOT_PRESENT 0x08 /* not documented */
+#define FSCHMD_FAN_NOT_PRESENT 0x08
+#define FSCHMD_FAN_DISABLED    0x80
 
 
 /* actual temperature registers */
-static const u8 FSCHMD_REG_TEMP_ACT[5][5] = {
+static const u8 FSCHMD_REG_TEMP_ACT[7][11] = {
        { 0x64, 0x32, 0x35 },                           /* pos */
        { 0x64, 0x32, 0x35 },                           /* her */
        { 0x64, 0xD0, 0x32, 0x35 },                     /* scy */
        { 0x64, 0x32, 0x35 },                           /* hrc */
        { 0x70, 0x80, 0x90, 0xd0, 0xe0 },               /* hmd */
+       { 0x70, 0x80, 0x90, 0xd0, 0xe0 },               /* hds */
+       { 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8,           /* syl */
+         0xb8, 0xc8, 0xd8, 0xe8, 0xf8 },
 };
 
 /* temperature state registers */
-static const u8 FSCHMD_REG_TEMP_STATE[5][5] = {
+static const u8 FSCHMD_REG_TEMP_STATE[7][11] = {
        { 0x71, 0x81, 0x91 },                           /* pos */
        { 0x71, 0x81, 0x91 },                           /* her */
        { 0x71, 0xd1, 0x81, 0x91 },                     /* scy */
        { 0x71, 0x81, 0x91 },                           /* hrc */
        { 0x71, 0x81, 0x91, 0xd1, 0xe1 },               /* hmd */
+       { 0x71, 0x81, 0x91, 0xd1, 0xe1 },               /* hds */
+       { 0x59, 0x69, 0x79, 0x89, 0x99, 0xa9,           /* syl */
+         0xb9, 0xc9, 0xd9, 0xe9, 0xf9 },
 };
 
 /* temperature high limit registers, FSC does not document these. Proven to be
@@ -158,24 +186,31 @@ static const u8 FSCHMD_REG_TEMP_STATE[5][5] = {
    in the fscscy 2.4 driver. FSC has confirmed that the fschmd has registers
    at these addresses, but doesn't want to confirm they are the same as with
    the fscher?? */
-static const u8 FSCHMD_REG_TEMP_LIMIT[5][5] = {
+static const u8 FSCHMD_REG_TEMP_LIMIT[7][11] = {
        { 0, 0, 0 },                                    /* pos */
        { 0x76, 0x86, 0x96 },                           /* her */
        { 0x76, 0xd6, 0x86, 0x96 },                     /* scy */
        { 0x76, 0x86, 0x96 },                           /* hrc */
        { 0x76, 0x86, 0x96, 0xd6, 0xe6 },               /* hmd */
+       { 0x76, 0x86, 0x96, 0xd6, 0xe6 },               /* hds */
+       { 0x5a, 0x6a, 0x7a, 0x8a, 0x9a, 0xaa,           /* syl */
+         0xba, 0xca, 0xda, 0xea, 0xfa },
 };
 
 /* These were found through experimenting with an fscher, currently they are
    not used, but we keep them around for future reference.
+   On the fscsyl AUTOP1 lives at 0x#c (so 0x5c for fan1, 0x6c for fan2, etc),
+   AUTOP2 lives at 0x#e, and 0x#1 is a bitmask defining which temps influence
+   the fan speed.
 static const u8 FSCHER_REG_TEMP_AUTOP1[] =     { 0x73, 0x83, 0x93 };
 static const u8 FSCHER_REG_TEMP_AUTOP2[] =     { 0x75, 0x85, 0x95 }; */
 
-static const int FSCHMD_NO_TEMP_SENSORS[5] = { 3, 3, 4, 3, 5 };
+static const int FSCHMD_NO_TEMP_SENSORS[7] = { 3, 3, 4, 3, 5, 5, 11 };
 
 /* temp status register bitmasks */
 #define FSCHMD_TEMP_WORKING    0x01
 #define FSCHMD_TEMP_ALERT      0x02
+#define FSCHMD_TEMP_DISABLED   0x80
 /* there only really is an alarm if the sensor is working and alert == 1 */
 #define FSCHMD_TEMP_ALARM_MASK \
        (FSCHMD_TEMP_WORKING | FSCHMD_TEMP_ALERT)
@@ -201,6 +236,8 @@ static const struct i2c_device_id fschmd_id[] = {
        { "fscscy", fscscy },
        { "fschrc", fschrc },
        { "fschmd", fschmd },
+       { "fschds", fschds },
+       { "fscsyl", fscsyl },
        { }
 };
 MODULE_DEVICE_TABLE(i2c, fschmd_id);
@@ -242,14 +279,14 @@ struct fschmd_data {
        u8 watchdog_control;    /* watchdog control register */
        u8 watchdog_state;      /* watchdog status register */
        u8 watchdog_preset;     /* watchdog counter preset on trigger val */
-       u8 volt[3];             /* 12, 5, battery voltage */
-       u8 temp_act[5];         /* temperature */
-       u8 temp_status[5];      /* status of sensor */
-       u8 temp_max[5];         /* high temp limit, notice: undocumented! */
-       u8 fan_act[6];          /* fans revolutions per second */
-       u8 fan_status[6];       /* fan status */
-       u8 fan_min[6];          /* fan min value for rps */
-       u8 fan_ripple[6];       /* divider for rps */
+       u8 volt[6];             /* voltage */
+       u8 temp_act[11];        /* temperature */
+       u8 temp_status[11];     /* status of sensor */
+       u8 temp_max[11];        /* high temp limit, notice: undocumented! */
+       u8 fan_act[7];          /* fans revolutions per second */
+       u8 fan_status[7];       /* fan status */
+       u8 fan_min[7];          /* fan min value for rps */
+       u8 fan_ripple[7];       /* divider for rps */
 };
 
 /* Global variables to hold information read from special DMI tables, which are
@@ -257,8 +294,8 @@ struct fschmd_data {
    protect these with a lock as they are only modified from our attach function
    which always gets called with the i2c-core lock held and never accessed
    before the attach function is done with them. */
-static int dmi_mult[3] = { 490, 200, 100 };
-static int dmi_offset[3] = { 0, 0, 0 };
+static int dmi_mult[6] = { 490, 200, 100, 100, 200, 100 };
+static int dmi_offset[6] = { 0, 0, 0, 0, 0, 0 };
 static int dmi_vref = -1;
 
 /* Somewhat ugly :( global data pointer list with all fschmd devices, so that
@@ -450,10 +487,11 @@ static ssize_t show_pwm_auto_point1_pwm(struct device *dev,
        struct device_attribute *devattr, char *buf)
 {
        int index = to_sensor_dev_attr(devattr)->index;
-       int val = fschmd_update_device(dev)->fan_min[index];
+       struct fschmd_data *data = fschmd_update_device(dev);
+       int val = data->fan_min[index];
 
-       /* 0 = allow turning off, 1-255 = 50-100% */
-       if (val)
+       /* 0 = allow turning off (except on the syl), 1-255 = 50-100% */
+       if (val || data->kind == fscsyl - 1)
                val = val / 2 + 128;
 
        return sprintf(buf, "%d\n", val);
@@ -466,8 +504,8 @@ static ssize_t store_pwm_auto_point1_pwm(struct device *dev,
        struct fschmd_data *data = dev_get_drvdata(dev);
        unsigned long v = simple_strtoul(buf, NULL, 10);
 
-       /* register: 0 = allow turning off, 1-255 = 50-100% */
-       if (v) {
+       /* reg: 0 = allow turning off (except on the syl), 1-255 = 50-100% */
+       if (v || data->kind == fscsyl - 1) {
                v = SENSORS_LIMIT(v, 128, 255);
                v = (v - 128) * 2 + 1;
        }
@@ -522,11 +560,15 @@ static ssize_t store_alert_led(struct device *dev,
        return count;
 }
 
+static DEVICE_ATTR(alert_led, 0644, show_alert_led, store_alert_led);
+
 static struct sensor_device_attribute fschmd_attr[] = {
        SENSOR_ATTR(in0_input, 0444, show_in_value, NULL, 0),
        SENSOR_ATTR(in1_input, 0444, show_in_value, NULL, 1),
        SENSOR_ATTR(in2_input, 0444, show_in_value, NULL, 2),
-       SENSOR_ATTR(alert_led, 0644, show_alert_led, store_alert_led, 0),
+       SENSOR_ATTR(in3_input, 0444, show_in_value, NULL, 3),
+       SENSOR_ATTR(in4_input, 0444, show_in_value, NULL, 4),
+       SENSOR_ATTR(in5_input, 0444, show_in_value, NULL, 5),
 };
 
 static struct sensor_device_attribute fschmd_temp_attr[] = {
@@ -550,6 +592,30 @@ static struct sensor_device_attribute fschmd_temp_attr[] = {
        SENSOR_ATTR(temp5_max,   0644, show_temp_max, store_temp_max, 4),
        SENSOR_ATTR(temp5_fault, 0444, show_temp_fault, NULL, 4),
        SENSOR_ATTR(temp5_alarm, 0444, show_temp_alarm, NULL, 4),
+       SENSOR_ATTR(temp6_input, 0444, show_temp_value, NULL, 5),
+       SENSOR_ATTR(temp6_max,   0644, show_temp_max, store_temp_max, 5),
+       SENSOR_ATTR(temp6_fault, 0444, show_temp_fault, NULL, 5),
+       SENSOR_ATTR(temp6_alarm, 0444, show_temp_alarm, NULL, 5),
+       SENSOR_ATTR(temp7_input, 0444, show_temp_value, NULL, 6),
+       SENSOR_ATTR(temp7_max,   0644, show_temp_max, store_temp_max, 6),
+       SENSOR_ATTR(temp7_fault, 0444, show_temp_fault, NULL, 6),
+       SENSOR_ATTR(temp7_alarm, 0444, show_temp_alarm, NULL, 6),
+       SENSOR_ATTR(temp8_input, 0444, show_temp_value, NULL, 7),
+       SENSOR_ATTR(temp8_max,   0644, show_temp_max, store_temp_max, 7),
+       SENSOR_ATTR(temp8_fault, 0444, show_temp_fault, NULL, 7),
+       SENSOR_ATTR(temp8_alarm, 0444, show_temp_alarm, NULL, 7),
+       SENSOR_ATTR(temp9_input, 0444, show_temp_value, NULL, 8),
+       SENSOR_ATTR(temp9_max,   0644, show_temp_max, store_temp_max, 8),
+       SENSOR_ATTR(temp9_fault, 0444, show_temp_fault, NULL, 8),
+       SENSOR_ATTR(temp9_alarm, 0444, show_temp_alarm, NULL, 8),
+       SENSOR_ATTR(temp10_input, 0444, show_temp_value, NULL, 9),
+       SENSOR_ATTR(temp10_max,   0644, show_temp_max, store_temp_max, 9),
+       SENSOR_ATTR(temp10_fault, 0444, show_temp_fault, NULL, 9),
+       SENSOR_ATTR(temp10_alarm, 0444, show_temp_alarm, NULL, 9),
+       SENSOR_ATTR(temp11_input, 0444, show_temp_value, NULL, 10),
+       SENSOR_ATTR(temp11_max,   0644, show_temp_max, store_temp_max, 10),
+       SENSOR_ATTR(temp11_fault, 0444, show_temp_fault, NULL, 10),
+       SENSOR_ATTR(temp11_alarm, 0444, show_temp_alarm, NULL, 10),
 };
 
 static struct sensor_device_attribute fschmd_fan_attr[] = {
@@ -589,6 +655,12 @@ static struct sensor_device_attribute fschmd_fan_attr[] = {
        SENSOR_ATTR(fan6_fault, 0444, show_fan_fault, NULL, 5),
        SENSOR_ATTR(pwm6_auto_point1_pwm, 0644, show_pwm_auto_point1_pwm,
                store_pwm_auto_point1_pwm, 5),
+       SENSOR_ATTR(fan7_input, 0444, show_fan_value, NULL, 6),
+       SENSOR_ATTR(fan7_div,   0644, show_fan_div, store_fan_div, 6),
+       SENSOR_ATTR(fan7_alarm, 0444, show_fan_alarm, NULL, 6),
+       SENSOR_ATTR(fan7_fault, 0444, show_fan_fault, NULL, 6),
+       SENSOR_ATTR(pwm7_auto_point1_pwm, 0644, show_pwm_auto_point1_pwm,
+               store_pwm_auto_point1_pwm, 6),
 };
 
 
@@ -624,10 +696,11 @@ static int watchdog_set_timeout(struct fschmd_data *data, int timeout)
        data->watchdog_preset = DIV_ROUND_UP(timeout, resolution);
 
        /* Write new timeout value */
-       i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_PRESET,
-               data->watchdog_preset);
+       i2c_smbus_write_byte_data(data->client,
+               FSCHMD_REG_WDOG_PRESET[data->kind], data->watchdog_preset);
        /* Write new control register, do not trigger! */
-       i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
+       i2c_smbus_write_byte_data(data->client,
+               FSCHMD_REG_WDOG_CONTROL[data->kind],
                data->watchdog_control & ~FSCHMD_WDOG_CONTROL_TRIGGER);
 
        ret = data->watchdog_preset * resolution;
@@ -662,8 +735,9 @@ static int watchdog_trigger(struct fschmd_data *data)
        }
 
        data->watchdog_control |= FSCHMD_WDOG_CONTROL_TRIGGER;
-       i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
-                                       data->watchdog_control);
+       i2c_smbus_write_byte_data(data->client,
+                                 FSCHMD_REG_WDOG_CONTROL[data->kind],
+                                 data->watchdog_control);
 leave:
        mutex_unlock(&data->watchdog_lock);
        return ret;
@@ -682,7 +756,8 @@ static int watchdog_stop(struct fschmd_data *data)
        data->watchdog_control &= ~FSCHMD_WDOG_CONTROL_STARTED;
        /* Don't store the stop flag in our watchdog control register copy, as
           its a write only bit (read always returns 0) */
-       i2c_smbus_write_byte_data(data->client, FSCHMD_REG_WDOG_CONTROL,
+       i2c_smbus_write_byte_data(data->client,
+               FSCHMD_REG_WDOG_CONTROL[data->kind],
                data->watchdog_control | FSCHMD_WDOG_CONTROL_STOP);
 leave:
        mutex_unlock(&data->watchdog_lock);
@@ -856,7 +931,7 @@ static struct file_operations watchdog_fops = {
 
 /* DMI decode routine to read voltage scaling factors from special DMI tables,
    which are available on FSC machines with an fscher or later chip. */
-static void fschmd_dmi_decode(const struct dmi_header *header)
+static void fschmd_dmi_decode(const struct dmi_header *header, void *dummy)
 {
        int i, mult[3] = { 0 }, offset[3] = { 0 }, vref = 0, found = 0;
 
@@ -912,6 +987,15 @@ static void fschmd_dmi_decode(const struct dmi_header *header)
                        dmi_mult[i] = mult[i] * 10;
                        dmi_offset[i] = offset[i] * 10;
                }
+               /* According to the docs there should be separate dmi entries
+                  for the mult's and offsets of in3-5 of the syl, but on
+                  my test machine these are not present */
+               dmi_mult[3] = dmi_mult[2];
+               dmi_mult[4] = dmi_mult[1];
+               dmi_mult[5] = dmi_mult[2];
+               dmi_offset[3] = dmi_offset[2];
+               dmi_offset[4] = dmi_offset[1];
+               dmi_offset[5] = dmi_offset[2];
                dmi_vref = vref;
        }
 }
@@ -920,8 +1004,6 @@ static int fschmd_detect(struct i2c_client *client, int kind,
                         struct i2c_board_info *info)
 {
        struct i2c_adapter *adapter = client->adapter;
-       const char * const client_names[5] = { "fscpos", "fscher", "fscscy",
-                                               "fschrc", "fschmd" };
 
        if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
                return -ENODEV;
@@ -948,11 +1030,15 @@ static int fschmd_detect(struct i2c_client *client, int kind,
                        kind = fschrc;
                else if (!strcmp(id, "HMD"))
                        kind = fschmd;
+               else if (!strcmp(id, "HDS"))
+                       kind = fschds;
+               else if (!strcmp(id, "SYL"))
+                       kind = fscsyl;
                else
                        return -ENODEV;
        }
 
-       strlcpy(info->type, client_names[kind - 1], I2C_NAME_SIZE);
+       strlcpy(info->type, fschmd_id[kind - 1].name, I2C_NAME_SIZE);
 
        return 0;
 }
@@ -961,8 +1047,8 @@ static int fschmd_probe(struct i2c_client *client,
                        const struct i2c_device_id *id)
 {
        struct fschmd_data *data;
-       const char * const names[5] = { "Poseidon", "Hermes", "Scylla",
-                                       "Heracles", "Heimdall" };
+       const char * const names[7] = { "Poseidon", "Hermes", "Scylla",
+                               "Heracles", "Heimdall", "Hades", "Syleus" };
        const int watchdog_minors[] = { WATCHDOG_MINOR, 212, 213, 214, 215 };
        int i, err;
        enum chips kind = id->driver_data;
@@ -991,7 +1077,7 @@ static int fschmd_probe(struct i2c_client *client,
 
        /* Read the special DMI table for fscher and newer chips */
        if ((kind == fscher || kind >= fschrc) && dmi_vref == -1) {
-               dmi_walk(fschmd_dmi_decode);
+               dmi_walk(fschmd_dmi_decode, NULL);
                if (dmi_vref == -1) {
                        dev_warn(&client->dev,
                                "Couldn't get voltage scaling factors from "
@@ -1000,21 +1086,25 @@ static int fschmd_probe(struct i2c_client *client,
                }
        }
 
+       /* i2c kind goes from 1-6, we want from 0-5 to address arrays */
+       data->kind = kind - 1;
+
        /* Read in some never changing registers */
        data->revision = i2c_smbus_read_byte_data(client, FSCHMD_REG_REVISION);
        data->global_control = i2c_smbus_read_byte_data(client,
                                        FSCHMD_REG_CONTROL);
        data->watchdog_control = i2c_smbus_read_byte_data(client,
-                                       FSCHMD_REG_WDOG_CONTROL);
+                                       FSCHMD_REG_WDOG_CONTROL[data->kind]);
        data->watchdog_state = i2c_smbus_read_byte_data(client,
-                                       FSCHMD_REG_WDOG_STATE);
+                                       FSCHMD_REG_WDOG_STATE[data->kind]);
        data->watchdog_preset = i2c_smbus_read_byte_data(client,
-                                       FSCHMD_REG_WDOG_PRESET);
+                                       FSCHMD_REG_WDOG_PRESET[data->kind]);
 
-       /* i2c kind goes from 1-5, we want from 0-4 to address arrays */
-       data->kind = kind - 1;
+       err = device_create_file(&client->dev, &dev_attr_alert_led);
+       if (err)
+               goto exit_detach;
 
-       for (i = 0; i < ARRAY_SIZE(fschmd_attr); i++) {
+       for (i = 0; i < FSCHMD_NO_VOLT_SENSORS[data->kind]; i++) {
                err = device_create_file(&client->dev,
                                        &fschmd_attr[i].dev_attr);
                if (err)
@@ -1027,6 +1117,16 @@ static int fschmd_probe(struct i2c_client *client,
                                show_temp_max)
                        continue;
 
+               if (kind == fscsyl) {
+                       if (i % 4 == 0)
+                               data->temp_status[i / 4] =
+                                       i2c_smbus_read_byte_data(client,
+                                               FSCHMD_REG_TEMP_STATE
+                                               [data->kind][i / 4]);
+                       if (data->temp_status[i / 4] & FSCHMD_TEMP_DISABLED)
+                               continue;
+               }
+
                err = device_create_file(&client->dev,
                                        &fschmd_temp_attr[i].dev_attr);
                if (err)
@@ -1040,6 +1140,16 @@ static int fschmd_probe(struct i2c_client *client,
                                        "pwm3_auto_point1_pwm"))
                        continue;
 
+               if (kind == fscsyl) {
+                       if (i % 5 == 0)
+                               data->fan_status[i / 5] =
+                                       i2c_smbus_read_byte_data(client,
+                                               FSCHMD_REG_FAN_STATE
+                                               [data->kind][i / 5]);
+                       if (data->fan_status[i / 5] & FSCHMD_FAN_DISABLED)
+                               continue;
+               }
+
                err = device_create_file(&client->dev,
                                        &fschmd_fan_attr[i].dev_attr);
                if (err)
@@ -1126,7 +1236,8 @@ static int fschmd_remove(struct i2c_client *client)
        if (data->hwmon_dev)
                hwmon_device_unregister(data->hwmon_dev);
 
-       for (i = 0; i < ARRAY_SIZE(fschmd_attr); i++)
+       device_remove_file(&client->dev, &dev_attr_alert_led);
+       for (i = 0; i < (FSCHMD_NO_VOLT_SENSORS[data->kind]); i++)
                device_remove_file(&client->dev, &fschmd_attr[i].dev_attr);
        for (i = 0; i < (FSCHMD_NO_TEMP_SENSORS[data->kind] * 4); i++)
                device_remove_file(&client->dev,
@@ -1171,7 +1282,7 @@ static struct fschmd_data *fschmd_update_device(struct device *dev)
                                        data->temp_act[i] < data->temp_max[i])
                                i2c_smbus_write_byte_data(client,
                                        FSCHMD_REG_TEMP_STATE[data->kind][i],
-                                       FSCHMD_TEMP_ALERT);
+                                       data->temp_status[i]);
                }
 
                for (i = 0; i < FSCHMD_NO_FAN_SENSORS[data->kind]; i++) {
@@ -1193,12 +1304,12 @@ static struct fschmd_data *fschmd_update_device(struct device *dev)
                                        data->fan_act[i])
                                i2c_smbus_write_byte_data(client,
                                        FSCHMD_REG_FAN_STATE[data->kind][i],
-                                       FSCHMD_FAN_ALARM);
+                                       data->fan_status[i]);
                }
 
-               for (i = 0; i < 3; i++)
+               for (i = 0; i < FSCHMD_NO_VOLT_SENSORS[data->kind]; i++)
                        data->volt[i] = i2c_smbus_read_byte_data(client,
-                                               FSCHMD_REG_VOLT[i]);
+                                              FSCHMD_REG_VOLT[data->kind][i]);
 
                data->last_updated = jiffies;
                data->valid = 1;
@@ -1220,8 +1331,8 @@ static void __exit fschmd_exit(void)
 }
 
 MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
-MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles and "
-                       "Heimdall driver");
+MODULE_DESCRIPTION("FSC Poseidon, Hermes, Scylla, Heracles, Heimdall, Hades "
+                       "and Syleus driver");
 MODULE_LICENSE("GPL");
 
 module_init(fschmd_init);
index a4d92d246d52620e1efb09288df69fdcbf352303..d3612a1f198135d1a719428fc5f77e417674e671 100644 (file)
 #define HDAPS_INPUT_FUZZ       4       /* input event threshold */
 #define HDAPS_INPUT_FLAT       4
 
+#define HDAPS_X_AXIS           (1 << 0)
+#define HDAPS_Y_AXIS           (1 << 1)
+#define HDAPS_BOTH_AXES                (HDAPS_X_AXIS | HDAPS_Y_AXIS)
+
 static struct platform_device *pdev;
 static struct input_polled_dev *hdaps_idev;
 static unsigned int hdaps_invert;
@@ -182,11 +186,11 @@ static int __hdaps_read_pair(unsigned int port1, unsigned int port2,
        km_activity = inb(HDAPS_PORT_KMACT);
        __device_complete();
 
-       /* if hdaps_invert is set, negate the two values */
-       if (hdaps_invert) {
+       /* hdaps_invert is a bitvector to negate the axes */
+       if (hdaps_invert & HDAPS_X_AXIS)
                *x = -*x;
+       if (hdaps_invert & HDAPS_Y_AXIS)
                *y = -*y;
-       }
 
        return 0;
 }
@@ -436,7 +440,8 @@ static ssize_t hdaps_invert_store(struct device *dev,
 {
        int invert;
 
-       if (sscanf(buf, "%d", &invert) != 1 || (invert != 1 && invert != 0))
+       if (sscanf(buf, "%d", &invert) != 1 ||
+           invert < 0 || invert > HDAPS_BOTH_AXES)
                return -EINVAL;
 
        hdaps_invert = invert;
@@ -483,56 +488,52 @@ static int __init hdaps_dmi_match(const struct dmi_system_id *id)
 /* hdaps_dmi_match_invert - found an inverted match. */
 static int __init hdaps_dmi_match_invert(const struct dmi_system_id *id)
 {
-       hdaps_invert = 1;
-       printk(KERN_INFO "hdaps: inverting axis readings.\n");
+       hdaps_invert = (unsigned long)id->driver_data;
+       printk(KERN_INFO "hdaps: inverting axis (%u) readings.\n",
+              hdaps_invert);
        return hdaps_dmi_match(id);
 }
 
-#define HDAPS_DMI_MATCH_NORMAL(vendor, model) {                \
-       .ident = vendor " " model,                      \
-       .callback = hdaps_dmi_match,                    \
-       .matches = {                                    \
-               DMI_MATCH(DMI_BOARD_VENDOR, vendor),    \
-               DMI_MATCH(DMI_PRODUCT_VERSION, model)   \
-       }                                               \
-}
-
-#define HDAPS_DMI_MATCH_INVERT(vendor, model) {                \
+#define HDAPS_DMI_MATCH_INVERT(vendor, model, axes) {  \
        .ident = vendor " " model,                      \
        .callback = hdaps_dmi_match_invert,             \
+       .driver_data = (void *)axes,                    \
        .matches = {                                    \
                DMI_MATCH(DMI_BOARD_VENDOR, vendor),    \
                DMI_MATCH(DMI_PRODUCT_VERSION, model)   \
        }                                               \
 }
 
+#define HDAPS_DMI_MATCH_NORMAL(vendor, model)          \
+       HDAPS_DMI_MATCH_INVERT(vendor, model, 0)
+
 /* Note that HDAPS_DMI_MATCH_NORMAL("ThinkPad T42") would match
    "ThinkPad T42p", so the order of the entries matters.
    If your ThinkPad is not recognized, please update to latest
    BIOS. This is especially the case for some R52 ThinkPads. */
 static struct dmi_system_id __initdata hdaps_whitelist[] = {
-       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p"),
+       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad R50p", HDAPS_BOTH_AXES),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R50"),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R51"),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad R52"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61"),
-       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p"),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61i", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad R61", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T41p", HDAPS_BOTH_AXES),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T41"),
-       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p"),
+       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad T42p", HDAPS_BOTH_AXES),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T42"),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad T43"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T60"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T61p"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T61"),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T60", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T61p", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad T61", HDAPS_BOTH_AXES),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X40"),
-       HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad X41"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X60"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X61s"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X61"),
+       HDAPS_DMI_MATCH_INVERT("IBM", "ThinkPad X41", HDAPS_Y_AXIS),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X60", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X61s", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad X61", HDAPS_BOTH_AXES),
        HDAPS_DMI_MATCH_NORMAL("IBM", "ThinkPad Z60m"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad Z61m"),
-       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad Z61p"),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad Z61m", HDAPS_BOTH_AXES),
+       HDAPS_DMI_MATCH_INVERT("LENOVO", "ThinkPad Z61p", HDAPS_BOTH_AXES),
        { .ident = NULL }
 };
 
@@ -627,8 +628,9 @@ static void __exit hdaps_exit(void)
 module_init(hdaps_init);
 module_exit(hdaps_exit);
 
-module_param_named(invert, hdaps_invert, bool, 0);
-MODULE_PARM_DESC(invert, "invert data along each axis");
+module_param_named(invert, hdaps_invert, int, 0);
+MODULE_PARM_DESC(invert, "invert data along each axis. 1 invert x-axis, "
+                "2 invert y-axis, 3 invert both axes.");
 
 MODULE_AUTHOR("Robert Love");
 MODULE_DESCRIPTION("IBM Hard Drive Active Protection System (HDAPS) driver");
similarity index 96%
rename from drivers/i2c/chips/pcf8591.c
rename to drivers/hwmon/pcf8591.c
index 16ce3e193776a673b47efbf7af6e50a68878553f..1d7ffebd679d0cce6f25c9e1946d7e9739c1b4b5 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2001-2004 Aurelien Jarno <aurelien@aurel32.net>
-    Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with 
+    Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
     the help of Jean Delvare <khali@linux-fr.org>
 
     This program is free software; you can redistribute it and/or modify
@@ -41,13 +41,13 @@ MODULE_PARM_DESC(input_mode,
        " 3 = two differential inputs\n");
 
 /* The PCF8591 control byte
-      7    6    5    4    3    2    1    0  
+      7    6    5    4    3    2    1    0
    |  0 |AOEF|   AIP   |  0 |AINC|  AICH   | */
 
 /* Analog Output Enable Flag (analog output active if 1) */
 #define PCF8591_CONTROL_AOEF           0x40
-                                       
-/* Analog Input Programming 
+
+/* Analog Input Programming
    0x00 = four single ended inputs
    0x10 = three differential inputs
    0x20 = single ended and differential mixed
@@ -58,7 +58,7 @@ MODULE_PARM_DESC(input_mode,
 #define PCF8591_CONTROL_AINC           0x04
 
 /* Channel selection
-   0x00 = channel 0 
+   0x00 = channel 0
    0x01 = channel 1
    0x02 = channel 2
    0x03 = channel 3 */
@@ -114,7 +114,7 @@ static ssize_t set_out0_output(struct device *dev, struct device_attribute *attr
        return -EINVAL;
 }
 
-static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, 
+static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO,
                   show_out0_ouput, set_out0_output);
 
 static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf)
@@ -139,7 +139,7 @@ static ssize_t set_out0_enable(struct device *dev, struct device_attribute *attr
        return count;
 }
 
-static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, 
+static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO,
                   show_out0_enable, set_out0_enable);
 
 static struct attribute *pcf8591_attributes[] = {
@@ -196,7 +196,7 @@ static int pcf8591_probe(struct i2c_client *client,
                err = -ENOMEM;
                goto exit;
        }
-       
+
        i2c_set_clientdata(client, data);
        mutex_init(&data->update_lock);
 
@@ -249,8 +249,8 @@ static void pcf8591_init_client(struct i2c_client *client)
        data->aout = PCF8591_INIT_AOUT;
 
        i2c_smbus_write_byte_data(client, data->control, data->aout);
-       
-       /* The first byte transmitted contains the conversion code of the 
+
+       /* The first byte transmitted contains the conversion code of the
           previous read cycle. FLUSH IT! */
        i2c_smbus_read_byte(client);
 }
@@ -267,8 +267,8 @@ static int pcf8591_read_channel(struct device *dev, int channel)
                data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK)
                              | channel;
                i2c_smbus_write_byte(client, data->control);
-       
-               /* The first byte transmitted contains the conversion code of 
+
+               /* The first byte transmitted contains the conversion code of
                   the previous read cycle. FLUSH IT! */
                i2c_smbus_read_byte(client);
        }
index feae743ba99163c2475b0f51663c89fc7e7f1375..e64b42058b219772d0c28ecf0a8780f8ef7ea1ab 100644 (file)
@@ -36,6 +36,7 @@
     w83627ehf   10      5       4       3      0x8850 0x88    0x5ca3
                                                0x8860 0xa1
     w83627dhg    9      5       4       3      0xa020 0xc1    0x5ca3
+    w83667hg     9      5       3       3      0xa510 0xc1    0x5ca3
 */
 
 #include <linux/module.h>
 #include <asm/io.h>
 #include "lm75.h"
 
-enum kinds { w83627ehf, w83627dhg };
+enum kinds { w83627ehf, w83627dhg, w83667hg };
 
 /* used to set data->name = w83627ehf_device_names[data->sio_kind] */
 static const char * w83627ehf_device_names[] = {
        "w83627ehf",
        "w83627dhg",
+       "w83667hg",
 };
 
 static unsigned short force_id;
@@ -71,6 +73,7 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID");
  */
 
 #define W83627EHF_LD_HWM       0x0b
+#define W83667HG_LD_VID        0x0d
 
 #define SIO_REG_LDSEL          0x07    /* Logical device select */
 #define SIO_REG_DEVID          0x20    /* Device ID (2 bytes) */
@@ -83,6 +86,7 @@ MODULE_PARM_DESC(force_id, "Override the detected device ID");
 #define SIO_W83627EHF_ID       0x8850
 #define SIO_W83627EHG_ID       0x8860
 #define SIO_W83627DHG_ID       0xa020
+#define SIO_W83667HG_ID        0xa510
 #define SIO_ID_MASK            0xFFF0
 
 static inline void
@@ -289,6 +293,7 @@ struct w83627ehf_data {
        u8 pwm_mode[4]; /* 0->DC variable voltage, 1->PWM variable duty cycle */
        u8 pwm_enable[4]; /* 1->manual
                             2->thermal cruise (also called SmartFan I) */
+       u8 pwm_num;             /* number of pwm */
        u8 pwm[4];
        u8 target_temp[4];
        u8 tolerance[4];
@@ -298,6 +303,9 @@ struct w83627ehf_data {
 
        u8 vid;
        u8 vrm;
+
+       u8 temp3_disable;
+       u8 in6_skip;
 };
 
 struct w83627ehf_sio_data {
@@ -866,25 +874,37 @@ show_temp_type(struct device *dev, struct device_attribute *attr, char *buf)
        return sprintf(buf, "%d\n", (int)data->temp_type[nr]);
 }
 
-static struct sensor_device_attribute sda_temp[] = {
+static struct sensor_device_attribute sda_temp_input[] = {
        SENSOR_ATTR(temp1_input, S_IRUGO, show_temp1, NULL, 0),
        SENSOR_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 0),
        SENSOR_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 1),
+};
+
+static struct sensor_device_attribute sda_temp_max[] = {
        SENSOR_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp1_max,
                    store_temp1_max, 0),
        SENSOR_ATTR(temp2_max, S_IRUGO | S_IWUSR, show_temp_max,
                    store_temp_max, 0),
        SENSOR_ATTR(temp3_max, S_IRUGO | S_IWUSR, show_temp_max,
                    store_temp_max, 1),
+};
+
+static struct sensor_device_attribute sda_temp_max_hyst[] = {
        SENSOR_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR, show_temp1_max_hyst,
                    store_temp1_max_hyst, 0),
        SENSOR_ATTR(temp2_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
                    store_temp_max_hyst, 0),
        SENSOR_ATTR(temp3_max_hyst, S_IRUGO | S_IWUSR, show_temp_max_hyst,
                    store_temp_max_hyst, 1),
+};
+
+static struct sensor_device_attribute sda_temp_alarm[] = {
        SENSOR_ATTR(temp1_alarm, S_IRUGO, show_alarm, NULL, 4),
        SENSOR_ATTR(temp2_alarm, S_IRUGO, show_alarm, NULL, 5),
        SENSOR_ATTR(temp3_alarm, S_IRUGO, show_alarm, NULL, 13),
+};
+
+static struct sensor_device_attribute sda_temp_type[] = {
        SENSOR_ATTR(temp1_type, S_IRUGO, show_temp_type, NULL, 0),
        SENSOR_ATTR(temp2_type, S_IRUGO, show_temp_type, NULL, 1),
        SENSOR_ATTR(temp3_type, S_IRUGO, show_temp_type, NULL, 2),
@@ -1181,6 +1201,8 @@ static void w83627ehf_device_remove_files(struct device *dev)
        for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++)
                device_remove_file(dev, &sda_sf3_arrays_fan4[i].dev_attr);
        for (i = 0; i < data->in_num; i++) {
+               if ((i == 6) && data->in6_skip)
+                       continue;
                device_remove_file(dev, &sda_in_input[i].dev_attr);
                device_remove_file(dev, &sda_in_alarm[i].dev_attr);
                device_remove_file(dev, &sda_in_min[i].dev_attr);
@@ -1192,15 +1214,22 @@ static void w83627ehf_device_remove_files(struct device *dev)
                device_remove_file(dev, &sda_fan_div[i].dev_attr);
                device_remove_file(dev, &sda_fan_min[i].dev_attr);
        }
-       for (i = 0; i < 4; i++) {
+       for (i = 0; i < data->pwm_num; i++) {
                device_remove_file(dev, &sda_pwm[i].dev_attr);
                device_remove_file(dev, &sda_pwm_mode[i].dev_attr);
                device_remove_file(dev, &sda_pwm_enable[i].dev_attr);
                device_remove_file(dev, &sda_target_temp[i].dev_attr);
                device_remove_file(dev, &sda_tolerance[i].dev_attr);
        }
-       for (i = 0; i < ARRAY_SIZE(sda_temp); i++)
-               device_remove_file(dev, &sda_temp[i].dev_attr);
+       for (i = 0; i < 3; i++) {
+               if ((i == 2) && data->temp3_disable)
+                       continue;
+               device_remove_file(dev, &sda_temp_input[i].dev_attr);
+               device_remove_file(dev, &sda_temp_max[i].dev_attr);
+               device_remove_file(dev, &sda_temp_max_hyst[i].dev_attr);
+               device_remove_file(dev, &sda_temp_alarm[i].dev_attr);
+               device_remove_file(dev, &sda_temp_type[i].dev_attr);
+       }
 
        device_remove_file(dev, &dev_attr_name);
        device_remove_file(dev, &dev_attr_cpu0_vid);
@@ -1222,6 +1251,8 @@ static inline void __devinit w83627ehf_init_device(struct w83627ehf_data *data)
        for (i = 0; i < 2; i++) {
                tmp = w83627ehf_read_value(data,
                                           W83627EHF_REG_TEMP_CONFIG[i]);
+               if ((i == 1) && data->temp3_disable)
+                       continue;
                if (tmp & 0x01)
                        w83627ehf_write_value(data,
                                              W83627EHF_REG_TEMP_CONFIG[i],
@@ -1272,8 +1303,17 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
        data->name = w83627ehf_device_names[sio_data->kind];
        platform_set_drvdata(pdev, data);
 
-       /* 627EHG and 627EHF have 10 voltage inputs; DHG has 9 */
-       data->in_num = (sio_data->kind == w83627dhg) ? 9 : 10;
+       /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
+       data->in_num = (sio_data->kind == w83627ehf) ? 10 : 9;
+       /* 667HG has 3 pwms */
+       data->pwm_num = (sio_data->kind == w83667hg) ? 3 : 4;
+
+       /* Check temp3 configuration bit for 667HG */
+       if (sio_data->kind == w83667hg) {
+               data->temp3_disable = w83627ehf_read_value(data,
+                                       W83627EHF_REG_TEMP_CONFIG[1]) & 0x01;
+               data->in6_skip = !data->temp3_disable;
+       }
 
        /* Initialize the chip */
        w83627ehf_init_device(data);
@@ -1281,44 +1321,64 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
        data->vrm = vid_which_vrm();
        superio_enter(sio_data->sioreg);
        /* Read VID value */
-       superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
-       if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) {
-               /* Set VID input sensibility if needed. In theory the BIOS
-                  should have set it, but in practice it's not always the
-                  case. We only do it for the W83627EHF/EHG because the
-                  W83627DHG is more complex in this respect. */
-               if (sio_data->kind == w83627ehf) {
-                       en_vrm10 = superio_inb(sio_data->sioreg,
-                                              SIO_REG_EN_VRM10);
-                       if ((en_vrm10 & 0x08) && data->vrm == 90) {
-                               dev_warn(dev, "Setting VID input voltage to "
-                                        "TTL\n");
-                               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
-                                            en_vrm10 & ~0x08);
-                       } else if (!(en_vrm10 & 0x08) && data->vrm == 100) {
-                               dev_warn(dev, "Setting VID input voltage to "
-                                        "VRM10\n");
-                               superio_outb(sio_data->sioreg, SIO_REG_EN_VRM10,
-                                            en_vrm10 | 0x08);
-                       }
-               }
-
-               data->vid = superio_inb(sio_data->sioreg, SIO_REG_VID_DATA);
-               if (sio_data->kind == w83627ehf) /* 6 VID pins only */
-                       data->vid &= 0x3f;
-
+       if (sio_data->kind == w83667hg) {
+               /* W83667HG has different pins for VID input and output, so
+               we can get the VID input values directly at logical device D
+               0xe3. */
+               superio_select(sio_data->sioreg, W83667HG_LD_VID);
+               data->vid = superio_inb(sio_data->sioreg, 0xe3);
                err = device_create_file(dev, &dev_attr_cpu0_vid);
                if (err)
                        goto exit_release;
        } else {
-               dev_info(dev, "VID pins in output mode, CPU VID not "
-                        "available\n");
+               superio_select(sio_data->sioreg, W83627EHF_LD_HWM);
+               if (superio_inb(sio_data->sioreg, SIO_REG_VID_CTRL) & 0x80) {
+                       /* Set VID input sensibility if needed. In theory the
+                          BIOS should have set it, but in practice it's not
+                          always the case. We only do it for the W83627EHF/EHG
+                          because the W83627DHG is more complex in this
+                          respect. */
+                       if (sio_data->kind == w83627ehf) {
+                               en_vrm10 = superio_inb(sio_data->sioreg,
+                                                      SIO_REG_EN_VRM10);
+                               if ((en_vrm10 & 0x08) && data->vrm == 90) {
+                                       dev_warn(dev, "Setting VID input "
+                                                "voltage to TTL\n");
+                                       superio_outb(sio_data->sioreg,
+                                                    SIO_REG_EN_VRM10,
+                                                    en_vrm10 & ~0x08);
+                               } else if (!(en_vrm10 & 0x08)
+                                          && data->vrm == 100) {
+                                       dev_warn(dev, "Setting VID input "
+                                                "voltage to VRM10\n");
+                                       superio_outb(sio_data->sioreg,
+                                                    SIO_REG_EN_VRM10,
+                                                    en_vrm10 | 0x08);
+                               }
+                       }
+
+                       data->vid = superio_inb(sio_data->sioreg,
+                                               SIO_REG_VID_DATA);
+                       if (sio_data->kind == w83627ehf) /* 6 VID pins only */
+                               data->vid &= 0x3f;
+
+                       err = device_create_file(dev, &dev_attr_cpu0_vid);
+                       if (err)
+                               goto exit_release;
+               } else {
+                       dev_info(dev, "VID pins in output mode, CPU VID not "
+                                "available\n");
+               }
        }
 
        /* fan4 and fan5 share some pins with the GPIO and serial flash */
-
-       fan5pin = superio_inb(sio_data->sioreg, 0x24) & 0x2;
-       fan4pin = superio_inb(sio_data->sioreg, 0x29) & 0x6;
+       if (sio_data->kind == w83667hg) {
+               fan5pin = superio_inb(sio_data->sioreg, 0x27) & 0x20;
+               fan4pin = superio_inb(sio_data->sioreg, 0x27) & 0x40;
+       } else {
+               fan5pin = !(superio_inb(sio_data->sioreg, 0x24) & 0x02);
+               fan4pin = !(superio_inb(sio_data->sioreg, 0x29) & 0x06);
+       }
        superio_exit(sio_data->sioreg);
 
        /* It looks like fan4 and fan5 pins can be alternatively used
@@ -1329,9 +1389,9 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
 
        data->has_fan = 0x07; /* fan1, fan2 and fan3 */
        i = w83627ehf_read_value(data, W83627EHF_REG_FANDIV1);
-       if ((i & (1 << 2)) && (!fan4pin))
+       if ((i & (1 << 2)) && fan4pin)
                data->has_fan |= (1 << 3);
-       if (!(i & (1 << 1)) && (!fan5pin))
+       if (!(i & (1 << 1)) && fan5pin)
                data->has_fan |= (1 << 4);
 
        /* Read fan clock dividers immediately */
@@ -1344,14 +1404,16 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
                        goto exit_remove;
 
        /* if fan4 is enabled create the sf3 files for it */
-       if (data->has_fan & (1 << 3))
+       if ((data->has_fan & (1 << 3)) && data->pwm_num >= 4)
                for (i = 0; i < ARRAY_SIZE(sda_sf3_arrays_fan4); i++) {
                        if ((err = device_create_file(dev,
                                &sda_sf3_arrays_fan4[i].dev_attr)))
                                goto exit_remove;
                }
 
-       for (i = 0; i < data->in_num; i++)
+       for (i = 0; i < data->in_num; i++) {
+               if ((i == 6) && data->in6_skip)
+                       continue;
                if ((err = device_create_file(dev, &sda_in_input[i].dev_attr))
                        || (err = device_create_file(dev,
                                &sda_in_alarm[i].dev_attr))
@@ -1360,6 +1422,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
                        || (err = device_create_file(dev,
                                &sda_in_max[i].dev_attr)))
                        goto exit_remove;
+       }
 
        for (i = 0; i < 5; i++) {
                if (data->has_fan & (1 << i)) {
@@ -1372,7 +1435,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
                                || (err = device_create_file(dev,
                                        &sda_fan_min[i].dev_attr)))
                                goto exit_remove;
-                       if (i < 4 && /* w83627ehf only has 4 pwm */
+                       if (i < data->pwm_num &&
                                ((err = device_create_file(dev,
                                        &sda_pwm[i].dev_attr))
                                || (err = device_create_file(dev,
@@ -1387,9 +1450,21 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev)
                }
        }
 
-       for (i = 0; i < ARRAY_SIZE(sda_temp); i++)
-               if ((err = device_create_file(dev, &sda_temp[i].dev_attr)))
+       for (i = 0; i < 3; i++) {
+               if ((i == 2) && data->temp3_disable)
+                       continue;
+               if ((err = device_create_file(dev,
+                               &sda_temp_input[i].dev_attr))
+                       || (err = device_create_file(dev,
+                               &sda_temp_max[i].dev_attr))
+                       || (err = device_create_file(dev,
+                               &sda_temp_max_hyst[i].dev_attr))
+                       || (err = device_create_file(dev,
+                               &sda_temp_alarm[i].dev_attr))
+                       || (err = device_create_file(dev,
+                               &sda_temp_type[i].dev_attr)))
                        goto exit_remove;
+       }
 
        err = device_create_file(dev, &dev_attr_name);
        if (err)
@@ -1442,6 +1517,7 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
        static const char __initdata sio_name_W83627EHF[] = "W83627EHF";
        static const char __initdata sio_name_W83627EHG[] = "W83627EHG";
        static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
+       static const char __initdata sio_name_W83667HG[] = "W83667HG";
 
        u16 val;
        const char *sio_name;
@@ -1466,6 +1542,10 @@ static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
                sio_data->kind = w83627dhg;
                sio_name = sio_name_W83627DHG;
                break;
+       case SIO_W83667HG_ID:
+               sio_data->kind = w83667hg;
+               sio_name = sio_name_W83667HG;
+               break;
        default:
                if (val != 0xffff)
                        pr_debug(DRVNAME ": unsupported chip ID: 0x%04x\n",
index 230238df56c4d238d3fd4e9d184c7e1d1f608968..10411848fd704f58e790cc3587a92e07bd6f22c6 100644 (file)
@@ -65,6 +65,7 @@
 #include <linux/i2c.h>
 #include <linux/acpi.h>
 #include <linux/io.h>
+#include <linux/dmi.h>
 
 /* I801 SMBus address offsets */
 #define SMBHSTSTS      (0 + i801_smba)
@@ -616,10 +617,81 @@ static void __init input_apanel_init(void)
 static void __init input_apanel_init(void) {}
 #endif
 
+#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
+struct dmi_onboard_device_info {
+       const char *name;
+       u8 type;
+       unsigned short i2c_addr;
+       const char *i2c_type;
+};
+
+static struct dmi_onboard_device_info __devinitdata dmi_devices[] = {
+       { "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" },
+       { "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" },
+       { "Hades",  DMI_DEV_TYPE_OTHER, 0x73, "fschds" },
+};
+
+static void __devinit dmi_check_onboard_device(u8 type, const char *name,
+                                              struct i2c_adapter *adap)
+{
+       int i;
+       struct i2c_board_info info;
+
+       for (i = 0; i < ARRAY_SIZE(dmi_devices); i++) {
+               /* & ~0x80, ignore enabled/disabled bit */
+               if ((type & ~0x80) != dmi_devices[i].type)
+                       continue;
+               if (strcmp(name, dmi_devices[i].name))
+                       continue;
+
+               memset(&info, 0, sizeof(struct i2c_board_info));
+               info.addr = dmi_devices[i].i2c_addr;
+               strlcpy(info.type, dmi_devices[i].i2c_type, I2C_NAME_SIZE);
+               i2c_new_device(adap, &info);
+               break;
+       }
+}
+
+/* We use our own function to check for onboard devices instead of
+   dmi_find_device() as some buggy BIOS's have the devices we are interested
+   in marked as disabled */
+static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
+                                               void *adap)
+{
+       int i, count;
+
+       if (dm->type != 10)
+               return;
+
+       count = (dm->length - sizeof(struct dmi_header)) / 2;
+       for (i = 0; i < count; i++) {
+               const u8 *d = (char *)(dm + 1) + (i * 2);
+               const char *name = ((char *) dm) + dm->length;
+               u8 type = d[0];
+               u8 s = d[1];
+
+               if (!s)
+                       continue;
+               s--;
+               while (s > 0 && name[0]) {
+                       name += strlen(name) + 1;
+                       s--;
+               }
+               if (name[0] == 0) /* Bogus string reference */
+                       continue;
+
+               dmi_check_onboard_device(type, name, adap);
+       }
+}
+#endif
+
 static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        unsigned char temp;
        int err;
+#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
+       const char *vendor;
+#endif
 
        I801_dev = dev;
        i801_features = 0;
@@ -712,6 +784,11 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id
                i2c_new_device(&i801_adapter, &info);
        }
 #endif
+#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
+       vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
+       if (vendor && !strcmp(vendor, "FUJITSU SIEMENS"))
+               dmi_walk(dmi_check_onboard_devices, &i801_adapter);
+#endif
 
        return 0;
 
index c80312c1f38278051f7209745bf170f5d4f35b4e..8f8c81eb0aee750006a7949ed530d10a4257503c 100644 (file)
@@ -64,19 +64,6 @@ config SENSORS_PCA9539
          This driver is deprecated and will be dropped soon. Use
          drivers/gpio/pca953x.c instead.
 
-config SENSORS_PCF8591
-       tristate "Philips PCF8591"
-       depends on EXPERIMENTAL
-       default n
-       help
-         If you say yes here you get support for Philips PCF8591 chips.
-
-         This driver can also be built as a module.  If so, the module
-         will be called pcf8591.
-
-         These devices are hard to detect and rarely found on mainstream
-         hardware.  If unsure, say N.
-
 config SENSORS_MAX6875
        tristate "Maxim MAX6875 Power supply supervisor"
        depends on EXPERIMENTAL
index d142f238a2de43f8af6169811b9a64e86803a9a2..55a37603718332dcceab0ef5c90f38a6cb054a8e 100644 (file)
@@ -15,7 +15,6 @@ obj-$(CONFIG_SENSORS_MAX6875) += max6875.o
 obj-$(CONFIG_SENSORS_PCA9539)  += pca9539.o
 obj-$(CONFIG_SENSORS_PCF8574)  += pcf8574.o
 obj-$(CONFIG_PCF8575)          += pcf8575.o
-obj-$(CONFIG_SENSORS_PCF8591)  += pcf8591.o
 obj-$(CONFIG_SENSORS_TSL2550)  += tsl2550.o
 
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
index 1730d7331a5dff13a6841fd0009066f49cde6666..ec3db3ade1182b01ef663a946c85de10efa54023 100644 (file)
@@ -903,8 +903,6 @@ static int __init input_proc_init(void)
        if (!proc_bus_input_dir)
                return -ENOMEM;
 
-       proc_bus_input_dir->owner = THIS_MODULE;
-
        entry = proc_create("devices", 0, proc_bus_input_dir,
                            &input_devices_fileops);
        if (!entry)
index f4969fe0a0554ad5f567268075be2a6e90b34bb1..69e71ebe7841830bf2af1dc68b894186b776cb91 100644 (file)
@@ -118,7 +118,6 @@ static int DIVA_INIT_FUNCTION create_um_idi_proc(void)
                return (0);
 
        um_idi_proc_entry->read_proc = um_idi_proc_read;
-       um_idi_proc_entry->owner = THIS_MODULE;
 
        return (1);
 }
index 60156dfdc608cf5e8d45e40ec34a51d09a084664..4845fb3cf74bd8911dc3a48b8370c722be688512 100644 (file)
@@ -152,8 +152,8 @@ static void unmap_switcher(void)
  * code.  We have to check that the range is below the pfn_limit the Launcher
  * gave us.  We have to make sure that addr + len doesn't give us a false
  * positive by overflowing, too. */
-int lguest_address_ok(const struct lguest *lg,
-                     unsigned long addr, unsigned long len)
+bool lguest_address_ok(const struct lguest *lg,
+                      unsigned long addr, unsigned long len)
 {
        return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr);
 }
index 415fab0125acd8e465e1fe2e6fe8241d75894868..6e99adbe1946e8810951460872fdd59d79985ebf 100644 (file)
@@ -34,7 +34,7 @@ static int idt_type(u32 lo, u32 hi)
 }
 
 /* An IDT entry can't be used unless the "present" bit is set. */
-static int idt_present(u32 lo, u32 hi)
+static bool idt_present(u32 lo, u32 hi)
 {
        return (hi & 0x8000);
 }
@@ -60,7 +60,8 @@ static void push_guest_stack(struct lg_cpu *cpu, unsigned long *gstack, u32 val)
  * We set up the stack just like the CPU does for a real interrupt, so it's
  * identical for the Guest (and the standard "iret" instruction will undo
  * it). */
-static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi, int has_err)
+static void set_guest_interrupt(struct lg_cpu *cpu, u32 lo, u32 hi,
+                               bool has_err)
 {
        unsigned long gstack, origstack;
        u32 eflags, ss, irq_enable;
@@ -184,7 +185,7 @@ void maybe_do_interrupt(struct lg_cpu *cpu)
                /* set_guest_interrupt() takes the interrupt descriptor and a
                 * flag to say whether this interrupt pushes an error code onto
                 * the stack as well: virtual interrupts never do. */
-               set_guest_interrupt(cpu, idt->a, idt->b, 0);
+               set_guest_interrupt(cpu, idt->a, idt->b, false);
        }
 
        /* Every time we deliver an interrupt, we update the timestamp in the
@@ -244,26 +245,26 @@ void free_interrupts(void)
 /*H:220 Now we've got the routines to deliver interrupts, delivering traps like
  * page fault is easy.  The only trick is that Intel decided that some traps
  * should have error codes: */
-static int has_err(unsigned int trap)
+static bool has_err(unsigned int trap)
 {
        return (trap == 8 || (trap >= 10 && trap <= 14) || trap == 17);
 }
 
 /* deliver_trap() returns true if it could deliver the trap. */
-int deliver_trap(struct lg_cpu *cpu, unsigned int num)
+bool deliver_trap(struct lg_cpu *cpu, unsigned int num)
 {
        /* Trap numbers are always 8 bit, but we set an impossible trap number
         * for traps inside the Switcher, so check that here. */
        if (num >= ARRAY_SIZE(cpu->arch.idt))
-               return 0;
+               return false;
 
        /* Early on the Guest hasn't set the IDT entries (or maybe it put a
         * bogus one in): if we fail here, the Guest will be killed. */
        if (!idt_present(cpu->arch.idt[num].a, cpu->arch.idt[num].b))
-               return 0;
+               return false;
        set_guest_interrupt(cpu, cpu->arch.idt[num].a,
                            cpu->arch.idt[num].b, has_err(num));
-       return 1;
+       return true;
 }
 
 /*H:250 Here's the hard part: returning to the Host every time a trap happens
@@ -279,18 +280,19 @@ int deliver_trap(struct lg_cpu *cpu, unsigned int num)
  *
  * This routine indicates if a particular trap number could be delivered
  * directly. */
-static int direct_trap(unsigned int num)
+static bool direct_trap(unsigned int num)
 {
        /* Hardware interrupts don't go to the Guest at all (except system
         * call). */
        if (num >= FIRST_EXTERNAL_VECTOR && !could_be_syscall(num))
-               return 0;
+               return false;
 
        /* The Host needs to see page faults (for shadow paging and to save the
         * fault address), general protection faults (in/out emulation) and
-        * device not available (TS handling), and of course, the hypercall
-        * trap. */
-       return num != 14 && num != 13 && num != 7 && num != LGUEST_TRAP_ENTRY;
+        * device not available (TS handling), invalid opcode fault (kvm hcall),
+        * and of course, the hypercall trap. */
+       return num != 14 && num != 13 && num != 7 &&
+                       num != 6 && num != LGUEST_TRAP_ENTRY;
 }
 /*:*/
 
index f2c641e0bdde508887809176774badcc31519622..ac8a4a3741b831e36d5ca499f85424e90b9d1335 100644 (file)
@@ -109,8 +109,8 @@ struct lguest
 extern struct mutex lguest_lock;
 
 /* core.c: */
-int lguest_address_ok(const struct lguest *lg,
-                     unsigned long addr, unsigned long len);
+bool lguest_address_ok(const struct lguest *lg,
+                      unsigned long addr, unsigned long len);
 void __lgread(struct lg_cpu *, void *, unsigned long, unsigned);
 void __lgwrite(struct lg_cpu *, unsigned long, const void *, unsigned);
 
@@ -140,7 +140,7 @@ int run_guest(struct lg_cpu *cpu, unsigned long __user *user);
 
 /* interrupts_and_traps.c: */
 void maybe_do_interrupt(struct lg_cpu *cpu);
-int deliver_trap(struct lg_cpu *cpu, unsigned int num);
+bool deliver_trap(struct lg_cpu *cpu, unsigned int num);
 void load_guest_idt_entry(struct lg_cpu *cpu, unsigned int i,
                          u32 low, u32 hi);
 void guest_set_stack(struct lg_cpu *cpu, u32 seg, u32 esp, unsigned int pages);
@@ -173,7 +173,7 @@ void guest_pagetable_flush_user(struct lg_cpu *cpu);
 void guest_set_pte(struct lg_cpu *cpu, unsigned long gpgdir,
                   unsigned long vaddr, pte_t val);
 void map_switcher_in_guest(struct lg_cpu *cpu, struct lguest_pages *pages);
-int demand_page(struct lg_cpu *cpu, unsigned long cr2, int errcode);
+bool demand_page(struct lg_cpu *cpu, unsigned long cr2, int errcode);
 void pin_page(struct lg_cpu *cpu, unsigned long vaddr);
 unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr);
 void page_table_guest_data_init(struct lg_cpu *cpu);
index 8132533d71f9384e3e73aca8092b02295cd75024..df44d962626d327ba26a3b1a2aa83a2bba383390 100644 (file)
@@ -161,7 +161,7 @@ static void set_status(struct virtio_device *vdev, u8 status)
 
        /* We set the status. */
        to_lgdev(vdev)->desc->status = status;
-       hcall(LHCALL_NOTIFY, (max_pfn<<PAGE_SHIFT) + offset, 0, 0);
+       kvm_hypercall1(LHCALL_NOTIFY, (max_pfn << PAGE_SHIFT) + offset);
 }
 
 static void lg_set_status(struct virtio_device *vdev, u8 status)
@@ -209,7 +209,7 @@ static void lg_notify(struct virtqueue *vq)
         * virtqueue structure. */
        struct lguest_vq_info *lvq = vq->priv;
 
-       hcall(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT, 0, 0);
+       kvm_hypercall1(LHCALL_NOTIFY, lvq->config.pfn << PAGE_SHIFT);
 }
 
 /* An extern declaration inside a C file is bad form.  Don't do it. */
index 576a8318221c9dfe47dc28a660565094c9ef7753..a059cf9980f711b97d2009545b574e63cf79fddc 100644 (file)
@@ -199,7 +199,7 @@ static void check_gpgd(struct lg_cpu *cpu, pgd_t gpgd)
  *
  * If we fixed up the fault (ie. we mapped the address), this routine returns
  * true.  Otherwise, it was a real fault and we need to tell the Guest. */
-int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
+bool demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
 {
        pgd_t gpgd;
        pgd_t *spgd;
@@ -211,7 +211,7 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
        gpgd = lgread(cpu, gpgd_addr(cpu, vaddr), pgd_t);
        /* Toplevel not present?  We can't map it in. */
        if (!(pgd_flags(gpgd) & _PAGE_PRESENT))
-               return 0;
+               return false;
 
        /* Now look at the matching shadow entry. */
        spgd = spgd_addr(cpu, cpu->cpu_pgd, vaddr);
@@ -222,7 +222,7 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
                 * simple for this corner case. */
                if (!ptepage) {
                        kill_guest(cpu, "out of memory allocating pte page");
-                       return 0;
+                       return false;
                }
                /* We check that the Guest pgd is OK. */
                check_gpgd(cpu, gpgd);
@@ -238,16 +238,16 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
 
        /* If this page isn't in the Guest page tables, we can't page it in. */
        if (!(pte_flags(gpte) & _PAGE_PRESENT))
-               return 0;
+               return false;
 
        /* Check they're not trying to write to a page the Guest wants
         * read-only (bit 2 of errcode == write). */
        if ((errcode & 2) && !(pte_flags(gpte) & _PAGE_RW))
-               return 0;
+               return false;
 
        /* User access to a kernel-only page? (bit 3 == user access) */
        if ((errcode & 4) && !(pte_flags(gpte) & _PAGE_USER))
-               return 0;
+               return false;
 
        /* Check that the Guest PTE flags are OK, and the page number is below
         * the pfn_limit (ie. not mapping the Launcher binary). */
@@ -283,7 +283,7 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
         * manipulated, the result returned and the code complete.  A small
         * delay and a trace of alliteration are the only indications the Guest
         * has that a page fault occurred at all. */
-       return 1;
+       return true;
 }
 
 /*H:360
@@ -296,7 +296,7 @@ int demand_page(struct lg_cpu *cpu, unsigned long vaddr, int errcode)
  *
  * This is a quick version which answers the question: is this virtual address
  * mapped by the shadow page tables, and is it writable? */
-static int page_writable(struct lg_cpu *cpu, unsigned long vaddr)
+static bool page_writable(struct lg_cpu *cpu, unsigned long vaddr)
 {
        pgd_t *spgd;
        unsigned long flags;
@@ -304,7 +304,7 @@ static int page_writable(struct lg_cpu *cpu, unsigned long vaddr)
        /* Look at the current top level entry: is it present? */
        spgd = spgd_addr(cpu, cpu->cpu_pgd, vaddr);
        if (!(pgd_flags(*spgd) & _PAGE_PRESENT))
-               return 0;
+               return false;
 
        /* Check the flags on the pte entry itself: it must be present and
         * writable. */
@@ -373,8 +373,10 @@ unsigned long guest_pa(struct lg_cpu *cpu, unsigned long vaddr)
        /* First step: get the top-level Guest page table entry. */
        gpgd = lgread(cpu, gpgd_addr(cpu, vaddr), pgd_t);
        /* Toplevel not present?  We can't map it in. */
-       if (!(pgd_flags(gpgd) & _PAGE_PRESENT))
+       if (!(pgd_flags(gpgd) & _PAGE_PRESENT)) {
                kill_guest(cpu, "Bad address %#lx", vaddr);
+               return -1UL;
+       }
 
        gpte = lgread(cpu, gpte_addr(gpgd, vaddr), pte_t);
        if (!(pte_flags(gpte) & _PAGE_PRESENT))
index ec6aa3f1c36b349464e946375de109cc606c82a2..4f15439b7f1288c8f0f9462e42e76db4471c199c 100644 (file)
@@ -45,7 +45,7 @@
  * "Task State Segment" which controls all kinds of delicate things.  The
  * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the
  * the Guest can't be trusted to deal with double faults. */
-static int ignored_gdt(unsigned int num)
+static bool ignored_gdt(unsigned int num)
 {
        return (num == GDT_ENTRY_TSS
                || num == GDT_ENTRY_LGUEST_CS
index bf7942327bda5c2f122889e9881e1b7d90acaf44..a6b717644be0d50efc2f257e52e9e543cc545833 100644 (file)
@@ -290,6 +290,57 @@ static int emulate_insn(struct lg_cpu *cpu)
        return 1;
 }
 
+/* Our hypercalls mechanism used to be based on direct software interrupts.
+ * After Anthony's "Refactor hypercall infrastructure" kvm patch, we decided to
+ * change over to using kvm hypercalls.
+ *
+ * KVM_HYPERCALL is actually a "vmcall" instruction, which generates an invalid
+ * opcode fault (fault 6) on non-VT cpus, so the easiest solution seemed to be
+ * an *emulation approach*: if the fault was really produced by an hypercall
+ * (is_hypercall() does exactly this check), we can just call the corresponding
+ * hypercall host implementation function.
+ *
+ * But these invalid opcode faults are notably slower than software interrupts.
+ * So we implemented the *patching (or rewriting) approach*: every time we hit
+ * the KVM_HYPERCALL opcode in Guest code, we patch it to the old "int 0x1f"
+ * opcode, so next time the Guest calls this hypercall it will use the
+ * faster trap mechanism.
+ *
+ * Matias even benchmarked it to convince you: this shows the average cycle
+ * cost of a hypercall.  For each alternative solution mentioned above we've
+ * made 5 runs of the benchmark:
+ *
+ * 1) direct software interrupt: 2915, 2789, 2764, 2721, 2898
+ * 2) emulation technique: 3410, 3681, 3466, 3392, 3780
+ * 3) patching (rewrite) technique: 2977, 2975, 2891, 2637, 2884
+ *
+ * One two-line function is worth a 20% hypercall speed boost!
+ */
+static void rewrite_hypercall(struct lg_cpu *cpu)
+{
+       /* This are the opcodes we use to patch the Guest.  The opcode for "int
+        * $0x1f" is "0xcd 0x1f" but vmcall instruction is 3 bytes long, so we
+        * complete the sequence with a NOP (0x90). */
+       u8 insn[3] = {0xcd, 0x1f, 0x90};
+
+       __lgwrite(cpu, guest_pa(cpu, cpu->regs->eip), insn, sizeof(insn));
+}
+
+static bool is_hypercall(struct lg_cpu *cpu)
+{
+       u8 insn[3];
+
+       /* This must be the Guest kernel trying to do something.
+        * The bottom two bits of the CS segment register are the privilege
+        * level. */
+       if ((cpu->regs->cs & 3) != GUEST_PL)
+               return false;
+
+       /* Is it a vmcall? */
+       __lgread(cpu, insn, guest_pa(cpu, cpu->regs->eip), sizeof(insn));
+       return insn[0] == 0x0f && insn[1] == 0x01 && insn[2] == 0xc1;
+}
+
 /*H:050 Once we've re-enabled interrupts, we look at why the Guest exited. */
 void lguest_arch_handle_trap(struct lg_cpu *cpu)
 {
@@ -337,7 +388,7 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
                break;
        case 32 ... 255:
                /* These values mean a real interrupt occurred, in which case
-                * the Host handler has already been run.  We just do a
+                * the Host handler has already been run. We just do a
                 * friendly check if another process should now be run, then
                 * return to run the Guest again */
                cond_resched();
@@ -347,6 +398,15 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu)
                 * up the pointer now to indicate a hypercall is pending. */
                cpu->hcall = (struct hcall_args *)cpu->regs;
                return;
+       case 6:
+               /* kvm hypercalls trigger an invalid opcode fault (6).
+                * We need to check if ring == GUEST_PL and
+                * faulting instruction == vmcall. */
+               if (is_hypercall(cpu)) {
+                       rewrite_hypercall(cpu);
+                       return;
+               }
+               break;
        }
 
        /* We didn't handle the trap, so it needs to go to the Guest. */
index c3b0c8c63c7642601a2b14feceb5a1f55ff86a78..43ab0adf3b610a8927299e833c6bb3ab5f3b73ad 100644 (file)
@@ -1381,9 +1381,7 @@ static void proc_cpia_create(void)
 {
        cpia_proc_root = proc_mkdir("cpia", NULL);
 
-       if (cpia_proc_root)
-               cpia_proc_root->owner = THIS_MODULE;
-       else
+       if (!cpia_proc_root)
                LOG("Unable to initialise /proc/cpia\n");
 }
 
index 9a36b5a7de5736365f356190877a6947f2048246..7045c45da9b160030fdd07859b373708656d2ea0 100644 (file)
@@ -2037,8 +2037,6 @@ static int __init i2o_proc_fs_create(void)
        if (!i2o_proc_dir_root)
                return -1;
 
-       i2o_proc_dir_root->owner = THIS_MODULE;
-
        list_for_each_entry(c, &i2o_controllers, list)
            i2o_proc_iop_add(i2o_proc_dir_root, c);
 
index 9c326a50a3eecb22851cc21ecb5f3d3a3e861e5b..99610f358c40629cecf9a12dfbc2566587a5026d 100644 (file)
@@ -3444,25 +3444,12 @@ static void bond_remove_proc_entry(struct bonding *bond)
  */
 static void bond_create_proc_dir(void)
 {
-       int len = strlen(DRV_NAME);
-
-       for (bond_proc_dir = init_net.proc_net->subdir; bond_proc_dir;
-            bond_proc_dir = bond_proc_dir->next) {
-               if ((bond_proc_dir->namelen == len) &&
-                   !memcmp(bond_proc_dir->name, DRV_NAME, len)) {
-                       break;
-               }
-       }
-
        if (!bond_proc_dir) {
                bond_proc_dir = proc_mkdir(DRV_NAME, init_net.proc_net);
-               if (bond_proc_dir) {
-                       bond_proc_dir->owner = THIS_MODULE;
-               } else {
+               if (!bond_proc_dir)
                        printk(KERN_WARNING DRV_NAME
                                ": Warning: cannot create /proc/net/%s\n",
                                DRV_NAME);
-               }
        }
 }
 
@@ -3471,25 +3458,7 @@ static void bond_create_proc_dir(void)
  */
 static void bond_destroy_proc_dir(void)
 {
-       struct proc_dir_entry *de;
-
-       if (!bond_proc_dir) {
-               return;
-       }
-
-       /* verify that the /proc dir is empty */
-       for (de = bond_proc_dir->subdir; de; de = de->next) {
-               /* ignore . and .. */
-               if (*(de->name) != '.') {
-                       break;
-               }
-       }
-
-       if (de) {
-               if (bond_proc_dir->owner == THIS_MODULE) {
-                       bond_proc_dir->owner = NULL;
-               }
-       } else {
+       if (bond_proc_dir) {
                remove_proc_entry(DRV_NAME, init_net.proc_net);
                bond_proc_dir = NULL;
        }
index 6a38800be3f109fd10d6a472517902c765f64572..65f55877be95c4c9e5d411e0bc23888b6d5c0a7a 100644 (file)
@@ -289,9 +289,9 @@ static int gfar_of_init(struct net_device *dev)
                id = of_get_property(phy, "reg", NULL);
 
                of_node_put(phy);
-               of_node_put(mdio);
 
                fsl_pq_mdio_bus_name(bus_name, mdio);
+               of_node_put(mdio);
                snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
                                bus_name, *id);
        }
index 881bf818bb48aac8a71672b4cd2677b2588613a4..7459b3ac77a9431a30c59f1d581d3c6ffe98fd02 100644 (file)
@@ -445,6 +445,7 @@ static const struct net_device_ops scc_netdev_ops = {
        .ndo_stop = scc_close,
        .ndo_start_xmit = scc_send_packet,
        .ndo_do_ioctl = scc_ioctl,
+       .ndo_set_mac_address = scc_set_mac_address,
 };
 
 static int __init setup_adapter(int card_base, int type, int n)
@@ -584,7 +585,6 @@ static int __init setup_adapter(int card_base, int type, int n)
                dev->irq = irq;
                dev->netdev_ops = &scc_netdev_ops;
                dev->header_ops = &ax25_header_ops;
-               dev->set_mac_address = scc_set_mac_address;
        }
        if (register_netdev(info->dev[0])) {
                printk(KERN_ERR "dmascc: could not register %s\n",
index 1243bc8e0035877dd2edf703b96edfbacdaaa54b..ac0e4b6b6b66793ca8fd16b2ffff4818975c2a28 100644 (file)
@@ -1871,13 +1871,6 @@ static int __init vlsi_mod_init(void)
         * without procfs - it's not required for the driver to work.
         */
        vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
-       if (vlsi_proc_root) {
-               /* protect registered procdir against module removal.
-                * Because we are in the module init path there's no race
-                * window after create_proc_entry (and no barrier needed).
-                */
-               vlsi_proc_root->owner = THIS_MODULE;
-       }
 
        ret = pci_register_driver(&vlsi_irda_driver);
 
index d304d38cd5d1728c45587efa0a986ca207d21240..eceadf787a67d5762cad157b5104a033f952a063 100644 (file)
@@ -294,14 +294,12 @@ static ssize_t show_remote_port(struct netconsole_target *nt, char *buf)
 
 static ssize_t show_local_ip(struct netconsole_target *nt, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
-                       HIPQUAD(nt->np.local_ip));
+       return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip);
 }
 
 static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
 {
-       return snprintf(buf, PAGE_SIZE, "%d.%d.%d.%d\n",
-                       HIPQUAD(nt->np.remote_ip));
+       return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
 }
 
 static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
@@ -438,7 +436,7 @@ static ssize_t store_local_ip(struct netconsole_target *nt,
                return -EINVAL;
        }
 
-       nt->np.local_ip = ntohl(in_aton(buf));
+       nt->np.local_ip = in_aton(buf);
 
        return strnlen(buf, count);
 }
@@ -454,7 +452,7 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,
                return -EINVAL;
        }
 
-       nt->np.remote_ip = ntohl(in_aton(buf));
+       nt->np.remote_ip = in_aton(buf);
 
        return strnlen(buf, count);
 }
index 539e18ab485cd5da15f1efe17061a5600b48baad..2a8da476ab3d1d9a77b3dbcf796cf75227aa1478 100644 (file)
@@ -189,6 +189,17 @@ static void __init trigger_irq(int ioaddr)
                outb(MM_EN_XMT|MM_MUX, IE_MMODE); /* Start transmission */
 }
 
+static const struct net_device_ops ni5010_netdev_ops = {
+       .ndo_open               = ni5010_open,
+       .ndo_stop               = ni5010_close,
+       .ndo_start_xmit         = ni5010_send_packet,
+       .ndo_set_multicast_list = ni5010_set_multicast_list,
+       .ndo_tx_timeout         = ni5010_timeout,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_change_mtu         = eth_change_mtu,
+};
+
 /*
  *      This is the real probe routine.  Linux has a history of friendly device
  *      probes on the ISA bus.  A good device probes avoids doing writes, and
@@ -328,13 +339,8 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
                outb(0, IE_RBUF);       /* set buffer byte 0 to 0 again */
        }
         printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE);
-       memset(netdev_priv(dev), 0, sizeof(struct ni5010_local));
 
-       dev->open               = ni5010_open;
-       dev->stop               = ni5010_close;
-       dev->hard_start_xmit    = ni5010_send_packet;
-       dev->set_multicast_list = ni5010_set_multicast_list;
-       dev->tx_timeout         = ni5010_timeout;
+       dev->netdev_ops         = &ni5010_netdev_ops;
        dev->watchdog_timeo     = HZ/20;
 
        dev->flags &= ~IFF_MULTICAST;   /* Multicast doesn't work */
index 50c11126a3db5adaa6dbb5d48ccfad1dafe95aa6..02c37e2f08a9fadc9dfaaa222193f97b036b0ba3 100644 (file)
@@ -3441,7 +3441,8 @@ static int niu_rx_pkt_ignore(struct niu *np, struct rx_ring_info *rp)
        return num_rcr;
 }
 
-static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
+static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
+                             struct rx_ring_info *rp)
 {
        unsigned int index = rp->rcr_index;
        struct sk_buff *skb;
@@ -3518,7 +3519,7 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
 
        skb->protocol = eth_type_trans(skb, np->dev);
        skb_record_rx_queue(skb, rp->rx_channel);
-       netif_receive_skb(skb);
+       napi_gro_receive(napi, skb);
 
        return num_rcr;
 }
@@ -3706,7 +3707,8 @@ static inline void niu_sync_rx_discard_stats(struct niu *np,
        }
 }
 
-static int niu_rx_work(struct niu *np, struct rx_ring_info *rp, int budget)
+static int niu_rx_work(struct napi_struct *napi, struct niu *np,
+                      struct rx_ring_info *rp, int budget)
 {
        int qlen, rcr_done = 0, work_done = 0;
        struct rxdma_mailbox *mbox = rp->mbox;
@@ -3728,7 +3730,7 @@ static int niu_rx_work(struct niu *np, struct rx_ring_info *rp, int budget)
        rcr_done = work_done = 0;
        qlen = min(qlen, budget);
        while (work_done < qlen) {
-               rcr_done += niu_process_rx_pkt(np, rp);
+               rcr_done += niu_process_rx_pkt(napi, np, rp);
                work_done++;
        }
 
@@ -3776,7 +3778,7 @@ static int niu_poll_core(struct niu *np, struct niu_ldg *lp, int budget)
                if (rx_vec & (1 << rp->rx_channel)) {
                        int this_work_done;
 
-                       this_work_done = niu_rx_work(np, rp,
+                       this_work_done = niu_rx_work(&lp->napi, np, rp,
                                                     budget);
 
                        budget -= this_work_done;
index f7efcecc4108f44e8fcdb26a83bb653a17660a36..1205c2a22657cc22dba58547b29abb5df25cd0be 100644 (file)
@@ -4392,7 +4392,7 @@ static void tg3_recycle_rx(struct tg3 *tp, u32 opaque_key,
 #if TG3_VLAN_TAG_USED
 static int tg3_vlan_rx(struct tg3 *tp, struct sk_buff *skb, u16 vlan_tag)
 {
-       return vlan_hwaccel_receive_skb(skb, tp->vlgrp, vlan_tag);
+       return vlan_gro_receive(&tp->napi, tp->vlgrp, vlan_tag, skb);
 }
 #endif
 
@@ -4539,7 +4539,7 @@ static int tg3_rx(struct tg3 *tp, int budget)
                                    desc->err_vlan & RXD_VLAN_MASK);
                } else
 #endif
-                       netif_receive_skb(skb);
+                       napi_gro_receive(&tp->napi, skb);
 
                received++;
                budget--;
index 86a479f61c0c09dbceb64688f1bd2b131105031d..933fcfbf35e1ea332e29081b6ab84bd64a2fca5e 100644 (file)
@@ -3648,15 +3648,16 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
                mdio = of_get_parent(phy);
 
                if (mdio == NULL)
-                       return -1;
+                       return -ENODEV;
 
                err = of_address_to_resource(mdio, 0, &res);
-               of_node_put(mdio);
-
-               if (err)
-                       return -1;
 
+               if (err) {
+                       of_node_put(mdio);
+                       return err;
+               }
                fsl_pq_mdio_bus_name(bus_name, mdio);
+               of_node_put(mdio);
                snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
                        "%s:%02x", bus_name, *prop);
        }
index 7e80aba8a148dbb821e6096181378f3768f4455a..f21a6171c691940b8f9d7788da1153766ba3ec74 100644 (file)
@@ -2752,7 +2752,6 @@ static const struct net_device_ops airo_netdev_ops = {
        .ndo_set_mac_address    = airo_set_mac_address,
        .ndo_do_ioctl           = airo_ioctl,
        .ndo_change_mtu         = airo_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
 
@@ -2765,7 +2764,6 @@ static const struct net_device_ops mpi_netdev_ops = {
        .ndo_set_mac_address    = airo_set_mac_address,
        .ndo_do_ioctl           = airo_ioctl,
        .ndo_change_mtu         = airo_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
 
@@ -4494,7 +4492,6 @@ static int setup_proc_entry( struct net_device *dev,
                goto fail;
        apriv->proc_entry->uid = proc_uid;
        apriv->proc_entry->gid = proc_gid;
-       apriv->proc_entry->owner = THIS_MODULE;
 
        /* Setup the StatsDelta */
        entry = proc_create_data("StatsDelta",
index b3449948a25a92ca8ac3afe17d099530249f0601..4a92af1d78776f3abbd9f8dfeec0df51966fe2a2 100644 (file)
@@ -11593,7 +11593,6 @@ static const struct net_device_ops ipw_netdev_ops = {
        .ndo_set_mac_address    = ipw_net_set_mac_address,
        .ndo_start_xmit         = ieee80211_xmit,
        .ndo_change_mtu         = ieee80211_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
 
index 166ed95846017c0463f5ab65a78acc8e5048aa49..e26d7b3ceab51cee23198ab5fc5c7fa60406ed59 100644 (file)
@@ -803,7 +803,6 @@ static const struct net_device_ops islpci_netdev_ops = {
        .ndo_tx_timeout         = islpci_eth_tx_timeout,
        .ndo_set_mac_address    = prism54_set_mac_address,
        .ndo_change_mtu         = eth_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
 
index 9b244c96b221bbc3c96006112681d1157e4d42d6..5fabd9c0f07a791483b01728e599b14a4a38ad3b 100644 (file)
@@ -1725,7 +1725,6 @@ static const struct net_device_ops zd1201_netdev_ops = {
        .ndo_set_multicast_list = zd1201_set_multicast,
        .ndo_set_mac_address    = zd1201_set_mac_address,
        .ndo_change_mtu         = eth_change_mtu,
-       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
 };
 
index b522f883d67432b5969b011634df7e369da881a5..16240390bcde2070de75c8162c4bd52666d07686 100644 (file)
@@ -351,53 +351,60 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
 {
        struct pci_dev * pci_dev = to_pci_dev(dev);
        struct pci_driver * drv = pci_dev->driver;
-       int i = 0;
+
+       pci_dev->state_saved = false;
 
        if (drv && drv->suspend) {
                pci_power_t prev = pci_dev->current_state;
+               int error;
 
-               pci_dev->state_saved = false;
-
-               i = drv->suspend(pci_dev, state);
-               suspend_report_result(drv->suspend, i);
-               if (i)
-                       return i;
-
-               if (pci_dev->state_saved)
-                       goto Fixup;
+               error = drv->suspend(pci_dev, state);
+               suspend_report_result(drv->suspend, error);
+               if (error)
+                       return error;
 
-               if (pci_dev->current_state != PCI_D0
+               if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
                    && pci_dev->current_state != PCI_UNKNOWN) {
                        WARN_ONCE(pci_dev->current_state != prev,
                                "PCI PM: Device state not saved by %pF\n",
                                drv->suspend);
-                       goto Fixup;
                }
        }
 
-       pci_save_state(pci_dev);
-       /*
-        * This is for compatibility with existing code with legacy PM support.
-        */
-       pci_pm_set_unknown_state(pci_dev);
-
- Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
 
-       return i;
+       return 0;
 }
 
 static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
 {
        struct pci_dev * pci_dev = to_pci_dev(dev);
        struct pci_driver * drv = pci_dev->driver;
-       int i = 0;
 
        if (drv && drv->suspend_late) {
-               i = drv->suspend_late(pci_dev, state);
-               suspend_report_result(drv->suspend_late, i);
+               pci_power_t prev = pci_dev->current_state;
+               int error;
+
+               error = drv->suspend_late(pci_dev, state);
+               suspend_report_result(drv->suspend_late, error);
+               if (error)
+                       return error;
+
+               if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: Device state not saved by %pF\n",
+                               drv->suspend_late);
+                       return 0;
+               }
        }
-       return i;
+
+       if (!pci_dev->state_saved)
+               pci_save_state(pci_dev);
+
+       pci_pm_set_unknown_state(pci_dev);
+
+       return 0;
 }
 
 static int pci_legacy_resume_early(struct device *dev)
@@ -422,6 +429,23 @@ static int pci_legacy_resume(struct device *dev)
 
 /* Auxiliary functions used by the new power management framework */
 
+/**
+ * pci_restore_standard_config - restore standard config registers of PCI device
+ * @pci_dev: PCI device to handle
+ */
+static int pci_restore_standard_config(struct pci_dev *pci_dev)
+{
+       pci_update_current_state(pci_dev, PCI_UNKNOWN);
+
+       if (pci_dev->current_state != PCI_D0) {
+               int error = pci_set_power_state(pci_dev, PCI_D0);
+               if (error)
+                       return error;
+       }
+
+       return pci_dev->state_saved ? pci_restore_state(pci_dev) : 0;
+}
+
 static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
 {
        pci_restore_standard_config(pci_dev);
@@ -442,7 +466,6 @@ static void pci_pm_default_suspend(struct pci_dev *pci_dev)
        /* Disable non-bridge devices without PM support */
        if (!pci_is_bridge(pci_dev))
                pci_disable_enabled_device(pci_dev);
-       pci_save_state(pci_dev);
 }
 
 static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
@@ -492,13 +515,13 @@ static int pci_pm_suspend(struct device *dev)
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_SUSPEND);
 
+       pci_dev->state_saved = false;
+
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                goto Fixup;
        }
 
-       pci_dev->state_saved = false;
-
        if (pm->suspend) {
                pci_power_t prev = pci_dev->current_state;
                int error;
@@ -508,24 +531,14 @@ static int pci_pm_suspend(struct device *dev)
                if (error)
                        return error;
 
-               if (pci_dev->state_saved)
-                       goto Fixup;
-
-               if (pci_dev->current_state != PCI_D0
+               if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
                    && pci_dev->current_state != PCI_UNKNOWN) {
                        WARN_ONCE(pci_dev->current_state != prev,
                                "PCI PM: State of device not saved by %pF\n",
                                pm->suspend);
-                       goto Fixup;
                }
        }
 
-       if (!pci_dev->state_saved) {
-               pci_save_state(pci_dev);
-               if (!pci_is_bridge(pci_dev))
-                       pci_prepare_to_sleep(pci_dev);
-       }
-
  Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
 
@@ -535,21 +548,43 @@ static int pci_pm_suspend(struct device *dev)
 static int pci_pm_suspend_noirq(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
-       int error = 0;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend_late(dev, PMSG_SUSPEND);
 
-       if (drv && drv->pm && drv->pm->suspend_noirq) {
-               error = drv->pm->suspend_noirq(dev);
-               suspend_report_result(drv->pm->suspend_noirq, error);
+       if (!pm) {
+               pci_save_state(pci_dev);
+               return 0;
        }
 
-       if (!error)
-               pci_pm_set_unknown_state(pci_dev);
+       if (pm->suspend_noirq) {
+               pci_power_t prev = pci_dev->current_state;
+               int error;
 
-       return error;
+               error = pm->suspend_noirq(dev);
+               suspend_report_result(pm->suspend_noirq, error);
+               if (error)
+                       return error;
+
+               if (!pci_dev->state_saved && pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: State of device not saved by %pF\n",
+                               pm->suspend_noirq);
+                       return 0;
+               }
+       }
+
+       if (!pci_dev->state_saved) {
+               pci_save_state(pci_dev);
+               if (!pci_is_bridge(pci_dev))
+                       pci_prepare_to_sleep(pci_dev);
+       }
+
+       pci_pm_set_unknown_state(pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_resume_noirq(struct device *dev)
@@ -616,13 +651,13 @@ static int pci_pm_freeze(struct device *dev)
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_FREEZE);
 
+       pci_dev->state_saved = false;
+
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                return 0;
        }
 
-       pci_dev->state_saved = false;
-
        if (pm->freeze) {
                int error;
 
@@ -632,9 +667,6 @@ static int pci_pm_freeze(struct device *dev)
                        return error;
        }
 
-       if (!pci_dev->state_saved)
-               pci_save_state(pci_dev);
-
        return 0;
 }
 
@@ -642,20 +674,25 @@ static int pci_pm_freeze_noirq(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct device_driver *drv = dev->driver;
-       int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend_late(dev, PMSG_FREEZE);
 
        if (drv && drv->pm && drv->pm->freeze_noirq) {
+               int error;
+
                error = drv->pm->freeze_noirq(dev);
                suspend_report_result(drv->pm->freeze_noirq, error);
+               if (error)
+                       return error;
        }
 
-       if (!error)
-               pci_pm_set_unknown_state(pci_dev);
+       if (!pci_dev->state_saved)
+               pci_save_state(pci_dev);
 
-       return error;
+       pci_pm_set_unknown_state(pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_thaw_noirq(struct device *dev)
@@ -698,46 +735,56 @@ static int pci_pm_poweroff(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
        struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
-       int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_HIBERNATE);
 
+       pci_dev->state_saved = false;
+
        if (!pm) {
                pci_pm_default_suspend(pci_dev);
                goto Fixup;
        }
 
-       pci_dev->state_saved = false;
-
        if (pm->poweroff) {
+               int error;
+
                error = pm->poweroff(dev);
                suspend_report_result(pm->poweroff, error);
+               if (error)
+                       return error;
        }
 
-       if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
-               pci_prepare_to_sleep(pci_dev);
-
  Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
 
-       return error;
+       return 0;
 }
 
 static int pci_pm_poweroff_noirq(struct device *dev)
 {
+       struct pci_dev *pci_dev = to_pci_dev(dev);
        struct device_driver *drv = dev->driver;
-       int error = 0;
 
        if (pci_has_legacy_pm_support(to_pci_dev(dev)))
                return pci_legacy_suspend_late(dev, PMSG_HIBERNATE);
 
-       if (drv && drv->pm && drv->pm->poweroff_noirq) {
+       if (!drv || !drv->pm)
+               return 0;
+
+       if (drv->pm->poweroff_noirq) {
+               int error;
+
                error = drv->pm->poweroff_noirq(dev);
                suspend_report_result(drv->pm->poweroff_noirq, error);
+               if (error)
+                       return error;
        }
 
-       return error;
+       if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
+               pci_prepare_to_sleep(pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_restore_noirq(struct device *dev)
index 6d6120007af4ed01d5fdc39331bff59349b1ed00..0195066251e52c152fa07ff9416e34e3c3c66314 100644 (file)
@@ -426,7 +426,6 @@ static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable)
  *                           given PCI device
  * @dev: PCI device to handle.
  * @state: PCI power state (D0, D1, D2, D3hot) to put the device into.
- * @wait: If 'true', wait for the device to change its power state
  *
  * RETURN VALUE:
  * -EINVAL if the requested state is invalid.
@@ -435,12 +434,15 @@ static inline int platform_pci_sleep_wake(struct pci_dev *dev, bool enable)
  * 0 if device already is in the requested state.
  * 0 if device's power state has been successfully changed.
  */
-static int
-pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state, bool wait)
+static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
 {
        u16 pmcsr;
        bool need_restore = false;
 
+       /* Check if we're already there */
+       if (dev->current_state == state)
+               return 0;
+
        if (!dev->pm_cap)
                return -EIO;
 
@@ -451,10 +453,7 @@ pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state, bool wait)
         * Can enter D0 from any state, but if we can only go deeper 
         * to sleep if we're already in a low power state
         */
-       if (dev->current_state == state) {
-               /* we're already there */
-               return 0;
-       } else if (state != PCI_D0 && dev->current_state <= PCI_D3cold
+       if (state != PCI_D0 && dev->current_state <= PCI_D3cold
            && dev->current_state > state) {
                dev_err(&dev->dev, "invalid power transition "
                        "(from state %d to %d)\n", dev->current_state, state);
@@ -481,10 +480,8 @@ pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state, bool wait)
                break;
        case PCI_UNKNOWN: /* Boot-up */
                if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
-                && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) {
+                && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
                        need_restore = true;
-                       wait = true;
-               }
                /* Fall-through: force to D0 */
        default:
                pmcsr = 0;
@@ -494,9 +491,6 @@ pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state, bool wait)
        /* enter specified state */
        pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr);
 
-       if (!wait)
-               return 0;
-
        /* Mandatory power management transition delays */
        /* see PCI PM 1.1 5.6.1 table 18 */
        if (state == PCI_D3hot || dev->current_state == PCI_D3hot)
@@ -521,7 +515,7 @@ pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state, bool wait)
        if (need_restore)
                pci_restore_bars(dev);
 
-       if (wait && dev->bus->self)
+       if (dev->bus->self)
                pcie_aspm_pm_state_change(dev->bus->self);
 
        return 0;
@@ -545,6 +539,53 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
        }
 }
 
+/**
+ * pci_platform_power_transition - Use platform to change device power state
+ * @dev: PCI device to handle.
+ * @state: State to put the device into.
+ */
+static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
+{
+       int error;
+
+       if (platform_pci_power_manageable(dev)) {
+               error = platform_pci_set_power_state(dev, state);
+               if (!error)
+                       pci_update_current_state(dev, state);
+       } else {
+               error = -ENODEV;
+               /* Fall back to PCI_D0 if native PM is not supported */
+               pci_update_current_state(dev, PCI_D0);
+       }
+
+       return error;
+}
+
+/**
+ * __pci_start_power_transition - Start power transition of a PCI device
+ * @dev: PCI device to handle.
+ * @state: State to put the device into.
+ */
+static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
+{
+       if (state == PCI_D0)
+               pci_platform_power_transition(dev, PCI_D0);
+}
+
+/**
+ * __pci_complete_power_transition - Complete power transition of a PCI device
+ * @dev: PCI device to handle.
+ * @state: State to put the device into.
+ *
+ * This function should not be called directly by device drivers.
+ */
+int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
+{
+       return state > PCI_D0 ?
+                       pci_platform_power_transition(dev, state) : -EINVAL;
+}
+EXPORT_SYMBOL_GPL(__pci_complete_power_transition);
+
 /**
  * pci_set_power_state - Set the power state of a PCI device
  * @dev: PCI device to handle.
@@ -577,30 +618,21 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
                 */
                return 0;
 
-       if (state == PCI_D0 && platform_pci_power_manageable(dev)) {
-               /*
-                * Allow the platform to change the state, for example via ACPI
-                * _PR0, _PS0 and some such, but do not trust it.
-                */
-               int ret = platform_pci_set_power_state(dev, PCI_D0);
-               if (!ret)
-                       pci_update_current_state(dev, PCI_D0);
-       }
+       /* Check if we're already there */
+       if (dev->current_state == state)
+               return 0;
+
+       __pci_start_power_transition(dev, state);
+
        /* This device is quirked not to be put into D3, so
           don't put it in D3 */
        if (state == PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3))
                return 0;
 
-       error = pci_raw_set_power_state(dev, state, true);
+       error = pci_raw_set_power_state(dev, state);
 
-       if (state > PCI_D0 && platform_pci_power_manageable(dev)) {
-               /* Allow the platform to finalize the transition */
-               int ret = platform_pci_set_power_state(dev, state);
-               if (!ret) {
-                       pci_update_current_state(dev, state);
-                       error = 0;
-               }
-       }
+       if (!__pci_complete_power_transition(dev, state))
+               error = 0;
 
        return error;
 }
@@ -1231,7 +1263,7 @@ int pci_prepare_to_sleep(struct pci_dev *dev)
        if (target_state == PCI_POWER_ERROR)
                return -EIO;
 
-       pci_enable_wake(dev, target_state, true);
+       pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev));
 
        error = pci_set_power_state(dev, target_state);
 
@@ -1380,50 +1412,6 @@ void pci_allocate_cap_save_buffers(struct pci_dev *dev)
                        "unable to preallocate PCI-X save buffer\n");
 }
 
-/**
- * pci_restore_standard_config - restore standard config registers of PCI device
- * @dev: PCI device to handle
- *
- * This function assumes that the device's configuration space is accessible.
- * If the device needs to be powered up, the function will wait for it to
- * change the state.
- */
-int pci_restore_standard_config(struct pci_dev *dev)
-{
-       pci_power_t prev_state;
-       int error;
-
-       pci_update_current_state(dev, PCI_D0);
-
-       prev_state = dev->current_state;
-       if (prev_state == PCI_D0)
-               goto Restore;
-
-       error = pci_raw_set_power_state(dev, PCI_D0, false);
-       if (error)
-               return error;
-
-       /*
-        * This assumes that we won't get a bus in B2 or B3 from the BIOS, but
-        * we've made this assumption forever and it appears to be universally
-        * satisfied.
-        */
-       switch(prev_state) {
-       case PCI_D3cold:
-       case PCI_D3hot:
-               mdelay(pci_pm_d3_delay);
-               break;
-       case PCI_D2:
-               udelay(PCI_PM_D2_DELAY);
-               break;
-       }
-
-       pci_update_current_state(dev, PCI_D0);
-
- Restore:
-       return dev->state_saved ? pci_restore_state(dev) : 0;
-}
-
 /**
  * pci_enable_ari - enable ARI forwarding if hardware support it
  * @dev: the PCI device
index 07c0aa5275e6edf33ab1914761d6acb3113f1741..149fff65891f568f67d19328d012b91da3acc84b 100644 (file)
@@ -49,7 +49,6 @@ extern void pci_disable_enabled_device(struct pci_dev *dev);
 extern void pci_pm_init(struct pci_dev *dev);
 extern void platform_pci_wakeup_init(struct pci_dev *dev);
 extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
-extern int pci_restore_standard_config(struct pci_dev *dev);
 
 static inline bool pci_is_bridge(struct pci_dev *pci_dev)
 {
index d63f26e666a4c0c369d340f7f90646d48a814c59..ba1f7497e4b9a99f5be8d9d9d406ff1f6b170dbd 100644 (file)
@@ -987,7 +987,6 @@ asus_proc_add(char *name, proc_writefunc *writefunc,
        proc->write_proc = writefunc;
        proc->read_proc = readfunc;
        proc->data = acpi_driver_data(device);
-       proc->owner = THIS_MODULE;
        proc->uid = asus_uid;
        proc->gid = asus_gid;
        return 0;
@@ -1020,7 +1019,6 @@ static int asus_hotk_add_fs(struct acpi_device *device)
        if (proc) {
                proc->read_proc = proc_read_info;
                proc->data = acpi_driver_data(device);
-               proc->owner = THIS_MODULE;
                proc->uid = asus_uid;
                proc->gid = asus_gid;
        } else {
@@ -1436,7 +1434,6 @@ static int __init asus_acpi_init(void)
                printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");
                return -ENODEV;
        }
-       asus_proc_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&asus_hotk_driver);
        if (result < 0) {
index 16e11c2ee19a2a4dfb54f8c95e6639aa26bbfe70..af9f430211722d71f85a79c762adb35ccda50b35 100644 (file)
@@ -103,7 +103,7 @@ static void parse_da_table(const struct dmi_header *dm)
        da_num_tokens += tokens;
 }
 
-static void find_tokens(const struct dmi_header *dm)
+static void find_tokens(const struct dmi_header *dm, void *dummy)
 {
        switch (dm->type) {
        case 0xd4: /* Indexed IO */
@@ -356,7 +356,7 @@ static int __init dell_init(void)
        if (!dmi_check_system(dell_device_table))
                return -ENODEV;
 
-       dmi_walk(find_tokens);
+       dmi_walk(find_tokens, NULL);
 
        if (!da_tokens)  {
                printk(KERN_INFO "dell-laptop: Unable to find dmi tokens\n");
index d2433204a40c056721d76c9f8bc2798e43feeb04..3dad27a385d3b27e90c80a229927db11b47cc9e5 100644 (file)
@@ -6992,7 +6992,6 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
                        ret = -ENODEV;
                        goto err_out;
                }
-               entry->owner = THIS_MODULE;
                entry->data = ibm;
                entry->read_proc = &dispatch_procfs_read;
                if (ibm->write)
@@ -7405,7 +7404,6 @@ static int __init thinkpad_acpi_module_init(void)
                thinkpad_acpi_module_exit();
                return -ENODEV;
        }
-       proc_dir->owner = THIS_MODULE;
 
        ret = platform_driver_register(&tpacpi_pdriver);
        if (ret) {
index 40e60fc2e596daead5c656396aa84fca0587868b..9f187265db8e260d201b167bc0095e8bd4757765 100644 (file)
@@ -679,8 +679,6 @@ static acpi_status __init add_device(void)
                                              toshiba_proc_dir,
                                              (read_proc_t *) dispatch_read,
                                              item);
-               if (proc)
-                       proc->owner = THIS_MODULE;
                if (proc && item->write_func)
                        proc->write_proc = (write_proc_t *) dispatch_write;
        }
@@ -772,7 +770,6 @@ static int __init toshiba_acpi_init(void)
                toshiba_acpi_exit();
                return -ENODEV;
        } else {
-               toshiba_proc_dir->owner = THIS_MODULE;
                status = add_device();
                if (ACPI_FAILURE(status)) {
                        toshiba_acpi_exit();
index 0c6257a034ff07b3dc85e9ce1db3847571c97fc4..c086fc30a84c9ad3b4e834559a4d433688758a1a 100644 (file)
@@ -105,14 +105,8 @@ static const struct file_operations rtc_proc_fops = {
 
 void rtc_proc_add_device(struct rtc_device *rtc)
 {
-       if (rtc->id == 0) {
-               struct proc_dir_entry *ent;
-
-               ent = proc_create_data("driver/rtc", 0, NULL,
-                                      &rtc_proc_fops, rtc);
-               if (ent)
-                       ent->owner = rtc->owner;
-       }
+       if (rtc->id == 0)
+               proc_create_data("driver/rtc", 0, NULL, &rtc_proc_fops, rtc);
 }
 
 void rtc_proc_del_device(struct rtc_device *rtc)
index 2080ba6a69b0ea5b906c0a3bfc1c6ed639651b8b..654daa3cdfda7bcb60ad0f51e4748c8ffdfd0da1 100644 (file)
@@ -320,7 +320,6 @@ dasd_proc_init(void)
        dasd_proc_root_entry = proc_mkdir("dasd", NULL);
        if (!dasd_proc_root_entry)
                goto out_nodasd;
-       dasd_proc_root_entry->owner = THIS_MODULE;
        dasd_devices_entry = proc_create("devices",
                                         S_IFREG | S_IRUGO | S_IWUSR,
                                         dasd_proc_root_entry,
@@ -334,7 +333,6 @@ dasd_proc_init(void)
                goto out_nostatistics;
        dasd_statistics_entry->read_proc = dasd_statistics_read;
        dasd_statistics_entry->write_proc = dasd_statistics_write;
-       dasd_statistics_entry->owner = THIS_MODULE;
        return 0;
 
  out_nostatistics:
index 099b5455bbce287f60ef888566913616f13e9908..b13481369642f272c34d7e021f2c32365177fb7c 100644 (file)
@@ -596,8 +596,6 @@ int __init scsi_init_devinfo(void)
                error = -ENOMEM;
                goto out;
        }
-
-       p->owner = THIS_MODULE;
 #endif /* CONFIG_SCSI_PROC_FS */
 
  out:
index 82f7b2dd08a23e934aa4d6e08ce76e3c84ab1dc4..77fbddb507fdcb65b5d4fc940e6780ae756f6da9 100644 (file)
@@ -115,8 +115,6 @@ void scsi_proc_hostdir_add(struct scsi_host_template *sht)
                if (!sht->proc_dir)
                        printk(KERN_ERR "%s: proc_mkdir failed for %s\n",
                               __func__, sht->proc_name);
-               else
-                       sht->proc_dir->owner = sht->module;
        }
        mutex_unlock(&global_host_template_mutex);
 }
@@ -163,7 +161,6 @@ void scsi_proc_host_add(struct Scsi_Host *shost)
        } 
 
        p->write_proc = proc_scsi_write_proc;
-       p->owner = sht->module;
 }
 
 /**
index c6d7cc76516ff116edfff3643156fb5a18d19e7a..1de0c0032468da11bf80ddc93067e5f111da9aef 100644 (file)
@@ -2582,7 +2582,7 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
                 * calling pci_set_power_state()
                 */
                radeonfb_whack_power_state(rinfo, PCI_D2);
-               pci_set_power_state(rinfo->pdev, PCI_D2);
+               __pci_complete_power_transition(rinfo->pdev, PCI_D2);
        } else {
                printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
                       pci_name(rinfo->pdev));
index 37b433a08ce8fcaf893b47dcff8719ae4d4d6033..e327b84820d28fdb96c6eab1d74b2a08e78e67ab 100644 (file)
@@ -2059,25 +2059,21 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
        if (viafb_entry) {
                entry = create_proc_entry("dvp0", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dvp0_proc_read;
                        entry->write_proc = viafb_dvp0_proc_write;
                }
                entry = create_proc_entry("dvp1", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dvp1_proc_read;
                        entry->write_proc = viafb_dvp1_proc_write;
                }
                entry = create_proc_entry("dfph", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dfph_proc_read;
                        entry->write_proc = viafb_dfph_proc_write;
                }
                entry = create_proc_entry("dfpl", 0, *viafb_entry);
                if (entry) {
-                       entry->owner = THIS_MODULE;
                        entry->read_proc = viafb_dfpl_proc_read;
                        entry->write_proc = viafb_dfpl_proc_write;
                }
@@ -2086,7 +2082,6 @@ static void viafb_init_proc(struct proc_dir_entry **viafb_entry)
                    viaparinfo->chip_info->lvds_chip_info2.lvds_chip_name) {
                        entry = create_proc_entry("vt1636", 0, *viafb_entry);
                        if (entry) {
-                               entry->owner = THIS_MODULE;
                                entry->read_proc = viafb_vt1636_proc_read;
                                entry->write_proc = viafb_vt1636_proc_write;
                        }
index 5777196bf6c9cc873ef07dd6e79eb10f1775379b..5c52369ab9bb81115376ec3e8b959908bdbe8d8f 100644 (file)
 
 #ifdef DEBUG
 /* For development, we want to crash whenever the ring is screwed. */
-#define BAD_RING(vq, fmt...)                   \
-       do { dev_err(&vq->vq.vdev->dev, fmt); BUG(); } while(0)
-#define START_USE(vq) \
-       do { if ((vq)->in_use) panic("in_use = %i\n", (vq)->in_use); (vq)->in_use = __LINE__; mb(); } while(0)
-#define END_USE(vq) \
-       do { BUG_ON(!(vq)->in_use); (vq)->in_use = 0; mb(); } while(0)
+#define BAD_RING(_vq, fmt...)                  \
+       do { dev_err(&(_vq)->vq.vdev->dev, fmt); BUG(); } while(0)
+/* Caller is supposed to guarantee no reentry. */
+#define START_USE(_vq)                                         \
+       do {                                                    \
+               if ((_vq)->in_use)                              \
+                       panic("in_use = %i\n", (_vq)->in_use);  \
+               (_vq)->in_use = __LINE__;                       \
+               mb();                                           \
+       } while(0)
+#define END_USE(_vq) \
+       do { BUG_ON(!(_vq)->in_use); (_vq)->in_use = 0; mb(); } while(0)
 #else
-#define BAD_RING(vq, fmt...)                   \
-       do { dev_err(&vq->vq.vdev->dev, fmt); (vq)->broken = true; } while(0)
+#define BAD_RING(_vq, fmt...)                  \
+       do { dev_err(&_vq->vq.vdev->dev, fmt); (_vq)->broken = true; } while(0)
 #define START_USE(vq)
 #define END_USE(vq)
 #endif
index 6cf155d6b350f1549aedca4dff0e3e6684a733d1..3137361ccbfe077eecfdfdaab61d4373224ed45c 100644 (file)
@@ -380,7 +380,7 @@ asm(".text                      \n\t"
  *     This function checks whether or not a SMBIOS/DMI record is
  *     the 64bit CRU info or not
  */
-static void __devinit dmi_find_cru(const struct dmi_header *dm)
+static void __devinit dmi_find_cru(const struct dmi_header *dm, void *dummy)
 {
        struct smbios_cru64_info *smbios_cru64_ptr;
        unsigned long cru_physical_address;
@@ -403,7 +403,7 @@ static int __devinit detect_cru_service(void)
 {
        cru_rom_addr = NULL;
 
-       dmi_walk(dmi_find_cru);
+       dmi_walk(dmi_find_cru, NULL);
 
        /* if cru_rom_addr has been set then we found a CRU service */
        return ((cru_rom_addr != NULL) ? 0 : -ENODEV);
index 3ccd348d112d62036f4e63a038d23deca7ed67f7..0d61db1e7b49bc5f5fd095795e74001dadda1bc3 100644 (file)
@@ -39,12 +39,6 @@ static int xen_suspend(void *data)
 
        BUG_ON(!irqs_disabled());
 
-       err = device_power_down(PMSG_SUSPEND);
-       if (err) {
-               printk(KERN_ERR "xen_suspend: device_power_down failed: %d\n",
-                      err);
-               return err;
-       }
        err = sysdev_suspend(PMSG_SUSPEND);
        if (err) {
                printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
@@ -69,7 +63,6 @@ static int xen_suspend(void *data)
        xen_mm_unpin_all();
 
        sysdev_resume();
-       device_power_up(PMSG_RESUME);
 
        if (!*cancelled) {
                xen_irq_resume();
@@ -108,6 +101,12 @@ static void do_suspend(void)
        /* XXX use normal device tree? */
        xenbus_suspend();
 
+       err = device_power_down(PMSG_SUSPEND);
+       if (err) {
+               printk(KERN_ERR "device_power_down failed: %d\n", err);
+               goto resume_devices;
+       }
+
        err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
        if (err) {
                printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
@@ -120,6 +119,9 @@ static void do_suspend(void)
        } else
                xenbus_suspend_cancel();
 
+       device_power_up(PMSG_RESUME);
+
+resume_devices:
        device_resume(PMSG_RESUME);
 
        /* Make sure timer events get retriggered on all CPUs */
index 7578c1ab9e0be9ec3260c4cce41b78287f213bce..8630615e57fe512ca9c7a10472ce5f959f317234 100644 (file)
@@ -146,7 +146,6 @@ int afs_proc_init(void)
        proc_afs = proc_mkdir("fs/afs", NULL);
        if (!proc_afs)
                goto error_dir;
-       proc_afs->owner = THIS_MODULE;
 
        p = proc_create("cells", 0, proc_afs, &afs_proc_cells_fops);
        if (!p)
index 877e4d9a1159d11203170ec463202187dd3a6466..7f19fefd3d45a2790d426e68e59f80f687b4911c 100644 (file)
@@ -404,7 +404,6 @@ cifs_proc_init(void)
        if (proc_fs_cifs == NULL)
                return;
 
-       proc_fs_cifs->owner = THIS_MODULE;
        proc_create("DebugData", 0, proc_fs_cifs, &cifs_debug_data_proc_fops);
 
 #ifdef CONFIG_CIFS_STATS
index 6a73de84bcef142350ad60f3b3fefe2b172de043..dd824d9b0b1a11877b2c901d335b2c746709bd08 100644 (file)
@@ -90,7 +90,6 @@ void jfs_proc_init(void)
 
        if (!(base = proc_mkdir("fs/jfs", NULL)))
                return;
-       base->owner = THIS_MODULE;
 
        for (i = 0; i < NPROCENT; i++)
                proc_create(Entries[i].name, 0, base, Entries[i].proc_fops);
index 574158ae2398aaeb1151d76f0a85f2b73871b976..2277421656e757a5b0132f2174c9a0a470dbf088 100644 (file)
@@ -1606,8 +1606,6 @@ int __init nfs_fs_proc_init(void)
        if (!proc_fs_nfs)
                goto error_0;
 
-       proc_fs_nfs->owner = THIS_MODULE;
-
        /* a file of servers with which we're dealing */
        p = proc_create("servers", S_IFREG|S_IRUGO,
                        proc_fs_nfs, &nfs_server_list_fops);
index 5d2989e9dcc125d17aac475df1007b86f43490fd..fa678abc9db1524c35cd543c9b32a1b49e713faf 100644 (file)
@@ -37,7 +37,7 @@ static int proc_match(int len, const char *name, struct proc_dir_entry *de)
 #define PROC_BLOCK_SIZE        (PAGE_SIZE - 1024)
 
 static ssize_t
-proc_file_read(struct file *file, char __user *buf, size_t nbytes,
+__proc_file_read(struct file *file, char __user *buf, size_t nbytes,
               loff_t *ppos)
 {
        struct inode * inode = file->f_path.dentry->d_inode;
@@ -182,20 +182,48 @@ proc_file_read(struct file *file, char __user *buf, size_t nbytes,
        return retval;
 }
 
+static ssize_t
+proc_file_read(struct file *file, char __user *buf, size_t nbytes,
+              loff_t *ppos)
+{
+       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       ssize_t rv = -EIO;
+
+       spin_lock(&pde->pde_unload_lock);
+       if (!pde->proc_fops) {
+               spin_unlock(&pde->pde_unload_lock);
+               return rv;
+       }
+       pde->pde_users++;
+       spin_unlock(&pde->pde_unload_lock);
+
+       rv = __proc_file_read(file, buf, nbytes, ppos);
+
+       pde_users_dec(pde);
+       return rv;
+}
+
 static ssize_t
 proc_file_write(struct file *file, const char __user *buffer,
                size_t count, loff_t *ppos)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
-       struct proc_dir_entry * dp;
-       
-       dp = PDE(inode);
-
-       if (!dp->write_proc)
-               return -EIO;
+       struct proc_dir_entry *pde = PDE(file->f_path.dentry->d_inode);
+       ssize_t rv = -EIO;
+
+       if (pde->write_proc) {
+               spin_lock(&pde->pde_unload_lock);
+               if (!pde->proc_fops) {
+                       spin_unlock(&pde->pde_unload_lock);
+                       return rv;
+               }
+               pde->pde_users++;
+               spin_unlock(&pde->pde_unload_lock);
 
-       /* FIXME: does this routine need ppos?  probably... */
-       return dp->write_proc(file, buffer, count, dp->data);
+               /* FIXME: does this routine need ppos?  probably... */
+               rv = pde->write_proc(file, buffer, count, pde->data);
+               pde_users_dec(pde);
+       }
+       return rv;
 }
 
 
@@ -307,6 +335,21 @@ static DEFINE_SPINLOCK(proc_inum_lock); /* protects the above */
 /*
  * Return an inode number between PROC_DYNAMIC_FIRST and
  * 0xffffffff, or zero on failure.
+ *
+ * Current inode allocations in the proc-fs (hex-numbers):
+ *
+ * 00000000            reserved
+ * 00000001-00000fff   static entries  (goners)
+ *      001            root-ino
+ *
+ * 00001000-00001fff   unused
+ * 0001xxxx-7fffxxxx   pid-dir entries for pid 1-7fff
+ * 80000000-efffffff   unused
+ * f0000000-ffffffff   dynamic entries
+ *
+ * Goal:
+ *     Once we split the thing into several virtual filesystems,
+ *     we will get rid of magical ranges (and this comment, BTW).
  */
 static unsigned int get_inode_number(void)
 {
diff --git a/fs/proc/inode-alloc.txt b/fs/proc/inode-alloc.txt
deleted file mode 100644 (file)
index 77212f9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-Current inode allocations in the proc-fs (hex-numbers):
-
-  00000000             reserved
-  00000001-00000fff    static entries  (goners)
-       001             root-ino
-
-  00001000-00001fff    unused
-  0001xxxx-7fffxxxx    pid-dir entries for pid 1-7fff
-  80000000-efffffff    unused
-  f0000000-ffffffff    dynamic entries
-
-Goal:
-       a) once we'll split the thing into several virtual filesystems we
-       will get rid of magical ranges (and this file, BTW).
index d8bb5c671f420a83c17c740425e6f71f9d85799e..d78ade305541d84a0a7b7682f203cd649c1e5a6a 100644 (file)
@@ -58,11 +58,8 @@ static void proc_delete_inode(struct inode *inode)
 
        /* Let go of any associated proc directory entry */
        de = PROC_I(inode)->pde;
-       if (de) {
-               if (de->owner)
-                       module_put(de->owner);
+       if (de)
                de_put(de);
-       }
        if (PROC_I(inode)->sysctl)
                sysctl_head_put(PROC_I(inode)->sysctl);
        clear_inode(inode);
@@ -127,7 +124,7 @@ static void __pde_users_dec(struct proc_dir_entry *pde)
                complete(pde->pde_unload_completion);
 }
 
-static void pde_users_dec(struct proc_dir_entry *pde)
+void pde_users_dec(struct proc_dir_entry *pde)
 {
        spin_lock(&pde->pde_unload_lock);
        __pde_users_dec(pde);
@@ -449,12 +446,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
 {
        struct inode * inode;
 
-       if (!try_module_get(de->owner))
-               goto out_mod;
-
        inode = iget_locked(sb, ino);
        if (!inode)
-               goto out_ino;
+               return NULL;
        if (inode->i_state & I_NEW) {
                inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
                PROC_I(inode)->fd = 0;
@@ -485,16 +479,9 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                        }
                }
                unlock_new_inode(inode);
-       } else {
-              module_put(de->owner);
+       } else
               de_put(de);
-       }
        return inode;
-
-out_ino:
-       module_put(de->owner);
-out_mod:
-       return NULL;
 }                      
 
 int proc_fill_super(struct super_block *s)
index cd53ff838498de03973494d6a70ddae9f193a1ce..f6db9618a88896f741bff9d1403d20189b445e6e 100644 (file)
@@ -91,3 +91,4 @@ struct pde_opener {
        int (*release)(struct inode *, struct file *);
        struct list_head lh;
 };
+void pde_users_dec(struct proc_dir_entry *pde);
index d153946d6d15553223c563f901d12bd976c65832..4a9e0f65ae607732303f3b2a81fad46a9d28f4b0 100644 (file)
@@ -152,7 +152,6 @@ void proc_tty_register_driver(struct tty_driver *driver)
        if (!ent)
                return;
        ent->read_proc = driver->ops->read_proc;
-       ent->owner = driver->owner;
        ent->data = driver;
 
        driver->proc_entry = ent;
index 94063840832ad99709d4ca878d9aff8704ac6424..b0ae0be4801f821f81c872299c135f55e6fb377c 100644 (file)
@@ -693,8 +693,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
                goto out_pages;
        }
 
-       pm.out = (u64 *)buf;
-       pm.end = (u64 *)(buf + count);
+       pm.out = (u64 __user *)buf;
+       pm.end = (u64 __user *)(buf + count);
 
        pagemap_walk.pmd_entry = pagemap_pte_range;
        pagemap_walk.pte_hole = pagemap_pte_hole;
@@ -720,9 +720,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
        if (ret == PM_END_OF_BUFFER)
                ret = 0;
        /* don't need mmap_sem for these, but this looks cleaner */
-       *ppos += (char *)pm.out - buf;
+       *ppos += (char __user *)pm.out - buf;
        if (!ret)
-               ret = (char *)pm.out - buf;
+               ret = (char __user *)pm.out - buf;
 
 out_pages:
        for (; pagecount; pagecount--) {
index df26aa88fa47cd46731f506d270d2faafc2e1fbd..0c10a0b3f1460c5ff8d533de1c6304a657c097fd 100644 (file)
@@ -1,45 +1,43 @@
+#include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/sched.h>
+#include <linux/seq_file.h>
 #include <linux/time.h>
 #include <asm/cputime.h>
 
-static int proc_calc_metrics(char *page, char **start, off_t off,
-                                int count, int *eof, int len)
-{
-       if (len <= off + count)
-               *eof = 1;
-       *start = page + off;
-       len -= off;
-       if (len > count)
-               len = count;
-       if (len < 0)
-               len = 0;
-       return len;
-}
-
-static int uptime_read_proc(char *page, char **start, off_t off, int count,
-                           int *eof, void *data)
+static int uptime_proc_show(struct seq_file *m, void *v)
 {
        struct timespec uptime;
        struct timespec idle;
-       int len;
        cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
 
        do_posix_clock_monotonic_gettime(&uptime);
        monotonic_to_bootbased(&uptime);
        cputime_to_timespec(idletime, &idle);
-       len = sprintf(page, "%lu.%02lu %lu.%02lu\n",
+       seq_printf(m, "%lu.%02lu %lu.%02lu\n",
                        (unsigned long) uptime.tv_sec,
                        (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
                        (unsigned long) idle.tv_sec,
                        (idle.tv_nsec / (NSEC_PER_SEC / 100)));
-       return proc_calc_metrics(page, start, off, count, eof, len);
+       return 0;
 }
 
+static int uptime_proc_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, uptime_proc_show, NULL);
+}
+
+static const struct file_operations uptime_proc_fops = {
+       .open           = uptime_proc_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
 static int __init proc_uptime_init(void)
 {
-       create_proc_read_entry("uptime", 0, NULL, uptime_read_proc, NULL);
+       proc_create("uptime", 0, NULL, &uptime_proc_fops);
        return 0;
 }
 module_init(proc_uptime_init);
index d5066400638a5f5c292ae1eb83daae0871b7b256..9229e5514a4e13eef0fbaaef47f547bc90989a10 100644 (file)
@@ -492,7 +492,6 @@ int reiserfs_proc_info_init(struct super_block *sb)
        spin_lock_init(&__PINFO(sb).lock);
        REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root);
        if (REISERFS_SB(sb)->procdir) {
-               REISERFS_SB(sb)->procdir->owner = THIS_MODULE;
                REISERFS_SB(sb)->procdir->data = sb;
                add_file(sb, "version", show_version);
                add_file(sb, "super", show_super);
@@ -556,9 +555,7 @@ int reiserfs_proc_info_global_init(void)
 {
        if (proc_info_root == NULL) {
                proc_info_root = proc_mkdir(proc_info_root_name, NULL);
-               if (proc_info_root) {
-                       proc_info_root->owner = THIS_MODULE;
-               } else {
+               if (!proc_info_root) {
                        reiserfs_warning(NULL, "cannot create /proc/%s",
                                         proc_info_root_name);
                        return 1;
index e52743e7700060dfb25416ff52e74385d4448ab5..f83f52bae390f6484702f8e470de497b41b59921 100644 (file)
 /* Helpers for inode ops. We do this so that we don't have all the VFS
  * overhead and also for proper i_mutex annotation.
  * dir->i_mutex must be held for all of them. */
+#ifdef CONFIG_REISERFS_FS_XATTR
 static int xattr_create(struct inode *dir, struct dentry *dentry, int mode)
 {
        BUG_ON(!mutex_is_locked(&dir->i_mutex));
        vfs_dq_init(dir);
        return dir->i_op->create(dir, dentry, mode, NULL);
 }
+#endif
 
 static int xattr_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
index a1a4cfe1921040d6044657e6c235e2f5d55f8292..7f40f30c55c5bdf31ecab91b9075b5d320e8ae0d 100644 (file)
@@ -513,7 +513,7 @@ int seq_bitmap(struct seq_file *m, const unsigned long *bits,
 }
 EXPORT_SYMBOL(seq_bitmap);
 
-int seq_bitmap_list(struct seq_file *m, unsigned long *bits,
+int seq_bitmap_list(struct seq_file *m, const unsigned long *bits,
                unsigned int nr_bits)
 {
        if (m->count < m->size) {
index 0e9e2bc0ee96e66d08beb37bb71933ab2ece7636..88bada2ebc4b1fb1bb980f96daa8409ac5933eb2 100644 (file)
 #ifndef cpumask_of_node
 #define cpumask_of_node(node)  ((void)node, cpu_online_mask)
 #endif
-#ifndef node_to_first_cpu
-#define node_to_first_cpu(node)        ((void)(node),0)
-#endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)    ((void)(bus), -1)
 #endif
 
-#ifndef pcibus_to_cpumask
-#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
-                                       CPU_MASK_ALL : \
-                                       node_to_cpumask(pcibus_to_node(bus)) \
-                               )
-#endif
-
 #ifndef cpumask_of_pcibus
 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ?            \
                                 cpu_all_mask :                         \
index 90c6074a36cab42c47df2ac8f6239cfe2ae0ddfe..2e0d79678debad2f0634e95b8dff71f0c88fb68d 100644 (file)
@@ -90,12 +90,12 @@ static inline void cpuset_init_smp(void) {}
 static inline void cpuset_cpus_allowed(struct task_struct *p,
                                       struct cpumask *mask)
 {
-       *mask = cpu_possible_map;
+       cpumask_copy(mask, cpu_possible_mask);
 }
 static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
                                              struct cpumask *mask)
 {
-       *mask = cpu_possible_map;
+       cpumask_copy(mask, cpu_possible_mask);
 }
 
 static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
index d741b9ceb0e06ad75b032a9f3251ca038d98f5ac..bb5489c82c99495b6bf2900175e1c22c25dd610c 100644 (file)
@@ -47,7 +47,8 @@ extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
 extern int dmi_name_in_serial(const char *str);
 extern int dmi_available;
-extern int dmi_walk(void (*decode)(const struct dmi_header *));
+extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+       void *private_data);
 extern bool dmi_match(enum dmi_field f, const char *str);
 
 #else
@@ -61,8 +62,8 @@ static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
 static inline int dmi_name_in_serial(const char *s) { return 0; }
 #define dmi_available 0
-static inline int dmi_walk(void (*decode)(const struct dmi_header *))
-       { return -1; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+       void *private_data) { return -1; }
 static inline bool dmi_match(enum dmi_field f, const char *str)
        { return false; }
 static inline const struct dmi_system_id *
index 0c9cb63e689530cfbc6a060b8a0b07ff2175bd62..c68bffd182bbe4d977848fd3507150da83be4d7b 100644 (file)
@@ -117,6 +117,15 @@ extern void disable_irq_nosync(unsigned int irq);
 extern void disable_irq(unsigned int irq);
 extern void enable_irq(unsigned int irq);
 
+/* The following three functions are for the core kernel use only. */
+extern void suspend_device_irqs(void);
+extern void resume_device_irqs(void);
+#ifdef CONFIG_PM_SLEEP
+extern int check_wakeup_irqs(void);
+#else
+static inline int check_wakeup_irqs(void) { return 0; }
+#endif
+
 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
 
 extern cpumask_var_t irq_default_affinity;
index 62b73668b60247c06da84bc8cca6919a9a34f6d6..f7c9c75a277547e7a6e8278d6f4da77a62eb3746 100644 (file)
@@ -230,6 +230,6 @@ static inline void ipmi_free_smi_msg(struct ipmi_smi_msg *msg)
    automatically be dstroyed when the interface is destroyed. */
 int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
                            read_proc_t *read_proc,
-                           void *data, struct module *owner);
+                           void *data);
 
 #endif /* __LINUX_IPMI_SMI_H */
index 9c62fbe2ef3016ccb087e9694c48e420b0f9fc0c..974890b3c52fbfe0048df3cf7d736798caf873b6 100644 (file)
@@ -67,6 +67,7 @@ typedef       void (*irq_flow_handler_t)(unsigned int irq,
 #define IRQ_SPURIOUS_DISABLED  0x00800000      /* IRQ was disabled by the spurious trap */
 #define IRQ_MOVE_PCNTXT                0x01000000      /* IRQ migration from process context */
 #define IRQ_AFFINITY_SET       0x02000000      /* IRQ affinity was set from userspace*/
+#define IRQ_SUSPENDED          0x04000000      /* IRQ has gone through suspend sequence */
 
 #ifdef CONFIG_IRQ_PER_CPU
 # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
index 914918abfdd122a5bf9a6c564fd7c41693917c9b..f81d80f47dcbc14b93628df8b2bb43ad76e0db46 100644 (file)
@@ -379,18 +379,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
        ((unsigned char *)&addr)[3]
 #define NIPQUAD_FMT "%u.%u.%u.%u"
 
-#if defined(__LITTLE_ENDIAN)
-#define HIPQUAD(addr) \
-       ((unsigned char *)&addr)[3], \
-       ((unsigned char *)&addr)[2], \
-       ((unsigned char *)&addr)[1], \
-       ((unsigned char *)&addr)[0]
-#elif defined(__BIG_ENDIAN)
-#define HIPQUAD        NIPQUAD
-#else
-#error "Please fix asm/byteorder.h"
-#endif /* __LITTLE_ENDIAN */
-
 /*
  * min()/max()/clamp() macros that also do
  * strict type-checking.. See the
index 23bf02fb124ffae0dfb282453582385ea34d1919..5a58ea3e91e94e5aca9c67811cb853ff05a1ec84 100644 (file)
@@ -20,43 +20,10 @@ struct lockdep_map;
 #include <linux/stacktrace.h>
 
 /*
- * Lock-class usage-state bits:
+ * We'd rather not expose kernel/lockdep_states.h this wide, but we do need
+ * the total number of states... :-(
  */
-enum lock_usage_bit
-{
-       LOCK_USED = 0,
-       LOCK_USED_IN_HARDIRQ,
-       LOCK_USED_IN_SOFTIRQ,
-       LOCK_ENABLED_SOFTIRQS,
-       LOCK_ENABLED_HARDIRQS,
-       LOCK_USED_IN_HARDIRQ_READ,
-       LOCK_USED_IN_SOFTIRQ_READ,
-       LOCK_ENABLED_SOFTIRQS_READ,
-       LOCK_ENABLED_HARDIRQS_READ,
-       LOCK_USAGE_STATES
-};
-
-/*
- * Usage-state bitmasks:
- */
-#define LOCKF_USED                     (1 << LOCK_USED)
-#define LOCKF_USED_IN_HARDIRQ          (1 << LOCK_USED_IN_HARDIRQ)
-#define LOCKF_USED_IN_SOFTIRQ          (1 << LOCK_USED_IN_SOFTIRQ)
-#define LOCKF_ENABLED_HARDIRQS         (1 << LOCK_ENABLED_HARDIRQS)
-#define LOCKF_ENABLED_SOFTIRQS         (1 << LOCK_ENABLED_SOFTIRQS)
-
-#define LOCKF_ENABLED_IRQS (LOCKF_ENABLED_HARDIRQS | LOCKF_ENABLED_SOFTIRQS)
-#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
-
-#define LOCKF_USED_IN_HARDIRQ_READ     (1 << LOCK_USED_IN_HARDIRQ_READ)
-#define LOCKF_USED_IN_SOFTIRQ_READ     (1 << LOCK_USED_IN_SOFTIRQ_READ)
-#define LOCKF_ENABLED_HARDIRQS_READ    (1 << LOCK_ENABLED_HARDIRQS_READ)
-#define LOCKF_ENABLED_SOFTIRQS_READ    (1 << LOCK_ENABLED_SOFTIRQS_READ)
-
-#define LOCKF_ENABLED_IRQS_READ \
-               (LOCKF_ENABLED_HARDIRQS_READ | LOCKF_ENABLED_SOFTIRQS_READ)
-#define LOCKF_USED_IN_IRQ_READ \
-               (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
+#define XXX_LOCK_USAGE_STATES          (1+3*4)
 
 #define MAX_LOCKDEP_SUBCLASSES         8UL
 
@@ -97,7 +64,7 @@ struct lock_class {
         * IRQ/softirq usage tracking bits:
         */
        unsigned long                   usage_mask;
-       struct stack_trace              usage_traces[LOCK_USAGE_STATES];
+       struct stack_trace              usage_traces[XXX_LOCK_USAGE_STATES];
 
        /*
         * These fields represent a directed graph of lock dependencies,
@@ -324,7 +291,11 @@ static inline void lock_set_subclass(struct lockdep_map *lock,
        lock_set_class(lock, lock->name, lock->key, subclass, ip);
 }
 
-# define INIT_LOCKDEP                          .lockdep_recursion = 0,
+extern void lockdep_set_current_reclaim_state(gfp_t gfp_mask);
+extern void lockdep_clear_current_reclaim_state(void);
+extern void lockdep_trace_alloc(gfp_t mask);
+
+# define INIT_LOCKDEP                          .lockdep_recursion = 0, .lockdep_reclaim_gfp = 0,
 
 #define lockdep_depth(tsk)     (debug_locks ? (tsk)->lockdep_depth : 0)
 
@@ -342,6 +313,9 @@ static inline void lockdep_on(void)
 # define lock_release(l, n, i)                 do { } while (0)
 # define lock_set_class(l, n, k, s, i)         do { } while (0)
 # define lock_set_subclass(l, s, i)            do { } while (0)
+# define lockdep_set_current_reclaim_state(g)  do { } while (0)
+# define lockdep_clear_current_reclaim_state() do { } while (0)
+# define lockdep_trace_alloc(g)                        do { } while (0)
 # define lockdep_init()                                do { } while (0)
 # define lockdep_info()                                do { } while (0)
 # define lockdep_init_map(lock, name, key, sub) \
index 7a0e5c4f8072c53f4b0d6a7dfa681355324e065f..3069ec7e0ab84ca54a282c72d73385e44e69d63a 100644 (file)
@@ -50,8 +50,10 @@ struct mutex {
        atomic_t                count;
        spinlock_t              wait_lock;
        struct list_head        wait_list;
-#ifdef CONFIG_DEBUG_MUTEXES
+#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
        struct thread_info      *owner;
+#endif
+#ifdef CONFIG_DEBUG_MUTEXES
        const char              *name;
        void                    *magic;
 #endif
@@ -68,7 +70,6 @@ struct mutex_waiter {
        struct list_head        list;
        struct task_struct      *task;
 #ifdef CONFIG_DEBUG_MUTEXES
-       struct mutex            *lock;
        void                    *magic;
 #endif
 };
index de99025f2c5d5d6ba1fa48775ef6c51f203dd47a..2524267210d308894317f00e057c0d61bf81098d 100644 (file)
@@ -18,7 +18,7 @@ struct netpoll {
        const char *name;
        void (*rx_hook)(struct netpoll *, int, char *, int);
 
-       u32 local_ip, remote_ip;
+       __be32 local_ip, remote_ip;
        u16 local_port, remote_port;
        u8 remote_mac[ETH_ALEN];
 };
index 7bd624bfdcfd37945e3c59bf2a74f0d2f1dabb21..df3644132617c1ecdeaec9184a457701ac5d464b 100644 (file)
@@ -689,6 +689,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
 /* Power management related routines */
 int pci_save_state(struct pci_dev *dev);
 int pci_restore_state(struct pci_dev *dev);
+int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state);
 int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
 pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
index b8bdb96eff78b8112ddf4717b651c4ef1126ead7..fbfa3d44d33d819ef6af58c95e136ed6cc7e594a 100644 (file)
@@ -41,9 +41,6 @@ enum {
  * while parent/subdir create the directory structure (every
  * /proc file has a parent, but "subdir" is NULL for all
  * non-directory entries).
- *
- * "owner" is used to protect module
- * from unloading while proc_dir_entry is in use
  */
 
 typedef        int (read_proc_t)(char *page, char **start, off_t off,
@@ -70,7 +67,6 @@ struct proc_dir_entry {
         * somewhere.
         */
        const struct file_operations *proc_fops;
-       struct module *owner;
        struct proc_dir_entry *next, *parent, *subdir;
        void *data;
        read_proc_t *read_proc;
index 52240e02de026fdfd0657edf61a5b0aecdd0bb33..8cc65757e47adfc476ed4b2ca2c1d020c06ab6bf 100644 (file)
@@ -80,7 +80,8 @@ static inline int reiserfs_acl_chmod(struct inode *inode)
 }
 
 static inline int
-reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
+reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
+                            const struct inode *dir, struct dentry *dentry,
                             struct inode *inode)
 {
        return 0;
index 1d19c025f9d2e78b34692b3f350d9bef6fe522ed..29df6374d2de517e078c7dd29dd5eb6b7c18f82b 100644 (file)
@@ -331,7 +331,9 @@ extern signed long schedule_timeout(signed long timeout);
 extern signed long schedule_timeout_interruptible(signed long timeout);
 extern signed long schedule_timeout_killable(signed long timeout);
 extern signed long schedule_timeout_uninterruptible(signed long timeout);
+asmlinkage void __schedule(void);
 asmlinkage void schedule(void);
+extern int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner);
 
 struct nsproxy;
 struct user_namespace;
@@ -1334,6 +1336,7 @@ struct task_struct {
        int lockdep_depth;
        unsigned int lockdep_recursion;
        struct held_lock held_locks[MAX_LOCK_DEPTH];
+       gfp_t lockdep_reclaim_gfp;
 #endif
 
 /* journalling filesystem info */
index f616f31576d719597cd91b25498fece72e24cc8d..004f3b3342c5d580664b73aab18a9229186c9ed9 100644 (file)
@@ -55,7 +55,7 @@ int seq_bitmap(struct seq_file *m, const unsigned long *bits,
                                   unsigned int nr_bits);
 static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
 {
-       return seq_bitmap(m, mask->bits, nr_cpu_ids);
+       return seq_bitmap(m, cpumask_bits(mask), nr_cpu_ids);
 }
 
 static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
@@ -63,12 +63,13 @@ static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
        return seq_bitmap(m, mask->bits, MAX_NUMNODES);
 }
 
-int seq_bitmap_list(struct seq_file *m, unsigned long *bits,
+int seq_bitmap_list(struct seq_file *m, const unsigned long *bits,
                unsigned int nr_bits);
 
-static inline int seq_cpumask_list(struct seq_file *m, cpumask_t *mask)
+static inline int seq_cpumask_list(struct seq_file *m,
+                                  const struct cpumask *mask)
 {
-       return seq_bitmap_list(m, mask->bits, NR_CPUS);
+       return seq_bitmap_list(m, cpumask_bits(mask), nr_cpu_ids);
 }
 
 static inline int seq_nodemask_list(struct seq_file *m, nodemask_t *mask)
index 55d67300fa10d128fd4254adff8a78fc05100a78..5fd389162f014ccb053d8563de6ce2a16cedd90f 100644 (file)
@@ -168,6 +168,7 @@ struct skb_shared_hwtstamps {
  * @software:          generate software time stamp
  * @in_progress:       device driver is going to provide
  *                     hardware time stamp
+ * @flags:             all shared_tx flags
  *
  * These flags are attached to packets as part of the
  * &skb_shared_info. Use skb_tx() to get a pointer.
index e2d662e3416e38026bbc7385f744481de1b7d0a0..6cdb6f3331f11b6a80d7cd2c85a45706937b16d3 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/ktime.h>
 #include <linux/stddef.h>
 #include <linux/debugobjects.h>
+#include <linux/stringify.h>
 
 struct tvec_base;
 
@@ -21,52 +22,126 @@ struct timer_list {
        char start_comm[16];
        int start_pid;
 #endif
+#ifdef CONFIG_LOCKDEP
+       struct lockdep_map lockdep_map;
+#endif
 };
 
 extern struct tvec_base boot_tvec_bases;
 
+#ifdef CONFIG_LOCKDEP
+/*
+ * NB: because we have to copy the lockdep_map, setting the lockdep_map key
+ * (second argument) here is required, otherwise it could be initialised to
+ * the copy of the lockdep_map later! We use the pointer to and the string
+ * "<file>:<line>" as the key resp. the name of the lockdep_map.
+ */
+#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)                           \
+       .lockdep_map = STATIC_LOCKDEP_MAP_INIT(_kn, &_kn),
+#else
+#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)
+#endif
+
 #define TIMER_INITIALIZER(_function, _expires, _data) {                \
                .entry = { .prev = TIMER_ENTRY_STATIC },        \
                .function = (_function),                        \
                .expires = (_expires),                          \
                .data = (_data),                                \
                .base = &boot_tvec_bases,                       \
+               __TIMER_LOCKDEP_MAP_INITIALIZER(                \
+                       __FILE__ ":" __stringify(__LINE__))     \
        }
 
 #define DEFINE_TIMER(_name, _function, _expires, _data)                \
        struct timer_list _name =                               \
                TIMER_INITIALIZER(_function, _expires, _data)
 
-void init_timer(struct timer_list *timer);
-void init_timer_deferrable(struct timer_list *timer);
+void init_timer_key(struct timer_list *timer,
+                   const char *name,
+                   struct lock_class_key *key);
+void init_timer_deferrable_key(struct timer_list *timer,
+                              const char *name,
+                              struct lock_class_key *key);
+
+#ifdef CONFIG_LOCKDEP
+#define init_timer(timer)                                              \
+       do {                                                            \
+               static struct lock_class_key __key;                     \
+               init_timer_key((timer), #timer, &__key);                \
+       } while (0)
+
+#define init_timer_deferrable(timer)                                   \
+       do {                                                            \
+               static struct lock_class_key __key;                     \
+               init_timer_deferrable_key((timer), #timer, &__key);     \
+       } while (0)
+
+#define init_timer_on_stack(timer)                                     \
+       do {                                                            \
+               static struct lock_class_key __key;                     \
+               init_timer_on_stack_key((timer), #timer, &__key);       \
+       } while (0)
+
+#define setup_timer(timer, fn, data)                                   \
+       do {                                                            \
+               static struct lock_class_key __key;                     \
+               setup_timer_key((timer), #timer, &__key, (fn), (data));\
+       } while (0)
+
+#define setup_timer_on_stack(timer, fn, data)                          \
+       do {                                                            \
+               static struct lock_class_key __key;                     \
+               setup_timer_on_stack_key((timer), #timer, &__key,       \
+                                        (fn), (data));                 \
+       } while (0)
+#else
+#define init_timer(timer)\
+       init_timer_key((timer), NULL, NULL)
+#define init_timer_deferrable(timer)\
+       init_timer_deferrable_key((timer), NULL, NULL)
+#define init_timer_on_stack(timer)\
+       init_timer_on_stack_key((timer), NULL, NULL)
+#define setup_timer(timer, fn, data)\
+       setup_timer_key((timer), NULL, NULL, (fn), (data))
+#define setup_timer_on_stack(timer, fn, data)\
+       setup_timer_on_stack_key((timer), NULL, NULL, (fn), (data))
+#endif
 
 #ifdef CONFIG_DEBUG_OBJECTS_TIMERS
-extern void init_timer_on_stack(struct timer_list *timer);
+extern void init_timer_on_stack_key(struct timer_list *timer,
+                                   const char *name,
+                                   struct lock_class_key *key);
 extern void destroy_timer_on_stack(struct timer_list *timer);
 #else
 static inline void destroy_timer_on_stack(struct timer_list *timer) { }
-static inline void init_timer_on_stack(struct timer_list *timer)
+static inline void init_timer_on_stack_key(struct timer_list *timer,
+                                          const char *name,
+                                          struct lock_class_key *key)
 {
-       init_timer(timer);
+       init_timer_key(timer, name, key);
 }
 #endif
 
-static inline void setup_timer(struct timer_list * timer,
+static inline void setup_timer_key(struct timer_list * timer,
+                               const char *name,
+                               struct lock_class_key *key,
                                void (*function)(unsigned long),
                                unsigned long data)
 {
        timer->function = function;
        timer->data = data;
-       init_timer(timer);
+       init_timer_key(timer, name, key);
 }
 
-static inline void setup_timer_on_stack(struct timer_list *timer,
+static inline void setup_timer_on_stack_key(struct timer_list *timer,
+                                       const char *name,
+                                       struct lock_class_key *key,
                                        void (*function)(unsigned long),
                                        unsigned long data)
 {
        timer->function = function;
        timer->data = data;
-       init_timer_on_stack(timer);
+       init_timer_on_stack_key(timer, name, key);
 }
 
 /**
index 6bf83afd654da44b5b52383a4697d4d98e0ff6fa..d6b388fbffa679bdb8cce29ddfd9042ca2841032 100644 (file)
@@ -407,8 +407,7 @@ static void __init smp_init(void)
         * Set up the current CPU as possible to migrate to.
         * The other ones will be done by cpu_up/cpu_down()
         */
-       cpu = smp_processor_id();
-       cpu_set(cpu, cpu_active_map);
+       set_cpu_active(smp_processor_id(), true);
 
        /* FIXME: This should be done in userspace --RR */
        for_each_present_cpu(cpu) {
@@ -842,7 +841,7 @@ static int __init kernel_init(void * unused)
        /*
         * init can run on any cpu.
         */
-       set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR);
+       set_cpus_allowed_ptr(current, cpu_all_mask);
        /*
         * Tell the world that we're going to be the grim
         * reaper of innocent orphaned children.
index 79e40f00dcb89b8b3b5dedb5cc1c7da507e6b322..395b6974dc8d56ccb2d91ede756069fe9b10c975 100644 (file)
@@ -281,7 +281,7 @@ int __ref cpu_down(unsigned int cpu)
                goto out;
        }
 
-       cpu_clear(cpu, cpu_active_map);
+       set_cpu_active(cpu, false);
 
        /*
         * Make sure the all cpus did the reschedule and are not
@@ -296,7 +296,7 @@ int __ref cpu_down(unsigned int cpu)
        err = _cpu_down(cpu, 0);
 
        if (cpu_online(cpu))
-               cpu_set(cpu, cpu_active_map);
+               set_cpu_active(cpu, true);
 
 out:
        cpu_maps_update_done();
@@ -333,7 +333,7 @@ static int __cpuinit _cpu_up(unsigned int cpu, int tasks_frozen)
                goto out_notify;
        BUG_ON(!cpu_online(cpu));
 
-       cpu_set(cpu, cpu_active_map);
+       set_cpu_active(cpu, true);
 
        /* Now call notifier in preparation. */
        raw_notifier_call_chain(&cpu_chain, CPU_ONLINE | mod, hcpu);
index 6715ebc3761de3ed10eeda84ff932e59ff8289c5..47c15840a3813ee3fcabe5f89d04bf73c08b66c2 100644 (file)
@@ -284,7 +284,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
        mm->free_area_cache = oldmm->mmap_base;
        mm->cached_hole_size = ~0UL;
        mm->map_count = 0;
-       cpus_clear(mm->cpu_vm_mask);
+       cpumask_clear(mm_cpumask(mm));
        mm->mm_rb = RB_ROOT;
        rb_link = &mm->mm_rb.rb_node;
        rb_parent = NULL;
index 4dd5b1edac984bca7326297ecee3daf0239301f1..3394f8f52964b3d9b4433a3560ff94eb32b20cb8 100644 (file)
@@ -4,3 +4,4 @@ obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o
 obj-$(CONFIG_PROC_FS) += proc.o
 obj-$(CONFIG_GENERIC_PENDING_IRQ) += migration.o
 obj-$(CONFIG_NUMA_MIGRATE_IRQ_DESC) += numa_migrate.o
+obj-$(CONFIG_PM_SLEEP) += pm.o
index ee1aa9f8e8b9341af0c81ec9073f52e48375eb5b..01ce20eab38fed96a7b5a861940ba58d47c18fbf 100644 (file)
@@ -12,6 +12,8 @@ extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
 
 extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
                unsigned long flags);
+extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
+extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
 
 extern struct lock_class_key irq_desc_lock_class;
 extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr);
index 6458e99984c08f3af7a108ac0f7db03b21a7e5e8..1516ab77355c928bd1e1f5c8b6759e53d3b0c7e3 100644 (file)
@@ -162,6 +162,20 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
 }
 #endif
 
+void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
+{
+       if (suspend) {
+               if (!desc->action || (desc->action->flags & IRQF_TIMER))
+                       return;
+               desc->status |= IRQ_SUSPENDED;
+       }
+
+       if (!desc->depth++) {
+               desc->status |= IRQ_DISABLED;
+               desc->chip->disable(irq);
+       }
+}
+
 /**
  *     disable_irq_nosync - disable an irq without waiting
  *     @irq: Interrupt to disable
@@ -182,10 +196,7 @@ void disable_irq_nosync(unsigned int irq)
                return;
 
        spin_lock_irqsave(&desc->lock, flags);
-       if (!desc->depth++) {
-               desc->status |= IRQ_DISABLED;
-               desc->chip->disable(irq);
-       }
+       __disable_irq(desc, irq, false);
        spin_unlock_irqrestore(&desc->lock, flags);
 }
 EXPORT_SYMBOL(disable_irq_nosync);
@@ -215,15 +226,21 @@ void disable_irq(unsigned int irq)
 }
 EXPORT_SYMBOL(disable_irq);
 
-static void __enable_irq(struct irq_desc *desc, unsigned int irq)
+void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume)
 {
+       if (resume)
+               desc->status &= ~IRQ_SUSPENDED;
+
        switch (desc->depth) {
        case 0:
+ err_out:
                WARN(1, KERN_WARNING "Unbalanced enable for IRQ %d\n", irq);
                break;
        case 1: {
                unsigned int status = desc->status & ~IRQ_DISABLED;
 
+               if (desc->status & IRQ_SUSPENDED)
+                       goto err_out;
                /* Prevent probing on this irq: */
                desc->status = status | IRQ_NOPROBE;
                check_irq_resend(desc, irq);
@@ -253,7 +270,7 @@ void enable_irq(unsigned int irq)
                return;
 
        spin_lock_irqsave(&desc->lock, flags);
-       __enable_irq(desc, irq);
+       __enable_irq(desc, irq, false);
        spin_unlock_irqrestore(&desc->lock, flags);
 }
 EXPORT_SYMBOL(enable_irq);
@@ -511,7 +528,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
         */
        if (shared && (desc->status & IRQ_SPURIOUS_DISABLED)) {
                desc->status &= ~IRQ_SPURIOUS_DISABLED;
-               __enable_irq(desc, irq);
+               __enable_irq(desc, irq, false);
        }
 
        spin_unlock_irqrestore(&desc->lock, flags);
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
new file mode 100644 (file)
index 0000000..638d8be
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * linux/kernel/irq/pm.c
+ *
+ * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
+ *
+ * This file contains power management functions related to interrupts.
+ */
+
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+
+#include "internals.h"
+
+/**
+ * suspend_device_irqs - disable all currently enabled interrupt lines
+ *
+ * During system-wide suspend or hibernation device interrupts need to be
+ * disabled at the chip level and this function is provided for this purpose.
+ * It disables all interrupt lines that are enabled at the moment and sets the
+ * IRQ_SUSPENDED flag for them.
+ */
+void suspend_device_irqs(void)
+{
+       struct irq_desc *desc;
+       int irq;
+
+       for_each_irq_desc(irq, desc) {
+               unsigned long flags;
+
+               spin_lock_irqsave(&desc->lock, flags);
+               __disable_irq(desc, irq, true);
+               spin_unlock_irqrestore(&desc->lock, flags);
+       }
+
+       for_each_irq_desc(irq, desc)
+               if (desc->status & IRQ_SUSPENDED)
+                       synchronize_irq(irq);
+}
+EXPORT_SYMBOL_GPL(suspend_device_irqs);
+
+/**
+ * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
+ *
+ * Enable all interrupt lines previously disabled by suspend_device_irqs() that
+ * have the IRQ_SUSPENDED flag set.
+ */
+void resume_device_irqs(void)
+{
+       struct irq_desc *desc;
+       int irq;
+
+       for_each_irq_desc(irq, desc) {
+               unsigned long flags;
+
+               if (!(desc->status & IRQ_SUSPENDED))
+                       continue;
+
+               spin_lock_irqsave(&desc->lock, flags);
+               __enable_irq(desc, irq, true);
+               spin_unlock_irqrestore(&desc->lock, flags);
+       }
+}
+EXPORT_SYMBOL_GPL(resume_device_irqs);
+
+/**
+ * check_wakeup_irqs - check if any wake-up interrupts are pending
+ */
+int check_wakeup_irqs(void)
+{
+       struct irq_desc *desc;
+       int irq;
+
+       for_each_irq_desc(irq, desc)
+               if ((desc->status & IRQ_WAKEUP) && (desc->status & IRQ_PENDING))
+                       return -EBUSY;
+
+       return 0;
+}
index c7fd6692939d6bd03c13019996874677f296d83c..93eed85fe017b3be1109c95bdc78fc16f54bf806 100644 (file)
@@ -1450,11 +1450,7 @@ int kernel_kexec(void)
                error = device_suspend(PMSG_FREEZE);
                if (error)
                        goto Resume_console;
-               error = disable_nonboot_cpus();
-               if (error)
-                       goto Resume_devices;
                device_pm_lock();
-               local_irq_disable();
                /* At this point, device_suspend() has been called,
                 * but *not* device_power_down(). We *must*
                 * device_power_down() now.  Otherwise, drivers for
@@ -1464,12 +1460,15 @@ int kernel_kexec(void)
                 */
                error = device_power_down(PMSG_FREEZE);
                if (error)
-                       goto Enable_irqs;
-
+                       goto Resume_devices;
+               error = disable_nonboot_cpus();
+               if (error)
+                       goto Enable_cpus;
+               local_irq_disable();
                /* Suspend system devices */
                error = sysdev_suspend(PMSG_FREEZE);
                if (error)
-                       goto Power_up_devices;
+                       goto Enable_irqs;
        } else
 #endif
        {
@@ -1483,13 +1482,13 @@ int kernel_kexec(void)
 #ifdef CONFIG_KEXEC_JUMP
        if (kexec_image->preserve_context) {
                sysdev_resume();
- Power_up_devices:
-               device_power_up(PMSG_RESTORE);
  Enable_irqs:
                local_irq_enable();
-               device_pm_unlock();
+ Enable_cpus:
                enable_nonboot_cpus();
+               device_power_up(PMSG_RESTORE);
  Resume_devices:
+               device_pm_unlock();
                device_resume(PMSG_RESTORE);
  Resume_console:
                resume_console();
index a27a5f64443dc5c9a27d04679171cf15dfc1eabf..f0c8f545180d13193960d3171a1e58272488e72f 100644 (file)
@@ -167,7 +167,7 @@ static int ____call_usermodehelper(void *data)
        }
 
        /* We can run anywhere, unlike our parent keventd(). */
-       set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR);
+       set_cpus_allowed_ptr(current, cpu_all_mask);
 
        /*
         * Our parent is keventd, which runs with elevated scheduling priority.
index 4fbc456f393d0b1fb328667d9e93cc214c39da06..84bbadd4d0213c1558ade617ab49695df0b1bd9f 100644 (file)
@@ -110,7 +110,7 @@ static void create_kthread(struct kthread_create_info *create)
                 */
                sched_setscheduler(create->result, SCHED_NORMAL, &param);
                set_user_nice(create->result, KTHREAD_NICE_LEVEL);
-               set_cpus_allowed_ptr(create->result, CPU_MASK_ALL_PTR);
+               set_cpus_allowed_ptr(create->result, cpu_all_mask);
        }
        complete(&create->done);
 }
@@ -240,7 +240,7 @@ int kthreadd(void *unused)
        set_task_comm(tsk, "kthreadd");
        ignore_signals(tsk);
        set_user_nice(tsk, KTHREAD_NICE_LEVEL);
-       set_cpus_allowed_ptr(tsk, CPU_MASK_ALL_PTR);
+       set_cpus_allowed_ptr(tsk, cpu_all_mask);
 
        current->flags |= PF_NOFREEZE | PF_FREEZER_NOSIG;
 
index 06b0c3568f0b230a8c6b669d055c8c442a7eb790..3673a3f44d9d445f7cdf42f2ee5592731a4c0db7 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/utsname.h>
 #include <linux/hash.h>
 #include <linux/ftrace.h>
+#include <linux/stringify.h>
 
 #include <asm/sections.h>
 
@@ -310,12 +311,14 @@ EXPORT_SYMBOL(lockdep_on);
 #if VERBOSE
 # define HARDIRQ_VERBOSE       1
 # define SOFTIRQ_VERBOSE       1
+# define RECLAIM_VERBOSE       1
 #else
 # define HARDIRQ_VERBOSE       0
 # define SOFTIRQ_VERBOSE       0
+# define RECLAIM_VERBOSE       0
 #endif
 
-#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE
+#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE || RECLAIM_VERBOSE
 /*
  * Quick filtering for interesting events:
  */
@@ -443,17 +446,18 @@ atomic_t nr_find_usage_backwards_recursions;
  * Locking printouts:
  */
 
+#define __USAGE(__STATE)                                               \
+       [LOCK_USED_IN_##__STATE] = "IN-"__stringify(__STATE)"-W",       \
+       [LOCK_ENABLED_##__STATE] = __stringify(__STATE)"-ON-W",         \
+       [LOCK_USED_IN_##__STATE##_READ] = "IN-"__stringify(__STATE)"-R",\
+       [LOCK_ENABLED_##__STATE##_READ] = __stringify(__STATE)"-ON-R",
+
 static const char *usage_str[] =
 {
-       [LOCK_USED] =                   "initial-use ",
-       [LOCK_USED_IN_HARDIRQ] =        "in-hardirq-W",
-       [LOCK_USED_IN_SOFTIRQ] =        "in-softirq-W",
-       [LOCK_ENABLED_SOFTIRQS] =       "softirq-on-W",
-       [LOCK_ENABLED_HARDIRQS] =       "hardirq-on-W",
-       [LOCK_USED_IN_HARDIRQ_READ] =   "in-hardirq-R",
-       [LOCK_USED_IN_SOFTIRQ_READ] =   "in-softirq-R",
-       [LOCK_ENABLED_SOFTIRQS_READ] =  "softirq-on-R",
-       [LOCK_ENABLED_HARDIRQS_READ] =  "hardirq-on-R",
+#define LOCKDEP_STATE(__STATE) __USAGE(__STATE)
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+       [LOCK_USED] = "INITIAL USE",
 };
 
 const char * __get_key_name(struct lockdep_subclass_key *key, char *str)
@@ -461,46 +465,45 @@ const char * __get_key_name(struct lockdep_subclass_key *key, char *str)
        return kallsyms_lookup((unsigned long)key, NULL, NULL, NULL, str);
 }
 
-void
-get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, char *c4)
+static inline unsigned long lock_flag(enum lock_usage_bit bit)
 {
-       *c1 = '.', *c2 = '.', *c3 = '.', *c4 = '.';
-
-       if (class->usage_mask & LOCKF_USED_IN_HARDIRQ)
-               *c1 = '+';
-       else
-               if (class->usage_mask & LOCKF_ENABLED_HARDIRQS)
-                       *c1 = '-';
+       return 1UL << bit;
+}
 
-       if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)
-               *c2 = '+';
-       else
-               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS)
-                       *c2 = '-';
+static char get_usage_char(struct lock_class *class, enum lock_usage_bit bit)
+{
+       char c = '.';
 
-       if (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)
-               *c3 = '-';
-       if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ) {
-               *c3 = '+';
-               if (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)
-                       *c3 = '?';
+       if (class->usage_mask & lock_flag(bit + 2))
+               c = '+';
+       if (class->usage_mask & lock_flag(bit)) {
+               c = '-';
+               if (class->usage_mask & lock_flag(bit + 2))
+                       c = '?';
        }
 
-       if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)
-               *c4 = '-';
-       if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ) {
-               *c4 = '+';
-               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)
-                       *c4 = '?';
-       }
+       return c;
+}
+
+void get_usage_chars(struct lock_class *class, char usage[LOCK_USAGE_CHARS])
+{
+       int i = 0;
+
+#define LOCKDEP_STATE(__STATE)                                                 \
+       usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE);     \
+       usage[i++] = get_usage_char(class, LOCK_USED_IN_##__STATE##_READ);
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+
+       usage[i] = '\0';
 }
 
 static void print_lock_name(struct lock_class *class)
 {
-       char str[KSYM_NAME_LEN], c1, c2, c3, c4;
+       char str[KSYM_NAME_LEN], usage[LOCK_USAGE_CHARS];
        const char *name;
 
-       get_usage_chars(class, &c1, &c2, &c3, &c4);
+       get_usage_chars(class, usage);
 
        name = class->name;
        if (!name) {
@@ -513,7 +516,7 @@ static void print_lock_name(struct lock_class *class)
                if (class->subclass)
                        printk("/%d", class->subclass);
        }
-       printk("){%c%c%c%c}", c1, c2, c3, c4);
+       printk("){%s}", usage);
 }
 
 static void print_lockdep_cache(struct lockdep_map *lock)
@@ -1263,9 +1266,49 @@ check_usage(struct task_struct *curr, struct held_lock *prev,
                        bit_backwards, bit_forwards, irqclass);
 }
 
-static int
-check_prev_add_irq(struct task_struct *curr, struct held_lock *prev,
-               struct held_lock *next)
+static const char *state_names[] = {
+#define LOCKDEP_STATE(__STATE) \
+       __stringify(__STATE),
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+};
+
+static const char *state_rnames[] = {
+#define LOCKDEP_STATE(__STATE) \
+       __stringify(__STATE)"-READ",
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+};
+
+static inline const char *state_name(enum lock_usage_bit bit)
+{
+       return (bit & 1) ? state_rnames[bit >> 2] : state_names[bit >> 2];
+}
+
+static int exclusive_bit(int new_bit)
+{
+       /*
+        * USED_IN
+        * USED_IN_READ
+        * ENABLED
+        * ENABLED_READ
+        *
+        * bit 0 - write/read
+        * bit 1 - used_in/enabled
+        * bit 2+  state
+        */
+
+       int state = new_bit & ~3;
+       int dir = new_bit & 2;
+
+       /*
+        * keep state, bit flip the direction and strip read.
+        */
+       return state | (dir ^ 2);
+}
+
+static int check_irq_usage(struct task_struct *curr, struct held_lock *prev,
+                          struct held_lock *next, enum lock_usage_bit bit)
 {
        /*
         * Prove that the new dependency does not connect a hardirq-safe
@@ -1273,38 +1316,34 @@ check_prev_add_irq(struct task_struct *curr, struct held_lock *prev,
         * the backwards-subgraph starting at <prev>, and the
         * forwards-subgraph starting at <next>:
         */
-       if (!check_usage(curr, prev, next, LOCK_USED_IN_HARDIRQ,
-                                       LOCK_ENABLED_HARDIRQS, "hard"))
+       if (!check_usage(curr, prev, next, bit,
+                          exclusive_bit(bit), state_name(bit)))
                return 0;
 
+       bit++; /* _READ */
+
        /*
         * Prove that the new dependency does not connect a hardirq-safe-read
         * lock with a hardirq-unsafe lock - to achieve this we search
         * the backwards-subgraph starting at <prev>, and the
         * forwards-subgraph starting at <next>:
         */
-       if (!check_usage(curr, prev, next, LOCK_USED_IN_HARDIRQ_READ,
-                                       LOCK_ENABLED_HARDIRQS, "hard-read"))
+       if (!check_usage(curr, prev, next, bit,
+                          exclusive_bit(bit), state_name(bit)))
                return 0;
 
-       /*
-        * Prove that the new dependency does not connect a softirq-safe
-        * lock with a softirq-unsafe lock - to achieve this we search
-        * the backwards-subgraph starting at <prev>, and the
-        * forwards-subgraph starting at <next>:
-        */
-       if (!check_usage(curr, prev, next, LOCK_USED_IN_SOFTIRQ,
-                                       LOCK_ENABLED_SOFTIRQS, "soft"))
-               return 0;
-       /*
-        * Prove that the new dependency does not connect a softirq-safe-read
-        * lock with a softirq-unsafe lock - to achieve this we search
-        * the backwards-subgraph starting at <prev>, and the
-        * forwards-subgraph starting at <next>:
-        */
-       if (!check_usage(curr, prev, next, LOCK_USED_IN_SOFTIRQ_READ,
-                                       LOCK_ENABLED_SOFTIRQS, "soft"))
+       return 1;
+}
+
+static int
+check_prev_add_irq(struct task_struct *curr, struct held_lock *prev,
+               struct held_lock *next)
+{
+#define LOCKDEP_STATE(__STATE)                                         \
+       if (!check_irq_usage(curr, prev, next, LOCK_USED_IN_##__STATE)) \
                return 0;
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
 
        return 1;
 }
@@ -1933,7 +1972,7 @@ void print_irqtrace_events(struct task_struct *curr)
        print_ip_sym(curr->softirq_disable_ip);
 }
 
-static int hardirq_verbose(struct lock_class *class)
+static int HARDIRQ_verbose(struct lock_class *class)
 {
 #if HARDIRQ_VERBOSE
        return class_filter(class);
@@ -1941,7 +1980,7 @@ static int hardirq_verbose(struct lock_class *class)
        return 0;
 }
 
-static int softirq_verbose(struct lock_class *class)
+static int SOFTIRQ_verbose(struct lock_class *class)
 {
 #if SOFTIRQ_VERBOSE
        return class_filter(class);
@@ -1949,185 +1988,94 @@ static int softirq_verbose(struct lock_class *class)
        return 0;
 }
 
+static int RECLAIM_FS_verbose(struct lock_class *class)
+{
+#if RECLAIM_VERBOSE
+       return class_filter(class);
+#endif
+       return 0;
+}
+
 #define STRICT_READ_CHECKS     1
 
-static int mark_lock_irq(struct task_struct *curr, struct held_lock *this,
-               enum lock_usage_bit new_bit)
+static int (*state_verbose_f[])(struct lock_class *class) = {
+#define LOCKDEP_STATE(__STATE) \
+       __STATE##_verbose,
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+};
+
+static inline int state_verbose(enum lock_usage_bit bit,
+                               struct lock_class *class)
 {
-       int ret = 1;
+       return state_verbose_f[bit >> 2](class);
+}
 
-       switch(new_bit) {
-       case LOCK_USED_IN_HARDIRQ:
-               if (!valid_state(curr, this, new_bit, LOCK_ENABLED_HARDIRQS))
-                       return 0;
-               if (!valid_state(curr, this, new_bit,
-                                LOCK_ENABLED_HARDIRQS_READ))
-                       return 0;
-               /*
-                * just marked it hardirq-safe, check that this lock
-                * took no hardirq-unsafe lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                                         LOCK_ENABLED_HARDIRQS, "hard"))
-                       return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it hardirq-safe, check that this lock
-                * took no hardirq-unsafe-read lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                               LOCK_ENABLED_HARDIRQS_READ, "hard-read"))
-                       return 0;
-#endif
-               if (hardirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_USED_IN_SOFTIRQ:
-               if (!valid_state(curr, this, new_bit, LOCK_ENABLED_SOFTIRQS))
-                       return 0;
-               if (!valid_state(curr, this, new_bit,
-                                LOCK_ENABLED_SOFTIRQS_READ))
-                       return 0;
-               /*
-                * just marked it softirq-safe, check that this lock
-                * took no softirq-unsafe lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                                         LOCK_ENABLED_SOFTIRQS, "soft"))
-                       return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it softirq-safe, check that this lock
-                * took no softirq-unsafe-read lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                               LOCK_ENABLED_SOFTIRQS_READ, "soft-read"))
-                       return 0;
-#endif
-               if (softirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_USED_IN_HARDIRQ_READ:
-               if (!valid_state(curr, this, new_bit, LOCK_ENABLED_HARDIRQS))
-                       return 0;
-               /*
-                * just marked it hardirq-read-safe, check that this lock
-                * took no hardirq-unsafe lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                                         LOCK_ENABLED_HARDIRQS, "hard"))
-                       return 0;
-               if (hardirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_USED_IN_SOFTIRQ_READ:
-               if (!valid_state(curr, this, new_bit, LOCK_ENABLED_SOFTIRQS))
-                       return 0;
-               /*
-                * just marked it softirq-read-safe, check that this lock
-                * took no softirq-unsafe lock in the past:
-                */
-               if (!check_usage_forwards(curr, this,
-                                         LOCK_ENABLED_SOFTIRQS, "soft"))
-                       return 0;
-               if (softirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_ENABLED_HARDIRQS:
-               if (!valid_state(curr, this, new_bit, LOCK_USED_IN_HARDIRQ))
-                       return 0;
-               if (!valid_state(curr, this, new_bit,
-                                LOCK_USED_IN_HARDIRQ_READ))
-                       return 0;
-               /*
-                * just marked it hardirq-unsafe, check that no hardirq-safe
-                * lock in the system ever took it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                          LOCK_USED_IN_HARDIRQ, "hard"))
-                       return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it hardirq-unsafe, check that no
-                * hardirq-safe-read lock in the system ever took
-                * it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                  LOCK_USED_IN_HARDIRQ_READ, "hard-read"))
-                       return 0;
-#endif
-               if (hardirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_ENABLED_SOFTIRQS:
-               if (!valid_state(curr, this, new_bit, LOCK_USED_IN_SOFTIRQ))
-                       return 0;
-               if (!valid_state(curr, this, new_bit,
-                                LOCK_USED_IN_SOFTIRQ_READ))
-                       return 0;
-               /*
-                * just marked it softirq-unsafe, check that no softirq-safe
-                * lock in the system ever took it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                          LOCK_USED_IN_SOFTIRQ, "soft"))
-                       return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it softirq-unsafe, check that no
-                * softirq-safe-read lock in the system ever took
-                * it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                  LOCK_USED_IN_SOFTIRQ_READ, "soft-read"))
-                       return 0;
-#endif
-               if (softirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_ENABLED_HARDIRQS_READ:
-               if (!valid_state(curr, this, new_bit, LOCK_USED_IN_HARDIRQ))
-                       return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it hardirq-read-unsafe, check that no
-                * hardirq-safe lock in the system ever took it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                          LOCK_USED_IN_HARDIRQ, "hard"))
-                       return 0;
-#endif
-               if (hardirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       case LOCK_ENABLED_SOFTIRQS_READ:
-               if (!valid_state(curr, this, new_bit, LOCK_USED_IN_SOFTIRQ))
+typedef int (*check_usage_f)(struct task_struct *, struct held_lock *,
+                            enum lock_usage_bit bit, const char *name);
+
+static int
+mark_lock_irq(struct task_struct *curr, struct held_lock *this, int new_bit)
+{
+       int excl_bit = exclusive_bit(new_bit);
+       int read = new_bit & 1;
+       int dir = new_bit & 2;
+
+       /*
+        * mark USED_IN has to look forwards -- to ensure no dependency
+        * has ENABLED state, which would allow recursion deadlocks.
+        *
+        * mark ENABLED has to look backwards -- to ensure no dependee
+        * has USED_IN state, which, again, would allow  recursion deadlocks.
+        */
+       check_usage_f usage = dir ?
+               check_usage_backwards : check_usage_forwards;
+
+       /*
+        * Validate that this particular lock does not have conflicting
+        * usage states.
+        */
+       if (!valid_state(curr, this, new_bit, excl_bit))
+               return 0;
+
+       /*
+        * Validate that the lock dependencies don't have conflicting usage
+        * states.
+        */
+       if ((!read || !dir || STRICT_READ_CHECKS) &&
+                       !usage(curr, this, excl_bit, state_name(new_bit)))
+               return 0;
+
+       /*
+        * Check for read in write conflicts
+        */
+       if (!read) {
+               if (!valid_state(curr, this, new_bit, excl_bit + 1))
                        return 0;
-#if STRICT_READ_CHECKS
-               /*
-                * just marked it softirq-read-unsafe, check that no
-                * softirq-safe lock in the system ever took it in the past:
-                */
-               if (!check_usage_backwards(curr, this,
-                                          LOCK_USED_IN_SOFTIRQ, "soft"))
+
+               if (STRICT_READ_CHECKS &&
+                       !usage(curr, this, excl_bit + 1,
+                               state_name(new_bit + 1)))
                        return 0;
-#endif
-               if (softirq_verbose(hlock_class(this)))
-                       ret = 2;
-               break;
-       default:
-               WARN_ON(1);
-               break;
        }
 
-       return ret;
+       if (state_verbose(new_bit, hlock_class(this)))
+               return 2;
+
+       return 1;
 }
 
+enum mark_type {
+#define LOCKDEP_STATE(__STATE) __STATE,
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+};
+
 /*
  * Mark all held locks with a usage bit:
  */
 static int
-mark_held_locks(struct task_struct *curr, int hardirq)
+mark_held_locks(struct task_struct *curr, enum mark_type mark)
 {
        enum lock_usage_bit usage_bit;
        struct held_lock *hlock;
@@ -2136,17 +2084,12 @@ mark_held_locks(struct task_struct *curr, int hardirq)
        for (i = 0; i < curr->lockdep_depth; i++) {
                hlock = curr->held_locks + i;
 
-               if (hardirq) {
-                       if (hlock->read)
-                               usage_bit = LOCK_ENABLED_HARDIRQS_READ;
-                       else
-                               usage_bit = LOCK_ENABLED_HARDIRQS;
-               } else {
-                       if (hlock->read)
-                               usage_bit = LOCK_ENABLED_SOFTIRQS_READ;
-                       else
-                               usage_bit = LOCK_ENABLED_SOFTIRQS;
-               }
+               usage_bit = 2 + (mark << 2); /* ENABLED */
+               if (hlock->read)
+                       usage_bit += 1; /* READ */
+
+               BUG_ON(usage_bit >= LOCK_USAGE_STATES);
+
                if (!mark_lock(curr, hlock, usage_bit))
                        return 0;
        }
@@ -2200,7 +2143,7 @@ void trace_hardirqs_on_caller(unsigned long ip)
         * We are going to turn hardirqs on, so set the
         * usage bit for all held locks:
         */
-       if (!mark_held_locks(curr, 1))
+       if (!mark_held_locks(curr, HARDIRQ))
                return;
        /*
         * If we have softirqs enabled, then set the usage
@@ -2208,7 +2151,7 @@ void trace_hardirqs_on_caller(unsigned long ip)
         * this bit from being set before)
         */
        if (curr->softirqs_enabled)
-               if (!mark_held_locks(curr, 0))
+               if (!mark_held_locks(curr, SOFTIRQ))
                        return;
 
        curr->hardirq_enable_ip = ip;
@@ -2288,7 +2231,7 @@ void trace_softirqs_on(unsigned long ip)
         * enabled too:
         */
        if (curr->hardirqs_enabled)
-               mark_held_locks(curr, 0);
+               mark_held_locks(curr, SOFTIRQ);
 }
 
 /*
@@ -2317,6 +2260,48 @@ void trace_softirqs_off(unsigned long ip)
                debug_atomic_inc(&redundant_softirqs_off);
 }
 
+static void __lockdep_trace_alloc(gfp_t gfp_mask, unsigned long flags)
+{
+       struct task_struct *curr = current;
+
+       if (unlikely(!debug_locks))
+               return;
+
+       /* no reclaim without waiting on it */
+       if (!(gfp_mask & __GFP_WAIT))
+               return;
+
+       /* this guy won't enter reclaim */
+       if ((curr->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC))
+               return;
+
+       /* We're only interested __GFP_FS allocations for now */
+       if (!(gfp_mask & __GFP_FS))
+               return;
+
+       if (DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)))
+               return;
+
+       mark_held_locks(curr, RECLAIM_FS);
+}
+
+static void check_flags(unsigned long flags);
+
+void lockdep_trace_alloc(gfp_t gfp_mask)
+{
+       unsigned long flags;
+
+       if (unlikely(current->lockdep_recursion))
+               return;
+
+       raw_local_irq_save(flags);
+       check_flags(flags);
+       current->lockdep_recursion = 1;
+       __lockdep_trace_alloc(gfp_mask, flags);
+       current->lockdep_recursion = 0;
+       raw_local_irq_restore(flags);
+}
+
 static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
 {
        /*
@@ -2345,19 +2330,35 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
        if (!hlock->hardirqs_off) {
                if (hlock->read) {
                        if (!mark_lock(curr, hlock,
-                                       LOCK_ENABLED_HARDIRQS_READ))
+                                       LOCK_ENABLED_HARDIRQ_READ))
                                return 0;
                        if (curr->softirqs_enabled)
                                if (!mark_lock(curr, hlock,
-                                               LOCK_ENABLED_SOFTIRQS_READ))
+                                               LOCK_ENABLED_SOFTIRQ_READ))
                                        return 0;
                } else {
                        if (!mark_lock(curr, hlock,
-                                       LOCK_ENABLED_HARDIRQS))
+                                       LOCK_ENABLED_HARDIRQ))
                                return 0;
                        if (curr->softirqs_enabled)
                                if (!mark_lock(curr, hlock,
-                                               LOCK_ENABLED_SOFTIRQS))
+                                               LOCK_ENABLED_SOFTIRQ))
+                                       return 0;
+               }
+       }
+
+       /*
+        * We reuse the irq context infrastructure more broadly as a general
+        * context checking code. This tests GFP_FS recursion (a lock taken
+        * during reclaim for a GFP_FS allocation is held over a GFP_FS
+        * allocation).
+        */
+       if (!hlock->trylock && (curr->lockdep_reclaim_gfp & __GFP_FS)) {
+               if (hlock->read) {
+                       if (!mark_lock(curr, hlock, LOCK_USED_IN_RECLAIM_FS_READ))
+                                       return 0;
+               } else {
+                       if (!mark_lock(curr, hlock, LOCK_USED_IN_RECLAIM_FS))
                                        return 0;
                }
        }
@@ -2412,6 +2413,10 @@ static inline int separate_irq_context(struct task_struct *curr,
        return 0;
 }
 
+void lockdep_trace_alloc(gfp_t gfp_mask)
+{
+}
+
 #endif
 
 /*
@@ -2445,14 +2450,13 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this,
                return 0;
 
        switch (new_bit) {
-       case LOCK_USED_IN_HARDIRQ:
-       case LOCK_USED_IN_SOFTIRQ:
-       case LOCK_USED_IN_HARDIRQ_READ:
-       case LOCK_USED_IN_SOFTIRQ_READ:
-       case LOCK_ENABLED_HARDIRQS:
-       case LOCK_ENABLED_SOFTIRQS:
-       case LOCK_ENABLED_HARDIRQS_READ:
-       case LOCK_ENABLED_SOFTIRQS_READ:
+#define LOCKDEP_STATE(__STATE)                 \
+       case LOCK_USED_IN_##__STATE:            \
+       case LOCK_USED_IN_##__STATE##_READ:     \
+       case LOCK_ENABLED_##__STATE:            \
+       case LOCK_ENABLED_##__STATE##_READ:
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
                ret = mark_lock_irq(curr, this, new_bit);
                if (!ret)
                        return 0;
@@ -2966,6 +2970,16 @@ void lock_release(struct lockdep_map *lock, int nested,
 }
 EXPORT_SYMBOL_GPL(lock_release);
 
+void lockdep_set_current_reclaim_state(gfp_t gfp_mask)
+{
+       current->lockdep_reclaim_gfp = gfp_mask;
+}
+
+void lockdep_clear_current_reclaim_state(void)
+{
+       current->lockdep_reclaim_gfp = 0;
+}
+
 #ifdef CONFIG_LOCK_STAT
 static int
 print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
index 56b196932c081e915568d4fef27a92c08e129758..a2cc7e9a6e841b9e955709b9139cd96b3d803f2e 100644 (file)
@@ -6,6 +6,45 @@
  * lockdep subsystem internal functions and variables.
  */
 
+/*
+ * Lock-class usage-state bits:
+ */
+enum lock_usage_bit {
+#define LOCKDEP_STATE(__STATE)         \
+       LOCK_USED_IN_##__STATE,         \
+       LOCK_USED_IN_##__STATE##_READ,  \
+       LOCK_ENABLED_##__STATE,         \
+       LOCK_ENABLED_##__STATE##_READ,
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+       LOCK_USED,
+       LOCK_USAGE_STATES
+};
+
+/*
+ * Usage-state bitmasks:
+ */
+#define __LOCKF(__STATE)       LOCKF_##__STATE = (1 << LOCK_##__STATE),
+
+enum {
+#define LOCKDEP_STATE(__STATE)                                         \
+       __LOCKF(USED_IN_##__STATE)                                      \
+       __LOCKF(USED_IN_##__STATE##_READ)                               \
+       __LOCKF(ENABLED_##__STATE)                                      \
+       __LOCKF(ENABLED_##__STATE##_READ)
+#include "lockdep_states.h"
+#undef LOCKDEP_STATE
+       __LOCKF(USED)
+};
+
+#define LOCKF_ENABLED_IRQ (LOCKF_ENABLED_HARDIRQ | LOCKF_ENABLED_SOFTIRQ)
+#define LOCKF_USED_IN_IRQ (LOCKF_USED_IN_HARDIRQ | LOCKF_USED_IN_SOFTIRQ)
+
+#define LOCKF_ENABLED_IRQ_READ \
+               (LOCKF_ENABLED_HARDIRQ_READ | LOCKF_ENABLED_SOFTIRQ_READ)
+#define LOCKF_USED_IN_IRQ_READ \
+               (LOCKF_USED_IN_HARDIRQ_READ | LOCKF_USED_IN_SOFTIRQ_READ)
+
 /*
  * MAX_LOCKDEP_ENTRIES is the maximum number of lock dependencies
  * we track.
 extern struct list_head all_lock_classes;
 extern struct lock_chain lock_chains[];
 
-extern void
-get_usage_chars(struct lock_class *class, char *c1, char *c2, char *c3, char *c4);
+#define LOCK_USAGE_CHARS (1+LOCK_USAGE_STATES/2)
+
+extern void get_usage_chars(struct lock_class *class,
+                           char usage[LOCK_USAGE_CHARS]);
 
 extern const char * __get_key_name(struct lockdep_subclass_key *key, char *str);
 
index 13716b8138961ee9f5feffe23ad9115fc27766e3..d7135aa2d2c4ccc0f3638cfa6fb3b2742e33c43c 100644 (file)
@@ -84,7 +84,7 @@ static int l_show(struct seq_file *m, void *v)
 {
        struct lock_class *class = v;
        struct lock_list *entry;
-       char c1, c2, c3, c4;
+       char usage[LOCK_USAGE_CHARS];
 
        if (v == SEQ_START_TOKEN) {
                seq_printf(m, "all lock classes:\n");
@@ -100,8 +100,8 @@ static int l_show(struct seq_file *m, void *v)
        seq_printf(m, " BD:%5ld", lockdep_count_backward_deps(class));
 #endif
 
-       get_usage_chars(class, &c1, &c2, &c3, &c4);
-       seq_printf(m, " %c%c%c%c", c1, c2, c3, c4);
+       get_usage_chars(class, usage);
+       seq_printf(m, " %s", usage);
 
        seq_printf(m, ": ");
        print_name(m, class);
@@ -300,27 +300,27 @@ static int lockdep_stats_show(struct seq_file *m, void *v)
                        nr_uncategorized++;
                if (class->usage_mask & LOCKF_USED_IN_IRQ)
                        nr_irq_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_IRQS)
+               if (class->usage_mask & LOCKF_ENABLED_IRQ)
                        nr_irq_unsafe++;
                if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ)
                        nr_softirq_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS)
+               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ)
                        nr_softirq_unsafe++;
                if (class->usage_mask & LOCKF_USED_IN_HARDIRQ)
                        nr_hardirq_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_HARDIRQS)
+               if (class->usage_mask & LOCKF_ENABLED_HARDIRQ)
                        nr_hardirq_unsafe++;
                if (class->usage_mask & LOCKF_USED_IN_IRQ_READ)
                        nr_irq_read_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_IRQS_READ)
+               if (class->usage_mask & LOCKF_ENABLED_IRQ_READ)
                        nr_irq_read_unsafe++;
                if (class->usage_mask & LOCKF_USED_IN_SOFTIRQ_READ)
                        nr_softirq_read_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQS_READ)
+               if (class->usage_mask & LOCKF_ENABLED_SOFTIRQ_READ)
                        nr_softirq_read_unsafe++;
                if (class->usage_mask & LOCKF_USED_IN_HARDIRQ_READ)
                        nr_hardirq_read_safe++;
-               if (class->usage_mask & LOCKF_ENABLED_HARDIRQS_READ)
+               if (class->usage_mask & LOCKF_ENABLED_HARDIRQ_READ)
                        nr_hardirq_read_unsafe++;
 
 #ifdef CONFIG_PROVE_LOCKING
@@ -601,6 +601,10 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
 static void seq_header(struct seq_file *m)
 {
        seq_printf(m, "lock_stat version 0.3\n");
+
+       if (unlikely(!debug_locks))
+               seq_printf(m, "*WARNING* lock debugging disabled!! - possibly due to a lockdep warning\n");
+
        seq_line(m, '-', 0, 40 + 1 + 10 * (14 + 1));
        seq_printf(m, "%40s %14s %14s %14s %14s %14s %14s %14s %14s "
                        "%14s %14s\n",
diff --git a/kernel/lockdep_states.h b/kernel/lockdep_states.h
new file mode 100644 (file)
index 0000000..995b0cc
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * Lockdep states,
+ *
+ * please update XXX_LOCK_USAGE_STATES in include/linux/lockdep.h whenever
+ * you add one, or come up with a nice dynamic solution.
+ */
+LOCKDEP_STATE(HARDIRQ)
+LOCKDEP_STATE(SOFTIRQ)
+LOCKDEP_STATE(RECLAIM_FS)
index 1d94160eb5326e94c0222da947b8c1ee4ee44875..50d022e5a5606dd64d985afbff9d33621f06ab96 100644 (file)
 /*
  * Must be called with lock->wait_lock held.
  */
-void debug_mutex_set_owner(struct mutex *lock, struct thread_info *new_owner)
-{
-       lock->owner = new_owner;
-}
-
 void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
 {
        memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
@@ -59,7 +54,6 @@ void debug_mutex_add_waiter(struct mutex *lock, struct mutex_waiter *waiter,
 
        /* Mark the current thread as blocked on the lock: */
        ti->task->blocked_on = waiter;
-       waiter->lock = lock;
 }
 
 void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
@@ -82,7 +76,7 @@ void debug_mutex_unlock(struct mutex *lock)
        DEBUG_LOCKS_WARN_ON(lock->magic != lock);
        DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
        DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
-       DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
+       mutex_clear_owner(lock);
 }
 
 void debug_mutex_init(struct mutex *lock, const char *name,
@@ -95,7 +89,6 @@ void debug_mutex_init(struct mutex *lock, const char *name,
        debug_check_no_locks_freed((void *)lock, sizeof(*lock));
        lockdep_init_map(&lock->dep_map, name, key, 0);
 #endif
-       lock->owner = NULL;
        lock->magic = lock;
 }
 
index babfbdfc534b7127e3769405433499f1929a44a5..6b2d735846a56f17425749b6501fe2023c0e6cdb 100644 (file)
 /*
  * This must be called with lock->wait_lock held.
  */
-extern void
-debug_mutex_set_owner(struct mutex *lock, struct thread_info *new_owner);
-
-static inline void debug_mutex_clear_owner(struct mutex *lock)
-{
-       lock->owner = NULL;
-}
-
 extern void debug_mutex_lock_common(struct mutex *lock,
                                    struct mutex_waiter *waiter);
 extern void debug_mutex_wake_waiter(struct mutex *lock,
@@ -35,6 +27,16 @@ extern void debug_mutex_unlock(struct mutex *lock);
 extern void debug_mutex_init(struct mutex *lock, const char *name,
                             struct lock_class_key *key);
 
+static inline void mutex_set_owner(struct mutex *lock)
+{
+       lock->owner = current_thread_info();
+}
+
+static inline void mutex_clear_owner(struct mutex *lock)
+{
+       lock->owner = NULL;
+}
+
 #define spin_lock_mutex(lock, flags)                   \
        do {                                            \
                struct mutex *l = container_of(lock, struct mutex, wait_lock); \
index 4f45d4b658ef6ab1fda9357725b01361a6768a76..5d79781394a306e75048668262a6c3f49f5321ef 100644 (file)
  * Many thanks to Arjan van de Ven, Thomas Gleixner, Steven Rostedt and
  * David Howells for suggestions and improvements.
  *
+ *  - Adaptive spinning for mutexes by Peter Zijlstra. (Ported to mainline
+ *    from the -rt tree, where it was originally implemented for rtmutexes
+ *    by Steven Rostedt, based on work by Gregory Haskins, Peter Morreale
+ *    and Sven Dietrich.
+ *
  * Also see Documentation/mutex-design.txt.
  */
 #include <linux/mutex.h>
@@ -46,6 +51,7 @@ __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
        atomic_set(&lock->count, 1);
        spin_lock_init(&lock->wait_lock);
        INIT_LIST_HEAD(&lock->wait_list);
+       mutex_clear_owner(lock);
 
        debug_mutex_init(lock, name, key);
 }
@@ -91,6 +97,7 @@ void inline __sched mutex_lock(struct mutex *lock)
         * 'unlocked' into 'locked' state.
         */
        __mutex_fastpath_lock(&lock->count, __mutex_lock_slowpath);
+       mutex_set_owner(lock);
 }
 
 EXPORT_SYMBOL(mutex_lock);
@@ -115,6 +122,14 @@ void __sched mutex_unlock(struct mutex *lock)
         * The unlocking fastpath is the 0->1 transition from 'locked'
         * into 'unlocked' state:
         */
+#ifndef CONFIG_DEBUG_MUTEXES
+       /*
+        * When debugging is enabled we must not clear the owner before time,
+        * the slow path will always be taken, and that clears the owner field
+        * after verifying that it was indeed current.
+        */
+       mutex_clear_owner(lock);
+#endif
        __mutex_fastpath_unlock(&lock->count, __mutex_unlock_slowpath);
 }
 
@@ -129,21 +144,75 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
 {
        struct task_struct *task = current;
        struct mutex_waiter waiter;
-       unsigned int old_val;
        unsigned long flags;
 
+       preempt_disable();
+       mutex_acquire(&lock->dep_map, subclass, 0, ip);
+#if defined(CONFIG_SMP) && !defined(CONFIG_DEBUG_MUTEXES)
+       /*
+        * Optimistic spinning.
+        *
+        * We try to spin for acquisition when we find that there are no
+        * pending waiters and the lock owner is currently running on a
+        * (different) CPU.
+        *
+        * The rationale is that if the lock owner is running, it is likely to
+        * release the lock soon.
+        *
+        * Since this needs the lock owner, and this mutex implementation
+        * doesn't track the owner atomically in the lock field, we need to
+        * track it non-atomically.
+        *
+        * We can't do this for DEBUG_MUTEXES because that relies on wait_lock
+        * to serialize everything.
+        */
+
+       for (;;) {
+               struct thread_info *owner;
+
+               /*
+                * If there's an owner, wait for it to either
+                * release the lock or go to sleep.
+                */
+               owner = ACCESS_ONCE(lock->owner);
+               if (owner && !mutex_spin_on_owner(lock, owner))
+                       break;
+
+               if (atomic_cmpxchg(&lock->count, 1, 0) == 1) {
+                       lock_acquired(&lock->dep_map, ip);
+                       mutex_set_owner(lock);
+                       preempt_enable();
+                       return 0;
+               }
+
+               /*
+                * When there's no owner, we might have preempted between the
+                * owner acquiring the lock and setting the owner field. If
+                * we're an RT task that will live-lock because we won't let
+                * the owner complete.
+                */
+               if (!owner && (need_resched() || rt_task(task)))
+                       break;
+
+               /*
+                * The cpu_relax() call is a compiler barrier which forces
+                * everything in this loop to be re-loaded. We don't need
+                * memory barriers as we'll eventually observe the right
+                * values at the cost of a few extra spins.
+                */
+               cpu_relax();
+       }
+#endif
        spin_lock_mutex(&lock->wait_lock, flags);
 
        debug_mutex_lock_common(lock, &waiter);
-       mutex_acquire(&lock->dep_map, subclass, 0, ip);
        debug_mutex_add_waiter(lock, &waiter, task_thread_info(task));
 
        /* add waiting tasks to the end of the waitqueue (FIFO): */
        list_add_tail(&waiter.list, &lock->wait_list);
        waiter.task = task;
 
-       old_val = atomic_xchg(&lock->count, -1);
-       if (old_val == 1)
+       if (atomic_xchg(&lock->count, -1) == 1)
                goto done;
 
        lock_contended(&lock->dep_map, ip);
@@ -158,8 +227,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
                 * that when we release the lock, we properly wake up the
                 * other waiters:
                 */
-               old_val = atomic_xchg(&lock->count, -1);
-               if (old_val == 1)
+               if (atomic_xchg(&lock->count, -1) == 1)
                        break;
 
                /*
@@ -173,21 +241,22 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
                        spin_unlock_mutex(&lock->wait_lock, flags);
 
                        debug_mutex_free_waiter(&waiter);
+                       preempt_enable();
                        return -EINTR;
                }
                __set_task_state(task, state);
 
                /* didnt get the lock, go to sleep: */
                spin_unlock_mutex(&lock->wait_lock, flags);
-               schedule();
+               __schedule();
                spin_lock_mutex(&lock->wait_lock, flags);
        }
 
 done:
        lock_acquired(&lock->dep_map, ip);
        /* got the lock - rejoice! */
-       mutex_remove_waiter(lock, &waiter, task_thread_info(task));
-       debug_mutex_set_owner(lock, task_thread_info(task));
+       mutex_remove_waiter(lock, &waiter, current_thread_info());
+       mutex_set_owner(lock);
 
        /* set it to 0 if there are no waiters left: */
        if (likely(list_empty(&lock->wait_list)))
@@ -196,6 +265,7 @@ done:
        spin_unlock_mutex(&lock->wait_lock, flags);
 
        debug_mutex_free_waiter(&waiter);
+       preempt_enable();
 
        return 0;
 }
@@ -222,7 +292,8 @@ int __sched
 mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass)
 {
        might_sleep();
-       return __mutex_lock_common(lock, TASK_INTERRUPTIBLE, subclass, _RET_IP_);
+       return __mutex_lock_common(lock, TASK_INTERRUPTIBLE,
+                                  subclass, _RET_IP_);
 }
 
 EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested);
@@ -260,8 +331,6 @@ __mutex_unlock_common_slowpath(atomic_t *lock_count, int nested)
                wake_up_process(waiter->task);
        }
 
-       debug_mutex_clear_owner(lock);
-
        spin_unlock_mutex(&lock->wait_lock, flags);
 }
 
@@ -298,18 +367,30 @@ __mutex_lock_interruptible_slowpath(atomic_t *lock_count);
  */
 int __sched mutex_lock_interruptible(struct mutex *lock)
 {
+       int ret;
+
        might_sleep();
-       return __mutex_fastpath_lock_retval
+       ret =  __mutex_fastpath_lock_retval
                        (&lock->count, __mutex_lock_interruptible_slowpath);
+       if (!ret)
+               mutex_set_owner(lock);
+
+       return ret;
 }
 
 EXPORT_SYMBOL(mutex_lock_interruptible);
 
 int __sched mutex_lock_killable(struct mutex *lock)
 {
+       int ret;
+
        might_sleep();
-       return __mutex_fastpath_lock_retval
+       ret = __mutex_fastpath_lock_retval
                        (&lock->count, __mutex_lock_killable_slowpath);
+       if (!ret)
+               mutex_set_owner(lock);
+
+       return ret;
 }
 EXPORT_SYMBOL(mutex_lock_killable);
 
@@ -352,9 +433,10 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count)
 
        prev = atomic_xchg(&lock->count, -1);
        if (likely(prev == 1)) {
-               debug_mutex_set_owner(lock, current_thread_info());
+               mutex_set_owner(lock);
                mutex_acquire(&lock->dep_map, 0, 1, _RET_IP_);
        }
+
        /* Set it back to 0 if there are no waiters: */
        if (likely(list_empty(&lock->wait_list)))
                atomic_set(&lock->count, 0);
@@ -380,8 +462,13 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count)
  */
 int __sched mutex_trylock(struct mutex *lock)
 {
-       return __mutex_fastpath_trylock(&lock->count,
-                                       __mutex_trylock_slowpath);
+       int ret;
+
+       ret = __mutex_fastpath_trylock(&lock->count, __mutex_trylock_slowpath);
+       if (ret)
+               mutex_set_owner(lock);
+
+       return ret;
 }
 
 EXPORT_SYMBOL(mutex_trylock);
index a075dafbb290c18bdf8972c361d8063f2478fa69..67578ca48f94e1dad6f7cf3760c28d20a86605e2 100644 (file)
 #define mutex_remove_waiter(lock, waiter, ti) \
                __list_del((waiter)->list.prev, (waiter)->list.next)
 
-#define debug_mutex_set_owner(lock, new_owner)         do { } while (0)
-#define debug_mutex_clear_owner(lock)                  do { } while (0)
+#ifdef CONFIG_SMP
+static inline void mutex_set_owner(struct mutex *lock)
+{
+       lock->owner = current_thread_info();
+}
+
+static inline void mutex_clear_owner(struct mutex *lock)
+{
+       lock->owner = NULL;
+}
+#else
+static inline void mutex_set_owner(struct mutex *lock)
+{
+}
+
+static inline void mutex_clear_owner(struct mutex *lock)
+{
+}
+#endif
+
 #define debug_mutex_wake_waiter(lock, waiter)          do { } while (0)
 #define debug_mutex_free_waiter(waiter)                        do { } while (0)
 #define debug_mutex_add_waiter(lock, waiter, ti)       do { } while (0)
index 4a4a206b1979c657c887df31907166080a004d8f..e886d1332a1024d40f2edc6cde7d144ec2ea8f59 100644 (file)
@@ -214,7 +214,7 @@ static int create_image(int platform_mode)
                return error;
 
        device_pm_lock();
-       local_irq_disable();
+
        /* At this point, device_suspend() has been called, but *not*
         * device_power_down(). We *must* call device_power_down() now.
         * Otherwise, drivers for some devices (e.g. interrupt controllers)
@@ -225,13 +225,25 @@ static int create_image(int platform_mode)
        if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down, "
                        "aborting hibernation\n");
-               goto Enable_irqs;
+               goto Unlock;
        }
+
+       error = platform_pre_snapshot(platform_mode);
+       if (error || hibernation_test(TEST_PLATFORM))
+               goto Platform_finish;
+
+       error = disable_nonboot_cpus();
+       if (error || hibernation_test(TEST_CPUS)
+           || hibernation_testmode(HIBERNATION_TEST))
+               goto Enable_cpus;
+
+       local_irq_disable();
+
        sysdev_suspend(PMSG_FREEZE);
        if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down, "
                        "aborting hibernation\n");
-               goto Power_up_devices;
+               goto Enable_irqs;
        }
 
        if (hibernation_test(TEST_CORE))
@@ -247,17 +259,28 @@ static int create_image(int platform_mode)
        restore_processor_state();
        if (!in_suspend)
                platform_leave(platform_mode);
+
  Power_up:
        sysdev_resume();
        /* NOTE:  device_power_up() is just a resume() for devices
         * that suspended with irqs off ... no overall powerup.
         */
- Power_up_devices:
-       device_power_up(in_suspend ?
-               (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
+
  Enable_irqs:
        local_irq_enable();
+
+ Enable_cpus:
+       enable_nonboot_cpus();
+
+ Platform_finish:
+       platform_finish(platform_mode);
+
+       device_power_up(in_suspend ?
+               (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
+
+ Unlock:
        device_pm_unlock();
+
        return error;
 }
 
@@ -291,25 +314,9 @@ int hibernation_snapshot(int platform_mode)
        if (hibernation_test(TEST_DEVICES))
                goto Recover_platform;
 
-       error = platform_pre_snapshot(platform_mode);
-       if (error || hibernation_test(TEST_PLATFORM))
-               goto Finish;
-
-       error = disable_nonboot_cpus();
-       if (!error) {
-               if (hibernation_test(TEST_CPUS))
-                       goto Enable_cpus;
-
-               if (hibernation_testmode(HIBERNATION_TEST))
-                       goto Enable_cpus;
+       error = create_image(platform_mode);
+       /* Control returns here after successful restore */
 
-               error = create_image(platform_mode);
-               /* Control returns here after successful restore */
-       }
- Enable_cpus:
-       enable_nonboot_cpus();
- Finish:
-       platform_finish(platform_mode);
  Resume_devices:
        device_resume(in_suspend ?
                (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
@@ -331,19 +338,33 @@ int hibernation_snapshot(int platform_mode)
  *     kernel.
  */
 
-static int resume_target_kernel(void)
+static int resume_target_kernel(bool platform_mode)
 {
        int error;
 
        device_pm_lock();
-       local_irq_disable();
+
        error = device_power_down(PMSG_QUIESCE);
        if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down, "
                        "aborting resume\n");
-               goto Enable_irqs;
+               goto Unlock;
        }
-       sysdev_suspend(PMSG_QUIESCE);
+
+       error = platform_pre_restore(platform_mode);
+       if (error)
+               goto Cleanup;
+
+       error = disable_nonboot_cpus();
+       if (error)
+               goto Enable_cpus;
+
+       local_irq_disable();
+
+       error = sysdev_suspend(PMSG_QUIESCE);
+       if (error)
+               goto Enable_irqs;
+
        /* We'll ignore saved state, but this gets preempt count (etc) right */
        save_processor_state();
        error = restore_highmem();
@@ -366,11 +387,23 @@ static int resume_target_kernel(void)
        swsusp_free();
        restore_processor_state();
        touch_softlockup_watchdog();
+
        sysdev_resume();
-       device_power_up(PMSG_RECOVER);
+
  Enable_irqs:
        local_irq_enable();
+
+ Enable_cpus:
+       enable_nonboot_cpus();
+
+ Cleanup:
+       platform_restore_cleanup(platform_mode);
+
+       device_power_up(PMSG_RECOVER);
+
+ Unlock:
        device_pm_unlock();
+
        return error;
 }
 
@@ -390,19 +423,10 @@ int hibernation_restore(int platform_mode)
        pm_prepare_console();
        suspend_console();
        error = device_suspend(PMSG_QUIESCE);
-       if (error)
-               goto Finish;
-
-       error = platform_pre_restore(platform_mode);
        if (!error) {
-               error = disable_nonboot_cpus();
-               if (!error)
-                       error = resume_target_kernel();
-               enable_nonboot_cpus();
+               error = resume_target_kernel(platform_mode);
+               device_resume(PMSG_RECOVER);
        }
-       platform_restore_cleanup(platform_mode);
-       device_resume(PMSG_RECOVER);
- Finish:
        resume_console();
        pm_restore_console();
        return error;
@@ -438,38 +462,46 @@ int hibernation_platform_enter(void)
                goto Resume_devices;
        }
 
+       device_pm_lock();
+
+       error = device_power_down(PMSG_HIBERNATE);
+       if (error)
+               goto Unlock;
+
        error = hibernation_ops->prepare();
        if (error)
-               goto Resume_devices;
+               goto Platofrm_finish;
 
        error = disable_nonboot_cpus();
        if (error)
-               goto Finish;
+               goto Platofrm_finish;
 
-       device_pm_lock();
        local_irq_disable();
-       error = device_power_down(PMSG_HIBERNATE);
-       if (!error) {
-               sysdev_suspend(PMSG_HIBERNATE);
-               hibernation_ops->enter();
-               /* We should never get here */
-               while (1);
-       }
-       local_irq_enable();
-       device_pm_unlock();
+       sysdev_suspend(PMSG_HIBERNATE);
+       hibernation_ops->enter();
+       /* We should never get here */
+       while (1);
 
        /*
         * We don't need to reenable the nonboot CPUs or resume consoles, since
         * the system is going to be halted anyway.
         */
Finish:
Platofrm_finish:
        hibernation_ops->finish();
+
+       device_power_up(PMSG_RESTORE);
+
+ Unlock:
+       device_pm_unlock();
+
  Resume_devices:
        entering_platform_hibernation = false;
        device_resume(PMSG_RESTORE);
        resume_console();
+
  Close:
        hibernation_ops->end();
+
        return error;
 }
 
index c9632f841f646fbfc146ecee855fd04068a548ae..f172f41858bb877305082c2e512d59848d6fdced 100644 (file)
@@ -287,17 +287,32 @@ void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
  */
 static int suspend_enter(suspend_state_t state)
 {
-       int error = 0;
+       int error;
 
        device_pm_lock();
-       arch_suspend_disable_irqs();
-       BUG_ON(!irqs_disabled());
 
-       if ((error = device_power_down(PMSG_SUSPEND))) {
+       error = device_power_down(PMSG_SUSPEND);
+       if (error) {
                printk(KERN_ERR "PM: Some devices failed to power down\n");
                goto Done;
        }
 
+       if (suspend_ops->prepare) {
+               error = suspend_ops->prepare();
+               if (error)
+                       goto Power_up_devices;
+       }
+
+       if (suspend_test(TEST_PLATFORM))
+               goto Platfrom_finish;
+
+       error = disable_nonboot_cpus();
+       if (error || suspend_test(TEST_CPUS))
+               goto Enable_cpus;
+
+       arch_suspend_disable_irqs();
+       BUG_ON(!irqs_disabled());
+
        error = sysdev_suspend(PMSG_SUSPEND);
        if (!error) {
                if (!suspend_test(TEST_CORE))
@@ -305,11 +320,22 @@ static int suspend_enter(suspend_state_t state)
                sysdev_resume();
        }
 
-       device_power_up(PMSG_RESUME);
- Done:
        arch_suspend_enable_irqs();
        BUG_ON(irqs_disabled());
+
+ Enable_cpus:
+       enable_nonboot_cpus();
+
+ Platfrom_finish:
+       if (suspend_ops->finish)
+               suspend_ops->finish();
+
+ Power_up_devices:
+       device_power_up(PMSG_RESUME);
+
+ Done:
        device_pm_unlock();
+
        return error;
 }
 
@@ -341,23 +367,8 @@ int suspend_devices_and_enter(suspend_state_t state)
        if (suspend_test(TEST_DEVICES))
                goto Recover_platform;
 
-       if (suspend_ops->prepare) {
-               error = suspend_ops->prepare();
-               if (error)
-                       goto Resume_devices;
-       }
-
-       if (suspend_test(TEST_PLATFORM))
-               goto Finish;
-
-       error = disable_nonboot_cpus();
-       if (!error && !suspend_test(TEST_CPUS))
-               suspend_enter(state);
+       suspend_enter(state);
 
-       enable_nonboot_cpus();
- Finish:
-       if (suspend_ops->finish)
-               suspend_ops->finish();
  Resume_devices:
        suspend_test_start();
        device_resume(PMSG_RESUME);
index 7c4142a79f0ab5a2ef80300b3d5be3188bdec8c7..9b4a975a4b4afc1f1eba22c1cb30d21aef844959 100644 (file)
@@ -126,6 +126,7 @@ static atomic_t n_rcu_torture_mberror;
 static atomic_t n_rcu_torture_error;
 static long n_rcu_torture_timers = 0;
 static struct list_head rcu_torture_removed;
+static cpumask_var_t shuffle_tmp_mask;
 
 static int stutter_pause_test = 0;
 
@@ -889,10 +890,9 @@ static int rcu_idle_cpu;   /* Force all torture tasks off this CPU */
  */
 static void rcu_torture_shuffle_tasks(void)
 {
-       cpumask_t tmp_mask;
        int i;
 
-       cpus_setall(tmp_mask);
+       cpumask_setall(shuffle_tmp_mask);
        get_online_cpus();
 
        /* No point in shuffling if there is only one online CPU (ex: UP) */
@@ -902,29 +902,29 @@ static void rcu_torture_shuffle_tasks(void)
        }
 
        if (rcu_idle_cpu != -1)
-               cpu_clear(rcu_idle_cpu, tmp_mask);
+               cpumask_clear_cpu(rcu_idle_cpu, shuffle_tmp_mask);
 
-       set_cpus_allowed_ptr(current, &tmp_mask);
+       set_cpus_allowed_ptr(current, shuffle_tmp_mask);
 
        if (reader_tasks) {
                for (i = 0; i < nrealreaders; i++)
                        if (reader_tasks[i])
                                set_cpus_allowed_ptr(reader_tasks[i],
-                                                    &tmp_mask);
+                                                    shuffle_tmp_mask);
        }
 
        if (fakewriter_tasks) {
                for (i = 0; i < nfakewriters; i++)
                        if (fakewriter_tasks[i])
                                set_cpus_allowed_ptr(fakewriter_tasks[i],
-                                                    &tmp_mask);
+                                                    shuffle_tmp_mask);
        }
 
        if (writer_task)
-               set_cpus_allowed_ptr(writer_task, &tmp_mask);
+               set_cpus_allowed_ptr(writer_task, shuffle_tmp_mask);
 
        if (stats_task)
-               set_cpus_allowed_ptr(stats_task, &tmp_mask);
+               set_cpus_allowed_ptr(stats_task, shuffle_tmp_mask);
 
        if (rcu_idle_cpu == -1)
                rcu_idle_cpu = num_online_cpus() - 1;
@@ -1012,6 +1012,7 @@ rcu_torture_cleanup(void)
        if (shuffler_task) {
                VERBOSE_PRINTK_STRING("Stopping rcu_torture_shuffle task");
                kthread_stop(shuffler_task);
+               free_cpumask_var(shuffle_tmp_mask);
        }
        shuffler_task = NULL;
 
@@ -1190,10 +1191,18 @@ rcu_torture_init(void)
        }
        if (test_no_idle_hz) {
                rcu_idle_cpu = num_online_cpus() - 1;
+
+               if (!alloc_cpumask_var(&shuffle_tmp_mask, GFP_KERNEL)) {
+                       firsterr = -ENOMEM;
+                       VERBOSE_PRINTK_ERRSTRING("Failed to alloc mask");
+                       goto unwind;
+               }
+
                /* Create the shuffler thread */
                shuffler_task = kthread_run(rcu_torture_shuffle, NULL,
                                          "rcu_torture_shuffle");
                if (IS_ERR(shuffler_task)) {
+                       free_cpumask_var(shuffle_tmp_mask);
                        firsterr = PTR_ERR(shuffler_task);
                        VERBOSE_PRINTK_ERRSTRING("Failed to create shuffler");
                        shuffler_task = NULL;
index 0ad7c28b7236e1f9e9ea4226849fb9a94863bf76..eb91695976e7b2a10102e2b8a7da6d3c3014d1cc 100644 (file)
@@ -4934,15 +4934,13 @@ pick_next_task(struct rq *rq)
 /*
  * schedule() is the main scheduler function.
  */
-asmlinkage void __sched schedule(void)
+asmlinkage void __sched __schedule(void)
 {
        struct task_struct *prev, *next;
        unsigned long *switch_count;
        struct rq *rq;
        int cpu;
 
-need_resched:
-       preempt_disable();
        cpu = smp_processor_id();
        rq = cpu_rq(cpu);
        rcu_qsctr_inc(cpu);
@@ -4999,13 +4997,80 @@ need_resched_nonpreemptible:
 
        if (unlikely(reacquire_kernel_lock(current) < 0))
                goto need_resched_nonpreemptible;
+}
 
+asmlinkage void __sched schedule(void)
+{
+need_resched:
+       preempt_disable();
+       __schedule();
        preempt_enable_no_resched();
        if (unlikely(test_thread_flag(TIF_NEED_RESCHED)))
                goto need_resched;
 }
 EXPORT_SYMBOL(schedule);
 
+#ifdef CONFIG_SMP
+/*
+ * Look out! "owner" is an entirely speculative pointer
+ * access and not reliable.
+ */
+int mutex_spin_on_owner(struct mutex *lock, struct thread_info *owner)
+{
+       unsigned int cpu;
+       struct rq *rq;
+
+       if (!sched_feat(OWNER_SPIN))
+               return 0;
+
+#ifdef CONFIG_DEBUG_PAGEALLOC
+       /*
+        * Need to access the cpu field knowing that
+        * DEBUG_PAGEALLOC could have unmapped it if
+        * the mutex owner just released it and exited.
+        */
+       if (probe_kernel_address(&owner->cpu, cpu))
+               goto out;
+#else
+       cpu = owner->cpu;
+#endif
+
+       /*
+        * Even if the access succeeded (likely case),
+        * the cpu field may no longer be valid.
+        */
+       if (cpu >= nr_cpumask_bits)
+               goto out;
+
+       /*
+        * We need to validate that we can do a
+        * get_cpu() and that we have the percpu area.
+        */
+       if (!cpu_online(cpu))
+               goto out;
+
+       rq = cpu_rq(cpu);
+
+       for (;;) {
+               /*
+                * Owner changed, break to re-assess state.
+                */
+               if (lock->owner != owner)
+                       break;
+
+               /*
+                * Is that owner really running on that cpu?
+                */
+               if (task_thread_info(rq->curr) != owner || need_resched())
+                       return 0;
+
+               cpu_relax();
+       }
+out:
+       return 1;
+}
+#endif
+
 #ifdef CONFIG_PREEMPT
 /*
  * this is the entry point to schedule() from in-kernel preemption
index 642a94ef8a0a7fb39f9b341eb292dfad9ab38762..9a7e859b8fbfdd753f09a4bc0949cf5345e2ae75 100644 (file)
@@ -25,7 +25,7 @@ struct cpupri {
 
 #ifdef CONFIG_SMP
 int  cpupri_find(struct cpupri *cp,
-                struct task_struct *p, cpumask_t *lowest_mask);
+                struct task_struct *p, struct cpumask *lowest_mask);
 void cpupri_set(struct cpupri *cp, int cpu, int pri);
 int cpupri_init(struct cpupri *cp, bool bootmem);
 void cpupri_cleanup(struct cpupri *cp);
index 76f61756e677647dda4ae01ede5ac942329a09c8..4569bfa7df9b9fee6f057e22aca18299d3c45f3b 100644 (file)
@@ -14,3 +14,4 @@ SCHED_FEAT(LB_WAKEUP_UPDATE, 1)
 SCHED_FEAT(ASYM_EFF_LOAD, 1)
 SCHED_FEAT(WAKEUP_OVERLAP, 0)
 SCHED_FEAT(LAST_BUDDY, 1)
+SCHED_FEAT(OWNER_SPIN, 1)
index 74541ca49536fda5dab61d473f8ce9d6aa3f3254..912823e2a11b0afb0f4448e5163bb9e39c7fc8b8 100644 (file)
@@ -44,7 +44,7 @@ static DEFINE_MUTEX(setup_lock);
 static int refcount;
 static struct workqueue_struct *stop_machine_wq;
 static struct stop_machine_data active, idle;
-static const cpumask_t *active_cpus;
+static const struct cpumask *active_cpus;
 static void *stop_machine_work;
 
 static void set_state(enum stopmachine_state newstate)
index 9b77fc9a9ac8286074b1784771dac7c0eb2a08e2..b4555568b4e4ad16f34a887eabed6f21e05abfba 100644 (file)
@@ -491,14 +491,18 @@ static inline void debug_timer_free(struct timer_list *timer)
        debug_object_free(timer, &timer_debug_descr);
 }
 
-static void __init_timer(struct timer_list *timer);
+static void __init_timer(struct timer_list *timer,
+                        const char *name,
+                        struct lock_class_key *key);
 
-void init_timer_on_stack(struct timer_list *timer)
+void init_timer_on_stack_key(struct timer_list *timer,
+                            const char *name,
+                            struct lock_class_key *key)
 {
        debug_object_init_on_stack(timer, &timer_debug_descr);
-       __init_timer(timer);
+       __init_timer(timer, name, key);
 }
-EXPORT_SYMBOL_GPL(init_timer_on_stack);
+EXPORT_SYMBOL_GPL(init_timer_on_stack_key);
 
 void destroy_timer_on_stack(struct timer_list *timer)
 {
@@ -512,7 +516,9 @@ static inline void debug_timer_activate(struct timer_list *timer) { }
 static inline void debug_timer_deactivate(struct timer_list *timer) { }
 #endif
 
-static void __init_timer(struct timer_list *timer)
+static void __init_timer(struct timer_list *timer,
+                        const char *name,
+                        struct lock_class_key *key)
 {
        timer->entry.next = NULL;
        timer->base = __raw_get_cpu_var(tvec_bases);
@@ -521,6 +527,7 @@ static void __init_timer(struct timer_list *timer)
        timer->start_pid = -1;
        memset(timer->start_comm, 0, TASK_COMM_LEN);
 #endif
+       lockdep_init_map(&timer->lockdep_map, name, key, 0);
 }
 
 /**
@@ -530,19 +537,23 @@ static void __init_timer(struct timer_list *timer)
  * init_timer() must be done to a timer prior calling *any* of the
  * other timer functions.
  */
-void init_timer(struct timer_list *timer)
+void init_timer_key(struct timer_list *timer,
+                   const char *name,
+                   struct lock_class_key *key)
 {
        debug_timer_init(timer);
-       __init_timer(timer);
+       __init_timer(timer, name, key);
 }
-EXPORT_SYMBOL(init_timer);
+EXPORT_SYMBOL(init_timer_key);
 
-void init_timer_deferrable(struct timer_list *timer)
+void init_timer_deferrable_key(struct timer_list *timer,
+                              const char *name,
+                              struct lock_class_key *key)
 {
-       init_timer(timer);
+       init_timer_key(timer, name, key);
        timer_set_deferrable(timer);
 }
-EXPORT_SYMBOL(init_timer_deferrable);
+EXPORT_SYMBOL(init_timer_deferrable_key);
 
 static inline void detach_timer(struct timer_list *timer,
                                int clear_pending)
@@ -826,6 +837,15 @@ EXPORT_SYMBOL(try_to_del_timer_sync);
  */
 int del_timer_sync(struct timer_list *timer)
 {
+#ifdef CONFIG_LOCKDEP
+       unsigned long flags;
+
+       local_irq_save(flags);
+       lock_map_acquire(&timer->lockdep_map);
+       lock_map_release(&timer->lockdep_map);
+       local_irq_restore(flags);
+#endif
+
        for (;;) {
                int ret = try_to_del_timer_sync(timer);
                if (ret >= 0)
@@ -897,10 +917,36 @@ static inline void __run_timers(struct tvec_base *base)
 
                        set_running_timer(base, timer);
                        detach_timer(timer, 1);
+
                        spin_unlock_irq(&base->lock);
                        {
                                int preempt_count = preempt_count();
+
+#ifdef CONFIG_LOCKDEP
+                               /*
+                                * It is permissible to free the timer from
+                                * inside the function that is called from
+                                * it, this we need to take into account for
+                                * lockdep too. To avoid bogus "held lock
+                                * freed" warnings as well as problems when
+                                * looking into timer->lockdep_map, make a
+                                * copy and use that here.
+                                */
+                               struct lockdep_map lockdep_map =
+                                       timer->lockdep_map;
+#endif
+                               /*
+                                * Couple the lock chain with the lock chain at
+                                * del_timer_sync() by acquiring the lock_map
+                                * around the fn() call here and in
+                                * del_timer_sync().
+                                */
+                               lock_map_acquire(&lockdep_map);
+
                                fn(data);
+
+                               lock_map_release(&lockdep_map);
+
                                if (preempt_count != preempt_count()) {
                                        printk(KERN_ERR "huh, entered %p "
                                               "with preempt_count %08x, exited"
index 1f0c509b40d34d944bea77e300e237ab9145439c..9aedd9fd825b7c332a4a2f53124b57040b013acd 100644 (file)
@@ -416,7 +416,7 @@ void flush_workqueue(struct workqueue_struct *wq)
        might_sleep();
        lock_map_acquire(&wq->lockdep_map);
        lock_map_release(&wq->lockdep_map);
-       for_each_cpu_mask_nr(cpu, *cpu_map)
+       for_each_cpu(cpu, cpu_map)
                flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));
 }
 EXPORT_SYMBOL_GPL(flush_workqueue);
@@ -547,7 +547,7 @@ static void wait_on_work(struct work_struct *work)
        wq = cwq->wq;
        cpu_map = wq_cpu_map(wq);
 
-       for_each_cpu_mask_nr(cpu, *cpu_map)
+       for_each_cpu(cpu, cpu_map)
                wait_on_cpu_work(per_cpu_ptr(wq->cpu_wq, cpu), work);
 }
 
@@ -911,7 +911,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
        list_del(&wq->list);
        spin_unlock(&workqueue_lock);
 
-       for_each_cpu_mask_nr(cpu, *cpu_map)
+       for_each_cpu(cpu, cpu_map)
                cleanup_workqueue_thread(per_cpu_ptr(wq->cpu_wq, cpu));
        cpu_maps_update_done();
 
index 1a992089486c614ed55497318801ac49e3d53c1b..d3da7edc034f7c60496056332850458b849a4f61 100644 (file)
@@ -648,7 +648,7 @@ static void check_sync(struct device *dev, dma_addr_t addr,
                err_printk(dev, NULL, "DMA-API: device driver tries "
                                "to sync DMA memory it has not allocated "
                                "[device address=0x%016llx] [size=%llu bytes]\n",
-                               addr, size);
+                               (unsigned long long)addr, size);
                goto out;
        }
 
@@ -666,7 +666,7 @@ static void check_sync(struct device *dev, dma_addr_t addr,
                                "DMA memory with different direction "
                                "[device address=0x%016llx] [size=%llu bytes] "
                                "[mapped with %s] [synced with %s]\n",
-                               addr, entry->size,
+                               (unsigned long long)addr, entry->size,
                                dir2name[entry->direction],
                                dir2name[direction]);
        }
@@ -680,7 +680,7 @@ static void check_sync(struct device *dev, dma_addr_t addr,
                                "device read-only DMA memory for cpu "
                                "[device address=0x%016llx] [size=%llu bytes] "
                                "[mapped with %s] [synced with %s]\n",
-                               addr, entry->size,
+                               (unsigned long long)addr, entry->size,
                                dir2name[entry->direction],
                                dir2name[direction]);
 
@@ -690,7 +690,7 @@ static void check_sync(struct device *dev, dma_addr_t addr,
                                "device write-only DMA memory to device "
                                "[device address=0x%016llx] [size=%llu bytes] "
                                "[mapped with %s] [synced with %s]\n",
-                               addr, entry->size,
+                               (unsigned long long)addr, entry->size,
                                dir2name[entry->direction],
                                dir2name[direction]);
 
index 1882923bc706071b79f823dd17b8f69d4fccf145..139d5b7b6621471ccb88c2ea3dd6b0fe66b15618 100644 (file)
@@ -143,7 +143,7 @@ void free_percpu(void *__pdata)
 {
        if (unlikely(!__pdata))
                return;
-       __percpu_depopulate_mask(__pdata, &cpu_possible_map);
+       __percpu_depopulate_mask(__pdata, cpu_possible_mask);
        kfree(__percpu_disguise(__pdata));
 }
 EXPORT_SYMBOL_GPL(free_percpu);
index a92b0975b9a5f49c7f1c235f0064921f18c43913..f87e0d8df5a7f517a06fff972674bd1039da61d5 100644 (file)
@@ -1479,6 +1479,8 @@ __alloc_pages_internal(gfp_t gfp_mask, unsigned int order,
        unsigned long did_some_progress;
        unsigned long pages_reclaimed = 0;
 
+       lockdep_trace_alloc(gfp_mask);
+
        might_sleep_if(wait);
 
        if (should_fail_alloc_page(gfp_mask, order))
@@ -1578,12 +1580,15 @@ nofail_alloc:
         */
        cpuset_update_task_memory_state();
        p->flags |= PF_MEMALLOC;
+
+       lockdep_set_current_reclaim_state(gfp_mask);
        reclaim_state.reclaimed_slab = 0;
        p->reclaim_state = &reclaim_state;
 
        did_some_progress = try_to_free_pages(zonelist, order, gfp_mask);
 
        p->reclaim_state = NULL;
+       lockdep_clear_current_reclaim_state();
        p->flags &= ~PF_MEMALLOC;
 
        cond_resched();
index 15de509b68fd657c7b9ecb0356cdadf9bc43b1ef..118905e3d7886f795875b376c70d23e4bfc4c038 100644 (file)
@@ -191,7 +191,7 @@ static int pdflush(void *dummy)
 
        /*
         * Some configs put our parent kthread in a limited cpuset,
-        * which kthread() overrides, forcing cpus_allowed == CPU_MASK_ALL.
+        * which kthread() overrides, forcing cpus_allowed == cpu_all_mask.
         * Our needs are more modest - cut back to our cpusets cpus_allowed.
         * This is needed as pdflush's are dynamically created and destroyed.
         * The boottime pdflush's are easily placed w/o these 2 lines.
index 2daaca0b4541e5dfc214f36f647686657e021ed7..59839d7ee5b3cd2e98122bc4203623fd55c1158f 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3318,6 +3318,8 @@ __cache_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid,
        unsigned long save_flags;
        void *ptr;
 
+       lockdep_trace_alloc(flags);
+
        if (slab_should_failslab(cachep, flags))
                return NULL;
 
@@ -3394,6 +3396,8 @@ __cache_alloc(struct kmem_cache *cachep, gfp_t flags, void *caller)
        unsigned long save_flags;
        void *objp;
 
+       lockdep_trace_alloc(flags);
+
        if (slab_should_failslab(cachep, flags))
                return NULL;
 
index 0bfa680a8981127307d1d922231dca3d66f9b2bd..7a3411524dacd555e9ce70e287a4232072391e10 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -475,6 +475,8 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
        unsigned int *m;
        int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
 
+       lockdep_trace_alloc(gfp);
+
        if (size < PAGE_SIZE - align) {
                if (!size)
                        return ZERO_SIZE_PTR;
index c65a4edafc3343e83a2513f8edab9b0ed82f3ab5..c4ea9158c9fbd0e4630062aa0098406000be45c3 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1590,6 +1590,7 @@ static __always_inline void *slab_alloc(struct kmem_cache *s,
        unsigned long flags;
        unsigned int objsize;
 
+       lockdep_trace_alloc(gfpflags);
        might_sleep_if(gfpflags & __GFP_WAIT);
 
        if (should_failslab(s->objsize, gfpflags))
index 1cdbf0b057278e8f157da93bb6eda0dc80644387..f74a61e522f43657bfa17aaf3219ca2dcb0c18a7 100644 (file)
@@ -1965,6 +1965,8 @@ static int kswapd(void *p)
        };
        const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);
 
+       lockdep_set_current_reclaim_state(GFP_KERNEL);
+
        if (!cpumask_empty(cpumask))
                set_cpus_allowed_ptr(tsk, cpumask);
        current->reclaim_state = &reclaim_state;
index 91149746bb8d6c94ac036879bbe557551630a1e1..8cd81ea1ddc138cf60b93c19554a68cc645160df 100644 (file)
@@ -27,7 +27,7 @@ static void sum_vm_events(unsigned long *ret, const struct cpumask *cpumask)
 
        memset(ret, 0, NR_VM_EVENT_ITEMS * sizeof(unsigned long));
 
-       for_each_cpu_mask_nr(cpu, *cpumask) {
+       for_each_cpu(cpu, cpumask) {
                struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
 
                for (i = 0; i < NR_VM_EVENT_ITEMS; i++)
index 162199a2d74f18e6b41ee7322c2ed8d66dfc4539..fd8e0847b25473ac9318aa22769af66500dbb073 100644 (file)
@@ -281,7 +281,6 @@ int __init atalk_proc_init(void)
        atalk_proc_dir = proc_mkdir("atalk", init_net.proc_net);
        if (!atalk_proc_dir)
                goto out;
-       atalk_proc_dir->owner = THIS_MODULE;
 
        p = proc_create("interface", S_IRUGO, atalk_proc_dir,
                        &atalk_seq_interface_fops);
index 4990541ef5da4ca7d0b2325bd39ebb4ffbf3c290..1a0f5ccea9c4494cad2c29755863f7dd0559e540 100644 (file)
@@ -281,7 +281,6 @@ int mpc_proc_init(void)
                printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
                return -ENOMEM;
        }
-       p->owner = THIS_MODULE;
        return 0;
 }
 
index 49487b313f221cf6394fa2c918fc67858ae1f45f..e7b3b273907d197b1a64ac8d1cd9c1ce0c3edc16 100644 (file)
@@ -476,7 +476,6 @@ int __init atm_proc_init(void)
                                     atm_proc_root, e->proc_fops);
                if (!dirent)
                        goto err_out_remove;
-               dirent->owner = THIS_MODULE;
                e->dirent = dirent;
        }
        ret = 0;
index b7c7d46511365ef5ff8c7bc93678a2ef97966c18..95d7f32643aef3a3e0b3830200ea592bb1b54849 100644 (file)
@@ -1604,10 +1604,6 @@ static int __init bcm_module_init(void)
 
        /* create /proc/net/can-bcm directory */
        proc_dir = proc_mkdir("can-bcm", init_net.proc_net);
-
-       if (proc_dir)
-               proc_dir->owner = THIS_MODULE;
-
        return 0;
 }
 
index 520fef5e5398aa867a267ae32bbffbba557795c2..1463653dbe34e986eb5f6283b7823ef109cb0fa8 100644 (file)
@@ -473,8 +473,6 @@ void can_init_proc(void)
                return;
        }
 
-       can_dir->owner = THIS_MODULE;
-
        /* own procfs entries from the AF_CAN core */
        pde_version     = can_create_proc_readentry(CAN_PROC_VERSION, 0644,
                                        can_proc_read_version, NULL);
index 755414cd49d10c8d65c6366bceb2618edf261f75..b5873bdff61207e13b89650c535393db0c44a830 100644 (file)
@@ -345,8 +345,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        udph->dest = htons(np->remote_port);
        udph->len = htons(udp_len);
        udph->check = 0;
-       udph->check = csum_tcpudp_magic(htonl(np->local_ip),
-                                       htonl(np->remote_ip),
+       udph->check = csum_tcpudp_magic(np->local_ip,
+                                       np->remote_ip,
                                        udp_len, IPPROTO_UDP,
                                        csum_partial(udph, udp_len, 0));
        if (udph->check == 0)
@@ -365,8 +365,8 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        iph->ttl      = 64;
        iph->protocol = IPPROTO_UDP;
        iph->check    = 0;
-       put_unaligned(htonl(np->local_ip), &(iph->saddr));
-       put_unaligned(htonl(np->remote_ip), &(iph->daddr));
+       put_unaligned(np->local_ip, &(iph->saddr));
+       put_unaligned(np->remote_ip, &(iph->daddr));
        iph->check    = ip_fast_csum((unsigned char *)iph, iph->ihl);
 
        eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
@@ -424,7 +424,7 @@ static void arp_reply(struct sk_buff *skb)
        memcpy(&tip, arp_ptr, 4);
 
        /* Should we ignore arp? */
-       if (tip != htonl(np->local_ip) ||
+       if (tip != np->local_ip ||
            ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
                return;
 
@@ -533,9 +533,9 @@ int __netpoll_rx(struct sk_buff *skb)
                goto out;
        if (checksum_udp(skb, uh, ulen, iph->saddr, iph->daddr))
                goto out;
-       if (np->local_ip && np->local_ip != ntohl(iph->daddr))
+       if (np->local_ip && np->local_ip != iph->daddr)
                goto out;
-       if (np->remote_ip && np->remote_ip != ntohl(iph->saddr))
+       if (np->remote_ip && np->remote_ip != iph->saddr)
                goto out;
        if (np->local_port && np->local_port != ntohs(uh->dest))
                goto out;
@@ -560,14 +560,14 @@ void netpoll_print_options(struct netpoll *np)
 {
        printk(KERN_INFO "%s: local port %d\n",
                         np->name, np->local_port);
-       printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
-                        np->name, HIPQUAD(np->local_ip));
+       printk(KERN_INFO "%s: local IP %pI4\n",
+                        np->name, &np->local_ip);
        printk(KERN_INFO "%s: interface %s\n",
                         np->name, np->dev_name);
        printk(KERN_INFO "%s: remote port %d\n",
                         np->name, np->remote_port);
-       printk(KERN_INFO "%s: remote IP %d.%d.%d.%d\n",
-                        np->name, HIPQUAD(np->remote_ip));
+       printk(KERN_INFO "%s: remote IP %pI4\n",
+                        np->name, &np->remote_ip);
        printk(KERN_INFO "%s: remote ethernet address %pM\n",
                         np->name, np->remote_mac);
 }
@@ -589,7 +589,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
                if ((delim = strchr(cur, '/')) == NULL)
                        goto parse_failed;
                *delim = 0;
-               np->local_ip = ntohl(in_aton(cur));
+               np->local_ip = in_aton(cur);
                cur = delim;
        }
        cur++;
@@ -618,7 +618,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
        if ((delim = strchr(cur, '/')) == NULL)
                goto parse_failed;
        *delim = 0;
-       np->remote_ip = ntohl(in_aton(cur));
+       np->remote_ip = in_aton(cur);
        cur = delim + 1;
 
        if (*cur != 0) {
@@ -759,10 +759,9 @@ int netpoll_setup(struct netpoll *np)
                        goto release;
                }
 
-               np->local_ip = ntohl(in_dev->ifa_list->ifa_local);
+               np->local_ip = in_dev->ifa_list->ifa_local;
                rcu_read_unlock();
-               printk(KERN_INFO "%s: local IP %d.%d.%d.%d\n",
-                      np->name, HIPQUAD(np->local_ip));
+               printk(KERN_INFO "%s: local IP %pI4\n", np->name, &np->local_ip);
        }
 
        if (np->rx_hook) {
index 32d419f5ac983e2601cda6ce189476a87886c699..3779c1438c11c84613f5ba9b40619907c9a18a9d 100644 (file)
@@ -3806,7 +3806,6 @@ static int __init pg_init(void)
        pg_proc_dir = proc_mkdir(PG_PROC_DIR, init_net.proc_net);
        if (!pg_proc_dir)
                return -ENODEV;
-       pg_proc_dir->owner = THIS_MODULE;
 
        pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
        if (pe == NULL) {
index 6acbf9e79eb1dc2076bc192f774c8b5591566c42..ce6356cd9f71c76bad3cf9a0ec5fbb774c0a427a 100644 (file)
@@ -2579,7 +2579,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features)
                                          skb_network_header_len(skb));
                skb_copy_from_linear_data(skb, nskb->data, doffset);
 
-               if (pos >= offset + len)
+               if (fskb != skb_shinfo(skb)->frag_list)
                        continue;
 
                if (!sg) {
index 88e80a312732a9ed18e7e1d511d79ac6f0f9d682..8ff1861649e87716d8ecf826c8682182a825a88b 100644 (file)
@@ -70,7 +70,6 @@ void __init irda_proc_register(void)
        proc_irda = proc_mkdir("irda", init_net.proc_net);
        if (proc_irda == NULL)
                return;
-       proc_irda->owner = THIS_MODULE;
 
        for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
                d = proc_create(irda_dirs[i].name, 0, proc_irda,
index b58bd7c6cdf8b5323df957c1bc113b8970aa9762..d208b3396d94e417546a143c4c7a1d09f9e95f3b 100644 (file)
@@ -236,7 +236,6 @@ int __init llc_proc_init(void)
        llc_proc_dir = proc_mkdir("llc", init_net.proc_net);
        if (!llc_proc_dir)
                goto out;
-       llc_proc_dir->owner = THIS_MODULE;
 
        p = proc_create("socket", S_IRUGO, llc_proc_dir, &llc_seq_socket_fops);
        if (!p)
index 409c8be58e7c3fe097ceacc47c37ffb8092a155a..8bd98c84f77e7962c55dee04084c8ee05128f1bd 100644 (file)
@@ -66,7 +66,7 @@ static const char *const dccprotos[] = {
  *     ad_beg_p        returns pointer to first byte of addr data
  *     ad_end_p        returns pointer to last byte of addr data
  */
-static int parse_dcc(char *data, const char *data_end, u_int32_t *ip,
+static int parse_dcc(char *data, const char *data_end, __be32 *ip,
                     u_int16_t *port, char **ad_beg_p, char **ad_end_p)
 {
        char *tmp;
@@ -85,7 +85,7 @@ static int parse_dcc(char *data, const char *data_end, u_int32_t *ip,
                return -1;
 
        *ad_beg_p = data;
-       *ip = simple_strtoul(data, &data, 10);
+       *ip = cpu_to_be32(simple_strtoul(data, &data, 10));
 
        /* skip blanks between ip and port */
        while (*data == ' ') {
@@ -112,7 +112,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
        int dir = CTINFO2DIR(ctinfo);
        struct nf_conntrack_expect *exp;
        struct nf_conntrack_tuple *tuple;
-       u_int32_t dcc_ip;
+       __be32 dcc_ip;
        u_int16_t dcc_port;
        __be16 port;
        int i, ret = NF_ACCEPT;
@@ -177,13 +177,14 @@ static int help(struct sk_buff *skb, unsigned int protoff,
                                pr_debug("unable to parse dcc command\n");
                                continue;
                        }
-                       pr_debug("DCC bound ip/port: %u.%u.%u.%u:%u\n",
-                                HIPQUAD(dcc_ip), dcc_port);
+
+                       pr_debug("DCC bound ip/port: %pI4:%u\n",
+                                &dcc_ip, dcc_port);
 
                        /* dcc_ip can be the internal OR external (NAT'ed) IP */
                        tuple = &ct->tuplehash[dir].tuple;
-                       if (tuple->src.u3.ip != htonl(dcc_ip) &&
-                           tuple->dst.u3.ip != htonl(dcc_ip)) {
+                       if (tuple->src.u3.ip != dcc_ip &&
+                           tuple->dst.u3.ip != dcc_ip) {
                                if (net_ratelimit())
                                        printk(KERN_WARNING
                                                "Forged DCC command from %pI4: %pI4:%u\n",
index ad5bd890e4e87c05323511e7e6e1a9e93892a673..6c4847662b8541ff1e808d0269518248930ed7f3 100644 (file)
@@ -57,6 +57,13 @@ xt_cluster_hash(const struct nf_conn *ct,
        return (((u64)hash * info->total_nodes) >> 32);
 }
 
+static inline bool
+xt_cluster_ipv6_is_multicast(const struct in6_addr *addr)
+{
+       __be32 st = addr->s6_addr32[0];
+       return ((st & htonl(0xFF000000)) == htonl(0xFF000000));
+}
+
 static inline bool
 xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family)
 {
@@ -67,8 +74,8 @@ xt_cluster_is_multicast_addr(const struct sk_buff *skb, u_int8_t family)
                is_multicast = ipv4_is_multicast(ip_hdr(skb)->daddr);
                break;
        case NFPROTO_IPV6:
-               is_multicast = ipv6_addr_type(&ipv6_hdr(skb)->daddr) &
-                                               IPV6_ADDR_MULTICAST;
+               is_multicast =
+                       xt_cluster_ipv6_is_multicast(&ipv6_hdr(skb)->daddr);
                break;
        default:
                WARN_ON(1);
index cb198af8887c97628a82a903b1c93623dcb992e8..8eb3e61cb7011d1032d5562c0f266281ddf00688 100644 (file)
@@ -106,12 +106,8 @@ static __init int sctp_proc_init(void)
                goto out_nomem;
 #ifdef CONFIG_PROC_FS
        if (!proc_net_sctp) {
-               struct proc_dir_entry *ent;
-               ent = proc_mkdir("sctp", init_net.proc_net);
-               if (ent) {
-                       ent->owner = THIS_MODULE;
-                       proc_net_sctp = ent;
-               } else
+               proc_net_sctp = proc_mkdir("sctp", init_net.proc_net);
+               if (!proc_net_sctp)
                        goto out_free_percpu;
        }
 
index 4735caad26edc4195f503befa997a432145c7528..20029a79a5debf4a645623843c110eecaf5017ad 100644 (file)
@@ -313,7 +313,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
        cd->proc_ent = proc_mkdir(cd->name, proc_net_rpc);
        if (cd->proc_ent == NULL)
                goto out_nomem;
-       cd->proc_ent->owner = cd->owner;
        cd->channel_ent = cd->content_ent = NULL;
 
        p = proc_create_data("flush", S_IFREG|S_IRUSR|S_IWUSR,
@@ -321,7 +320,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
        cd->flush_ent = p;
        if (p == NULL)
                goto out_nomem;
-       p->owner = cd->owner;
 
        if (cd->cache_request || cd->cache_parse) {
                p = proc_create_data("channel", S_IFREG|S_IRUSR|S_IWUSR,
@@ -329,7 +327,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
                cd->channel_ent = p;
                if (p == NULL)
                        goto out_nomem;
-               p->owner = cd->owner;
        }
        if (cd->cache_show) {
                p = proc_create_data("content", S_IFREG|S_IRUSR|S_IWUSR,
@@ -337,7 +334,6 @@ static int create_cache_proc_entries(struct cache_detail *cd)
                cd->content_ent = p;
                if (p == NULL)
                        goto out_nomem;
-               p->owner = cd->owner;
        }
        return 0;
 out_nomem:
index 085372ef4feb148bf99d0525074ef7c819c09051..1ef6e46d9da273b276625e765e6d6bd1c880457a 100644 (file)
@@ -262,14 +262,8 @@ void
 rpc_proc_init(void)
 {
        dprintk("RPC:       registering /proc/net/rpc\n");
-       if (!proc_net_rpc) {
-               struct proc_dir_entry *ent;
-               ent = proc_mkdir("rpc", init_net.proc_net);
-               if (ent) {
-                       ent->owner = THIS_MODULE;
-                       proc_net_rpc = ent;
-               }
-       }
+       if (!proc_net_rpc)
+               proc_net_rpc = proc_mkdir("rpc", init_net.proc_net);
 }
 
 void
index 3bdd5bffaca89138ada174e521bac2facbb47da1..7dc0524bb727f3d1b6076ef03f273a79d52e4554 100644 (file)
@@ -312,7 +312,7 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
        switch (m->mode) {
        case SVC_POOL_PERCPU:
        {
-               set_cpus_allowed_ptr(task, &cpumask_of_cpu(node));
+               set_cpus_allowed_ptr(task, cpumask_of(node));
                break;
        }
        case SVC_POOL_PERNODE:
index 70fa87189f3624694dc52ab3f04f48f13dba6fee..35df614f6c5599329a403beb7295f3ffe3a51d2e 100644 (file)
@@ -154,11 +154,6 @@ EXPORT_SYMBOL(snd_seq_root);
 struct snd_info_entry *snd_oss_root;
 #endif
 
-static inline void snd_info_entry_prepare(struct proc_dir_entry *de)
-{
-       de->owner = THIS_MODULE;
-}
-
 static void snd_remove_proc_entry(struct proc_dir_entry *parent,
                                  struct proc_dir_entry *de)
 {
@@ -522,32 +517,11 @@ static const struct file_operations snd_info_entry_operations =
        .release =              snd_info_entry_release,
 };
 
-/**
- * snd_create_proc_entry - create a procfs entry
- * @name: the name of the proc file
- * @mode: the file permission bits, S_Ixxx
- * @parent: the parent proc-directory entry
- *
- * Creates a new proc file entry with the given name and permission
- * on the given directory.
- *
- * Returns the pointer of new instance or NULL on failure.
- */
-static struct proc_dir_entry *snd_create_proc_entry(const char *name, mode_t mode,
-                                                   struct proc_dir_entry *parent)
-{
-       struct proc_dir_entry *p;
-       p = create_proc_entry(name, mode, parent);
-       if (p)
-               snd_info_entry_prepare(p);
-       return p;
-}
-
 int __init snd_info_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = snd_create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
+       p = create_proc_entry("asound", S_IFDIR | S_IRUGO | S_IXUGO, NULL);
        if (p == NULL)
                return -ENOMEM;
        snd_proc_root = p;
@@ -974,12 +948,11 @@ int snd_info_register(struct snd_info_entry * entry)
                return -ENXIO;
        root = entry->parent == NULL ? snd_proc_root : entry->parent->p;
        mutex_lock(&info_mutex);
-       p = snd_create_proc_entry(entry->name, entry->mode, root);
+       p = create_proc_entry(entry->name, entry->mode, root);
        if (!p) {
                mutex_unlock(&info_mutex);
                return -ENOMEM;
        }
-       p->owner = entry->module;
        if (!S_ISDIR(entry->mode))
                p->proc_fops = &snd_info_entry_operations;
        p->size = entry->size;