Merge branches 'misc', 'drv_cleanup', 'devm-cleanup' and 'ti-soc' of .git into next
authorZhang Rui <rui.zhang@intel.com>
Tue, 28 May 2013 02:46:46 +0000 (10:46 +0800)
committerZhang Rui <rui.zhang@intel.com>
Tue, 28 May 2013 02:46:46 +0000 (10:46 +0800)
drivers/thermal/armada_thermal.c
drivers/thermal/dove_thermal.c
drivers/thermal/exynos_thermal.c
drivers/thermal/kirkwood_thermal.c
drivers/thermal/rcar_thermal.c
drivers/thermal/spear_thermal.c
drivers/thermal/thermal_core.c

index 5b4d75f..5e53212 100644 (file)
@@ -169,21 +169,11 @@ static int armada_thermal_probe(struct platform_device *pdev)
                return -ENOMEM;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENODEV;
-       }
-
        priv->sensor = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->sensor))
                return PTR_ERR(priv->sensor);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       if (!res) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENODEV;
-       }
-
        priv->control = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->control))
                return PTR_ERR(priv->control);
@@ -210,7 +200,6 @@ static int armada_thermal_exit(struct platform_device *pdev)
                platform_get_drvdata(pdev);
 
        thermal_zone_device_unregister(armada_thermal);
-       platform_set_drvdata(pdev, NULL);
 
        return 0;
 }
@@ -221,7 +210,7 @@ static struct platform_driver armada_thermal_driver = {
        .driver = {
                .name = "armada_thermal",
                .owner = THIS_MODULE,
-               .of_match_table = of_match_ptr(armada_thermal_id_table),
+               .of_match_table = armada_thermal_id_table,
        },
 };
 
index 4b15a5f..828f5e3 100644 (file)
@@ -134,25 +134,16 @@ static int dove_thermal_probe(struct platform_device *pdev)
        struct resource *res;
        int ret;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENODEV;
-       }
-
        priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        priv->sensor = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->sensor))
                return PTR_ERR(priv->sensor);
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-       if (!res) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENODEV;
-       }
        priv->control = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->control))
                return PTR_ERR(priv->control);
@@ -182,7 +173,6 @@ static int dove_thermal_exit(struct platform_device *pdev)
                platform_get_drvdata(pdev);
 
        thermal_zone_device_unregister(dove_thermal);
-       platform_set_drvdata(pdev, NULL);
 
        return 0;
 }
@@ -195,7 +185,7 @@ static struct platform_driver dove_thermal_driver = {
        .driver = {
                .name = "dove_thermal",
                .owner = THIS_MODULE,
-               .of_match_table = of_match_ptr(dove_thermal_id_table),
+               .of_match_table = dove_thermal_id_table,
        },
 };
 
index d20ce9e..03e4bbc 100644 (file)
@@ -925,11 +925,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
        INIT_WORK(&data->irq_work, exynos_tmu_work);
 
        data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!data->mem) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENOENT;
-       }
-
        data->base = devm_ioremap_resource(&pdev->dev, data->mem);
        if (IS_ERR(data->base))
                return PTR_ERR(data->base);
@@ -1001,7 +996,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
 
        return 0;
 err_clk:
-       platform_set_drvdata(pdev, NULL);
        clk_unprepare(data->clk);
        return ret;
 }
@@ -1016,8 +1010,6 @@ static int exynos_tmu_remove(struct platform_device *pdev)
 
        clk_unprepare(data->clk);
 
-       platform_set_drvdata(pdev, NULL);
-
        return 0;
 }
 
index dfeceaf..3b034a0 100644 (file)
@@ -75,16 +75,11 @@ static int kirkwood_thermal_probe(struct platform_device *pdev)
        struct kirkwood_thermal_priv *priv;
        struct resource *res;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&pdev->dev, "Failed to get platform resource\n");
-               return -ENODEV;
-       }
-
        priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        priv->sensor = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(priv->sensor))
                return PTR_ERR(priv->sensor);
@@ -108,7 +103,6 @@ static int kirkwood_thermal_exit(struct platform_device *pdev)
                platform_get_drvdata(pdev);
 
        thermal_zone_device_unregister(kirkwood_thermal);
-       platform_set_drvdata(pdev, NULL);
 
        return 0;
 }
@@ -121,7 +115,7 @@ static struct platform_driver kirkwood_thermal_driver = {
        .driver = {
                .name = "kirkwood_thermal",
                .owner = THIS_MODULE,
-               .of_match_table = of_match_ptr(kirkwood_thermal_id_table),
+               .of_match_table = kirkwood_thermal_id_table,
        },
 };
 
