cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem
[deliverable/linux.git] / arch / ia64 / kernel / err_inject.c
index 6a49600cf337f5e468e857ccce5088f12917bfe8..2d67317a1ec206c824eb754becfcd919f7ee9700 100644 (file)
@@ -24,7 +24,7 @@
  * Copyright (C) 2006, Intel Corp.  All rights reserved.
  *
  */
-#include <linux/sysdev.h>
+#include <linux/device.h>
 #include <linux/init.h>
 #include <linux/mm.h>
 #include <linux/cpu.h>
 #define ERR_DATA_BUFFER_SIZE 3                 // Three 8-byte;
 
 #define define_one_ro(name)                                            \
-static SYSDEV_ATTR(name, 0444, show_##name, NULL)
+static DEVICE_ATTR(name, 0444, show_##name, NULL)
 
 #define define_one_rw(name)                                            \
-static SYSDEV_ATTR(name, 0644, show_##name, store_##name)
+static DEVICE_ATTR(name, 0644, show_##name, store_##name)
 
 static u64 call_start[NR_CPUS];
 static u64 phys_addr[NR_CPUS];
@@ -55,7 +55,8 @@ static u64 resources[NR_CPUS];
 
 #define show(name)                                                     \
 static ssize_t                                                                 \
-show_##name(struct sys_device *dev, char *buf)                         \
+show_##name(struct device *dev, struct device_attribute *attr, \
+               char *buf)                                              \
 {                                                                      \
        u32 cpu=dev->id;                                                \
        return sprintf(buf, "%lx\n", name[cpu]);                        \
@@ -63,7 +64,8 @@ show_##name(struct sys_device *dev, char *buf)                                \
 
 #define store(name)                                                    \
 static ssize_t                                                                 \
-store_##name(struct sys_device *dev, const char *buf, size_t size)     \
+store_##name(struct device *dev, struct device_attribute *attr,        \
+                                       const char *buf, size_t size)   \
 {                                                                      \
        unsigned int cpu=dev->id;                                       \
        name[cpu] = simple_strtoull(buf, NULL, 16);                     \
@@ -76,7 +78,8 @@ show(call_start)
  * processor. The cpu number in driver is only used for storing data.
  */
 static ssize_t
-store_call_start(struct sys_device *dev, const char *buf, size_t size)
+store_call_start(struct device *dev, struct device_attribute *attr,
+               const char *buf, size_t size)
 {
        unsigned int cpu=dev->id;
        unsigned long call_start = simple_strtoull(buf, NULL, 16);
@@ -124,14 +127,16 @@ show(err_type_info)
 store(err_type_info)
 
 static ssize_t
-show_virtual_to_phys(struct sys_device *dev, char *buf)
+show_virtual_to_phys(struct device *dev, struct device_attribute *attr,
+                       char *buf)
 {
        unsigned int cpu=dev->id;
        return sprintf(buf, "%lx\n", phys_addr[cpu]);
 }
 
 static ssize_t
-store_virtual_to_phys(struct sys_device *dev, const char *buf, size_t size)
+store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
+                       const char *buf, size_t size)
 {
        unsigned int cpu=dev->id;
        u64 virt_addr=simple_strtoull(buf, NULL, 16);
@@ -154,7 +159,8 @@ show(err_struct_info)
 store(err_struct_info)
 
 static ssize_t
-show_err_data_buffer(struct sys_device *dev, char *buf)
+show_err_data_buffer(struct device *dev,
+                       struct device_attribute *attr, char *buf)
 {
        unsigned int cpu=dev->id;
 
@@ -165,7 +171,9 @@ show_err_data_buffer(struct sys_device *dev, char *buf)
 }
 
 static ssize_t
-store_err_data_buffer(struct sys_device *dev, const char *buf, size_t size)
+store_err_data_buffer(struct device *dev,
+                       struct device_attribute *attr,
+                       const char *buf, size_t size)
 {
        unsigned int cpu=dev->id;
        int ret;
@@ -201,14 +209,14 @@ define_one_ro(capabilities);
 define_one_ro(resources);
 
 static struct attribute *default_attrs[] = {
-       &attr_call_start.attr,
-       &attr_virtual_to_phys.attr,
-       &attr_err_type_info.attr,
-       &attr_err_struct_info.attr,
-       &attr_err_data_buffer.attr,
-       &attr_status.attr,
-       &attr_capabilities.attr,
-       &attr_resources.attr,
+       &dev_attr_call_start.attr,
+       &dev_attr_virtual_to_phys.attr,
+       &dev_attr_err_type_info.attr,
+       &dev_attr_err_struct_info.attr,
+       &dev_attr_err_data_buffer.attr,
+       &dev_attr_status.attr,
+       &dev_attr_capabilities.attr,
+       &dev_attr_resources.attr,
        NULL
 };
 
@@ -217,12 +225,12 @@ static struct attribute_group err_inject_attr_group = {
        .name = "err_inject"
 };
 /* Add/Remove err_inject interface for CPU device */
-static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev)
+static int __cpuinit err_inject_add_dev(struct device * sys_dev)
 {
        return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group);
 }
 
-static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev)
+static int __cpuinit err_inject_remove_dev(struct device * sys_dev)
 {
        sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
        return 0;
@@ -231,9 +239,9 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
                unsigned long action, void *hcpu)
 {
        unsigned int cpu = (unsigned long)hcpu;
-       struct sys_device *sys_dev;
+       struct device *sys_dev;
 
-       sys_dev = get_cpu_sysdev(cpu);
+       sys_dev = get_cpu_device(cpu);
        switch (action) {
        case CPU_ONLINE:
        case CPU_ONLINE_FROZEN:
@@ -275,13 +283,13 @@ static void __exit
 err_inject_exit(void)
 {
        int i;
-       struct sys_device *sys_dev;
+       struct device *sys_dev;
 
 #ifdef ERR_INJ_DEBUG
        printk(KERN_INFO "Exit error injection driver.\n");
 #endif
        for_each_online_cpu(i) {
-               sys_dev = get_cpu_sysdev(i);
+               sys_dev = get_cpu_device(i);
                sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group);
        }
        unregister_hotcpu_notifier(&err_inject_cpu_notifier);
@@ -291,5 +299,5 @@ module_init(err_inject_init);
 module_exit(err_inject_exit);
 
 MODULE_AUTHOR("Fenghua Yu <fenghua.yu@intel.com>");
-MODULE_DESCRIPTION("MC error injection kenrel sysfs interface");
+MODULE_DESCRIPTION("MC error injection kernel sysfs interface");
 MODULE_LICENSE("GPL");
This page took 0.030454 seconds and 5 git commands to generate.