]> Pileus Git - ~andy/linux/blobdiff - drivers/thermal/thermal_core.c
Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next into cpsw
[~andy/linux] / drivers / thermal / thermal_core.c
index c00dc9275fc06273b84fa1b7e99f9d96a0d5fd70..1f02e8edb45c9f6b36dae08a563b47efecf4c99d 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>
 
@@ -714,10 +715,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;
 
@@ -1625,7 +1629,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);