From: Nathan Lynch <nathanl@linux.ibm.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2] powerpc/machdep: warn when machine_is() used too early
Date: Mon, 13 Feb 2023 14:20:53 -0600 [thread overview]
Message-ID: <87cz6d9v16.fsf@linux.ibm.com> (raw)
In-Reply-To: <3ee6023e-5ee8-e448-5f6c-4e44912e8400@csgroup.eu>
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 13/02/2023 à 20:23, Nathan Lynch via B4 Submission Endpoint a écrit :
>> From: Nathan Lynch <nathanl@linux.ibm.com>
>>
>> machine_is() can't provide correct results before probe_machine() has
>> run. Warn when it's used too early in boot, placing the WARN_ON() in a
>> helper function so the reported file:line indicates exactly what went
>> wrong.
>>
>> checkpatch complains about __attribute__((weak)) in the patch, so
>> change that to __weak, and align the line continuations as well.
>>
>> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
>
> Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
thanks!
>> @@ -220,11 +221,16 @@ extern struct machdep_calls *machine_id;
>> EXPORT_SYMBOL(mach_##name); \
>> struct machdep_calls mach_##name __machine_desc =
>>
>> -#define machine_is(name) \
>> - ({ \
>> - extern struct machdep_calls mach_##name \
>> - __attribute__((weak)); \
>> - machine_id == &mach_##name; \
>> +static inline bool __machine_is(const struct machdep_calls *md)
>> +{
>> + WARN_ON(!machine_id); // complain if used before probe_machine()
>> + return machine_id == md;
>> +}
>> +
>> +#define machine_is(name) \
>
> Misaligned back-slash ?
An artifact of the patch format + tabs for indentation. It should be
aligned with the rest when looking at the file itself after the patch is
applied.
>
>> + ({ \
>> + extern struct machdep_calls mach_##name __weak; \
>> + __machine_is(&mach_##name); \
>> })
>>
>> static inline void log_error(char *buf, unsigned int err_type, int fatal)
next prev parent reply other threads:[~2023-02-13 20:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 19:23 [PATCH v2] powerpc/machdep: warn when machine_is() used too early Nathan Lynch
2023-02-13 20:12 ` Christophe Leroy
2023-02-13 20:20 ` Nathan Lynch [this message]
2023-02-20 3:49 ` Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2023-02-13 19:23 Nathan Lynch via B4 Submission Endpoint
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=87cz6d9v16.fsf@linux.ibm.com \
--to=nathanl@linux.ibm.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@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 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.