]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branches 'release', 'idle', 'redhat-bugzilla-436589', 'sbs' and 'video' into...
authorLen Brown <len.brown@intel.com>
Thu, 27 Mar 2008 02:50:09 +0000 (22:50 -0400)
committerLen Brown <len.brown@intel.com>
Thu, 27 Mar 2008 02:50:09 +0000 (22:50 -0400)
46 files changed:
Documentation/i386/IO-APIC.txt
MAINTAINERS
Makefile
arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
arch/x86/kernel/cpu/mtrr/generic.c
arch/x86/kernel/io_delay.c
arch/x86/kernel/mfgpt_32.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
arch/x86/kvm/mmu.c
arch/x86/kvm/vmx.c
arch/x86/mm/discontig_32.c
arch/x86/mm/ioremap.c
arch/x86/mm/pageattr.c
drivers/acpi/pci_irq.c
drivers/acpi/processor_idle.c
drivers/acpi/sbshc.c
drivers/cpuidle/cpuidle.c
drivers/cpuidle/sysfs.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-omap.c
drivers/i2c/i2c-core.c
drivers/pci/setup-bus.c
drivers/pnp/pnpacpi/rsparser.c
fs/anon_inodes.c
fs/file_table.c
fs/hppfs/hppfs_kern.c
fs/hugetlbfs/inode.c
fs/namei.c
fs/open.c
fs/pipe.c
fs/reiserfs/xattr.c
fs/super.c
include/asm-x86/pgtable.h
include/linux/cpuidle.h
include/linux/sched.h
kernel/relay.c
kernel/sched.c
kernel/time/clocksource.c
kernel/timer.c
mm/hugetlb.c
mm/slab.c
mm/slub.c
mm/tiny-shmem.c
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
sound/soc/codecs/tlv320aic3x.c

index f95166645d29ffb1d97ba991355031cc41a40685..30b4c714fbe127cd088f6511fb19af74a41e388f 100644 (file)
@@ -70,7 +70,7 @@ Every PCI card emits a PCI IRQ, which can be INTA, INTB, INTC or INTD:
 
 These INTA-D PCI IRQs are always 'local to the card', their real meaning
 depends on which slot they are in. If you look at the daisy chaining diagram,
-a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ2 of
+a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ4 of
 the PCI chipset. Most cards issue INTA, this creates optimal distribution
 between the PIRQ lines. (distributing IRQ sources properly is not a
 necessity, PCI IRQs can be shared at will, but it's a good for performance
index 73883b8bbd764e8b6732525d18ad3b9600ef8c1f..2f70e5c10ae45ed1a624e258e3f4a539abec32d1 100644 (file)
@@ -2322,6 +2322,8 @@ P:        Anil S Keshavamurthy
 M:     anil.s.keshavamurthy@intel.com
 P:     David S. Miller
 M:     davem@davemloft.net
+P:     Masami Hiramatsu
+M:     mhiramat@redhat.com
 L:     linux-kernel@vger.kernel.org
 S:     Maintained
 
index 1c4c8f87f6c582f51c44823b2614d4414927534d..b08a259e21dc2e32c027c36a033f216f73a50ef9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 25
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc7
 NAME = Funky Weasel is Jiggy wit it
 
 # *DOCUMENTATION*
index f2b5a621d27b39e4ece42418719655406b220e17..8a85c93bd62a4678f58be9cdcf8040875b564756 100644 (file)
@@ -63,7 +63,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
  */
 static int speedstep_smi_ownership (void)
 {
-       u32 command, result, magic;
+       u32 command, result, magic, dummy;
        u32 function = GET_SPEEDSTEP_OWNER;
        unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation";
 
@@ -73,8 +73,11 @@ static int speedstep_smi_ownership (void)
        dprintk("trying to obtain ownership with command %x at port %x\n", command, smi_port);
 
        __asm__ __volatile__(
+               "push %%ebp\n"
                "out %%al, (%%dx)\n"
-               : "=D" (result)
+               "pop %%ebp\n"
+               : "=D" (result), "=a" (dummy), "=b" (dummy), "=c" (dummy), "=d" (dummy),
+                       "=S" (dummy)
                : "a" (command), "b" (function), "c" (0), "d" (smi_port),
                        "D" (0), "S" (magic)
                : "memory"
@@ -96,7 +99,7 @@ static int speedstep_smi_ownership (void)
  */
 static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
 {
-       u32 command, result = 0, edi, high_mhz, low_mhz;
+       u32 command, result = 0, edi, high_mhz, low_mhz, dummy;
        u32 state=0;
        u32 function = GET_SPEEDSTEP_FREQS;
 
@@ -109,10 +112,12 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
 
        dprintk("trying to determine frequencies with command %x at port %x\n", command, smi_port);
 
-       __asm__ __volatile__("movl $0, %%edi\n"
+       __asm__ __volatile__(
+               "push %%ebp\n"
                "out %%al, (%%dx)\n"
-               : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi)
-               : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
+               "pop %%ebp"
+               : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi), "=S" (dummy)
+               : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0)
        );
 
        dprintk("result %x, low_freq %u, high_freq %u\n", result, low_mhz, high_mhz);
@@ -135,16 +140,18 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
 static int speedstep_get_state (void)
 {
        u32 function=GET_SPEEDSTEP_STATE;
-       u32 result, state, edi, command;
+       u32 result, state, edi, command, dummy;
 
        command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
 
        dprintk("trying to determine current setting with command %x at port %x\n", command, smi_port);
 
-       __asm__ __volatile__("movl $0, %%edi\n"
+       __asm__ __volatile__(
+               "push %%ebp\n"
                "out %%al, (%%dx)\n"
-               : "=a" (result), "=b" (state), "=D" (edi)
-               : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
+               "pop %%ebp\n"
+               : "=a" (result), "=b" (state), "=D" (edi), "=c" (dummy), "=d" (dummy), "=S" (dummy)
+               : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0), "D" (0)
        );
 
        dprintk("state is %x, result is %x\n", state, result);
@@ -160,7 +167,7 @@ static int speedstep_get_state (void)
  */
 static void speedstep_set_state (unsigned int state)
 {
-       unsigned int result = 0, command, new_state;
+       unsigned int result = 0, command, new_state, dummy;
        unsigned long flags;
        unsigned int function=SET_SPEEDSTEP_STATE;
        unsigned int retry = 0;
@@ -182,10 +189,12 @@ static void speedstep_set_state (unsigned int state)
                }
                retry++;
                __asm__ __volatile__(
-                       "movl $0, %%edi\n"
+                       "push %%ebp\n"
                        "out %%al, (%%dx)\n"
-                       : "=b" (new_state), "=D" (result)
-                       : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
+                       "pop %%ebp"
+                       : "=b" (new_state), "=D" (result), "=c" (dummy), "=a" (dummy),
+                               "=d" (dummy), "=S" (dummy)
+                       : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0)
                        );
        } while ((new_state != state) && (retry <= SMI_TRIES));
 
@@ -195,7 +204,7 @@ static void speedstep_set_state (unsigned int state)
        if (new_state == state) {
                dprintk("change to %u MHz succeeded after %u tries with result %u\n", (speedstep_freqs[new_state].frequency / 1000), retry, result);
        } else {
-               printk(KERN_ERR "cpufreq: change failed with new_state %u and result %u\n", new_state, result);
+               printk(KERN_ERR "cpufreq: change to state %u failed with new_state %u and result %u\n", state, new_state, result);
        }
 
        return;
index 103d61a59b196ac5bebd57a9c3369409cba56bfa..3e18db4cefeec9ac73e0220bb1b5ccc44f8999dc 100644 (file)
@@ -176,12 +176,13 @@ static inline void k8_enable_fixed_iorrs(void)
 }
 
 /**
- * Checks and updates an fixed-range MTRR if it differs from the value it
- * should have. If K8 extentions are wanted, update the K8 SYSCFG MSR also.
- * see AMD publication no. 24593, chapter 7.8.1, page 233 for more information
- * \param msr MSR address of the MTTR which should be checked and updated
- * \param changed pointer which indicates whether the MTRR needed to be changed
- * \param msrwords pointer to the MSR values which the MSR should have
+ * set_fixed_range - checks & updates a fixed-range MTRR if it differs from the value it should have
+ * @msr: MSR address of the MTTR which should be checked and updated
+ * @changed: pointer which indicates whether the MTRR needed to be changed
+ * @msrwords: pointer to the MSR values which the MSR should have
+ *
+ * If K8 extentions are wanted, update the K8 SYSCFG MSR also.
+ * See AMD publication no. 24593, chapter 7.8.1, page 233 for more information.
  */
 static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
 {
@@ -199,12 +200,15 @@ static void set_fixed_range(int msr, bool *changed, unsigned int *msrwords)
        }
 }
 
+/**
+ * generic_get_free_region - Get a free MTRR.
+ * @base: The starting (base) address of the region.
+ * @size: The size (in bytes) of the region.
+ * @replace_reg: mtrr index to be replaced; set to invalid value if none.
+ *
+ * Returns: The index of the region on success, else negative on error.
+ */
 int generic_get_free_region(unsigned long base, unsigned long size, int replace_reg)
-/*  [SUMMARY] Get a free MTRR.
-    <base> The starting (base) address of the region.
-    <size> The size (in bytes) of the region.
-    [RETURNS] The index of the region on success, else -1 on error.
-*/
 {
        int i, max;
        mtrr_type ltype;
@@ -249,8 +253,8 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
 }
 
 /**
- * Checks and updates the fixed-range MTRRs if they differ from the saved set
- * \param frs pointer to fixed-range MTRR values, saved by get_fixed_ranges()
+ * set_fixed_ranges - checks & updates the fixed-range MTRRs if they differ from the saved set
+ * @frs: pointer to fixed-range MTRR values, saved by get_fixed_ranges()
  */
 static int set_fixed_ranges(mtrr_type * frs)
 {
@@ -294,13 +298,13 @@ static bool set_mtrr_var_ranges(unsigned int index, struct mtrr_var_range *vr)
 
 static u32 deftype_lo, deftype_hi;
 
+/**
+ * set_mtrr_state - Set the MTRR state for this CPU.
+ *
+ * NOTE: The CPU must already be in a safe state for MTRR changes.
+ * RETURNS: 0 if no changes made, else a mask indicating what was changed.
+ */
 static unsigned long set_mtrr_state(void)
-/*  [SUMMARY] Set the MTRR state for this CPU.
-    <state> The MTRR state information to read.
-    <ctxt> Some relevant CPU context.
-    [NOTE] The CPU must already be in a safe state for MTRR changes.
-    [RETURNS] 0 if no changes made, else a mask indication what was changed.
-*/
 {
        unsigned int i;
        unsigned long change_mask = 0;
index c706a3061553d31f69e8904ae23b7b2b335ccfd8..5921e5f0a64027745fa2ac3e5f695ceaca9ddeae 100644 (file)
@@ -76,6 +76,14 @@ static struct dmi_system_id __initdata io_delay_0xed_port_dmi_table[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "30B9")
                }
        },
