All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i3c: dw: make struct dw_i3c_cmd smaller
Date: Fri, 14 Aug 2026 11:57:24 +0800	[thread overview]
Message-ID: <an6SJAnIl_wdTPNA@xhacker> (raw)
In-Reply-To: <an4rSDgJtDvudtmY@lizhi-Precision-Tower-5810>

On Thu, Aug 13, 2026 at 04:38:32PM -0400, Frank Li wrote:
> On Thu, Aug 13, 2026 at 12:46:03PM +0800, Jisheng Zhang wrote:
> > The dw_i3c_cmd is dynamically allocated, make it smaller. For example
> > on 64bit platforms, we reduce the size from 48 bytes to 32 bytes.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> > ---
> >  drivers/i3c/master/dw-i3c-master.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> > index 6ba84a97765f..d6f84f0f4c2d 100644
> > --- a/drivers/i3c/master/dw-i3c-master.c
> > +++ b/drivers/i3c/master/dw-i3c-master.c
> > @@ -247,10 +247,10 @@ struct dw_i3c_cmd {
> >  	u32 cmd_lo;
> >  	u32 cmd_hi;
> >  	u16 tx_len;
> > -	const void *tx_buf;
> >  	u16 rx_len;
> 
> only switch rx_len and tx_buf should be enough. otherwise there are data
> pad after u8 error.

If we keep the error at the end of the struct, there's still padding
after the u8 error.
There's no big difference between current sol and only switch rx_len and
tx_buf on 32bit platforms. But on 64bit platforms, the current version
makes use of the pad to store the error, thus saves 8 byte more.

Thanks
> 
> Frank
> 
> > -	void *rx_buf;
> >  	u8 error;
> > +	const void *tx_buf;
> > +	void *rx_buf;
> >  };
> >
> >  struct dw_i3c_xfer {
> > --
> > 2.51.0
> >

WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang@kernel.org>
To: Frank Li <Frank.li@oss.nxp.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Frank Li <Frank.Li@nxp.com>,
	linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i3c: dw: make struct dw_i3c_cmd smaller
Date: Fri, 14 Aug 2026 11:57:24 +0800	[thread overview]
Message-ID: <an6SJAnIl_wdTPNA@xhacker> (raw)
In-Reply-To: <an4rSDgJtDvudtmY@lizhi-Precision-Tower-5810>

On Thu, Aug 13, 2026 at 04:38:32PM -0400, Frank Li wrote:
> On Thu, Aug 13, 2026 at 12:46:03PM +0800, Jisheng Zhang wrote:
> > The dw_i3c_cmd is dynamically allocated, make it smaller. For example
> > on 64bit platforms, we reduce the size from 48 bytes to 32 bytes.
> >
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> > ---
> >  drivers/i3c/master/dw-i3c-master.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> > index 6ba84a97765f..d6f84f0f4c2d 100644
> > --- a/drivers/i3c/master/dw-i3c-master.c
> > +++ b/drivers/i3c/master/dw-i3c-master.c
> > @@ -247,10 +247,10 @@ struct dw_i3c_cmd {
> >  	u32 cmd_lo;
> >  	u32 cmd_hi;
> >  	u16 tx_len;
> > -	const void *tx_buf;
> >  	u16 rx_len;
> 
> only switch rx_len and tx_buf should be enough. otherwise there are data
> pad after u8 error.

If we keep the error at the end of the struct, there's still padding
after the u8 error.
There's no big difference between current sol and only switch rx_len and
tx_buf on 32bit platforms. But on 64bit platforms, the current version
makes use of the pad to store the error, thus saves 8 byte more.

Thanks
> 
> Frank
> 
> > -	void *rx_buf;
> >  	u8 error;
> > +	const void *tx_buf;
> > +	void *rx_buf;
> >  };
> >
> >  struct dw_i3c_xfer {
> > --
> > 2.51.0
> >

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

  reply	other threads:[~2026-08-14  4:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  4:46 [PATCH] i3c: dw: make struct dw_i3c_cmd smaller Jisheng Zhang
2026-08-13  4:46 ` Jisheng Zhang
2026-08-13 20:38 ` Frank Li
2026-08-13 20:38   ` Frank Li
2026-08-14  3:57   ` Jisheng Zhang [this message]
2026-08-14  3:57     ` Jisheng Zhang

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=an6SJAnIl_wdTPNA@xhacker \
    --to=jszhang@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=Frank.li@oss.nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-i3c@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.