Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 00:39:04 +0000 (17:39 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 00:39:04 +0000 (17:39 -0700)
* master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SOUND] sparc/amd7930: Use __devinit and __devinitdata as needed.
  [SUNLANCE]: Mark sparc_lance_probe_one as __devinit.
  [SPARC64]: Fix section-mismatch errors in solaris emul module.

12 files changed:
arch/i386/kernel/smpboot.c
arch/i386/mm/boot_ioremap.c
arch/ia64/kernel/acpi.c
arch/ia64/kernel/numa.c
arch/ia64/kernel/topology.c
drivers/char/rtc.c
drivers/media/video/videodev.c
drivers/video/fbsysfs.c
fs/autofs4/expire.c
include/asm-ia64/numa.h
kernel/module.c
mm/page_alloc.c

index f948419c888a85905aa768f1aaeaf0c5378ca910..efe07990e7fca6e6508b8e5ceb54caa55bad47c8 100644 (file)
@@ -642,9 +642,13 @@ static void map_cpu_to_logical_apicid(void)
 {
        int cpu = smp_processor_id();
        int apicid = logical_smp_processor_id();
+       int node = apicid_to_node(apicid);
+
+       if (!node_online(node))
+               node = first_online_node;
 
        cpu_2_logical_apicid[cpu] = apicid;
-       map_cpu_to_node(cpu, apicid_to_node(apicid));
+       map_cpu_to_node(cpu, node);
 }
 
 static void unmap_cpu_to_logical_apicid(int cpu)
index 5d44f4f5ff592a479d965449f1962dbe39daaee9..4de11f508c3a0ffb161aa95e8cd910471323aae4 100644 (file)
  */
 
 #define BOOT_PTE_PTRS (PTRS_PER_PTE*2)
-#define boot_pte_index(address) \
-            (((address) >> PAGE_SHIFT) & (BOOT_PTE_PTRS - 1))
+
+static unsigned long boot_pte_index(unsigned long vaddr) 
+{
+       return __pa(vaddr) >> PAGE_SHIFT;
+}
 
 static inline boot_pte_t* boot_vaddr_to_pte(void *address)
 {
index 0176556aeeccbf28fa6c14a9c99f07f51750d9ae..32c3abededc69aac74e522b9d06687066a716ccb 100644 (file)
@@ -771,16 +771,19 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
 {
 #ifdef CONFIG_ACPI_NUMA
        int pxm_id;
+       int nid;
 
        pxm_id = acpi_get_pxm(handle);
-
        /*
-        * Assuming that the container driver would have set the proximity
-        * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
+        * We don't have cpu-only-node hotadd. But if the system equips
+        * SRAT table, pxm is already found and node is ready.
+        * So, just pxm_to_nid(pxm) is OK.
+        * This code here is for the system which doesn't have full SRAT
+        * table for possible cpus.
         */
-       node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
-
+       nid = acpi_map_pxm_to_node(pxm_id);
        node_cpuid[cpu].phys_id = physid;
+       node_cpuid[cpu].nid = nid;
 #endif
        return (0);
 }
index 1cc360c83e7af01b1ddfc632d3a7f5f071764363..20340631179f669fd7d9216d85f210c2a4cf381e 100644 (file)
@@ -29,6 +29,36 @@ EXPORT_SYMBOL(cpu_to_node_map);
 
 cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
 
+void __cpuinit map_cpu_to_node(int cpu, int nid)
+{
+       int oldnid;
+       if (nid < 0) { /* just initialize by zero */
+               cpu_to_node_map[cpu] = 0;
+               return;
+       }
+       /* sanity check first */
+       oldnid = cpu_to_node_map[cpu];
+       if (cpu_isset(cpu, node_to_cpu_mask[oldnid])) {
+               return; /* nothing to do */
+       }
+       /* we don't have cpu-driven node hot add yet...
+          In usual case, node is created from SRAT at boot time. */
+       if (!node_online(nid))
+               nid = first_online_node;
+       cpu_to_node_map[cpu] = nid;
+       cpu_set(cpu, node_to_cpu_mask[nid]);
+       return;
+}
+
+void __cpuinit unmap_cpu_from_node(int cpu, int nid)
+{
+       WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid]));
+       WARN_ON(cpu_to_node_map[cpu] != nid);
+       cpu_to_node_map[cpu] = 0;
+       cpu_clear(cpu, node_to_cpu_mask[nid]);
+}
+
+
 /**
  * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays
  *
@@ -49,8 +79,6 @@ void __init build_cpu_to_node_map(void)
                                node = node_cpuid[i].nid;
                                break;
                        }
-               cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
-               if (node >= 0)
-                       cpu_set(cpu, node_to_cpu_mask[node]);
+               map_cpu_to_node(cpu, node);
        }
 }
index f648c610b10c50882b7fcbd0869e19b3659539b6..05bdf7affb431742a7c0f7ea8c167bea6300c530 100644 (file)
@@ -36,6 +36,9 @@ int arch_register_cpu(int num)
         */
        if (!can_cpei_retarget() && is_cpu_cpei_target(num))
                sysfs_cpus[num].cpu.no_control = 1;
+#ifdef CONFIG_NUMA
+       map_cpu_to_node(num, node_cpuid[num].nid);
+#endif
 #endif
 
        return register_cpu(&sysfs_cpus[num].cpu, num);
