From: Segher Boessenkool <segher@kernel.crashing.org>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: nathanl@linux.ibm.com, wvoigt@us.ibm.com,
linux-watchdog@vger.kernel.org, aik@ozlabs.ru,
Scott Cheloha <cheloha@linux.ibm.com>,
vaishnavi@linux.ibm.com, npiggin@gmail.com, tzungbi@kernel.org,
brking@linux.ibm.com, linuxppc-dev@lists.ozlabs.org,
linux@roeck-us.net
Subject: Re: [PATCH v2 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers
Date: Fri, 24 Jun 2022 10:31:34 -0500 [thread overview]
Message-ID: <20220624153134.GV25951@gate.crashing.org> (raw)
In-Reply-To: <87wnd642f7.fsf@mpe.ellerman.id.au>
On Fri, Jun 24, 2022 at 11:27:24PM +1000, Michael Ellerman wrote:
> Scott Cheloha <cheloha@linux.ibm.com> writes:
> > + * - For the "Query Watchdog Capabilities" operation, a 64-bit
> > + * value structured as follows:
> > + *
> > + * Bits 0-15: The minimum supported timeout in milliseconds.
> > + * Bits 16-31: The number of watchdogs supported.
> > + * Bits 32-63: Reserved.
> > + */
> > +#define PSERIES_WDTQ_MIN_TIMEOUT(cap) GETFIELD((cap), 0, 15)
>
> This one is less obviously better, but I still think it's clearer as all
> the logic is there in front of you, rather than hidden in the macro. It
> is clearer that we're only returning a 16-bit value.
>
> #define PSERIES_WDTQ_MIN_TIMEOUT(cap) (((cap) >> 48) & 0xffff)
Or even
((cap) >> 48)
since it is a 64-bit value. If you want better defences you should not
use macros here at all, anyway (but inline functions, instead).
I could rant about the 1000UL being meaningless and/or misleading, or
that 0x1 is just silly, but it is a sunny day :-)
Segher
next prev parent reply other threads:[~2022-06-24 15:35 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-02 17:53 [PATCH v2 0/4] pseries-wdt: initial support for H_WATCHDOG-based watchdog timers Scott Cheloha
2022-06-02 17:53 ` [PATCH v2 1/4] powerpc/pseries: hvcall.h: add H_WATCHDOG opcode, H_NOOP return code Scott Cheloha
2022-06-21 14:44 ` Nathan Lynch
2022-06-21 17:31 ` Segher Boessenkool
2022-06-21 22:22 ` Nathan Lynch
2022-06-02 17:53 ` [PATCH v2 2/4] powerpc/pseries: add FW_FEATURE_WATCHDOG flag Scott Cheloha
2022-06-21 15:03 ` Nathan Lynch
2022-06-02 17:53 ` [PATCH v2 3/4] powerpc/pseries: register pseries-wdt device with platform bus Scott Cheloha
2022-06-21 15:30 ` Nathan Lynch
2022-06-24 13:27 ` Michael Ellerman
2022-07-07 15:53 ` Scott Cheloha
2022-06-02 17:53 ` [PATCH v2 4/4] watchdog/pseries-wdt: initial support for H_WATCHDOG-based watchdog timers Scott Cheloha
2022-06-20 6:09 ` Alexey Kardashevskiy
2022-06-21 15:45 ` Nathan Lynch
2022-06-24 13:27 ` Michael Ellerman
2022-06-24 15:31 ` Segher Boessenkool [this message]
2022-07-08 5:51 ` Scott Cheloha
2022-06-24 13:51 ` Michael Ellerman
2022-07-07 15:53 ` Scott Cheloha
2022-06-16 1:43 ` [PATCH v2 0/4] pseries-wdt: " Daniel Henrique Barboza
2022-06-16 16:44 ` Tyrel Datwyler
2022-06-16 18:16 ` Daniel Henrique Barboza
2022-06-16 18:33 ` Daniel Henrique Barboza
2022-06-17 12:54 ` Daniel Henrique Barboza
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=20220624153134.GV25951@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=aik@ozlabs.ru \
--cc=brking@linux.ibm.com \
--cc=cheloha@linux.ibm.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nathanl@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=tzungbi@kernel.org \
--cc=vaishnavi@linux.ibm.com \
--cc=wvoigt@us.ibm.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;
as well as URLs for NNTP newsgroup(s).