- patches.fixes/acpi_fix_no_critical_tp.patch: ACPI thermal:
authorThomas Renninger <trenn@suse.de>
Fri, 12 Feb 2010 15:57:30 +0000 (16:57 +0100)
committerThomas Renninger <trenn@suse.de>
Fri, 12 Feb 2010 15:57:30 +0000 (16:57 +0100)
  Don't invalidate thermal zone if critical trip point is bad
  (bnc#531547).
- patches.fixes/acpi_pci_hot_plug_sanity_checks.patch: ACPI:
  acpi_bus_{scan,bus,add}: return -ENODEV if no device was found
  (bnc#531547).
- patches.fixes/acpi_thermal_check_trip_points.patch: ACPI
  thermal: Check for thermal zone requirement (bnc#531547).

suse-commit: 084c0f77990f74ac269f8960e325ae3b724a94c7

drivers/acpi/scan.c
drivers/acpi/thermal.c
drivers/pci/hotplug/acpiphp_glue.c

index 4e77012..20e7c06 100644 (file)
@@ -1361,9 +1361,25 @@ static int acpi_bus_scan(acpi_handle handle, struct acpi_bus_ops *ops,
 
        if (child)
                *child = device;
-       return 0;
+
+       if (device)
+               return 0;
+       else
+               return -ENODEV;
 }
 
+/*
+ * acpi_bus_add and acpi_bus_start
+ *
+ * scan a given ACPI tree and (probably recently hot-plugged)
+ * create and add or starts found devices.
+ *
+ * If no devices were found -ENODEV is returned which does not
+ * mean that this is a real error, there just have been no suitable
+ * ACPI objects in the table trunk from which the kernel could create
+ * a device and add/start an appropriate driver.
+ */
+
 int
 acpi_bus_add(struct acpi_device **child,
             struct acpi_device *parent, acpi_handle handle, int type)
@@ -1373,8 +1389,7 @@ acpi_bus_add(struct acpi_device **child,
        memset(&ops, 0, sizeof(ops));
        ops.acpi_op_add = 1;
 
-       acpi_bus_scan(handle, &ops, child);
-       return 0;
+       return acpi_bus_scan(handle, &ops, child);
 }
 EXPORT_SYMBOL(acpi_bus_add);
 
@@ -1385,8 +1400,7 @@ int acpi_bus_start(struct acpi_device *device)
        memset(&ops, 0, sizeof(ops));
        ops.acpi_op_start = 1;
 
-       acpi_bus_scan(device->handle, &ops, NULL);
-       return 0;
+       return acpi_bus_scan(device->handle, &ops, NULL);
 }
 EXPORT_SYMBOL(acpi_bus_start);
 
index 403bacc..eb11d97 100644 (file)
@@ -369,7 +369,7 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
        int valid = 0;
        int i;
 
-       /* Critical Shutdown (required) */
+       /* Critical Shutdown */
        if (flag & ACPI_TRIPS_CRITICAL) {
                status = acpi_evaluate_integer(tz->device->handle,
                                "_CRT", NULL, &tmp);
@@ -380,17 +380,19 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
                 * Below zero (Celsius) values clearly aren't right for sure..
                 * ... so lets discard those as invalid.
                 */
-               if (ACPI_FAILURE(status) ||
-                               tz->trips.critical.temperature <= 2732) {
+               if (ACPI_FAILURE(status)) {
+                       tz->trips.critical.flags.valid = 0;
+                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                         "No critical threshold\n"));
+               } else if (tmp <= 2732) {
+                       printk(KERN_WARNING FW_BUG "Invalid critical threshold "
+                              "(_CRT:%)\n", tmp);
                        tz->trips.critical.flags.valid = 0;
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "No or invalid critical threshold"));
-                       return -ENODEV;
                } else {
                        tz->trips.critical.flags.valid = 1;
                        ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                       "Found critical threshold [%lu]\n",
-                                       tz->trips.critical.temperature));
+                                         "Found critical threshold [%lu]\n",
+                                         tz->trips.critical.temperature));
                }
                if (tz->trips.critical.flags.valid == 1) {
                        if (crt == -1) {
@@ -576,7 +578,23 @@ static int acpi_thermal_trips_update(struct acpi_thermal *tz, int flag)
 
 static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 {
-       return acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+       int i, valid, ret = acpi_thermal_trips_update(tz, ACPI_TRIPS_INIT);
+
+       if (ret)
+               return ret;
+
+       valid = tz->trips.critical.flags.valid |
+               tz->trips.hot.flags.valid |
+               tz->trips.passive.flags.valid;
+
+       for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++)
+               valid |= tz->trips.active[i].flags.valid;
+
+       if (!valid) {
+               printk(KERN_WARNING FW_BUG "No valid trip found\n");
+               return -ENODEV;
+       }
+       return 0;
 }
 
 static void acpi_thermal_check(void *data)
index 8e952fd..cb2fd01 100644 (file)
@@ -720,12 +720,6 @@ static int acpiphp_bus_add(struct acpiphp_func *func)
                        -ret_val);
                goto acpiphp_bus_add_out;
        }
-       /*
-        * try to start anyway.  We could have failed to add
-        * simply because this bus had previously been added
-        * on another add.  Don't bother with the return value
-        * we just keep going.
-        */
        ret_val = acpi_bus_start(device);
 
 acpiphp_bus_add_out: