Re: [PATCH v3 5/6] s390/crash: Use note name macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Thu, Jan 09, 2025 at 02:29:19PM +0900, Akihiko Odaki wrote:
> On 2025/01/08 22:50, Dave Martin wrote:
> > On Wed, Jan 08, 2025 at 01:53:51PM +0900, Akihiko Odaki wrote:
> > > On 2025/01/08 1:17, Dave Martin wrote:
> > > > Hi,
> > > > 
> > > > On Tue, Jan 07, 2025 at 09:45:56PM +0900, Akihiko Odaki wrote:
> > > > > Use note name macros to match with the userspace's expectation.
> > > > > 
> > > > > Signed-off-by: Akihiko Odaki <akihiko.odaki@xxxxxxxxxx>
> > > > > ---
> > > > >    arch/s390/kernel/crash_dump.c | 62 ++++++++++++++++---------------------------
> > > > >    1 file changed, 23 insertions(+), 39 deletions(-)
> > > > > 
> > > > > diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
> > > > 
> > > > [...]
> > 
> > > > > +#define NT_INIT(buf, type, desc) \
> > > > > +	(nt_init_name((buf), NT_ ## type, &(desc), sizeof(desc), NN_ ## type))
> > 
> > [...]
> > 
> > > > (Note also, the outer parentheses and the parentheses around (buf)
> > > > appear redundant -- although harmless?)
> > > 
> > > They only make a difference in trivial corner cases and may look needlessly
> > > verbose.
> > 
> > (In case there was a misunderstanding here, I meant that some
> > parentheses can be removed without affecting correctness:
> > 
> > #define NT_INIT(buf, type, desc) \
> > 	nt_init_name(buf, NT_ ## type, &(desc), sizeof(desc), NN_ ## type))
> > 
> > It still doesn't matter though -- and some people do prefer to be
> > defensive anyway and err on the side of having too many parentheses
> > rather than too few.)
> 
> Well, being very pedantic, there are some cases where these parentheses have
> some effect.
> 
> If you omit the outer parentheses, the following code will have different
> consequences:
> a->NT_INIT(buf, PRSTATUS, desc)
> 
> The parentheses around buf will make difference for the following code:
> #define COMMA ,
> NT_INIT(NULL COMMA buf, PRSTATUS, desc)
> 
> But nobody will write such code.

Ah, it looks like you're right on both!

Apologies for the noise.

(I must try find a neat use for these...)

Cheers
---Dave




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux