]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
thermal: int340x: check for sensor when PTYP is missing
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tue, 6 Jun 2017 23:00:41 +0000 (16:00 -0700)
committerZhang Rui <rui.zhang@intel.com>
Thu, 29 Jun 2017 02:53:38 +0000 (10:53 +0800)
For INT3403 sensor PTYP field is mandatory. But some platforms didn't
have this field for sensors. This cause load failure for int3403 driver.

This change checks for the presence of _TMP method and if present, then
treats this device as a sensor.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/int340x_thermal/int3403_thermal.c

index c4890c9437ebaaa6ca7562a94a6c37a400c9f92d..8a7f24dd9315e3be809ef98e4513506561be04fb 100644 (file)
@@ -238,8 +238,16 @@ static int int3403_add(struct platform_device *pdev)
        status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
                                       NULL, &priv->type);
        if (ACPI_FAILURE(status)) {
-               result = -EINVAL;
-               goto err;
+               unsigned long long tmp;
+
+               status = acpi_evaluate_integer(priv->adev->handle, "_TMP",
+                                              NULL, &tmp);
+               if (ACPI_FAILURE(status)) {
+                       result = -EINVAL;
+                       goto err;
+               } else {
+                       priv->type = INT3403_TYPE_SENSOR;
+               }
        }
 
        platform_set_drvdata(pdev, priv);