From: Jonathan Cameron <jic23@kernel.org>
To: Yusuf Alper Bilgin <y.alperbilgin@gmail.com>,
Lars-Peter Clausen <lars@metafoo.de>
Cc: "Michael Hennerich" <Michael.Hennerich@analog.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Liam Beguin" <liambeguin@gmail.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/3] iio: adc: ltc2497: reorder struct members to fix memory holes
Date: Sat, 16 Aug 2025 11:53:48 +0100 [thread overview]
Message-ID: <20250816115348.1fba0a7b@jic23-huawei> (raw)
In-Reply-To: <20250815-ltc2495-v4-3-2d04e6005468@gmail.com>
On Fri, 15 Aug 2025 12:02:04 +0200
Yusuf Alper Bilgin <y.alperbilgin@gmail.com> wrote:
> Reorder members in the `ltc2497_chip_info` and `ltc2497core_driverdata`
> structs to eliminate memory holes identified by the `pahole` tool.
>
> Confirm via the `bloat-o-meter` that this change has no significant
> impact on the final code size:
>
> | Object File | Total Size Change |
> |-----------------|-------------------|
> | ltc2497-core.o | 0 (0.00%) |
> | ltc2497.o | +2 (+0.10%) |
> | ltc2496.o | 0 (0.00%) |
>
> Signed-off-by: Yusuf Alper Bilgin <y.alperbilgin@gmail.com>
whilst I know Andy is a fan of this stuff, I'm not convinced it is worth
the churn in this particular case.
The driverdata is allocated via iio_priv() so has a bunch of additional
alignment rules applied and is on the end of another larger allocation.
I suspect that completely hides the advantages in closing the holes up.
The chip_info one is a bit more convincing as that's static const stuff and
maybe it ends up packing a little better.
Anyhow, let us see what Andy thinks.
Thanks,
Jonathan
> ---
> drivers/iio/adc/ltc2497.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/ltc2497.h b/drivers/iio/adc/ltc2497.h
> index dfe2d5c30017adeb3f17e57fc5bf1e0e792ff30f..48e9f74870ab489b5df6e69a39446610c6a72b93 100644
> --- a/drivers/iio/adc/ltc2497.h
> +++ b/drivers/iio/adc/ltc2497.h
> @@ -5,8 +5,8 @@
> #define LTC2497_CONVERSION_TIME_MS 150ULL
>
> struct ltc2497_chip_info {
> - u32 resolution;
> const char *name;
> + u32 resolution;
> /*
> * Represents the datasheet constant from the temperature formula:
> * T_Kelvin = (DATAOUT * Vref) / temp_scale, where Vref is in Volts.
> @@ -20,15 +20,15 @@ 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;
> + struct regulator *ref;
> + ktime_t time_prev;
> const struct ltc2497_chip_info *chip_info;
> - u8 addr_prev;
> int (*result_and_measure)(struct ltc2497core_driverdata *ddata,
> u8 address, int *val);
> enum iio_chan_type chan_type_prev;
> + u8 addr_prev;
> };
>
> int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev);
>
next prev parent reply other threads:[~2025-08-16 10:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 10:02 [PATCH v4 0/3] Add LTC2495 support Yusuf Alper Bilgin
2025-08-15 10:02 ` [PATCH v4 1/3] dt-bindings: iio: adc: ltc2497: add lltc,ltc2495 bindings Yusuf Alper Bilgin
2025-08-16 10:24 ` Jonathan Cameron
2025-08-15 10:02 ` [PATCH v4 2/3] iio: adc: ltc2497: add support for LTC2495 Yusuf Alper Bilgin
2025-08-16 10:49 ` Jonathan Cameron
2025-08-15 10:02 ` [PATCH v4 3/3] iio: adc: ltc2497: reorder struct members to fix memory holes Yusuf Alper Bilgin
2025-08-16 10:53 ` Jonathan Cameron [this message]
2025-08-16 10:18 ` [PATCH v4 0/3] Add LTC2495 support Jonathan Cameron
2025-08-18 16:11 ` Alper Bilgin
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=20250816115348.1fba0a7b@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=liambeguin@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=y.alperbilgin@gmail.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