All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "Zhang, Rui" <rui.zhang@intel.com>,
	"edubezval@gmail.com" <edubezval@gmail.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] thermal: int340x: check for sensor when PTYP is missing
Date: Fri, 09 Jun 2017 15:23:14 -0700	[thread overview]
Message-ID: <1497046994.26258.9.camel@linux.intel.com> (raw)
In-Reply-To: <CAHp75VfvVNFRiVMnGEe96C84AkxKs=hR29q8dp701Q4OyNO47g@mail.gmail.com>

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;
> > +               }
> >         }

  reply	other threads:[~2017-06-09 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06 23:00 [PATCH] thermal: int340x: check for sensor when PTYP is missing Srinivas Pandruvada
2017-06-07 10:55 ` Andy Shevchenko
2017-06-09 22:23   ` Srinivas Pandruvada [this message]
2017-06-09 22:36     ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497046994.26258.9.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=edubezval@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.