From: Herve Codina <herve.codina@bootlin.com>
To: Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
Lizhi Hou <lizhi.hou@amd.com>
Cc: Max Zhen <max.zhen@amd.com>, Sonal Santan <sonal.santan@amd.com>,
Stefano Stabellini <stefano.stabellini@xilinx.com>,
Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
Bjorn Helgaas <bhelgaas@google.com>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Allan Nielsen <allan.nielsen@microchip.com>,
Horatiu Vultur <horatiu.vultur@microchip.com>,
Steen Hegelund <steen.hegelund@microchip.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Herve Codina <herve.codina@bootlin.com>
Subject: [PATCH v2 2/3] of: address: Remove duplicated functions
Date: Tue, 17 Oct 2023 13:02:17 +0200 [thread overview]
Message-ID: <20231017110221.189299-3-herve.codina@bootlin.com> (raw)
In-Reply-To: <20231017110221.189299-1-herve.codina@bootlin.com>
The recently added of_bus_default_flags_translate() performs the exact
same operation as of_bus_pci_translate() and of_bus_isa_translate().
Avoid duplicated code replacing both of_bus_pci_translate() and
of_bus_isa_translate() with of_bus_default_flags_translate().
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
drivers/of/address.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 3219c5177750..d21a3b74ac56 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -216,10 +216,6 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
return da - cp;
}
-static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
-{
- return of_bus_default_translate(addr + 1, offset, na - 1);
-}
#endif /* CONFIG_PCI */
/*
@@ -343,11 +339,6 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
return da - cp;
}
-static int of_bus_isa_translate(__be32 *addr, u64 offset, int na)
-{
- return of_bus_default_translate(addr + 1, offset, na - 1);
-}
-
static unsigned int of_bus_isa_get_flags(const __be32 *addr)
{
unsigned int flags = 0;
@@ -378,7 +369,7 @@ static struct of_bus of_busses[] = {
.match = of_bus_pci_match,
.count_cells = of_bus_pci_count_cells,
.map = of_bus_pci_map,
- .translate = of_bus_pci_translate,
+ .translate = of_bus_default_flags_translate,
.has_flags = true,
.get_flags = of_bus_pci_get_flags,
},
@@ -390,7 +381,7 @@ static struct of_bus of_busses[] = {
.match = of_bus_isa_match,
.count_cells = of_bus_isa_count_cells,
.map = of_bus_isa_map,
- .translate = of_bus_isa_translate,
+ .translate = of_bus_default_flags_translate,
.has_flags = true,
.get_flags = of_bus_isa_get_flags,
},
--
2.41.0
next prev parent reply other threads:[~2023-10-17 11:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-17 11:02 [PATCH v2 0/3] Fix DT based address translations Herve Codina
2023-10-17 11:02 ` [PATCH v2 1/3] of: address: Fix address translation when address-size is greater than 2 Herve Codina
2023-10-17 11:02 ` Herve Codina [this message]
2023-10-17 11:02 ` [PATCH v2 3/3] of: unittest: Add tests for address translations Herve Codina
2023-10-27 7:53 ` kernel test robot
2023-10-26 13:58 ` [PATCH v2 0/3] Fix DT based " Rob Herring
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=20231017110221.189299-3-herve.codina@bootlin.com \
--to=herve.codina@bootlin.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=allan.nielsen@microchip.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=horatiu.vultur@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=max.zhen@amd.com \
--cc=robh+dt@kernel.org \
--cc=sonal.santan@amd.com \
--cc=steen.hegelund@microchip.com \
--cc=stefano.stabellini@xilinx.com \
--cc=thomas.petazzoni@bootlin.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;
as well as URLs for NNTP newsgroup(s).