From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org
Cc: linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH v2] regmap: sdw-mbq: Reorder regmap_mbq_context struct for better packing
Date: Fri, 7 Nov 2025 10:45:51 +0000 [thread overview]
Message-ID: <20251107104551.1553526-1-ckeepax@opensource.cirrus.com> (raw)
Avoid a hole in struct regmap_mbq_context by shuffling the members
slightly. Pahole before:
struct regmap_mbq_context {
struct device * dev; /* 0 8 */
struct sdw_slave * sdw; /* 8 8 */
struct regmap_sdw_mbq_cfg cfg; /* 16 32 */
int val_size; /* 48 4 */
/* XXX 4 bytes hole, try to pack */
bool (*readable_reg)(struct device *, unsigned int); /* 56 8 */
/* size: 64, cachelines: 1, members: 5 */
/* sum members: 60, holes: 1, sum holes: 4 */
};
Pahole after:
struct regmap_mbq_context {
struct device * dev; /* 0 8 */
struct sdw_slave * sdw; /* 8 8 */
bool (*readable_reg)(struct device *, unsigned int); /* 16 8 */
struct regmap_sdw_mbq_cfg cfg; /* 24 32 */
int val_size; /* 56 4 */
/* size: 64, cachelines: 1, members: 5 */
/* padding: 4 */
};
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
Changes since v1:
- Update commit description to include pahole outputs before and after
drivers/base/regmap/regmap-sdw-mbq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap-sdw-mbq.c b/drivers/base/regmap/regmap-sdw-mbq.c
index 86644bbd07100..225c158d7f9d7 100644
--- a/drivers/base/regmap/regmap-sdw-mbq.c
+++ b/drivers/base/regmap/regmap-sdw-mbq.c
@@ -16,10 +16,11 @@
struct regmap_mbq_context {
struct device *dev;
+ bool (*readable_reg)(struct device *dev, unsigned int reg);
+
struct regmap_sdw_mbq_cfg cfg;
int val_size;
- bool (*readable_reg)(struct device *dev, unsigned int reg);
};
static int regmap_sdw_mbq_size(struct regmap_mbq_context *ctx, unsigned int reg)
--
2.47.3
next reply other threads:[~2025-11-07 10:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 10:45 Charles Keepax [this message]
2025-11-07 19:19 ` Mark Brown
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=20251107104551.1553526-1-ckeepax@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@opensource.cirrus.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®