+       {
+               .callback       = dmi_io_delay_0xed_port,
+               .ident          = "HP Pavilion dv6000",
+               .matches        = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Quanta"),
+                       DMI_MATCH(DMI_BOARD_NAME, "30B8")
+               }
+       },
        {
                .callback       = dmi_io_delay_0xed_port,
                .ident          = "HP Pavilion tx1000",
index 027fc067b3995153164c799fbe63502baf7706fd..b402c0f3f192213f84595197f067c28043545ea1 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 #include <asm/geode.h>
 
 static struct mfgpt_timer_t {
index a1d7071a51c91c472d4c2926018906dd47e31344..2b3e5d45176bda99d2172a2484076e973d53cfd4 100644 (file)
@@ -406,8 +406,6 @@ static unsigned long __init setup_memory(void)
         */
        min_low_pfn = PFN_UP(init_pg_tables_end);
 
-       find_max_pfn();
-
        max_low_pfn = find_max_low_pfn();
 
 #ifdef CONFIG_HIGHMEM
@@ -764,12 +762,13 @@ void __init setup_arch(char **cmdline_p)
        if (efi_enabled)
                efi_init();
 
-       max_low_pfn = setup_memory();
-
        /* update e820 for memory not covered by WB MTRRs */
+       find_max_pfn();
        mtrr_bp_init();
        if (mtrr_trim_uncached_memory(max_pfn))
-               max_low_pfn = setup_memory();
+               find_max_pfn();
+
+       max_low_pfn = setup_memory();
 
 #ifdef CONFIG_VMI
        /*
index 7637dc91c79bebac16365bbcff3b480c408584ef..f4f7ecfb898c7628eb220143dd7ad54b60a4ccbd 100644 (file)
@@ -801,7 +801,7 @@ static void __cpuinit srat_detect_node(void)
        /* Don't do the funky fallback heuristics the AMD version employs
           for now. */
        node = apicid_to_node[apicid];
-       if (node == NUMA_NO_NODE)
+       if (node == NUMA_NO_NODE || !node_online(node))
                node = first_node(node_online_map);
        numa_set_node(cpu, node);
 
index d8172aabc660de7503c43b697fea470d81f7eb9a..e55af12e11b7aeb523ff0296d7e525d2f7a33a6d 100644 (file)
@@ -222,8 +222,7 @@ static int is_io_pte(unsigned long pte)
 
 static int is_rmap_pte(u64 pte)
 {
-       return pte != shadow_trap_nonpresent_pte
-               && pte != shadow_notrap_nonpresent_pte;
+       return is_shadow_present_pte(pte);
 }
 
 static gfn_t pse36_gfn_delta(u32 gpte)
@@ -893,14 +892,25 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
                         int *ptwrite, gfn_t gfn, struct page *page)
 {
        u64 spte;
-       int was_rmapped = is_rmap_pte(*shadow_pte);
+       int was_rmapped = 0;
        int was_writeble = is_writeble_pte(*shadow_pte);
+       hfn_t host_pfn = (*shadow_pte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT;
 
        pgprintk("%s: spte %llx access %x write_fault %d"
                 " user_fault %d gfn %lx\n",
                 __FUNCTION__, *shadow_pte, pt_access,
                 write_fault, user_fault, gfn);
 
+       if (is_rmap_pte(*shadow_pte)) {
+               if (host_pfn != page_to_pfn(page)) {
+                       pgprintk("hfn old %lx new %lx\n",
+                                host_pfn, page_to_pfn(page));
+                       rmap_remove(vcpu->kvm, shadow_pte);
+               }
+               else
+                       was_rmapped = 1;
+       }
+
        /*
         * We don't set the accessed bit, since we sometimes want to see
         * whether the guest actually used the pte (in order to detect
@@ -1402,7 +1412,7 @@ static void mmu_guess_page_from_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
        up_read(&current->mm->mmap_sem);
 
        vcpu->arch.update_pte.gfn = gfn;
-       vcpu->arch.update_pte.page = gfn_to_page(vcpu->kvm, gfn);
+       vcpu->arch.update_pte.page = page;
 }
 
 void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
index 94ea724638fda63b87ec248c2c3b40783ad93e08..8e1462880d1f1dec6d6162124db057ae5f687868 100644 (file)
@@ -349,8 +349,6 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
 
 static void reload_tss(void)
 {
-#ifndef CONFIG_X86_64
-
        /*
         * VT restores TR but not its size.  Useless.
         */
@@ -361,7 +359,6 @@ static void reload_tss(void)
        descs = (void *)gdt.base;
        descs[GDT_ENTRY_TSS].type = 9; /* available TSS */
        load_TR_desc();
-#endif
 }
 
 static void load_transition_efer(struct vcpu_vmx *vmx)
@@ -1436,7 +1433,7 @@ static int init_rmode_tss(struct kvm *kvm)
        int ret = 0;
        int r;
 
-       down_read(&current->mm->mmap_sem);
+       down_read(&kvm->slots_lock);
        r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE);
        if (r < 0)
                goto out;
@@ -1459,7 +1456,7 @@ static int init_rmode_tss(struct kvm *kvm)
 
        ret = 1;
 out:
-       up_read(&current->mm->mmap_sem);
+       up_read(&kvm->slots_lock);
        return ret;
 }
 
index c394ca0720b8d0566f39536b57fc241202c5eb7a..8e25e06ff73088f50a335a9316e1c472b7d1f571 100644 (file)
@@ -324,7 +324,6 @@ unsigned long __init setup_memory(void)
         * this space and use it to adjust the boundary between ZONE_NORMAL
         * and ZONE_HIGHMEM.
         */
-       find_max_pfn();
        get_memcfg_numa();
 
        kva_pages = calculate_numa_remap_pages();
index 4afaba0ed72221175854a856d347179b1ab3e979..794895c6dcc99428b2105a9f4062b109b90f5215 100644 (file)
@@ -137,7 +137,11 @@ static void __iomem *__ioremap(resource_size_t phys_addr, unsigned long size,
        switch (mode) {
        case IOR_MODE_UNCACHED:
        default:
-               prot = PAGE_KERNEL_NOCACHE;
+               /*
+                * FIXME: we will use UC MINUS for now, as video fb drivers
+                * depend on it. Upcoming ioremap_wc() will fix this behavior.
+                */
+               prot = PAGE_KERNEL_UC_MINUS;
                break;
        case IOR_MODE_CACHED:
                prot = PAGE_KERNEL;
index 14e48b5a94ba193c1cb4acc667482e05905d373e..7b79f6be4e7df99dc663d2d4c935a7e35f877a3b 100644 (file)
@@ -771,7 +771,7 @@ static inline int change_page_attr_clear(unsigned long addr, int numpages,
 int set_memory_uc(unsigned long addr, int numpages)
 {
        return change_page_attr_set(addr, numpages,
-                                   __pgprot(_PAGE_PCD | _PAGE_PWT));
+                                   __pgprot(_PAGE_PCD));
 }
 EXPORT_SYMBOL(set_memory_uc);
 
index 7af414a3c63ee89f3ec0624d256437f9d74a2825..89022a74faeeda9d9ed9b11f431c2e4c4eecb4d7 100644 (file)
@@ -131,8 +131,8 @@ struct prt_quirk {
  */
 static struct prt_quirk prt_quirks[] = {
        { medion_md9580, 0, 0, 9, 'A',
-               "\\_SB_.PCI0.ISA.LNKA",
-               "\\_SB_.PCI0.ISA.LNKB"},
+               "\\_SB_.PCI0.ISA_.LNKA",
+               "\\_SB_.PCI0.ISA_.LNKB"},
        { dell_optiplex, 0, 0, 0xd, 'A',
                "\\_SB_.LNKB",
                "\\_SB_.LNKA"},
index e8e2d88692368f5ea4903485aa7ca6a6b783e493..788da9781f80ffb5311b396cd3557b0786376dcd 100644 (file)
@@ -1487,7 +1487,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
                return 0;
        }
 
-       acpi_unlazy_tlb(smp_processor_id());
        /*
         * Must be done before busmaster disable as we might need to
         * access HPET !
@@ -1577,6 +1576,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
                return 0;
        }
 
+       acpi_unlazy_tlb(smp_processor_id());
+
        /* Tell the scheduler that we are going deep-idle: */
        sched_clock_idle_sleep_event();
        /*
@@ -1692,7 +1693,9 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr)
                switch (cx->type) {
                        case ACPI_STATE_C1:
                        state->flags |= CPUIDLE_FLAG_SHALLOW;
-                       state->flags |= CPUIDLE_FLAG_TIME_VALID;
+                       if (cx->entry_method == ACPI_CSTATE_FFH)
+                               state->flags |= CPUIDLE_FLAG_TIME_VALID;
+
                        state->enter = acpi_idle_enter_c1;
                        dev->safe_state = state;
                        break;
index a2cf3008ce6c03eb40ad564d3063700896a68d03..bcf2c70fca87f498b9a3c5af5e0037248c488b37 100644 (file)
@@ -130,7 +130,6 @@ static int acpi_smbus_transaction(struct acpi_smb_hc *hc, u8 protocol,
                goto end;
        }
        smb_hc_write(hc, ACPI_SMB_COMMAND, command);
-       smb_hc_write(hc, ACPI_SMB_COMMAND, command);
        if (!(protocol & 0x01)) {
                smb_hc_write(hc, ACPI_SMB_BLOCK_COUNT, length);
                for (i = 0; i < length; ++i)
index d73663a52324b89b93a7eb68f2fe0df9d21fbe26..fc555a90bb211b651e20c254751ae08f00fffd1a 100644 (file)
@@ -67,7 +67,7 @@ static void cpuidle_idle_call(void)
        /* enter the state and update stats */
        dev->last_residency = target_state->enter(dev, target_state);
        dev->last_state = target_state;
-       target_state->time += dev->last_residency;
+       target_state->time += (unsigned long long)dev->last_residency;
        target_state->usage++;
 
        /* give the governor an opportunity to reflect on the outcome */
@@ -224,7 +224,7 @@ static void poll_idle_init(struct cpuidle_device *dev)
        state->exit_latency = 0;
        state->target_residency = 0;
        state->power_usage = -1;
-       state->flags = CPUIDLE_FLAG_POLL | CPUIDLE_FLAG_TIME_VALID;
+       state->flags = CPUIDLE_FLAG_POLL;
        state->enter = poll_idle;
 }
 #else
index 69102ca05685bdf9f7f48d0926edd160d3428074..e949618b9be0ee3d0e95b48bbac4fd5f93ad21f2 100644 (file)
@@ -218,6 +218,12 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
        return sprintf(buf, "%u\n", state->_name);\
 }
 