index 8d7edd4..88f92e1 100644 (file)
@@ -389,11 +389,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
                 * platform has IRQ support.
                 * Then, drier use common register
                 */
-               res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
-               if (!res) {
-                       dev_err(dev, "Could not get platform resource\n");
-                       return -ENODEV;
-               }
 
                ret = devm_request_irq(dev, irq->start, rcar_thermal_irq, 0,
                                       dev_name(dev), common);
@@ -405,6 +400,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
                /*
                 * rcar_has_irq_support() will be enabled
                 */
+               res = platform_get_resource(pdev, IORESOURCE_MEM, mres++);
                common->base = devm_ioremap_resource(dev, res);
                if (IS_ERR(common->base))
                        return PTR_ERR(common->base);
@@ -458,7 +454,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 
        platform_set_drvdata(pdev, common);
 
-       dev_info(dev, "%d sensor proved\n", i);
+       dev_info(dev, "%d sensor probed\n", i);
 
        return 0;
 
@@ -487,8 +483,6 @@ static int rcar_thermal_remove(struct platform_device *pdev)
                        rcar_thermal_irq_disable(priv);
        }
 
-       platform_set_drvdata(pdev, NULL);
-
        pm_runtime_put_sync(dev);
        pm_runtime_disable(dev);
 
index 3c5ee56..ab79ea4 100644 (file)
@@ -104,7 +104,7 @@ static int spear_thermal_probe(struct platform_device *pdev)
        struct thermal_zone_device *spear_thermal = NULL;
        struct spear_thermal_dev *stdev;
        struct device_node *np = pdev->dev.of_node;
-       struct resource *stres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       struct resource *res;
        int ret = 0, val;
 
        if (!np || !of_property_read_u32(np, "st,thermal-flags", &val)) {
@@ -112,11 +112,6 @@ static int spear_thermal_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       if (!stres) {
-               dev_err(&pdev->dev, "memory resource missing\n");
-               return -ENODEV;
-       }
-
        stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL);
        if (!stdev) {
                dev_err(&pdev->dev, "kzalloc fail\n");
@@ -124,12 +119,10 @@ static int spear_thermal_probe(struct platform_device *pdev)
        }
 
        /* Enable thermal sensor */
-       stdev->thermal_base = devm_ioremap(&pdev->dev, stres->start,
-                       resource_size(stres));
-       if (!stdev->thermal_base) {
-               dev_err(&pdev->dev, "ioremap failed\n");
-               return -ENOMEM;
-       }
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       stdev->thermal_base = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(stdev->thermal_base))
+               return PTR_ERR(stdev->thermal_base);
 
        stdev->clk = devm_clk_get(&pdev->dev, NULL);
        if (IS_ERR(stdev->clk)) {
@@ -174,7 +167,6 @@ static int spear_thermal_exit(struct platform_device *pdev)
        struct spear_thermal_dev *stdev = spear_thermal->devdata;
 
        thermal_zone_device_unregister(spear_thermal);
-       platform_set_drvdata(pdev, NULL);
 
        /* Disable SPEAr Thermal Sensor */
        actual_mask = readl_relaxed(stdev->thermal_base);
@@ -198,7 +190,7 @@ static struct platform_driver spear_thermal_driver = {
                .name = "spear_thermal",
                .owner = THIS_MODULE,
                .pm = &spear_thermal_pm_ops,
-               .of_match_table = of_match_ptr(spear_thermal_id_table),
+               .of_match_table = spear_thermal_id_table,
        },
 };
 
index d755440..e56ded5 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/idr.h>
 #include <linux/thermal.h>
 #include <linux/reboot.h>
+#include <linux/string.h>
 #include <net/netlink.h>
 #include <net/genetlink.h>
 
@@ -713,10 +714,13 @@ policy_store(struct device *dev, struct device_attribute *attr,
        int ret = -EINVAL;
        struct thermal_zone_device *tz = to_thermal_zone(dev);
        struct thermal_governor *gov;
+       char name[THERMAL_NAME_LENGTH];
+
+       snprintf(name, sizeof(name), "%s", buf);
 
        mutex_lock(&thermal_governor_lock);
 
-       gov = __find_governor(buf);
+       gov = __find_governor(strim(name));
        if (!gov)
                goto exit;
 
@@ -1624,7 +1628,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type,
        if (!ops || !ops->get_temp)
                return ERR_PTR(-EINVAL);
 
-       if (trips > 0 && !ops->get_trip_type)
+       if (trips > 0 && (!ops->get_trip_type || !ops->get_trip_temp))
                return ERR_PTR(-EINVAL);
 
        tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);