Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662786 > unrolled thread
| Started by | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| First post | 2017-06-10 00:30 +0200 |
| Last post | 2017-06-10 00:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] thermal: int340x: check for sensor when PTYP is missing Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> - 2017-06-10 00:30 +0200
Re: [PATCH] thermal: int340x: check for sensor when PTYP is missing Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-10 00:40 +0200
| From | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> |
|---|---|
| Date | 2017-06-10 00:30 +0200 |
| Subject | Re: [PATCH] thermal: int340x: check for sensor when PTYP is missing |
| Message-ID | <tQAzM-7eY-11@gated-at.bofh.it> |
On Wed, 2017-06-07 at 13:55 +0300, Andy Shevchenko wrote:
> On Wed, Jun 7, 2017 at 2:00 AM, Srinivas Pandruvada
> <srinivas.pandruvada@linux.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;
>
So what are we saving by doing this way?
Thanks,
Srinivas
> >
> > + } else {
> This is redundant.
>
> >
> > + priv->type = INT3403_TYPE_SENSOR;
> > + }
> > }
[toc] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2017-06-10 00:40 +0200 |
| Message-ID | <tQAJs-7ia-17@gated-at.bofh.it> |
| In reply to | #1662786 |
On Sat, Jun 10, 2017 at 1:23 AM, Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
> On Wed, 2017-06-07 at 13:55 +0300, Andy Shevchenko wrote:
>> On Wed, Jun 7, 2017 at 2:00 AM, Srinivas Pandruvada
>> <srinivas.pandruvada@linux.intel.com> wrote:
>> > 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;
>>
> So what are we saving by doing this way?
We make priv->type assignment in one place.
That's the difference.
So, you may choose your way of course. It's not a big deal.
--
With Best Regards,
Andy Shevchenko
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web