mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: rui.zhang@intel.com, Eduardo Valentin <edubezval@gmail.com>,
	linux-pm@vger.kernel.org,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	Jassi Brar <jaswinder.singh@linaro.org>
Subject: Re: [PATCH v3 2/2] thermal: uniphier: add UniPhier thermal driver
Date: Thu, 06 Jul 2017 09:42:06 +0900	[thread overview]
Message-ID: <20170706094205.1DAF.4A936039@socionext.com> (raw)
In-Reply-To: <CAK7LNAQgPEoNDTL-Er0bKSVwmNmjyvwz2BcVSvNONFj9-6499Q@mail.gmail.com>

On Wed, 5 Jul 2017 21:27:57 +0900 <yamada.masahiro@socionext.com> wrote:

> 2017-07-05 21:20 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> > 2017-07-05 20:50 GMT+09:00 Kunihiko Hayashi <hayashi.kunihiko@socionext.com>:
> >
> >> +
> >> +#define TMOD                           0x0928
> >> +#define TMOD_MASK                      GENMASK(9, 0)
> >> +
> >  [ snip ]
> >> +
> >> +       /*
> >> +        * The bit[8:0] of TMOD register represents 2's complement value
> >> +        * of temperature in Celsius. Since bit8 of TMOD shows a sign bit,
> >> +        * 32bit temperature value is obtained by sign extension.
> >> +        */
> >
> >
> > Apparently, this comment does not match your code:
> >
> >      #define TMOD_MASK                      GENMASK(9, 0)
> >
> >
> > TMOD_MASK is indicating bit[9:0].
> >
> >
> >
> > Digging into the patch history, now I understood what happened.
> >
> >
> >
> > In v1, you described
> > #define TMOD_MASK         0x1ff
> >
> > This was correct.
> >
> >
> > In v2, you converted it into
> > #define TMOD_MASK          GENMASK(9, 0)
> >
> > This was misconversion.  It should be GENMASK(8, 0)
> >
> >
> >
> > Anyway, TMOD_MASK is not used any more.

That's true.
TMOD_MASK in v2/v3 is wrong, and not used no longer.

> >> +       *out_temp = sign_extend32(temp, 8) * 1000;
> >
> >
> > Why magic number here?
> >
> >    /* MSB of the TMOD field is a sign bit */
> >    *out_temp = sign_extend32(temp, TMOD_WIDTH) * 1000;
> 
> No.    sign_extend32(temp, TMOD_WIDTH - 1) or
>        sign_extend32(temp, TMOD_MSB)  or whatever.

I see. I'll replace with the macro.

Best Regards,
Kunihiko Hayashi

      reply	other threads:[~2017-07-06  0:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 11:50 [PATCH v3 0/2] add UniPhier thermal support Kunihiko Hayashi
2017-07-05 11:50 ` [PATCH v3 1/2] dt-bindings: thermal: add binding documentation for UniPhier thermal monitor Kunihiko Hayashi
2017-07-05 11:50 ` [PATCH v3 2/2] thermal: uniphier: add UniPhier thermal driver Kunihiko Hayashi
2017-07-05 12:20   ` Masahiro Yamada
2017-07-05 12:27     ` Masahiro Yamada
2017-07-06  0:42       ` Kunihiko Hayashi [this message]

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=20170706094205.1DAF.4A936039@socionext.com \
    --to=hayashi.kunihiko@socionext.com \
    --cc=edubezval@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=masami.hiramatsu@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®