+#define define_show_state_ull_function(_name) \
+static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
+{ \
+       return sprintf(buf, "%llu\n", state->_name);\
+}
+
 #define define_show_state_str_function(_name) \
 static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
 { \
@@ -228,8 +234,8 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
 
 define_show_state_function(exit_latency)
 define_show_state_function(power_usage)
-define_show_state_function(usage)
-define_show_state_function(time)
+define_show_state_ull_function(usage)
+define_show_state_ull_function(time)
 define_show_state_str_function(name)
 define_show_state_str_function(desc)
 
index 476b0bb72d6c680b6636e8cd6e784e039f2a772b..5fa9c3c67e0cd55d18f779552c89f017a9ab644f 100644 (file)
@@ -100,7 +100,7 @@ config I2C_AU1550
 
 config I2C_BLACKFIN_TWI
        tristate "Blackfin TWI I2C support"
-       depends on BF534 || BF536 || BF537 || BF54x
+       depends on BF534 || BF536 || BF537
        help
          This is the TWI I2C device driver for Blackfin 534/536/537/54x.
          This driver can also be built as a module.  If so, the module
index da6639707ea31e32f944d9cccae70e7827c4cb2a..7ba31770d773245102b4ece0dc9393af76791a3b 100644 (file)
@@ -128,6 +128,8 @@ struct omap_i2c_dev {
        size_t                  buf_len;
        struct i2c_adapter      adapter;
        unsigned                rev1:1;
+       unsigned                idle:1;
+       u16                     iestate;        /* Saved interrupt register */
 };
 
 static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
@@ -174,18 +176,30 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
        }
 }
 
-static void omap_i2c_enable_clocks(struct omap_i2c_dev *dev)
+static void omap_i2c_unidle(struct omap_i2c_dev *dev)
 {
        if (dev->iclk != NULL)
                clk_enable(dev->iclk);
        clk_enable(dev->fclk);
+       if (dev->iestate)
+               omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
+       dev->idle = 0;
 }
 
-static void omap_i2c_disable_clocks(struct omap_i2c_dev *dev)
+static void omap_i2c_idle(struct omap_i2c_dev *dev)
 {
+       u16 iv;
+
+       dev->idle = 1;
+       dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
+       omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
+       if (dev->rev1)
+               iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG);   /* Read clears */
+       else
+               omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
+       clk_disable(dev->fclk);
        if (dev->iclk != NULL)
                clk_disable(dev->iclk);
-       clk_disable(dev->fclk);
 }
 
 static int omap_i2c_init(struct omap_i2c_dev *dev)
@@ -360,7 +374,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
        int i;
        int r;
 
-       omap_i2c_enable_clocks(dev);
+       omap_i2c_unidle(dev);
 
        if ((r = omap_i2c_wait_for_bb(dev)) < 0)
                goto out;
@@ -374,7 +388,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
        if (r == 0)
                r = num;
 out:
-       omap_i2c_disable_clocks(dev);
+       omap_i2c_idle(dev);
        return r;
 }
 
@@ -403,6 +417,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
        struct omap_i2c_dev *dev = dev_id;
        u16 iv, w;
 
+       if (dev->idle)
+               return IRQ_NONE;
+
        iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG);
        switch (iv) {
        case 0x00:      /* None */
@@ -457,6 +474,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
        u16 stat, w;
        int count = 0;
 
+       if (dev->idle)
+               return IRQ_NONE;
+
        bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
        while ((stat = (omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG))) & bits) {
                dev_dbg(dev->dev, "IRQ (ISR = 0x%04x)\n", stat);
@@ -575,7 +595,7 @@ omap_i2c_probe(struct platform_device *pdev)
        if ((r = omap_i2c_get_clocks(dev)) != 0)
                goto err_free_mem;
 
-       omap_i2c_enable_clocks(dev);
+       omap_i2c_unidle(dev);
 
        if (cpu_is_omap15xx())
                dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20;
@@ -610,7 +630,7 @@ omap_i2c_probe(struct platform_device *pdev)
                goto err_free_irq;
        }
 
-       omap_i2c_disable_clocks(dev);
+       omap_i2c_idle(dev);
 
        return 0;
 
@@ -618,7 +638,7 @@ err_free_irq:
        free_irq(dev->irq, dev);
 err_unuse_clocks:
        omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
-       omap_i2c_disable_clocks(dev);
+       omap_i2c_idle(dev);
        omap_i2c_put_clocks(dev);
 err_free_mem:
        platform_set_drvdata(pdev, NULL);
index fd84b2a363381a6571a09d883cc3d7fe3cc676fa..8b645c6b2cb50c506b82a21f7af0d3c1fdecccf8 100644 (file)
@@ -489,8 +489,8 @@ EXPORT_SYMBOL(i2c_add_adapter);
  * Context: can sleep
  *
  * This routine is used to declare an I2C adapter when its bus number
- * matters.  Example: for I2C adapters from system-on-chip CPUs, or
- * otherwise built in to the system's mainboard, and where i2c_board_info
+ * matters.  For example, use it for I2C adapters from system-on-chip CPUs,
+ * or otherwise built in to the system's mainboard, and where i2c_board_info
  * is used to properly configure I2C devices.
  *
  * If no devices have pre-been declared for this bus, then be sure to
index 125e7b7f34ffd13462e551b31c79cd03ab0d3572..f7cb8e0758b48a5b7c49e0099d0c3cbc60ae23d8 100644 (file)
@@ -486,12 +486,7 @@ void __ref pci_bus_size_bridges(struct pci_bus *bus)
                break;
 
        case PCI_CLASS_BRIDGE_PCI:
-               /* don't size subtractive decoding (transparent)
-                * PCI-to-PCI bridges */
-               if (bus->self->transparent)
-                       break;
                pci_bridge_check_ranges(bus);
