asus-laptop: leds, remove dead code and fix asus_led_exit()/asus_led_init()
[safe/jmp/linux-2.6] / drivers / hwmon / sht15.c
index 6290a25..864a371 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/hwmon-sysfs.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
+#include <linux/sched.h>
 #include <linux/delay.h>
 #include <linux/jiffies.h>
 #include <linux/err.h>
@@ -304,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
        int d1 = 0;
        int i;
 
-       for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++)
+       for (i = 1; i < ARRAY_SIZE(temppoints); i++)
                /* Find pointer to interpolate */
                if (data->supply_uV > temppoints[i - 1].vdd) {
                        d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
@@ -331,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
 
        const int c1 = -4;
        const int c2 = 40500; /* x 10 ^ -6 */
-       const int c3 = 2800; /* x10 ^ -9 */
+       const int c3 = -2800; /* x10 ^ -9 */
 
        RHlinear = c1*1000
                + c2 * data->val_humid/1000
                + (data->val_humid * data->val_humid * c3)/1000000;
-       return (temp - 25000) * (10000 + 800 * data->val_humid)
+       return (temp - 25000) * (10000 + 80 * data->val_humid)
                / 1000000 + RHlinear;
 }
 
@@ -562,7 +563,7 @@ static int __devinit sht15_probe(struct platform_device *pdev)
        ret = sysfs_create_group(&pdev->dev.kobj, &sht15_attr_group);
        if (ret) {
                dev_err(&pdev->dev, "sysfs create failed");
-               goto err_free_data;
+               goto err_release_gpio_data;
        }
 
        ret = request_irq(gpio_to_irq(data->pdata->gpio_data),
@@ -581,10 +582,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
        data->hwmon_dev = hwmon_device_register(data->dev);
        if (IS_ERR(data->hwmon_dev)) {
                ret = PTR_ERR(data->hwmon_dev);
-               goto err_release_gpio_data;
+               goto err_release_irq;
        }
        return 0;
 
+err_release_irq:
+       free_irq(gpio_to_irq(data->pdata->gpio_data), data);
 err_release_gpio_data:
        gpio_free(data->pdata->gpio_data);
 err_release_gpio_sck:
@@ -620,7 +623,12 @@ static int __devexit sht15_remove(struct platform_device *pdev)
 }
 
 
-static struct platform_driver sht_drivers[] = {
+/*
+ * sht_drivers simultaneously refers to __devinit and __devexit function
+ * which causes spurious section mismatch warning. So use __refdata to
+ * get rid from this.
+ */
+static struct platform_driver __refdata sht_drivers[] = {
        {
                .driver = {
                        .name = "sht10",