@@ -45,7 +48,8 @@ int arch_register_cpu(int num)
 
 void arch_unregister_cpu(int num)
 {
-       return unregister_cpu(&sysfs_cpus[num].cpu);
+       unregister_cpu(&sysfs_cpus[num].cpu);
+       unmap_cpu_from_node(num, cpu_to_node(num));
 }
 EXPORT_SYMBOL(arch_register_cpu);
 EXPORT_SYMBOL(arch_unregister_cpu);
index 6e6a7c7a7eff191bc56f1d634afed8bdd85f9304..ab6429b4a84e424a9e390d3946bbd1ff6a8c316f 100644 (file)
@@ -209,11 +209,12 @@ static const unsigned char days_in_mo[] =
  */
 static inline unsigned char rtc_is_updating(void)
 {
+       unsigned long flags;
        unsigned char uip;
 
-       spin_lock_irq(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
        uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
-       spin_unlock_irq(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
        return uip;
 }
 
index 88bf2af2a0e715d575ca6614139d8becfc16fb05..edd7b83c3464b4a2367c6391b30fcee2f9abcbe7 100644 (file)
@@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
                        break;
                }
 
-               if (index<=0 || index >= vfd->tvnormsize) {
+               if (index < 0 || index >= vfd->tvnormsize) {
                        ret=-EINVAL;
                        break;
                }
index 4f78f234473d78ca36a25b0e34239ea052aedac0..c151dcf68786a1c5ca1987f209e83351db5159d7 100644 (file)
@@ -397,6 +397,12 @@ static ssize_t store_bl_curve(struct class_device *class_device,
        u8 tmp_curve[FB_BACKLIGHT_LEVELS];
        unsigned int i;
 
+       /* Some drivers don't use framebuffer_alloc(), but those also
+        * don't have backlights.
+        */
+       if (!fb_info || !fb_info->bl_dev)
+               return -ENODEV;
+
        if (count != (FB_BACKLIGHT_LEVELS / 8 * 24))
                return -EINVAL;
 
@@ -430,6 +436,12 @@ static ssize_t show_bl_curve(struct class_device *class_device, char *buf)
        ssize_t len = 0;
        unsigned int i;
 
+       /* Some drivers don't use framebuffer_alloc(), but those also
+        * don't have backlights.
+        */
+       if (!fb_info || !fb_info->bl_dev)
+               return -ENODEV;
+
        mutex_lock(&fb_info->bl_mutex);
        for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
                len += snprintf(&buf[len], PAGE_SIZE,
index 8dbd44f10e9dbec10775834ae40480c1d4b98232..d96e5c14a9caaaaa2c498b3e5f833176634e3b14 100644 (file)
@@ -32,7 +32,7 @@ static inline int autofs4_can_expire(struct dentry *dentry,
 
        if (!do_now) {
                /* Too young to die */
-               if (time_after(ino->last_used + timeout, now))
+               if (!timeout || time_after(ino->last_used + timeout, now))
                        return 0;
 
                /* update last_used here :-
@@ -253,7 +253,7 @@ static struct dentry *autofs4_expire_direct(struct super_block *sb,
        struct dentry *root = dget(sb->s_root);
        int do_now = how & AUTOFS_EXP_IMMEDIATE;
 
-       if (!sbi->exp_timeout || !root)
+       if (!root)
                return NULL;
 
        now = jiffies;
@@ -293,7 +293,7 @@ static struct dentry *autofs4_expire_indirect(struct super_block *sb,
        int do_now = how & AUTOFS_EXP_IMMEDIATE;
        int exp_leaves = how & AUTOFS_EXP_LEAVES;
 
-       if ( !sbi->exp_timeout || !root )
+       if (!root)
                return NULL;
 
        now = jiffies;
index e5a8260593a55e3c15f88a6bc8391a8b8e021db3..e0a1d173e42df07fd74ebee65ffde116b9e76ec9 100644 (file)
@@ -64,6 +64,10 @@ extern int paddr_to_nid(unsigned long paddr);
 
 #define local_nodeid (cpu_to_node_map[smp_processor_id()])
 
+extern void map_cpu_to_node(int cpu, int nid);
+extern void unmap_cpu_from_node(int cpu, int nid);
+
+
 #else /* !CONFIG_NUMA */
 
 #define paddr_to_nid(addr)     0
index 2a19cd47c0469462947991e5c6ee7259b4d7ea54..b7fe6e84096303865f20e1c606c6bb35c77451c8 100644 (file)
@@ -1054,6 +1054,12 @@ static int mod_sysfs_setup(struct module *mod,
 {
        int err;
 
+       if (!module_subsys.kset.subsys) {
+               printk(KERN_ERR "%s: module_subsys not initialized\n",
+                      mod->name);
+               err = -EINVAL;
+               goto out;
+       }
        memset(&mod->mkobj.kobj, 0, sizeof(mod->mkobj.kobj));
        err = kobject_set_name(&mod->mkobj.kobj, "%s", mod->name);
        if (err)
index 3b5358a0561fa99366fbb9c7d2f858c40208b0fb..8a52ba9fe693bcf749486c3ec5ae6f1e26849700 100644 (file)
@@ -1845,8 +1845,10 @@ static inline void free_zone_pagesets(int cpu)
        for_each_zone(zone) {
                struct per_cpu_pageset *pset = zone_pcp(zone, cpu);
 
+               /* Free per_cpu_pageset if it is slab allocated */
+               if (pset != &boot_pageset[cpu])
+                       kfree(pset);
                zone_pcp(zone, cpu) = NULL;
-               kfree(pset);
        }
 }