-               /* fall through */
        default:
                pbus_size_io(bus);
                /* If the bridge supports prefetchable range, size it
index 6aa231ef642d3e366b13984a56e524851d9251fa..2dcd1960aca844c5cc98e5796b11dec81cde6dbf 100644 (file)
@@ -85,7 +85,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
               i < PNP_MAX_IRQ)
                i++;
        if (i >= PNP_MAX_IRQ && !warned) {
-               printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ "
+               printk(KERN_WARNING "pnpacpi: exceeded the max number of IRQ "
                                "resources: %d \n", PNP_MAX_IRQ);
                warned = 1;
                return;
@@ -187,7 +187,7 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
                res->dma_resource[i].start = dma;
                res->dma_resource[i].end = dma;
        } else if (!warned) {
-               printk(KERN_ERR "pnpacpi: exceeded the max number of DMA "
+               printk(KERN_WARNING "pnpacpi: exceeded the max number of DMA "
                                "resources: %d \n", PNP_MAX_DMA);
                warned = 1;
        }
@@ -213,7 +213,7 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                res->port_resource[i].start = io;
                res->port_resource[i].end = io + len - 1;
        } else if (!warned) {
-               printk(KERN_ERR "pnpacpi: exceeded the max number of IO "
+               printk(KERN_WARNING "pnpacpi: exceeded the max number of IO "
                                "resources: %d \n", PNP_MAX_PORT);
                warned = 1;
        }
@@ -241,7 +241,7 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
                res->mem_resource[i].start = mem;
                res->mem_resource[i].end = mem + len - 1;
        } else if (!warned) {
-               printk(KERN_ERR "pnpacpi: exceeded the max number of mem "
+               printk(KERN_WARNING "pnpacpi: exceeded the max number of mem "
                                "resources: %d\n", PNP_MAX_MEM);
                warned = 1;
        }
index 23321889d9b09d89075272ee419d4e00b496f1d8..f42be069e085b2d212b8cc633d61f418be6801f5 100644 (file)
@@ -81,13 +81,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
 
        if (IS_ERR(anon_inode_inode))
                return -ENODEV;
-       file = get_empty_filp();
-       if (!file)
-               return -ENFILE;
 
        error = get_unused_fd();
        if (error < 0)
-               goto err_put_filp;
+               return error;
        fd = error;
 
        /*
@@ -114,14 +111,15 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
        dentry->d_flags &= ~DCACHE_UNHASHED;
        d_instantiate(dentry, anon_inode_inode);
 
-       file->f_path.mnt = mntget(anon_inode_mnt);
-       file->f_path.dentry = dentry;
+       error = -ENFILE;
+       file = alloc_file(anon_inode_mnt, dentry,
+                         FMODE_READ | FMODE_WRITE, fops);
+       if (!file)
+               goto err_dput;
        file->f_mapping = anon_inode_inode->i_mapping;
 
        file->f_pos = 0;
        file->f_flags = O_RDWR;
-       file->f_op = fops;
-       file->f_mode = FMODE_READ | FMODE_WRITE;
        file->f_version = 0;
        file->private_data = priv;
 
@@ -132,10 +130,10 @@ int anon_inode_getfd(int *pfd, struct inode **pinode, struct file **pfile,
        *pfile = file;
        return 0;
 
+err_dput:
+       dput(dentry);
 err_put_unused_fd:
        put_unused_fd(fd);
-err_put_filp:
-       put_filp(file);
        return error;
 }
 EXPORT_SYMBOL_GPL(anon_inode_getfd);
index 6d27befe2d48ff5fbb13a45c5cd86618777bbbd9..986ff4ed0a7cbf56d258b290635c32203284c565 100644 (file)
@@ -83,6 +83,12 @@ int proc_nr_files(ctl_table *table, int write, struct file *filp,
 /* Find an unused file structure and return a pointer to it.
  * Returns NULL, if there are no more free file structures or
  * we run out of memory.
+ *
+ * Be very careful using this.  You are responsible for
+ * getting write access to any mount that you might assign
+ * to this filp, if it is opened for write.  If this is not
+ * done, you will imbalance int the mount's writer count
+ * and a warning at __fput() time.
  */
 struct file *get_empty_filp(void)
 {
index a1e1f0f61aa5b750971cc81f7369541ed95c0ad0..8601d8ef3b550d1c803c3a5bb7cd37f831717fd2 100644 (file)
@@ -1,23 +1,24 @@
 /*
- * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+ * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  * Licensed under the GPL
  */
 
-#include <linux/fs.h>
+#include <linux/ctype.h>
+#include <linux/dcache.h>
 #include <linux/file.h>
-#include <linux/module.h>
+#include <linux/fs.h>
 #include <linux/init.h>
-#include <linux/slab.h>
-#include <linux/list.h>
 #include <linux/kernel.h>
-#include <linux/ctype.h>
-#include <linux/dcache.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/mount.h>
+#include <linux/slab.h>
 #include <linux/statfs.h>
+#include <linux/types.h>
 #include <asm/uaccess.h>
-#include <asm/fcntl.h>
 #include "os.h"
 
-static int init_inode(struct inode *inode, struct dentry *dentry);
+static struct inode *get_inode(struct super_block *, struct dentry *);
 
 struct hppfs_data {
        struct list_head list;
@@ -51,14 +52,14 @@ static int is_pid(struct dentry *dentry)
        int i;
 
        sb = dentry->d_sb;
-       if((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root))
-               return(0);
+       if ((sb->s_op != &hppfs_sbops) || (dentry->d_parent != sb->s_root))
+               return 0;
 
-       for(i = 0; i < dentry->d_name.len; i++){
-               if(!isdigit(dentry->d_name.name[i]))
-                       return(0);
+       for (i = 0; i < dentry->d_name.len; i++) {
+               if (!isdigit(dentry->d_name.name[i]))
+                       return 0;
        }
-       return(1);
+       return 1;
 }
 
 static char *dentry_name(struct dentry *dentry, int extra)
@@ -70,8 +71,8 @@ static char *dentry_name(struct dentry *dentry, int extra)
 
        len = 0;
        parent = dentry;
-       while(parent->d_parent != parent){
-               if(is_pid(parent))
+       while (parent->d_parent != parent) {
+               if (is_pid(parent))
                        len += strlen("pid") + 1;
                else len += parent->d_name.len + 1;
                parent = parent->d_parent;
@@ -80,12 +81,13 @@ static char *dentry_name(struct dentry *dentry, int extra)
        root = "proc";
        len += strlen(root);
        name = kmalloc(len + extra + 1, GFP_KERNEL);
-       if(name == NULL) return(NULL);
+       if (name == NULL)
+               return NULL;
 
        name[len] = '\0';
        parent = dentry;
-       while(parent->d_parent != parent){
-               if(is_pid(parent)){
+       while (parent->d_parent != parent) {
+               if (is_pid(parent)) {
                        seg_name = "pid";
                        seg_len = strlen("pid");
                }
@@ -100,27 +102,25 @@ static char *dentry_name(struct dentry *dentry, int extra)
                parent = parent->d_parent;
        }
        strncpy(name, root, strlen(root));
-       return(name);
+       return name;
 }
 
-struct dentry_operations hppfs_dentry_ops = {
-};
-
 static int file_removed(struct dentry *dentry, const char *file)
 {
        char *host_file;
        int extra, fd;
 
        extra = 0;
-       if(file != NULL) extra += strlen(file) + 1;
+       if (file != NULL)
+               extra += strlen(file) + 1;
 
        host_file = dentry_name(dentry, extra + strlen("/remove"));
-       if(host_file == NULL){
-               printk("file_removed : allocation failed\n");
-               return(-ENOMEM);
+       if (host_file == NULL) {
+               printk(KERN_ERR "file_removed : allocation failed\n");
+               return -ENOMEM;
        }
 
-       if(file != NULL){
+       if (file != NULL) {
                strcat(host_file, "/");
                strcat(host_file, file);
        }
@@ -128,45 +128,11 @@ static int file_removed(struct dentry *dentry, const char *file)
 
        fd = os_open_file(host_file, of_read(OPENFLAGS()), 0);
        kfree(host_file);
-       if(fd > 0){
+       if (fd > 0) {
                os_close_file(fd);
-               return(1);
-       }
-       return(0);
-}
-
-static void hppfs_read_inode(struct inode *ino)
-{
-       struct inode *proc_ino;
-
-       if(HPPFS_I(ino)->proc_dentry == NULL)
-               return;
-
-       proc_ino = HPPFS_I(ino)->proc_dentry->d_inode;
-       ino->i_uid = proc_ino->i_uid;
-       ino->i_gid = proc_ino->i_gid;
-       ino->i_atime = proc_ino->i_atime;
-       ino->i_mtime = proc_ino->i_mtime;
-       ino->i_ctime = proc_ino->i_ctime;
-       ino->i_ino = proc_ino->i_ino;
-       ino->i_mode = proc_ino->i_mode;
-       ino->i_nlink = proc_ino->i_nlink;
-       ino->i_size = proc_ino->i_size;
-       ino->i_blocks = proc_ino->i_blocks;
-}
-
-static struct inode *hppfs_iget(struct super_block *sb)
-{
-       struct inode *inode;
-
-       inode = iget_locked(sb, 0);
-       if (!inode)
-               return ERR_PTR(-ENOMEM);
-       if (inode->i_state & I_NEW) {
-               hppfs_read_inode(inode);
-               unlock_new_inode(inode);
+               return 1;
        }
-       return inode;
+       return 0;
 }
 
 static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
@@ -177,55 +143,45 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
        int err, deleted;
 
        deleted = file_removed(dentry, NULL);
-       if(deleted < 0)
-               return(ERR_PTR(deleted));
-       else if(deleted)
-               return(ERR_PTR(-ENOENT));
+       if (deleted < 0)
+               return ERR_PTR(deleted);
+       else if (deleted)
+               return ERR_PTR(-ENOENT);
 
        err = -ENOMEM;
        parent = HPPFS_I(ino)->proc_dentry;
        mutex_lock(&parent->d_inode->i_mutex);
        proc_dentry = d_lookup(parent, &dentry->d_name);
-       if(proc_dentry == NULL){
+       if (proc_dentry == NULL) {
                proc_dentry = d_alloc(parent, &dentry->d_name);
-               if(proc_dentry == NULL){
+               if (proc_dentry == NULL) {
                        mutex_unlock(&parent->d_inode->i_mutex);
                        goto out;
                }
                new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
                                                       proc_dentry, NULL);
-               if(new){
+               if (new) {
                        dput(proc_dentry);
                        proc_dentry = new;
                }
        }
        mutex_unlock(&parent->d_inode->i_mutex);
 
-       if(IS_ERR(proc_dentry))
-               return(proc_dentry);
+       if (IS_ERR(proc_dentry))
+               return proc_dentry;
 
-       inode = hppfs_iget(ino->i_sb);
-       if (IS_ERR(inode)) {
-               err = PTR_ERR(inode);
+       err = -ENOMEM;
+       inode = get_inode(ino->i_sb, proc_dentry);
+       if (!inode)
                goto out_dput;
-       }
-
-       err = init_inode(inode, proc_dentry);
-       if(err)
-               goto out_put;
-
-       hppfs_read_inode(inode);
 
        d_add(dentry, inode);
-       dentry->d_op = &hppfs_dentry_ops;
-       return(NULL);
+       return NULL;
 
- out_put:
-       iput(inode);
  out_dput:
        dput(proc_dentry);
  out:
-       return(ERR_PTR(err));
+       return ERR_PTR(err);
 }
 
 static const struct inode_operations hppfs_file_iops = {
@@ -239,15 +195,16 @@ static ssize_t read_proc(struct file *file, char __user *buf, ssize_t count,
 
        read = file->f_path.dentry->d_inode->i_fop->read;
 
-       if(!is_user)
+       if (!is_user)
                set_fs(KERNEL_DS);
 
        n = (*read)(file, buf, count, &file->f_pos);
 
-       if(!is_user)
+       if (!is_user)
                set_fs(USER_DS);
 
-       if(ppos) *ppos = file->f_pos;
+       if (ppos)
+               *ppos = file->f_pos;
        return n;
 }
 
@@ -259,24 +216,23 @@ static ssize_t hppfs_read_file(int fd, char __user *buf, ssize_t count)
 
        n = -ENOMEM;
        new_buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-       if(new_buf == NULL){
-               printk("hppfs_read_file : kmalloc failed\n");
+       if (new_buf == NULL) {
+               printk(KERN_ERR "hppfs_read_file : kmalloc failed\n");
                goto out;
        }
        n = 0;
-       while(count > 0){
+       while (count > 0) {
                cur = min_t(ssize_t, count, PAGE_SIZE);
                err = os_read_file(fd, new_buf, cur);
-               if(err < 0){
-                       printk("hppfs_read : read failed, errno = %d\n",
-                              err);
+               if (err < 0) {
+                       printk(KERN_ERR "hppfs_read : read failed, "
+                              "errno = %d\n", err);
                        n = err;
                        goto out_free;
-               }
-               else if(err == 0)
+               } else if (err == 0)
                        break;
 
-               if(copy_to_user(buf, new_buf, err)){
+               if (copy_to_user(buf, new_buf, err)) {
                        n = -EFAULT;
                        goto out_free;
                }
@@ -297,35 +253,36 @@ static ssize_t hppfs_read(struct file *file, char __user *buf, size_t count,
        loff_t off;
        int err;
 
-       if(hppfs->contents != NULL){
-               if(*ppos >= hppfs->len) return(0);
+       if (hppfs->contents != NULL) {
+               if (*ppos >= hppfs->len)
+                       return 0;
 
                data = hppfs->contents;
                off = *ppos;
-               while(off >= sizeof(data->contents)){
+               while (off >= sizeof(data->contents)) {
                        data = list_entry(data->list.next, struct hppfs_data,
                                          list);
                        off -= sizeof(data->contents);
                }
 
-               if(off + count > hppfs->len)
+               if (off + count > hppfs->len)
                        count = hppfs->len - off;
                copy_to_user(buf, &data->contents[off], count);
                *ppos += count;
-       }
-       else if(hppfs->host_fd != -1){
+       } else if (hppfs->host_fd != -1) {
                err = os_seek_file(hppfs->host_fd, *ppos);
-               if(err){
-                       printk("hppfs_read : seek failed, errno = %d\n", err);
-                       return(err);
+               if (err) {
+                       printk(KERN_ERR "hppfs_read : seek failed, "
+                              "errno = %d\n", err);
+                       return err;
                }
                count = hppfs_read_file(hppfs->host_fd, buf, count);
-               if(count > 0)
+               if (count > 0)
                        *ppos += count;
        }
        else count = read_proc(hppfs->proc_file, buf, count, ppos, 1);
 
-       return(count);
+       return count;
 }
 
 static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len,
@@ -342,7 +299,7 @@ static ssize_t hppfs_write(struct file *file, const char __user *buf, size_t len
        err = (*write)(proc_file, buf, len, &proc_file->f_pos);
        file->f_pos = proc_file->f_pos;
 
-       return(err);
+       return err;
 }
 
 static int open_host_sock(char *host_file, int *filter_out)
@@ -354,13 +311,13 @@ static int open_host_sock(char *host_file, int *filter_out)
        strcpy(end, "/rw");
        *filter_out = 1;
        fd = os_connect_socket(host_file);
-       if(fd > 0)
-               return(fd);
+       if (fd > 0)
+               return fd;
 
        strcpy(end, "/r");
        *filter_out = 0;
        fd = os_connect_socket(host_file);
-       return(fd);
+       return fd;
 }
 
 static void free_contents(struct hppfs_data *head)
@@ -368,9 +325,10 @@ static void free_contents(struct hppfs_data *head)
        struct hppfs_data *data;
        struct list_head *ele, *next;
 
-       if(head == NULL) return;
+       if (head == NULL)
+               return;
 
-       list_for_each_safe(ele, next, &head->list){
+       list_for_each_safe(ele, next, &head->list) {
                data = list_entry(ele, struct hppfs_data, list);
                kfree(data);
        }
@@ -387,8 +345,8 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
 
        err = -ENOMEM;
        data = kmalloc(sizeof(*data), GFP_KERNEL);
-       if(data == NULL){
-               printk("hppfs_get_data : head allocation failed\n");
+       if (data == NULL) {
+               printk(KERN_ERR "hppfs_get_data : head allocation failed\n");
                goto failed;
        }
 
@@ -397,36 +355,36 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
        head = data;
        *size_out = 0;
 
-       if(filter){
-               while((n = read_proc(proc_file, data->contents,
+       if (filter) {
+               while ((n = read_proc(proc_file, data->contents,
                                     sizeof(data->contents), NULL, 0)) > 0)
                        os_write_file(fd, data->contents, n);
                err = os_shutdown_socket(fd, 0, 1);
-               if(err){
-                       printk("hppfs_get_data : failed to shut down "
+               if (err) {
+                       printk(KERN_ERR "hppfs_get_data : failed to shut down "
                               "socket\n");
                        goto failed_free;
                }
        }
-       while(1){
+       while (1) {
                n = os_read_file(fd, data->contents, sizeof(data->contents));
-               if(n < 0){
+               if (n < 0) {
                        err = n;
-                       printk("hppfs_get_data : read failed, errno = %d\n",
-                              err);
+                       printk(KERN_ERR "hppfs_get_data : read failed, "
+                              "errno = %d\n", err);
                        goto failed_free;
-               }
-               else if(n == 0)
+               } else if (n == 0)
                        break;
 
                *size_out += n;
 
-               if(n < sizeof(data->contents))
+               if (n < sizeof(data->contents))
                        break;
 
                new = kmalloc(sizeof(*data), GFP_KERNEL);
-               if(new == 0){
-                       printk("hppfs_get_data : data allocation failed\n");
+               if (new == 0) {
+                       printk(KERN_ERR "hppfs_get_data : data allocation "
+                              "failed\n");
                        err = -ENOMEM;
                        goto failed_free;
                }
@@ -435,12 +393,12 @@ static struct hppfs_data *hppfs_get_data(int fd, int filter,
                list_add(&new->list, &data->list);
                data = new;
        }
-       return(head);
+       return head;
 
  failed_free:
        free_contents(head);
  failed:
-       return(ERR_PTR(err));
+       return ERR_PTR(err);
 }
 
 static struct hppfs_private *hppfs_data(void)
@@ -448,77 +406,79 @@ static struct hppfs_private *hppfs_data(void)
        struct hppfs_private *data;
 
        data = kmalloc(sizeof(*data), GFP_KERNEL);
-       if(data == NULL)
-               return(data);
+       if (data == NULL)
+               return data;
 
        *data = ((struct hppfs_private ) { .host_fd             = -1,
                                           .len                 = -1,
                                           .contents            = NULL } );
-       return(data);
+       return data;
 }
 
 static int file_mode(int fmode)
 {
-       if(fmode == (FMODE_READ | FMODE_WRITE))
-               return(O_RDWR);
-       if(fmode == FMODE_READ)
-               return(O_RDONLY);
-       if(fmode == FMODE_WRITE)
-               return(O_WRONLY);
-       return(0);
+       if (fmode == (FMODE_READ | FMODE_WRITE))
+               return O_RDWR;
+       if (fmode == FMODE_READ)
+               return O_RDONLY;
+       if (fmode == FMODE_WRITE)
+               return O_WRONLY;
+       return 0;
 }
 
 static int hppfs_open(struct inode *inode, struct file *file)
 {
        struct hppfs_private *data;
        struct dentry *proc_dentry;
+       struct vfsmount *proc_mnt;
        char *host_file;
        int err, fd, type, filter;
 
        err = -ENOMEM;
        data = hppfs_data();
-       if(data == NULL)
+       if (data == NULL)
                goto out;
 
        host_file = dentry_name(file->f_path.dentry, strlen("/rw"));
-       if(host_file == NULL)
+       if (host_file == NULL)
                goto out_free2;
 
        proc_dentry = HPPFS_I(inode)->proc_dentry;
+       proc_mnt = inode->i_sb->s_fs_info;
 
        /* XXX This isn't closed anywhere */
-       data->proc_file = dentry_open(dget(proc_dentry), NULL,
+       data->proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt),
                                      file_mode(file->f_mode));
        err = PTR_ERR(data->proc_file);
-       if(IS_ERR(data->proc_file))
+       if (IS_ERR(data->proc_file))
                goto out_free1;
 
        type = os_file_type(host_file);
-       if(type == OS_TYPE_FILE){
+       if (type == OS_TYPE_FILE) {
                fd = os_open_file(host_file, of_read(OPENFLAGS()), 0);
-               if(fd >= 0)
+               if (fd >= 0)
                        data->host_fd = fd;
-               else printk("hppfs_open : failed to open '%s', errno = %d\n",
-                           host_file, -fd);
+               else
+                       printk(KERN_ERR "hppfs_open : failed to open '%s', "
+                              "errno = %d\n", host_file, -fd);
 
                data->contents = NULL;
-       }
-       else if(type == OS_TYPE_DIR){
+       } else if (type == OS_TYPE_DIR) {
                fd = open_host_sock(host_file, &filter);
-               if(fd > 0){
+               if (fd > 0) {
                        data->contents = hppfs_get_data(fd, filter,
                                                        data->proc_file,
                                                        file, &data->len);
-                       if(!IS_ERR(data->contents))
+                       if (!IS_ERR(data->contents))
                                data->host_fd = fd;
-               }
-               else printk("hppfs_open : failed to open a socket in "
-                           "'%s', errno = %d\n", host_file, -fd);
+               } else
+                       printk(KERN_ERR "hppfs_open : failed to open a socket "
+                              "in '%s', errno = %d\n", host_file, -fd);
        }
        kfree(host_file);
 
        file->private_data = data;
-       return(0);
+       return 0;
 
  out_free1:
        kfree(host_file);
@@ -526,34 +486,36 @@ static int hppfs_open(struct inode *inode, struct file *file)
        free_contents(data->contents);
        kfree(data);
  out:
-       return(err);
+       return err;
 }
 
 static int hppfs_dir_open(struct inode *inode, struct file *file)
 {
        struct hppfs_private *data;
        struct dentry *proc_dentry;
+       struct vfsmount *proc_mnt;
        int err;
 
        err = -ENOMEM;
        data = hppfs_data();
-       if(data == NULL)
+       if (data == NULL)
                goto out;
 
        proc_dentry = HPPFS_I(inode)->proc_dentry;
-       data->proc_file = dentry_open(dget(proc_dentry), NULL,
+       proc_mnt = inode->i_sb->s_fs_info;
+       data->proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt),
                                      file_mode(file->f_mode));
        err = PTR_ERR(data->proc_file);
-       if(IS_ERR(data->proc_file))
+       if (IS_ERR(data->proc_file))
                goto out_free;
 
        file->private_data = data;
-       return(0);
+       return 0;
 
  out_free:
        kfree(data);
  out:
-       return(err);
+       return err;
 }
 
 static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
@@ -564,13 +526,13 @@ static loff_t hppfs_llseek(struct file *file, loff_t off, int where)
        loff_t ret;
 
        llseek = proc_file->f_path.dentry->d_inode->i_fop->llseek;
-       if(llseek != NULL){
+       if (llseek != NULL) {
                ret = (*llseek)(proc_file, off, where);
-               if(ret < 0)
-                       return(ret);
+               if (ret < 0)
+                       return ret;
        }
 
-       return(default_llseek(file, off, where));
+       return default_llseek(file, off, where);
 }
 
 static const struct file_operations hppfs_file_fops = {
@@ -592,11 +554,11 @@ static int hppfs_filldir(void *d, const char *name, int size,
 {
        struct hppfs_dirent *dirent = d;
 
-       if(file_removed(dirent->dentry, name))
-               return(0);
+       if (file_removed(dirent->dentry, name))
+               return 0;
 
-       return((*dirent->filldir)(dirent->vfs_dirent, name, size, offset,
-                                 inode, type));
+       return (*dirent->filldir)(dirent->vfs_dirent, name, size, offset,
+                                 inode, type);
 }
 
 static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
@@ -607,7 +569,8 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
        struct hppfs_dirent dirent = ((struct hppfs_dirent)
                                      { .vfs_dirent     = ent,
                                        .filldir        = filldir,
-                                       .dentry         = file->f_path.dentry } );
+                                       .dentry         = file->f_path.dentry
+                                     });
        int err;
 
        readdir = proc_file->f_path.dentry->d_inode->i_fop->readdir;
@@ -616,12 +579,12 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir)
        err = (*readdir)(proc_file, &dirent, hppfs_filldir);
        file->f_pos = proc_file->f_pos;
 
-       return(err);
+       return err;
 }
 
 static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync)
 {
-       return(0);
+       return 0;
 }
 
 static const struct file_operations hppfs_dir_fops = {
@@ -639,7 +602,7 @@ static int hppfs_statfs(struct dentry *dentry, struct kstatfs *sf)
        sf->f_files = 0;
        sf->f_ffree = 0;
        sf->f_type = HPPFS_SUPER_MAGIC;
-       return(0);
+       return 0;
 }
 
 static struct inode *hppfs_alloc_inode(struct super_block *sb)
@@ -647,12 +610,12 @@ static struct inode *hppfs_alloc_inode(struct super_block *sb)
        struct hppfs_inode_info *hi;
 
        hi = kmalloc(sizeof(*hi), GFP_KERNEL);
-       if(hi == NULL)
-               return(NULL);
+       if (!hi)
+               return NULL;
 
-       *hi = ((struct hppfs_inode_info) { .proc_dentry = NULL });
+       hi->proc_dentry = NULL;
        inode_init_once(&hi->vfs_inode);
-       return(&hi->vfs_inode);
+       return &hi->vfs_inode;
 }
 
 void hppfs_delete_inode(struct inode *ino)
@@ -665,21 +628,31 @@ static void hppfs_destroy_inode(struct inode *inode)
        kfree(HPPFS_I(inode));
 }
 
+static void hppfs_put_super(struct super_block *sb)
+{
+       mntput(sb->s_fs_info);
+}
+
 static const struct super_operations hppfs_sbops = {
        .alloc_inode    = hppfs_alloc_inode,
        .destroy_inode  = hppfs_destroy_inode,
        .delete_inode   = hppfs_delete_inode,
        .statfs         = hppfs_statfs,
+       .put_super      = hppfs_put_super,
 };
 
-static int hppfs_readlink(struct dentry *dentry, char __user *buffer, int buflen)
+static int hppfs_readlink(struct dentry *dentry, char __user *buffer,
+                         int buflen)
 {
        struct file *proc_file;
        struct dentry *proc_dentry;
+       struct vfsmount *proc_mnt;
        int ret;
 
        proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
-       proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
+       proc_mnt = dentry->d_sb->s_fs_info;
+
+       proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
        if (IS_ERR(proc_file))
                return PTR_ERR(proc_file);
 
@@ -694,10 +667,13 @@ static void* hppfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
        struct file *proc_file;
        struct dentry *proc_dentry;
+       struct vfsmount *proc_mnt;
        void *ret;
 
        proc_dentry = HPPFS_I(dentry->d_inode)->proc_dentry;
-       proc_file = dentry_open(dget(proc_dentry), NULL, O_RDONLY);
+       proc_mnt = dentry->d_sb->s_fs_info;
+
+       proc_file = dentry_open(dget(proc_dentry), mntget(proc_mnt), O_RDONLY);
        if (IS_ERR(proc_file))
                return proc_file;
 
@@ -717,70 +693,72 @@ static const struct inode_operations hppfs_link_iops = {
        .follow_link    = hppfs_follow_link,
 };
 
-static int init_inode(struct inode *inode, struct dentry *dentry)
+static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
 {
-       if(S_ISDIR(dentry->d_inode->i_mode)){
+       struct inode *proc_ino = dentry->d_inode;
+       struct inode *inode = new_inode(sb);
+
+       if (!inode)
+               return ERR_PTR(-ENOMEM);
+
+       if (S_ISDIR(dentry->d_inode->i_mode)) {
                inode->i_op = &hppfs_dir_iops;
                inode->i_fop = &hppfs_dir_fops;
-       }
-       else if(S_ISLNK(dentry->d_inode->i_mode)){
+       } else if (S_ISLNK(dentry->d_inode->i_mode)) {
                inode->i_op = &hppfs_link_iops;
                inode->i_fop = &hppfs_file_fops;
-       }
-       else {
+       } else {
                inode->i_op = &hppfs_file_iops;
                inode->i_fop = &hppfs_file_fops;
        }
 
        HPPFS_I(inode)->proc_dentry = dentry;
 
-       return(0);
+       inode->i_uid = proc_ino->i_uid;
+       inode->i_gid = proc_ino->i_gid;
+       inode->i_atime = proc_ino->i_atime;
+       inode->i_mtime = proc_ino->i_mtime;
+       inode->i_ctime = proc_ino->i_ctime;
+       inode->i_ino = proc_ino->i_ino;
+       inode->i_mode = proc_ino->i_mode;
+       inode->i_nlink = proc_ino->i_nlink;
+       inode->i_size = proc_ino->i_size;
+       inode->i_blocks = proc_ino->i_blocks;
+
+       return 0;
 }
 
 static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
 {
        struct inode *root_inode;
-       struct file_system_type *procfs;
-       struct super_block *proc_sb;
-       int err;
+       struct vfsmount *proc_mnt;
+       int err = -ENOENT;
 
-       err = -ENOENT;
-       procfs = get_fs_type("proc");
-       if(procfs == NULL)
+       proc_mnt = do_kern_mount("proc", 0, "proc", NULL);
+       if (IS_ERR(proc_mnt))
                goto out;
 
-       if(list_empty(&procfs->fs_supers))
-               goto out;
-
-       proc_sb = list_entry(procfs->fs_supers.next, struct super_block,
-                            s_instances);
-
        sb->s_blocksize = 1024;
        sb->s_blocksize_bits = 10;
        sb->s_magic = HPPFS_SUPER_MAGIC;
        sb->s_op = &hppfs_sbops;
-
-       root_inode = hppfs_iget(sb);
-       if (IS_ERR(root_inode)) {
-               err = PTR_ERR(root_inode);
-               goto out;
-       }
-
-       err = init_inode(root_inode, proc_sb->s_root);
-       if(err)
-               goto out_put;
+       sb->s_fs_info = proc_mnt;
 
        err = -ENOMEM;
-       sb->s_root = d_alloc_root(root_inode);
-       if(sb->s_root == NULL)
-               goto out_put;
+       root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root);
+       if (!root_inode)
+               goto out_mntput;
 
-       hppfs_read_inode(root_inode);
+       sb->s_root = d_alloc_root(root_inode);
+       if (!sb->s_root)
+               goto out_iput;
 
-       return(0);
+       return 0;
 
- out_put:
+ out_iput:
        iput(root_inode);
+ out_mntput:
+       mntput(proc_mnt);
  out:
        return(err);
 }
@@ -802,7 +780,7 @@ static struct file_system_type hppfs_type = {
 
 static int __init init_hppfs(void)
 {
-       return(register_filesystem(&hppfs_type));
+       return register_filesystem(&hppfs_type);
 }
 
 static void __exit exit_hppfs(void)
@@ -813,14 +791,3 @@ static void __exit exit_hppfs(void)
 module_init(init_hppfs)
 module_exit(exit_hppfs)
 MODULE_LICENSE("GPL");
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index eee9487ae47fb78a12ffd92a4adaa6e185fbe085..6846785fe9043b48279bc04c44328d0264e48197 100644 (file)
@@ -954,7 +954,7 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
                        FMODE_WRITE | FMODE_READ,
                        &hugetlbfs_file_operations);
        if (!file)
-               goto out_inode;
+               goto out_dentry; /* inode is already attached */
 
        return file;
 
index 6b7a0eef409076abca4a3383bd1c177595aff2ec..8cf9bb9c2fc0b0133d85f0f6ff0f3e35a9fb8e07 100644 (file)
  * any extra contention...
  */
 
-static int link_path_walk(const char *name, struct nameidata *nd);
+static int __link_path_walk(const char *name, struct nameidata *nd);
 
 /* In order to reduce some races, while at the same time doing additional
  * checking and hopefully speeding things up, we copy filenames to the
@@ -563,6 +563,37 @@ walk_init_root(const char *name, struct nameidata *nd)
        return 1;
 }
 
+/*
+ * Wrapper to retry pathname resolution whenever the underlying
+ * file system returns an ESTALE.
+ *
+ * Retry the whole path once, forcing real lookup requests
+ * instead of relying on the dcache.
+ */
+static __always_inline int link_path_walk(const char *name, struct nameidata *nd)
+{
+       struct path save = nd->path;
+       int result;
+
+       /* make sure the stuff we saved doesn't go away */
+       dget(save.dentry);
+       mntget(save.mnt);
+
+       result = __link_path_walk(name, nd);
+       if (result == -ESTALE) {
+               /* nd->path had been dropped */
+               nd->path = save;
+               dget(nd->path.dentry);
+               mntget(nd->path.mnt);
+               nd->flags |= LOOKUP_REVAL;
+               result = __link_path_walk(name, nd);
+       }
+
+       path_put(&save);
+
+       return result;
+}
+
 static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link)
 {
        int res = 0;
@@ -1020,36 +1051,6 @@ return_err:
        return err;
 }
 
-/*
- * Wrapper to retry pathname resolution whenever the underlying
- * file system returns an ESTALE.
- *
- * Retry the whole path once, forcing real lookup requests
- * instead of relying on the dcache.
- */
-static int link_path_walk(const char *name, struct nameidata *nd)
-{
-       struct nameidata save = *nd;
-       int result;
-
-       /* make sure the stuff we saved doesn't go away */
-       dget(save.path.dentry);
-       mntget(save.path.mnt);
-
-       result = __link_path_walk(name, nd);
-       if (result == -ESTALE) {
-               *nd = save;
-               dget(nd->path.dentry);
-               mntget(nd->path.mnt);
-               nd->flags |= LOOKUP_REVAL;
-               result = __link_path_walk(name, nd);
-       }
-
-       path_put(&save.path);
-
-       return result;
-}
-
 static int path_walk(const char *name, struct nameidata *nd)
 {
        current->total_link_count = 0;
index 54198538b67e7a285fadcc4a8eb905cfe32f4864..a4b12022edaa27cb8cd3ea865d14f1368d507660 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -903,6 +903,18 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
        int error;
        struct file *f;
 
+       /*
+        * We must always pass in a valid mount pointer.   Historically
+        * callers got away with not passing it, but we must enforce this at
+        * the earliest possible point now to avoid strange problems deep in the
+        * filesystem stack.
+        */
+       if (!mnt) {
+               printk(KERN_WARNING "%s called with NULL vfsmount\n", __func__);
+               dump_stack();
+               return ERR_PTR(-EINVAL);
+       }
+
        error = -ENFILE;
        f = get_empty_filp();
        if (f == NULL) {
index 3c185b6527bca9eb650ca21c455c29767e23c7ab..8be381bbcb54ad4108ea3bf453b19afd702314b5 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -957,13 +957,10 @@ struct file *create_write_pipe(void)
        struct dentry *dentry;
        struct qstr name = { .name = "" };
 
-       f = get_empty_filp();
-       if (!f)
-               return ERR_PTR(-ENFILE);
        err = -ENFILE;
        inode = get_pipe_inode();
        if (!inode)
-               goto err_file;
+               goto err;
 
        err = -ENOMEM;
        dentry = d_alloc(pipe_mnt->mnt_sb->s_root, &name);
@@ -978,22 +975,24 @@ struct file *create_write_pipe(void)
         */
        dentry->d_flags &= ~DCACHE_UNHASHED;
        d_instantiate(dentry, inode);
-       f->f_path.mnt = mntget(pipe_mnt);
-       f->f_path.dentry = dentry;
+
+       err = -ENFILE;
+       f = alloc_file(pipe_mnt, dentry, FMODE_WRITE, &write_pipe_fops);
+       if (!f)
+               goto err_dentry;
        f->f_mapping = inode->i_mapping;
 
        f->f_flags = O_WRONLY;
-       f->f_op = &write_pipe_fops;
-       f->f_mode = FMODE_WRITE;
        f->f_version = 0;
 
        return f;
 
+ err_dentry:
+       dput(dentry);
  err_inode:
        free_pipe_info(inode);
        iput(inode);
- err_file:
-       put_filp(f);
+ err:
        return ERR_PTR(err);
 }
 
index eba037b3338fe8c2c480318d38441d3de65aab51..344b9b96cc56ecd10f0612300e844948b0892d90 100644 (file)
@@ -191,28 +191,11 @@ static struct dentry *get_xa_file_dentry(const struct inode *inode,
        dput(xadir);
        if (err)
                xafile = ERR_PTR(err);
-       return xafile;
-}
-
-/* Opens a file pointer to the attribute associated with inode */
-static struct file *open_xa_file(const struct inode *inode, const char *name,
-                                int flags)
-{
-       struct dentry *xafile;
-       struct file *fp;
-
-       xafile = get_xa_file_dentry(inode, name, flags);
-       if (IS_ERR(xafile))
-               return ERR_PTR(PTR_ERR(xafile));
        else if (!xafile->d_inode) {
                dput(xafile);
-               return ERR_PTR(-ENODATA);
+               xafile = ERR_PTR(-ENODATA);
        }
-
-       fp = dentry_open(xafile, NULL, O_RDWR);
-       /* dentry_open dputs the dentry if it fails */
-
-       return fp;
+       return xafile;
 }
 
 /*
@@ -228,9 +211,8 @@ static struct file *open_xa_file(const struct inode *inode, const char *name,
  * we're called with i_mutex held, so there are no worries about the directory
  * changing underneath us.
  */
-static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
+static int __xattr_readdir(struct inode *inode, void *dirent, filldir_t filldir)
 {
-       struct inode *inode = filp->f_path.dentry->d_inode;
        struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
        INITIALIZE_PATH(path_to_entry);
        struct buffer_head *bh;
@@ -374,23 +356,16 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir)
  *
  */
 static
-int xattr_readdir(struct file *file, filldir_t filler, void *buf)
+int xattr_readdir(struct inode *inode, filldir_t filler, void *buf)
 {
-       struct inode *inode = file->f_path.dentry->d_inode;
-       int res = -ENOTDIR;
-       if (!file->f_op || !file->f_op->readdir)
-               goto out;
+       int res = -ENOENT;
        mutex_lock_nested(&inode->i_mutex, I_MUTEX_XATTR);
-//        down(&inode->i_zombie);
-       res = -ENOENT;
        if (!IS_DEADDIR(inode)) {
                lock_kernel();
-               res = __xattr_readdir(file, buf, filler);
+               res = __xattr_readdir(inode, buf, filler);
                unlock_kernel();
        }
-//        up(&inode->i_zombie);
        mutex_unlock(&inode->i_mutex);
-      out:
        return res;
 }
 
@@ -442,7 +417,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
                   size_t buffer_size, int flags)
 {
        int err = 0;
-       struct file *fp;
+       struct dentry *dentry;
        struct page *page;
        char *data;
        struct address_space *mapping;
@@ -460,18 +435,18 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
                xahash = xattr_hash(buffer, buffer_size);
 
       open_file:
-       fp = open_xa_file(inode, name, flags);
-       if (IS_ERR(fp)) {
-               err = PTR_ERR(fp);
+       dentry = get_xa_file_dentry(inode, name, flags);
+       if (IS_ERR(dentry)) {
+               err = PTR_ERR(dentry);
                goto out;
        }
 
-       xinode = fp->f_path.dentry->d_inode;
+       xinode = dentry->d_inode;
        REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
 
        /* we need to copy it off.. */
        if (xinode->i_nlink > 1) {
-               fput(fp);
+               dput(dentry);
                err = reiserfs_xattr_del(inode, name);
                if (err < 0)
                        goto out;
@@ -485,7 +460,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
        newattrs.ia_size = buffer_size;
        newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
        mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR);
-       err = notify_change(fp->f_path.dentry, &newattrs);
+       err = notify_change(dentry, &newattrs);
        if (err)
                goto out_filp;
 
@@ -518,15 +493,14 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
                        rxh->h_hash = cpu_to_le32(xahash);
                }
 
-               err = reiserfs_prepare_write(fp, page, page_offset,
+               err = reiserfs_prepare_write(NULL, page, page_offset,
                                            page_offset + chunk + skip);
                if (!err) {
                        if (buffer)
                                memcpy(data + skip, buffer + buffer_pos, chunk);
-                       err =
-                           reiserfs_commit_write(fp, page, page_offset,
-                                                 page_offset + chunk +
-                                                 skip);
+                       err = reiserfs_commit_write(NULL, page, page_offset,
+                                                   page_offset + chunk +
+                                                   skip);
                }
                unlock_page(page);
                reiserfs_put_page(page);
@@ -548,7 +522,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
 
       out_filp:
        mutex_unlock(&xinode->i_mutex);
-       fput(fp);
+       dput(dentry);
 
       out:
        return err;
@@ -562,7 +536,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
                   size_t buffer_size)
 {
        ssize_t err = 0;
-       struct file *fp;
+       struct dentry *dentry;
        size_t isize;
        size_t file_pos = 0;
        size_t buffer_pos = 0;
@@ -578,13 +552,13 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
        if (get_inode_sd_version(inode) == STAT_DATA_V1)
                return -EOPNOTSUPP;
 
-       fp = open_xa_file(inode, name, FL_READONLY);
-       if (IS_ERR(fp)) {
-               err = PTR_ERR(fp);
+       dentry = get_xa_file_dentry(inode, name, FL_READONLY);
+       if (IS_ERR(dentry)) {
+               err = PTR_ERR(dentry);
                goto out;
        }
 
-       xinode = fp->f_path.dentry->d_inode;
+       xinode = dentry->d_inode;
        isize = xinode->i_size;
        REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
 
@@ -652,7 +626,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
        }
 
       out_dput:
-       fput(fp);
+       dput(dentry);
 
       out:
        return err;
@@ -742,7 +716,6 @@ reiserfs_delete_xattrs_filler(void *buf, const char *name, int namelen,
 /* This is called w/ inode->i_mutex downed */
 int reiserfs_delete_xattrs(struct inode *inode)
 {
-       struct file *fp;
        struct dentry *dir, *root;
        int err = 0;
 
@@ -763,15 +736,8 @@ int reiserfs_delete_xattrs(struct inode *inode)
                return 0;
        }
 
-       fp = dentry_open(dir, NULL, O_RDWR);
-       if (IS_ERR(fp)) {
-               err = PTR_ERR(fp);
-               /* dentry_open dputs the dentry if it fails */
-               goto out;
-       }
-
        lock_kernel();
-       err = xattr_readdir(fp, reiserfs_delete_xattrs_filler, dir);
+       err = xattr_readdir(dir->d_inode, reiserfs_delete_xattrs_filler, dir);
        if (err) {
                unlock_kernel();
                goto out_dir;
@@ -791,7 +757,7 @@ int reiserfs_delete_xattrs(struct inode *inode)
        unlock_kernel();
 
       out_dir:
-       fput(fp);
+       dput(dir);
 
       out:
        if (!err)
@@ -833,7 +799,6 @@ reiserfs_chown_xattrs_filler(void *buf, const char *name, int namelen,
 
 int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
 {
-       struct file *fp;
        struct dentry *dir;
        int err = 0;
        struct reiserfs_chown_buf buf;
@@ -857,13 +822,6 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
                goto out;
        }
 
-       fp = dentry_open(dir, NULL, O_RDWR);
-       if (IS_ERR(fp)) {
-               err = PTR_ERR(fp);
-               /* dentry_open dputs the dentry if it fails */
-               goto out;
-       }
-
        lock_kernel();
 
        attrs->ia_valid &= (ATTR_UID | ATTR_GID | ATTR_CTIME);
@@ -871,7 +829,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
        buf.attrs = attrs;
        buf.inode = inode;
 
-       err = xattr_readdir(fp, reiserfs_chown_xattrs_filler, &buf);
+       err = xattr_readdir(dir->d_inode, reiserfs_chown_xattrs_filler, &buf);
        if (err) {
                unlock_kernel();
                goto out_dir;
@@ -881,7 +839,7 @@ int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs)
        unlock_kernel();
 
       out_dir:
-       fput(fp);
+       dput(dir);
 
       out:
        attrs->ia_valid = ia_valid;
@@ -1029,7 +987,6 @@ reiserfs_listxattr_filler(void *buf, const char *name, int namelen,
  */
 ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
 {
-       struct file *fp;
        struct dentry *dir;
        int err = 0;
        struct reiserfs_listxattr_buf buf;
@@ -1052,13 +1009,6 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
                goto out;
        }
 
-       fp = dentry_open(dir, NULL, O_RDWR);
-       if (IS_ERR(fp)) {
-               err = PTR_ERR(fp);
-               /* dentry_open dputs the dentry if it fails */
-               goto out;
-       }
-
        buf.r_buf = buffer;
        buf.r_size = buffer ? size : 0;
        buf.r_pos = 0;
@@ -1066,7 +1016,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
 
        REISERFS_I(dentry->d_inode)->i_flags |= i_has_xattr_dir;
 
-       err = xattr_readdir(fp, reiserfs_listxattr_filler, &buf);
+       err = xattr_readdir(dir->d_inode, reiserfs_listxattr_filler, &buf);
        if (err)
                goto out_dir;
 
@@ -1076,7 +1026,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
                err = buf.r_pos;
 
       out_dir:
-       fput(fp);
+       dput(dir);
 
       out:
        reiserfs_read_unlock_xattr_i(dentry->d_inode);
index d0a941a4e62007034a2367a5fbff27bc5571e851..09008dbd264e731411c6da60def6648888cc6b52 100644 (file)
@@ -945,6 +945,7 @@ do_kern_mount(const char *fstype, int flags, const char *name, void *data)
        put_filesystem(type);
        return mnt;
 }
+EXPORT_SYMBOL_GPL(do_kern_mount);
 
 struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
 {
index 174b87738714fe634d135c8738df8a6f5ba8a0c5..9cf472aeb9ce5841185ac52131dc311123c9b6f6 100644 (file)
@@ -85,6 +85,7 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
 #define __PAGE_KERNEL_RX               (__PAGE_KERNEL_EXEC & ~_PAGE_RW)
 #define __PAGE_KERNEL_EXEC_NOCACHE     (__PAGE_KERNEL_EXEC | _PAGE_PCD | _PAGE_PWT)
 #define __PAGE_KERNEL_NOCACHE          (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
+#define __PAGE_KERNEL_UC_MINUS         (__PAGE_KERNEL | _PAGE_PCD)
 #define __PAGE_KERNEL_VSYSCALL         (__PAGE_KERNEL_RX | _PAGE_USER)
 #define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
 #define __PAGE_KERNEL_LARGE            (__PAGE_KERNEL | _PAGE_PSE)
@@ -101,6 +102,7 @@ extern pteval_t __PAGE_KERNEL, __PAGE_KERNEL_EXEC;
 #define PAGE_KERNEL_EXEC               MAKE_GLOBAL(__PAGE_KERNEL_EXEC)
 #define PAGE_KERNEL_RX                 MAKE_GLOBAL(__PAGE_KERNEL_RX)
 #define PAGE_KERNEL_NOCACHE            MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE)
+#define PAGE_KERNEL_UC_MINUS           MAKE_GLOBAL(__PAGE_KERNEL_UC_MINUS)
 #define PAGE_KERNEL_EXEC_NOCACHE       MAKE_GLOBAL(__PAGE_KERNEL_EXEC_NOCACHE)
 #define PAGE_KERNEL_LARGE              MAKE_GLOBAL(__PAGE_KERNEL_LARGE)
 #define PAGE_KERNEL_LARGE_EXEC         MAKE_GLOBAL(__PAGE_KERNEL_LARGE_EXEC)
index 6b72a458408639becc0f60508d30406093329fe3..51e6b1e520e6feeaefaf71d692be486a128d1d22 100644 (file)
@@ -38,8 +38,8 @@ struct cpuidle_state {
        unsigned int    power_usage; /* in mW */
        unsigned int    target_residency; /* in US */
 
-       unsigned int    usage;
-       unsigned int    time; /* in US */
+       unsigned long long      usage;
+       unsigned long long      time; /* in US */
 
        int (*enter)    (struct cpuidle_device *dev,
                         struct cpuidle_state *state);
index fed07d03364e869df06d7f1405d23d75850fe2b7..6a1e7afb099bc981f91a23ac9698e7244bab4aa0 100644 (file)
@@ -1541,6 +1541,12 @@ static inline void idle_task_exit(void) {}
 
 extern void sched_idle_next(void);
 
+#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
+extern void wake_up_idle_cpu(int cpu);
+#else
+static inline void wake_up_idle_cpu(int cpu) { }
+#endif
+
 #ifdef CONFIG_SCHED_DEBUG
 extern unsigned int sysctl_sched_latency;
 extern unsigned int sysctl_sched_min_granularity;
index 4c035a8a248c2bfabea85bfd616c9562fcf4f440..d6204a4858183c754d5d401ad230c11f60a546c1 100644 (file)
@@ -736,7 +736,7 @@ static int relay_file_open(struct inode *inode, struct file *filp)
        kref_get(&buf->kref);
        filp->private_data = buf;
 
-       return 0;
+       return nonseekable_open(inode, filp);
 }
 
 /**
@@ -1056,6 +1056,10 @@ static struct pipe_buf_operations relay_pipe_buf_ops = {
        .get = generic_pipe_buf_get,
 };
 
+static void relay_page_release(struct splice_pipe_desc *spd, unsigned int i)
+{
+}
+
 /*
  *     subbuf_splice_actor - splice up to one subbuf's worth of data
  */
@@ -1083,6 +1087,7 @@ static int subbuf_splice_actor(struct file *in,
                .partial = partial,
                .flags = flags,
                .ops = &relay_pipe_buf_ops,
+               .spd_release = relay_page_release,
        };
 
        if (rbuf->subbufs_produced == rbuf->subbufs_consumed)
index 28c73f07efb2f7506f70be5ceb7a44c134770afa..8dcdec6fe0fe0983f4a90e8d51e501871974d383 100644 (file)
@@ -1052,6 +1052,49 @@ static void resched_cpu(int cpu)
        resched_task(cpu_curr(cpu));
        spin_unlock_irqrestore(&rq->lock, flags);
 }
+
+#ifdef CONFIG_NO_HZ
+/*
+ * When add_timer_on() enqueues a timer into the timer wheel of an
+ * idle CPU then this timer might expire before the next timer event
+ * which is scheduled to wake up that CPU. In case of a completely
+ * idle system the next event might even be infinite time into the
+ * future. wake_up_idle_cpu() ensures that the CPU is woken up and
+ * leaves the inner idle loop so the newly added timer is taken into
+ * account when the CPU goes back to idle and evaluates the timer
+ * wheel for the next timer event.
+ */
+void wake_up_idle_cpu(int cpu)
+{
+       struct rq *rq = cpu_rq(cpu);
+
+       if (cpu == smp_processor_id())
+               return;
+
+       /*
+        * This is safe, as this function is called with the timer
+        * wheel base lock of (cpu) held. When the CPU is on the way
+        * to idle and has not yet set rq->curr to idle then it will
+        * be serialized on the timer wheel base lock and take the new
+        * timer into account automatically.
+        */
+       if (rq->curr != rq->idle)
+               return;
+
+       /*
+        * We can set TIF_RESCHED on the idle task of the other CPU
+        * lockless. The worst case is that the other CPU runs the
+        * idle task through an additional NOOP schedule()
+        */
+       set_tsk_thread_flag(rq->idle, TIF_NEED_RESCHED);
+
+       /* NEED_RESCHED must be visible before we test polling */
+       smp_mb();
+       if (!tsk_is_polling(rq->idle))
+               smp_send_reschedule(cpu);
+}
+#endif
+
 #else
 static void __resched_task(struct task_struct *p, int tif_bit)
 {
index 278534bbca956a93de37352767b91cc72aa87dcd..7f60097d443a6258b2044a37b5d23f0d4656aaca 100644 (file)
@@ -174,7 +174,7 @@ static void clocksource_check_watchdog(struct clocksource *cs)
                        if (watchdog)
                                del_timer(&watchdog_timer);
                        watchdog = cs;
-                       init_timer_deferrable(&watchdog_timer);
+                       init_timer(&watchdog_timer);
                        watchdog_timer.function = clocksource_watchdog;
 
                        /* Reset watchdog cycles */
index 99b00a25f88b3efc4c0558c78ece429d3d3300c3..b024106daa70163646b31a031085b4d732b4f096 100644 (file)
@@ -451,10 +451,18 @@ void add_timer_on(struct timer_list *timer, int cpu)
        spin_lock_irqsave(&base->lock, flags);
        timer_set_base(timer, base);
        internal_add_timer(base, timer);
+       /*
+        * Check whether the other CPU is idle and needs to be
+        * triggered to reevaluate the timer wheel when nohz is
+        * active. We are protected against the other CPU fiddling
+        * with the timer by holding the timer base lock. This also
+        * makes sure that a CPU on the way to idle can not evaluate
+        * the timer wheel.
+        */
+       wake_up_idle_cpu(cpu);
        spin_unlock_irqrestore(&base->lock, flags);
 }
 
-
 /**
  * mod_timer - modify a timer's timeout
  * @timer: the timer to be modified
index 74c1b6b0b37b82dce75e06533c989ab73001afeb..51c9e2c0164068681b299b37f48840af59d5c79d 100644 (file)
@@ -401,12 +401,20 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
        struct page *page;
        unsigned long nr_pages;
 
+       /*
+        * We want to release as many surplus pages as possible, spread
+        * evenly across all nodes. Iterate across all nodes until we
+        * can no longer free unreserved surplus pages. This occurs when
+        * the nodes with surplus pages have no free pages.
+        */
+       unsigned long remaining_iterations = num_online_nodes();
+
        /* Uncommit the reservation */
        resv_huge_pages -= unused_resv_pages;
 
        nr_pages = min(unused_resv_pages, surplus_huge_pages);
 
-       while (nr_pages) {
+       while (remaining_iterations-- && nr_pages) {
                nid = next_node(nid, node_online_map);
                if (nid == MAX_NUMNODES)
                        nid = first_node(node_online_map);
@@ -424,6 +432,7 @@ static void return_unused_surplus_pages(unsigned long unused_resv_pages)
                        surplus_huge_pages--;
                        surplus_huge_pages_node[nid]--;
                        nr_pages--;
+                       remaining_iterations = num_online_nodes();
                }
        }
 }
@@ -671,9 +680,11 @@ int hugetlb_report_node_meminfo(int nid, char *buf)
 {
        return sprintf(buf,
                "Node %d HugePages_Total: %5u\n"
-               "Node %d HugePages_Free:  %5u\n",
+               "Node %d HugePages_Free:  %5u\n"
+               "Node %d HugePages_Surp:  %5u\n",
                nid, nr_huge_pages_node[nid],
-               nid, free_huge_pages_node[nid]);
+               nid, free_huge_pages_node[nid],
+               nid, surplus_huge_pages_node[nid]);
 }
 
 /* Return the number pages of memory we physically have, in PAGE_SIZE units. */
index bb4070e1079fb7e863386f84f5fd138163a9a6ba..04b308c3bc547f72762521fa5a45170713546e41 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1481,7 +1481,7 @@ void __init kmem_cache_init(void)
        list_add(&cache_cache.next, &cache_chain);
        cache_cache.colour_off = cache_line_size();
        cache_cache.array[smp_processor_id()] = &initarray_cache.cache;
-       cache_cache.nodelists[node] = &initkmem_list3[CACHE_CACHE];
+       cache_cache.nodelists[node] = &initkmem_list3[CACHE_CACHE + node];
 
        /*
         * struct kmem_cache size depends on nr_node_ids, which
@@ -1602,7 +1602,7 @@ void __init kmem_cache_init(void)
                int nid;
 
                for_each_online_node(nid) {
-                       init_list(&cache_cache, &initkmem_list3[CACHE_CACHE], nid);
+                       init_list(&cache_cache, &initkmem_list3[CACHE_CACHE + nid], nid);
 
                        init_list(malloc_sizes[INDEX_AC].cs_cachep,
                                  &initkmem_list3[SIZE_AC + nid], nid);
index ca71d5b81e4a436b43bb183728650887eef4f0e9..b72bc98e2dc19814405764de399a0d4276232028 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2685,6 +2685,7 @@ void kfree(const void *x)
 }
 EXPORT_SYMBOL(kfree);
 
+#if defined(SLUB_DEBUG) || defined(CONFIG_SLABINFO)
 static unsigned long count_partial(struct kmem_cache_node *n)
 {
        unsigned long flags;
@@ -2697,6 +2698,7 @@ static unsigned long count_partial(struct kmem_cache_node *n)
        spin_unlock_irqrestore(&n->list_lock, flags);
        return x;
 }
+#endif
 
 /*
  * kmem_cache_shrink removes empty slabs from the partial lists and sorts
index f0f55875dd6acc34d3c9ee05298cd43dcea02650..ae532f50194319ce83b813a88b6a25aa5a4e85e5 100644 (file)
@@ -88,6 +88,8 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
 
 close_file:
        put_filp(file);
+       return ERR_PTR(error);
+
 put_dentry:
        dput(dentry);
 put_memory:
index 971271602dd07e5ae97b0e42b42f02cc2b9f4eb9..c22d6b6f2db43d2d8475c742ac66edd047161f86 100644 (file)
@@ -322,15 +322,6 @@ next_sge:
                ctxt->direction = DMA_FROM_DEVICE;
                clear_bit(RDMACTXT_F_READ_DONE, &ctxt->flags);
                clear_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
-               if ((ch+1)->rc_discrim == 0) {
-                       /*
-                        * Checked in sq_cq_reap to see if we need to
-                        * be enqueued
-                        */
-                       set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
-                       ctxt->next = hdr_ctxt;
-                       hdr_ctxt->next = head;
-               }
 
                /* Prepare READ WR */
                memset(&read_wr, 0, sizeof read_wr);
@@ -348,7 +339,17 @@ next_sge:
                rdma_set_ctxt_sge(ctxt, &sge[ch_sge_ary[ch_no].start],
                                  &sgl_offset,
                                  read_wr.num_sge);
-
+               if (((ch+1)->rc_discrim == 0) &&
+                   (read_wr.num_sge == ch_sge_ary[ch_no].count)) {
+                       /*
+                        * Mark the last RDMA_READ with a bit to
+                        * indicate all RPC data has been fetched from
+                        * the client and the RPC needs to be enqueued.
+                        */
+                       set_bit(RDMACTXT_F_LAST_CTXT, &ctxt->flags);
+                       ctxt->next = hdr_ctxt;
+                       hdr_ctxt->next = head;
+               }
                /* Post the read */
                err = svc_rdma_send(xprt, &read_wr);
                if (err) {
index 569ecaca0e8b9caf7723d9a393367ab6853242c9..889a897d41ac3ed49a5baea9674fdf4d04fbb14b 100644 (file)
@@ -1187,10 +1187,8 @@ static struct i2c_driver aic3x_i2c_driver = {
                .name = "aic3x I2C Codec",
                .owner = THIS_MODULE,
        },
-       .id = I2C_DRIVERID_I2CDEV,
        .attach_adapter = aic3x_i2c_attach,
        .detach_client = aic3x_i2c_detach,
-       .command = NULL,
 };
 
 static struct i2c_client client_template = {