Skip to content

Commit 7464145

Browse files
tititiou36broonie
authored andcommitted
regmap: Reorder fields in 'struct regmap_bus' to save some memory
Group some bool variables to reduce hole and avoid padding. On x86_64, this shrinks the size from 136 to 128 bytes. As an example: $ size drivers/base/regmap/regmap-fsi.o (Before) text data bss dec hex filename 4837 136 0 4973 136d drivers/base/regmap/regmap-fsi.o $ size drivers/base/regmap/regmap-fsi.o (After) text data bss dec hex filename 4701 136 0 4837 12e5 drivers/base/regmap/regmap-fsi.o Signed-off-by: Christophe JAILLET <[email protected]> Link: https://lore.kernel.org/r/077ca39622c8870a3ea932298a9cec34f7a8295a.1676363976.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent 7b3c4c3 commit 7464145

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/regmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ typedef void (*regmap_hw_free_context)(void *context);
520520
* to perform locking. This field is ignored if custom lock/unlock
521521
* functions are used (see fields lock/unlock of
522522
* struct regmap_config).
523+
* @free_on_exit: kfree this on exit of regmap
523524
* @write: Write operation.
524525
* @gather_write: Write operation with split register/value, return -ENOTSUPP
525526
* if not implemented on a given device.
@@ -548,10 +549,10 @@ typedef void (*regmap_hw_free_context)(void *context);
548549
* DEFAULT, BIG is assumed.
549550
* @max_raw_read: Max raw read size that can be used on the bus.
550551
* @max_raw_write: Max raw write size that can be used on the bus.
551-
* @free_on_exit: kfree this on exit of regmap
552552
*/
553553
struct regmap_bus {
554554
bool fast_io;
555+
bool free_on_exit;
555556
regmap_hw_write write;
556557
regmap_hw_gather_write gather_write;
557558
regmap_hw_async_write async_write;
@@ -568,7 +569,6 @@ struct regmap_bus {
568569
enum regmap_endian val_format_endian_default;
569570
size_t max_raw_read;
570571
size_t max_raw_write;
571-
bool free_on_exit;
572572
};
573573

574574
/*

0 commit comments

Comments
 (0)