]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/macintosh/therm_adt746x.c
Suspend: Fix comment in main.c
[linux-2.6-omap-h63xx.git] / drivers / macintosh / therm_adt746x.c
index bd55e6ab99fc536164fe0c5b72a107fb6b6012f3..54f4942a2968ee8c9d92bf57703073c60adf4e07 100644 (file)
@@ -335,6 +335,7 @@ static int monitor_task(void *arg)
 {
        struct thermostat* th = arg;
 
+       set_freezable();
        while(!kthread_should_stop()) {
                try_to_freeze();
                msleep_interruptible(2000);
@@ -378,13 +379,10 @@ static int attach_one_thermostat(struct i2c_adapter *adapter, int addr,
        if (thermostat)
                return 0;
 
-       th = (struct thermostat *)
-               kmalloc(sizeof(struct thermostat), GFP_KERNEL);
-
+       th = kzalloc(sizeof(struct thermostat), GFP_KERNEL);
        if (!th)
                return -ENOMEM;
 
-       memset(th, 0, sizeof(*th));
        th->clt.addr = addr;
        th->clt.adapter = adapter;
        th->clt.driver = &thermostat_driver;
@@ -555,6 +553,7 @@ thermostat_init(void)
        struct device_node* np;
        const u32 *prop;
        int i = 0, offset = 0;
+       int err;
        
        np = of_find_node_by_name(NULL, "fan");
        if (!np)
@@ -614,17 +613,20 @@ thermostat_init(void)
                return -ENODEV;
        }
        
-       device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature);
-       device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature);
-       device_create_file(&of_dev->dev, &dev_attr_sensor1_limit);
-       device_create_file(&of_dev->dev, &dev_attr_sensor2_limit);
-       device_create_file(&of_dev->dev, &dev_attr_sensor1_location);
-       device_create_file(&of_dev->dev, &dev_attr_sensor2_location);
-       device_create_file(&of_dev->dev, &dev_attr_limit_adjust);
-       device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed);
-       device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed);
+       err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_limit);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_location);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_location);
+       err |= device_create_file(&of_dev->dev, &dev_attr_limit_adjust);
+       err |= device_create_file(&of_dev->dev, &dev_attr_specified_fan_speed);
+       err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_fan_speed);
        if(therm_type == ADT7460)
-               device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed);
+               err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_fan_speed);
+       if (err)
+               printk(KERN_WARNING
+                       "Failed to create tempertaure attribute file(s).\n");
 
 #ifndef CONFIG_I2C_POWERMAC
        request_module("i2c-powermac");