[PATCH v2 4/4] iio: adc: ltc2497: reorder ltc2497core_driverdata members to remove hole

Yusuf Alper Bilgin posted 4 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH v2 4/4] iio: adc: ltc2497: reorder ltc2497core_driverdata members to remove hole
Posted by Yusuf Alper Bilgin 1 month, 3 weeks ago
Reorder struct members from largest to smallest to eliminate a 7-byte
hole identified by the pahole tool, making the layout memory-optimal.

Signed-off-by: Yusuf Alper Bilgin <y.alperbilgin@gmail.com>
---
 drivers/iio/adc/ltc2497.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/adc/ltc2497.h b/drivers/iio/adc/ltc2497.h
index 7f53bf8b8469d2371bb7ae64ce90a61beadba9ba..578f55efc5c400980fe8bbd2b220aafb222d6f33 100644
--- a/drivers/iio/adc/ltc2497.h
+++ b/drivers/iio/adc/ltc2497.h
@@ -27,12 +27,12 @@ struct ltc2497_chip_info {
 struct ltc2497core_driverdata {
 	struct regulator *ref;
 	ktime_t	time_prev;
-	/* lock to protect against multiple access to the device */
-	struct mutex lock;
 	const struct ltc2497_chip_info	*chip_info;
-	u8 addr_prev;
 	int (*result_and_measure)(struct ltc2497core_driverdata *ddata,
 				  u8 address, int *val);
+	/* lock to protect against multiple access to the device */
+	struct mutex lock;
+	u8 addr_prev;
 };
 
 int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev);

-- 
2.43.0
Re: [PATCH v2 4/4] iio: adc: ltc2497: reorder ltc2497core_driverdata members to remove hole
Posted by Andy Shevchenko 1 month, 3 weeks ago
On Wed, Aug 13, 2025 at 6:54 PM Yusuf Alper Bilgin
<y.alperbilgin@gmail.com> wrote:
>
> Reorder struct members from largest to smallest to eliminate a 7-byte
> hole identified by the pahole tool, making the layout memory-optimal.

`pahole`

...

Cool, have you also checked the generated code with bloat-o-meter,
i.e. does the new object file is bigger/smaller/the same size as the
old one?

And make this patch with the one member shuffling from the previous one.


-- 
With Best Regards,
Andy Shevchenko