mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Steven Rostedt' <rostedt@goodmis.org>,
	Sven Schnelle <svens@linux.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] tracing/synthetic: use union instead of casts
Date: Mon, 14 Aug 2023 11:34:20 +0000	[thread overview]
Message-ID: <de9b98fe665f4062b5a7eeaa726c547d@AcuMS.aculab.com> (raw)
In-Reply-To: <20230809085449.453b632a@gandalf.local.home>

From: Steven Rostedt
> Sent: 09 August 2023 13:55
> On Wed,  9 Aug 2023 09:14:59 +0200
> Sven Schnelle <svens@linux.ibm.com> wrote:
> 
> > --- a/kernel/trace/trace.h
> > +++ b/kernel/trace/trace.h
> > @@ -1295,6 +1295,16 @@ static inline void trace_branch_disable(void)
> >  /* set ring buffers to default size if not already done so */
> >  int tracing_update_buffers(void);
> >
> > +struct trace_dynamic {
> > +	union {
> > +		u8				as_u8;
> > +		u16				as_u16;
> > +		u32				as_u32;
> > +		u64				as_u64;
> > +		struct trace_dynamic_info	as_dynamic;
> > +	};
> > +};
> > +
> 
> No need to create a structure around a single element union. Also, I would
> like to name it for what it is for.
> 
> union trace_synth_field {
> 	u8				as_u8;
> 	u16				as_u16;
> 	u32				as_u32;
> 	u64				as_u64;
> 	struct trace_dynamic_info	as_dynamic;
> };
> 
> Other than that, the patch looks good. Although I still need to test it.

I was wondering if you need the u8 and u16 members at all?
Can't the values just be treated as 32bit?
Both char and short aren't really 'proper' arithmetic types.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2023-08-14 11:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  7:14 Sven Schnelle
2023-08-09 12:54 ` Steven Rostedt
2023-08-14 11:34   ` David Laight [this message]
2023-08-15  0:47     ` Steven Rostedt

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=de9b98fe665f4062b5a7eeaa726c547d@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=svens@linux.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

all inboxes | Powered by JetHome®