[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfvVNFRiVMnGEe96C84AkxKs=hR29q8dp701Q4OyNO47g@mail.gmail.com>
Date: Wed, 7 Jun 2017 13:55:39 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>
Cc: "Zhang, Rui" <rui.zhang@...el.com>,
"edubezval@...il.com" <edubezval@...il.com>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] thermal: int340x: check for sensor when PTYP is missing
On Wed, Jun 7, 2017 at 2:00 AM, Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com> wrote:
> 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.
> status = acpi_evaluate_integer(priv->adev->handle, "PTYP",
> NULL, &priv->type);
> if (ACPI_FAILURE(status)) {
> - result = -EINVAL;
> - goto err;
> + unsigned long long tmp;
You may use &priv->type as temporary variable, though I would go other
way around:
declare tmp for function, then
unsigned long long tmp;
...
status = acpi_evaluate_integer(priv->adev->handle, "PTYP", NULL, &tmp);
if (ACPI_FAILURE(status)) {
status = acpi_evaluate_integer(priv->adev->handle, "_TMP", NULL, &tmp);
if (ACPI_FAILURE(status)) {
result = -EINVAL;
goto err;
}
tmp = INT3403_TYPE_SENSOR;
}
priv->type = tmp;
> + } else {
This is redundant.
> + priv->type = INT3403_TYPE_SENSOR;
> + }
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists