[PATCH] 64bit resource: fix up printks for resources in misc drivers
[pandora-kernel.git] / drivers / base / memory.c
index bc3ca6a..dd547af 100644 (file)
@@ -13,8 +13,8 @@
 #include <linux/sysdev.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/sched.h>       /* capable() */
 #include <linux/topology.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/memory.h>
 #include <linux/kobject.h>
@@ -29,12 +29,12 @@ static struct sysdev_class memory_sysdev_class = {
        set_kset_name(MEMORY_CLASS_NAME),
 };
 
-static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj)
+static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
 {
        return MEMORY_CLASS_NAME;
 }
 
-static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
+static int memory_uevent(struct kset *kset, struct kobject *kobj, char **envp,
                        int num_envp, char *buffer, int buffer_size)
 {
        int retval = 0;
@@ -42,28 +42,27 @@ static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
        return retval;
 }
 
-static struct kset_hotplug_ops memory_hotplug_ops = {
-       .name           = memory_hotplug_name,
-       .hotplug        = memory_hotplug,
+static struct kset_uevent_ops memory_uevent_ops = {
+       .name           = memory_uevent_name,
+       .uevent         = memory_uevent,
 };
 
-static struct notifier_block *memory_chain;
+static BLOCKING_NOTIFIER_HEAD(memory_chain);
 
-static int register_memory_notifier(struct notifier_block *nb)
+int register_memory_notifier(struct notifier_block *nb)
 {
-        return notifier_chain_register(&memory_chain, nb);
+        return blocking_notifier_chain_register(&memory_chain, nb);
 }
 
-static void unregister_memory_notifier(struct notifier_block *nb)
+void unregister_memory_notifier(struct notifier_block *nb)
 {
-        notifier_chain_unregister(&memory_chain, nb);
+        blocking_notifier_chain_unregister(&memory_chain, nb);
 }
 
 /*
  * register_memory - Setup a sysfs device for a memory block
  */
-static int
-register_memory(struct memory_block *memory, struct mem_section *section,
+int register_memory(struct memory_block *memory, struct mem_section *section,
                struct node *root)
 {
        int error;
@@ -141,7 +140,7 @@ static ssize_t show_mem_state(struct sys_device *dev, char *buf)
 
 static inline int memory_notify(unsigned long val, void *v)
 {
-       return notifier_call_chain(&memory_chain, val, v);
+       return blocking_notifier_call_chain(&memory_chain, val, v);
 }
 
 /*
@@ -304,7 +303,7 @@ static int block_size_init(void)
  */
 #ifdef CONFIG_ARCH_MEMORY_PROBE
 static ssize_t
-memory_probe_store(struct class *class, const char __user *buf, size_t count)
+memory_probe_store(struct class *class, const char *buf, size_t count)
 {
        u64 phys_addr;
        int ret;
@@ -431,7 +430,7 @@ int __init memory_dev_init(void)
        unsigned int i;
        int ret;
 
-       memory_sysdev_class.kset.hotplug_ops = &memory_hotplug_ops;
+       memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops;
        ret = sysdev_class_register(&memory_sysdev_class);
 
        /*