* [PATCH 0/3] MIPS: Constify static irq_domain_ops structs
@ 2022-02-07 21:18 Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 1/3] MIPS: OCTEON: Constify static irq_domain_ops Rikard Falkeborn
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2022-02-07 21:18 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Marc Zyngier, Mark Rutland, linux-mips, linux-kernel, Rikard Falkeborn
Constify a number of static irq_domain_ops structs that were never
modified. This allows the compiler to put them in read-only memory.
Rikard Falkeborn (3):
MIPS: OCTEON: Constify static irq_domain_ops
MIPS: ath25: Constify static irq_domain_ops
MIPS: pci-ar2315: Constify static irq_domain_ops
arch/mips/ath25/ar2315.c | 2 +-
arch/mips/ath25/ar5312.c | 2 +-
arch/mips/cavium-octeon/octeon-irq.c | 10 +++++-----
arch/mips/pci/pci-ar2315.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] MIPS: OCTEON: Constify static irq_domain_ops
2022-02-07 21:18 [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Rikard Falkeborn
@ 2022-02-07 21:18 ` Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 2/3] MIPS: ath25: " Rikard Falkeborn
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2022-02-07 21:18 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Marc Zyngier, Mark Rutland, linux-mips, linux-kernel, Rikard Falkeborn
The only usage of these structs is to pass their address to either
irq_domain_add_tree() or irq_domain_create_linear(), both which takes
pointers to const struct irq_domain_ops. Make them const to allow the
compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
arch/mips/cavium-octeon/octeon-irq.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 844f882096e6..07d7ff5a981d 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -1274,13 +1274,13 @@ static int octeon_irq_gpio_map(struct irq_domain *d,
return r;
}
-static struct irq_domain_ops octeon_irq_domain_ciu_ops = {
+static const struct irq_domain_ops octeon_irq_domain_ciu_ops = {
.map = octeon_irq_ciu_map,
.unmap = octeon_irq_free_cd,
.xlate = octeon_irq_ciu_xlat,
};
-static struct irq_domain_ops octeon_irq_domain_gpio_ops = {
+static const struct irq_domain_ops octeon_irq_domain_gpio_ops = {
.map = octeon_irq_gpio_map,
.unmap = octeon_irq_free_cd,
.xlate = octeon_irq_gpio_xlat,
@@ -1974,7 +1974,7 @@ static int octeon_irq_ciu2_map(struct irq_domain *d,
return 0;
}
-static struct irq_domain_ops octeon_irq_domain_ciu2_ops = {
+static const struct irq_domain_ops octeon_irq_domain_ciu2_ops = {
.map = octeon_irq_ciu2_map,
.unmap = octeon_irq_free_cd,
.xlate = octeon_irq_ciu2_xlat,
@@ -2226,7 +2226,7 @@ static int octeon_irq_cib_map(struct irq_domain *d,
return 0;
}
-static struct irq_domain_ops octeon_irq_domain_cib_ops = {
+static const struct irq_domain_ops octeon_irq_domain_cib_ops = {
.map = octeon_irq_cib_map,
.unmap = octeon_irq_free_cd,
.xlate = octeon_irq_cib_xlat,
@@ -2578,7 +2578,7 @@ static int octeon_irq_ciu3_map(struct irq_domain *d,
return octeon_irq_ciu3_mapx(d, virq, hw, &octeon_irq_chip_ciu3);
}
-static struct irq_domain_ops octeon_dflt_domain_ciu3_ops = {
+static const struct irq_domain_ops octeon_dflt_domain_ciu3_ops = {
.map = octeon_irq_ciu3_map,
.unmap = octeon_irq_free_cd,
.xlate = octeon_irq_ciu3_xlat,
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] MIPS: ath25: Constify static irq_domain_ops
2022-02-07 21:18 [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 1/3] MIPS: OCTEON: Constify static irq_domain_ops Rikard Falkeborn
@ 2022-02-07 21:18 ` Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 3/3] MIPS: pci-ar2315: " Rikard Falkeborn
2022-02-22 8:47 ` [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2022-02-07 21:18 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Marc Zyngier, Mark Rutland, linux-mips, linux-kernel, Rikard Falkeborn
The only usage of these structs is to pass their address to either
irq_domain_add_tree() or irq_domain_create_linear(), both which takes
pointers to const struct irq_domain_ops. Make them const to allow the
compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
arch/mips/ath25/ar2315.c | 2 +-
arch/mips/ath25/ar5312.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/mips/ath25/ar2315.c b/arch/mips/ath25/ar2315.c
index 76e43a73ba1b..8ccf167c167e 100644
--- a/arch/mips/ath25/ar2315.c
+++ b/arch/mips/ath25/ar2315.c
@@ -112,7 +112,7 @@ static int ar2315_misc_irq_map(struct irq_domain *d, unsigned irq,
return 0;
}
-static struct irq_domain_ops ar2315_misc_irq_domain_ops = {
+static const struct irq_domain_ops ar2315_misc_irq_domain_ops = {
.map = ar2315_misc_irq_map,
};
diff --git a/arch/mips/ath25/ar5312.c b/arch/mips/ath25/ar5312.c
index 822b639dbd1e..cfa103518113 100644
--- a/arch/mips/ath25/ar5312.c
+++ b/arch/mips/ath25/ar5312.c
@@ -116,7 +116,7 @@ static int ar5312_misc_irq_map(struct irq_domain *d, unsigned irq,
return 0;
}
-static struct irq_domain_ops ar5312_misc_irq_domain_ops = {
+static const struct irq_domain_ops ar5312_misc_irq_domain_ops = {
.map = ar5312_misc_irq_map,
};
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] MIPS: pci-ar2315: Constify static irq_domain_ops
2022-02-07 21:18 [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 1/3] MIPS: OCTEON: Constify static irq_domain_ops Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 2/3] MIPS: ath25: " Rikard Falkeborn
@ 2022-02-07 21:18 ` Rikard Falkeborn
2022-02-22 8:47 ` [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Rikard Falkeborn @ 2022-02-07 21:18 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: Marc Zyngier, Mark Rutland, linux-mips, linux-kernel, Rikard Falkeborn
The only usage of ar2315_pci_irq_domain_ops is to pass its address to
irq_domain_add_linear() which takes a pointer to const struct
irq_domain_ops. Make it const to allow the compiler to put it in
read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
arch/mips/pci/pci-ar2315.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/pci/pci-ar2315.c b/arch/mips/pci/pci-ar2315.c
index 9a4bfb4e63e3..30e0922f4cea 100644
--- a/arch/mips/pci/pci-ar2315.c
+++ b/arch/mips/pci/pci-ar2315.c
@@ -384,7 +384,7 @@ static int ar2315_pci_irq_map(struct irq_domain *d, unsigned irq,
return 0;
}
-static struct irq_domain_ops ar2315_pci_irq_domain_ops = {
+static const struct irq_domain_ops ar2315_pci_irq_domain_ops = {
.map = ar2315_pci_irq_map,
};
--
2.35.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] MIPS: Constify static irq_domain_ops structs
2022-02-07 21:18 [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Rikard Falkeborn
` (2 preceding siblings ...)
2022-02-07 21:18 ` [PATCH 3/3] MIPS: pci-ar2315: " Rikard Falkeborn
@ 2022-02-22 8:47 ` Thomas Bogendoerfer
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2022-02-22 8:47 UTC (permalink / raw)
To: Rikard Falkeborn; +Cc: Marc Zyngier, Mark Rutland, linux-mips, linux-kernel
On Mon, Feb 07, 2022 at 10:18:13PM +0100, Rikard Falkeborn wrote:
> Constify a number of static irq_domain_ops structs that were never
> modified. This allows the compiler to put them in read-only memory.
>
> Rikard Falkeborn (3):
> MIPS: OCTEON: Constify static irq_domain_ops
> MIPS: ath25: Constify static irq_domain_ops
> MIPS: pci-ar2315: Constify static irq_domain_ops
>
> arch/mips/ath25/ar2315.c | 2 +-
> arch/mips/ath25/ar5312.c | 2 +-
> arch/mips/cavium-octeon/octeon-irq.c | 10 +++++-----
> arch/mips/pci/pci-ar2315.c | 2 +-
> 4 files changed, 8 insertions(+), 8 deletions(-)
series applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-22 8:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 21:18 [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 1/3] MIPS: OCTEON: Constify static irq_domain_ops Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 2/3] MIPS: ath25: " Rikard Falkeborn
2022-02-07 21:18 ` [PATCH 3/3] MIPS: pci-ar2315: " Rikard Falkeborn
2022-02-22 8:47 ` [PATCH 0/3] MIPS: Constify static irq_domain_ops structs Thomas Bogendoerfer
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).