Linux IIO development
 help / color / mirror / Atom feed
From: David Lechner <david@lechnology.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"William Breathitt Gray" <vilhelm.gray@gmail.com>
Cc: linux-iio@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] counter: ti-eqep: Use container_of instead of struct counter_device::priv
Date: Mon, 13 Dec 2021 09:50:02 -0600	[thread overview]
Message-ID: <759aa00b-89b4-e1b9-bfbc-bda2e96d0bd7@lechnology.com> (raw)
In-Reply-To: <20211213114312.1406562-1-u.kleine-koenig@pengutronix.de>

On 12/13/21 5:43 AM, Uwe Kleine-König wrote:
> Using counter->priv is a memory read and so more expensive than
> container_of which is only an addition. (In this case even a noop
> because the offset is 0.)
> 
> So container_of is expected to be a tad faster, it's type-safe, and
> produces smaller code (ARCH=arm allmodconfig):
> 
> 	$ source/scripts/bloat-o-meter drivers/counter/ti-eqep.o-pre drivers/counter/ti-eqep.o
> 	add/remove: 0/0 grow/shrink: 0/9 up/down: 0/-108 (-108)
> 	Function                                     old     new   delta
> 	ti_eqep_position_enable_write                132     120     -12
> 	ti_eqep_position_enable_read                 260     248     -12
> 	ti_eqep_position_ceiling_write               132     120     -12
> 	ti_eqep_position_ceiling_read                236     224     -12
> 	ti_eqep_function_write                       220     208     -12
> 	ti_eqep_function_read                        372     360     -12
> 	ti_eqep_count_write                          312     300     -12
> 	ti_eqep_count_read                           236     224     -12
> 	ti_eqep_action_read                          664     652     -12
> 	Total: Before=4598, After=4490, chg -2.35%
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Acked-by: David Lechner <david@lechnology.com>


  reply	other threads:[~2021-12-13 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 11:43 [PATCH] counter: ti-eqep: Use container_of instead of struct counter_device::priv Uwe Kleine-König
2021-12-13 15:50 ` David Lechner [this message]
2021-12-16  5:25 ` William Breathitt Gray
2021-12-16 10:49   ` Uwe Kleine-König
2021-12-16 23:31     ` William Breathitt Gray

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=759aa00b-89b4-e1b9-bfbc-bda2e96d0bd7@lechnology.com \
    --to=david@lechnology.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vilhelm.gray@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