Skip to contentSkip to conversation

regmap: sdw-mbq: Reorder regmap_mbq_context struct for better packing

PATCH In review Charles Keepax 2 participants 2 messages Nov 7, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 regmap: sdw-mbq: Reorder regmap_mbq_context struct for better packing

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 */
};

---

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(-)
drivers/base/regmap/regmap-sdw-mbq.c +2 -1
index 86644bbd07100..225c158d7f9d7 100644
@@ -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)
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 10 lines · Charles Keepax

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 */

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: sdw-mbq: Reorder regmap_mbq_context struct for better packing

      commit: 6985defd1d832f1dd9d1977a6a2cc2cef7632704

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark