From: Peter Feuerer <peter@piie.net>
To: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <petkovbb@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [Patch] acerhdf: Return temperature in milidegree
Date: Mon, 19 Oct 2009 23:24:47 +0200 [thread overview]
Message-ID: <cone.1255987487.209127.3188.1000@deskpiie> (raw)
In-Reply-To: <20091019091617.GA13277@rhlx01.hs-esslingen.de>
Hi Andreas,
thank you very much for your brainstorming.
Andreas Mohr writes:
> Hi,
>
> On Mon, Oct 19, 2009 at 10:21:16AM +0200, Peter Feuerer wrote:
>>
>> Hi Boris,
>>
>> what do you think about this patch?
>
> Personally I'm hurting a bit due to the open-coded "* 1000" transition
> in all places.
>
> I'd add a helper macro
> #define TEMP_DEGREE_TO_SYS(x) ((x) * 1000)
> and use that in all places where it matters.
>
> Advantage:
> - either no mistyping (10000 instead of 1000) _or_ bug occurring in _all_
> places where this macro is used
> - easily grepped-for
> - easily changed once the system granularity gets updated
I agree with you in these points, but I have also some disadvantages to discuss:
Disadvantages:
- Thinking about the implemenation such a macro would require, users may
get confused. They would still set the fanon / fanoff trip points in
degree, but when they read documentation or the current temperature,
millidegree is used.
- I think "TEMP_DEGREE_TO_SYS(59)" in code is not
as good readable as "59000"
what about writing something like "59 * 1000" insead of "59000"?
Or something like that:
#define FACTOR_MILLIDEGREE 1000
59 * FACTOR_MILLIDEGREE
this solution has all your listed advantages and eliminates the
disadvantages I see in the "TEMP_DEGREE_TO_SYS" solution.
--peter
next prev parent reply other threads:[~2009-10-19 21:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-19 8:21 Peter Feuerer
2009-10-19 9:16 ` Andreas Mohr
2009-10-19 21:24 ` Peter Feuerer [this message]
2009-10-20 5:25 ` Andreas Mohr
2009-10-19 18:51 ` Borislav Petkov
2009-10-19 21:11 ` Peter Feuerer
2009-10-20 7:27 ` Borislav Petkov
2009-11-02 11:02 ` Peter Feuerer
2009-11-02 12:49 ` Borislav Petkov
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=cone.1255987487.209127.3188.1000@deskpiie \
--to=peter@piie.net \
--cc=andi@lisas.de \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.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®