Skip to content

Commit 279b418

Browse files
haokexinbroonie
authored andcommitted
spi: fsl-qspi: Optimize fsl_qspi struct
Reorgize the members of the fsl_qspi struct to: - Reduce a hole in the struct. - Group members required by each op (e.g., iobase, ahb_addr, devtype_data and lock) into the same cacheline. Before: struct fsl_qspi { [...] /* size: 176, cachelines: 3, members: 11 */ /* sum members: 168, holes: 1, sum holes: 4 */ /* padding: 4 */ /* member types with holes: 1, total: 1 */ /* last cacheline: 48 bytes */ }; after: struct fsl_qspi { void * iobase; /* 0 8 */ void * ahb_addr; /* 8 8 */ const struct fsl_qspi_devtype_data * devtype_data; /* 16 8 */ struct mutex lock; /* 24 32 */ struct completion c; /* 56 32 */ /* XXX last struct has 1 hole */ /* --- cacheline 1 boundary (64 bytes) was 24 bytes ago --- */ struct clk * clk; /* 88 8 */ struct clk * clk_en; /* 96 8 */ struct pm_qos_request pm_qos_req; /* 104 48 */ /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */ struct device * dev; /* 152 8 */ int selected; /* 160 4 */ u32 memmap_phy; /* 164 4 */ /* size: 168, cachelines: 3, members: 11 */ /* member types with holes: 1, total: 1 */ /* last cacheline: 40 bytes */ }; Reviewed-by: Han Xu <han.xu@nxp.com> Signed-off-by: Kevin Hao <haokexin@gmail.com> Link: https://patch.msgid.link/20250411-spi-v1-1-8d6dfb1a9262@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 88113e0 commit 279b418

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/spi/spi-fsl-qspi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ static const struct fsl_qspi_devtype_data ls2080a_data = {
264264
struct fsl_qspi {
265265
void __iomem *iobase;
266266
void __iomem *ahb_addr;
267-
u32 memmap_phy;
268-
struct clk *clk, *clk_en;
269-
struct device *dev;
270-
struct completion c;
271267
const struct fsl_qspi_devtype_data *devtype_data;
272268
struct mutex lock;
269+
struct completion c;
270+
struct clk *clk, *clk_en;
273271
struct pm_qos_request pm_qos_req;
272+
struct device *dev;
274273
int selected;
274+
u32 memmap_phy;
275275
};
276276

277277
static inline int needs_swap_endian(struct fsl_qspi *q)

0 commit comments

Comments
 (0)