drivers/iommu: Constify structs
Subsystems (4)
cover drivers/iommu: Constify structs
Constify some structs with function pointers to allow the compiler to put them in read-only memory. There is not dependency between the patches.
Rikard Falkeborn (2):
iommu/hyper-v: Constify hyperv_ir_domain_ops
iommu/sun50i: Constify sun50i_iommu_ops
drivers/iommu/hyperv-iommu.c | 2 +- drivers/iommu/sun50i-iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 iommu/hyper-v: Constify hyperv_ir_domain_ops
The struct hyperv_ir_domain_ops is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
2916 1180 1120 5216 1460 drivers/iommu/hyperv-iommu.o
After:
text data bss dec hex filename
3044 1052 1120 5216 1460 drivers/iommu/hyperv-iommu.o
--- drivers/iommu/hyperv-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/hyperv-iommu.c +1 -1
@@ -131,7 +131,7 @@ static int hyperv_irq_remapping_activate(struct irq_domain *domain,return 0 ; } -static struct irq_domain_ops hyperv_ir_domain_ops = { +static const struct irq_domain_ops hyperv_ir_domain_ops = { .alloc = hyperv_irq_remapping_alloc, .free = hyperv_irq_remapping_free, .activate = hyperv_irq_remapping_activate,
Signature · 1 line
2.26.2
Re: [PATCH 1/2] iommu/hyper-v: Constify hyperv_ir_domain_ops
Quoted 7 lines · Rikard Falkeborn
The struct
hyperv_ir_domain_opsis not modified and can be made const to allow the compiler to put it in read-only memory.Before:
text data bss dec hex filename
2916 1180 1120 5216 1460drivers/iommu/hyperv-iommu.o
Quoted 5 lines
After:
text data bss dec hex filename
3044 1052 1120 5216 1460drivers/iommu/hyperv-iommu.oSigned-off-by Rikard Falkeborn <[email protected]>
Quoted 20 lines
--- drivers/iommu/hyperv-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iommu/hyperv-iommu.c +1
-1@@ -131,7 +131,7 @@ static int hyperv_irq_remapping_activate(struct irq_domain *domain,return 0 ; } -static struct irq_domain_ops hyperv_ir_domain_ops = { +static const struct irq_domain_ops hyperv_ir_domain_ops = { .alloc = hyperv_irq_remapping_alloc, .free = hyperv_irq_remapping_free, .activate = hyperv_irq_remapping_activate,Signature · 1 line
2.26.2
PATCH 2/2 iommu/sun50i: Constify sun50i_iommu_ops
In reply to Rikard FalkebornThe struct sun50i_iommu_ops is not modified and can be made const to allow the compiler to put it in read-only memory.
Before:
text data bss dec hex filename
14358 2501 64 16923 421b drivers/iommu/sun50i-iommu.o
After:
text data bss dec hex filename
14726 2117 64 16907 420b drivers/iommu/sun50i-iommu.o
--- drivers/iommu/sun50i-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/sun50i-iommu.c +1 -1
@@ -771,7 +771,7 @@ static int sun50i_iommu_of_xlate(struct device *dev,return iommu_fwspec_add_ids (dev, &id,1 ); } -static struct iommu_ops sun50i_iommu_ops = { +static const struct iommu_ops sun50i_iommu_ops = { .pgsize_bitmap =SZ_4K , .attach_dev = sun50i_iommu_attach_device, .detach_dev = sun50i_iommu_detach_device,
Signature · 1 line
2.26.2
Re: [PATCH 2/2] iommu/sun50i: Constify sun50i_iommu_ops
Quoted 7 lines · Rikard Falkeborn
The struct
sun50i_iommu_opsis not modified and can be made const to allow the compiler to put it in read-only memory.Before:
text data bss dec hex filename
14358 2501 64 16923 421bdrivers/iommu/sun50i-iommu.o
Quoted 5 lines
After:
text data bss dec hex filename
14726 2117 64 16907 420bdrivers/iommu/sun50i-iommu.oSigned-off-by Rikard Falkeborn <[email protected]>
Thanks!
Maxime
Quoted 11 lines · Rikard Falkeborn
Constify some structs with function pointers to allow the compiler to put them in read-only memory. There is not dependency between the patches.
Rikard Falkeborn (2):
iommu/hyper-v: Constifyhyperv_ir_domain_ops
iommu/sun50i: Constifysun50i_iommu_opsdrivers/iommu/hyperv-iommu.c | 2 +- drivers/iommu/sun50i-iommu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Applied both, thanks.