qlge: bugfix: Pad outbound frames smaller than 60 bytes.
[safe/jmp/linux-2.6] / drivers / cpuidle / sysfs.c
index 059db9c..97b0038 100644 (file)
@@ -21,7 +21,8 @@ static int __init cpuidle_sysfs_setup(char *unused)
 }
 __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup);
 
-static ssize_t show_available_governors(struct sys_device *dev, char *buf)
+static ssize_t show_available_governors(struct sysdev_class *class,
+                                       char *buf)
 {
        ssize_t i = 0;
        struct cpuidle_governor *tmp;
@@ -39,7 +40,8 @@ out:
        return i;
 }
 
-static ssize_t show_current_driver(struct sys_device *dev, char *buf)
+static ssize_t show_current_driver(struct sysdev_class *class,
+                                  char *buf)
 {
        ssize_t ret;
 
@@ -53,7 +55,8 @@ static ssize_t show_current_driver(struct sys_device *dev, char *buf)
        return ret;
 }
 
-static ssize_t show_current_governor(struct sys_device *dev, char *buf)
+static ssize_t show_current_governor(struct sysdev_class *class,
+                                    char *buf)
 {
        ssize_t ret;
 
@@ -67,8 +70,8 @@ static ssize_t show_current_governor(struct sys_device *dev, char *buf)
        return ret;
 }
 
-static ssize_t store_current_governor(struct sys_device *dev,
-       const char *buf, size_t count)
+static ssize_t store_current_governor(struct sysdev_class *class,
+                                     const char *buf, size_t count)
 {
        char gov_name[CPUIDLE_NAME_LEN];
        int ret = -EINVAL;
@@ -100,8 +103,9 @@ static ssize_t store_current_governor(struct sys_device *dev,
                return count;
 }
 
-static SYSDEV_ATTR(current_driver, 0444, show_current_driver, NULL);
-static SYSDEV_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
+static SYSDEV_CLASS_ATTR(current_driver, 0444, show_current_driver, NULL);
+static SYSDEV_CLASS_ATTR(current_governor_ro, 0444, show_current_governor,
+                        NULL);
 
 static struct attribute *cpuclass_default_attrs[] = {
        &attr_current_driver.attr,
@@ -109,9 +113,10 @@ static struct attribute *cpuclass_default_attrs[] = {
        NULL
 };
 
-static SYSDEV_ATTR(available_governors, 0444, show_available_governors, NULL);
-static SYSDEV_ATTR(current_governor, 0644, show_current_governor,
-       store_current_governor);
+static SYSDEV_CLASS_ATTR(available_governors, 0444, show_available_governors,
+                        NULL);
+static SYSDEV_CLASS_ATTR(current_governor, 0644, show_current_governor,
+                        store_current_governor);
 
 static struct attribute *cpuclass_switch_attrs[] = {
        &attr_available_governors.attr,
@@ -218,16 +223,29 @@ static ssize_t show_state_##_name(struct cpuidle_state *state, char *buf) \
        return sprintf(buf, "%u\n", state->_name);\
 }
 
-static ssize_t show_state_name(struct cpuidle_state *state, char *buf)
-{
-       return sprintf(buf, "%s\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) \
+{ \
+       if (state->_name[0] == '\0')\
+               return sprintf(buf, "<null>\n");\
+       return sprintf(buf, "%s\n", state->_name);\
 }
 
 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)
+
 define_one_state_ro(name, show_state_name);
+define_one_state_ro(desc, show_state_desc);
 define_one_state_ro(latency, show_state_exit_latency);
 define_one_state_ro(power, show_state_power_usage);
 define_one_state_ro(usage, show_state_usage);
@@ -235,6 +253,7 @@ define_one_state_ro(time, show_state_time);
 
 static struct attribute *cpuidle_state_default_attrs[] = {
        &attr_name.attr,
+       &attr_desc.attr,
        &attr_latency.attr,
        &attr_power.attr,
        &attr_usage.attr,
@@ -277,7 +296,7 @@ static struct kobj_type ktype_state_cpuidle = {
 
 static void inline cpuidle_free_state_kobj(struct cpuidle_device *device, int i)
 {
-       kobject_unregister(&device->kobjs[i]->kobj);
+       kobject_put(&device->kobjs[i]->kobj);
        wait_for_completion(&device->kobjs[i]->kobj_unregister);
        kfree(device->kobjs[i]);
        device->kobjs[i] = NULL;
@@ -358,5 +377,5 @@ void cpuidle_remove_sysfs(struct sys_device *sysdev)
        struct cpuidle_device *dev;
 
        dev = per_cpu(cpuidle_devices, cpu);
-       kobject_unregister(&dev->kobj);
+       kobject_put(&dev->kobj);
 }