public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>, Konstantin Porotchkin <kostap@marvell.com>
Cc: "Marek Behún" <marek.behun@nic.cz>, u-boot@lists.denx.de
Subject: [PATCH 2/3] arm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero
Date: Thu,  8 Jul 2021 20:18:59 +0200	[thread overview]
Message-ID: <20210708181900.8047-2-pali@kernel.org> (raw)
In-Reply-To: <20210708181900.8047-1-pali@kernel.org>

If fixup offset is zero then there is nothing to fix. All calculation in
this case just increase addresses by value zero which results in identity.
So in this case skip whole fixup re-calculation as it is not needed.

This is just an optimization for special case when fix_offset is zero which
skips code path which does only identity operations (meaning nothing). No
functional changes.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/arm/mach-mvebu/armada3700/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-mvebu/armada3700/cpu.c
index 4dd9de471b4e..64838b16c4d8 100644
--- a/arch/arm/mach-mvebu/armada3700/cpu.c
+++ b/arch/arm/mach-mvebu/armada3700/cpu.c
@@ -339,6 +339,10 @@ int a3700_fdt_fix_pcie_regions(void *blob)
 	/* Calculate fixup offset from first child address (in last cell) */
 	fix_offset = base - fdt32_to_cpu(ranges[2]);
 
+	/* If fixup offset is zero then there is nothing to fix */
+	if (!fix_offset)
+		return 0;
+
 	/*
 	 * Fix address (last cell) of each child address and each parent
 	 * address
-- 
2.20.1


  reply	other threads:[~2021-07-08 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 18:18 [PATCH 1/3] arm: a37xx: pci: Extend validation for PCIe resources and oubound windows Pali Rohár
2021-07-08 18:18 ` Pali Rohár [this message]
2021-07-11 10:08   ` [EXT] [PATCH 2/3] arm: a37xx: pci: Optimize a3700_fdt_fix_pcie_regions() when fixup offset is zero Kostya Porotchkin
2021-07-12 12:34   ` Stefan Roese
2021-07-08 18:19 ` [PATCH 3/3] arm: a37xx: pci: Fix typo in comment Pali Rohár
2021-07-11 10:05   ` [EXT] " Kostya Porotchkin
2021-07-12 12:34   ` Stefan Roese
2021-07-11 10:07 ` [EXT] [PATCH 1/3] arm: a37xx: pci: Extend validation for PCIe resources and oubound windows Kostya Porotchkin
2021-07-12 12:28 ` Stefan Roese
2021-07-15 10:33 ` Stefan Roese

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=20210708181900.8047-2-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=kostap@marvell.com \
    --cc=marek.behun@nic.cz \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /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