PCI: kirin: Fix section mismatch warning
PATCH v2 1/1 PCI: kirin: Fix section mismatch warning
WARNING: vmlinux.o(.text+0x4758cc): Section mismatch in reference from the function kirin_pcie_probe() to the function .init.text:kirin_add_pcie_port()
The function kirin_pcie_probe() references
the function __init kirin_add_pcie_port().
This is often because kirin_pcie_probe lacks a __init annotation or the annotation of kirin_add_pcie_port is wrong.
Add the __init annotation to both kirin_pcie_probe and kirin_pcie_add_msi then use builtin_platform_driver_probe instead of builtin_platform_driver + .probe to avoid a section mismatch warning with kirin_pcie_driver.
---
v1 -> v2:
Instead of removing the annotation on kirin_add_pcie_port, add it to kirin_pcie_add_msi and kirin_pcie_probe. To avoid a warning with this configuration, use builtin_platform_driver_probe.
drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/pci/controller/dwc/pcie-kirin.c +4 -5
@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;
@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;
@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);
Signature · 1 line
2.19.0
Quoted 56 lines · Nathan Chancellor
WARNING:
vmlinux.o(.text+0x4758cc): Section mismatch in reference from the functionkirin_pcie_probe()to the function .init.text:kirin_add_pcie_port()
The functionkirin_pcie_probe()references
the function__initkirin_add_pcie_port().
This is often becausekirin_pcie_probelacks a__initannotation or the annotation ofkirin_add_pcie_portis wrong.Add the
__initannotation to bothkirin_pcie_probeandkirin_pcie_add_msithen usebuiltin_platform_driver_probeinstead ofbuiltin_platform_driver+ .probe to avoid a section mismatch warning withkirin_pcie_driver.Fixes fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
v1 -> v2:
Instead of removing the annotation on
kirin_add_pcie_port, add it tokirin_pcie_add_msiandkirin_pcie_probe. To avoid a warning with this configuration, usebuiltin_platform_driver_probe.drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/pci/controller/dwc/pcie-kirin.c +3
-3@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };
drivers/pci/controller/dwc/pcie-kirin.c static const struct of_device_id kirin_pcie_match[] = { · line 542
Quoted 10 lines
drivers/pci/controller/dwc/pcie-kirin.c +1
-2static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);
It would be good to get additional review from someone who knows more about driver callback lifecycles, but I think this is the correct fix. Thanks Nathan.
Signature · 2 lines
Thanks, ~Nick Desaulniers
[+Paul]
Quoted 72 lines · Nick Desaulniers
Quoted 56 lines · Nathan Chancellor
WARNING:
vmlinux.o(.text+0x4758cc): Section mismatch in reference from the functionkirin_pcie_probe()to the function .init.text:kirin_add_pcie_port()
The functionkirin_pcie_probe()references
the function__initkirin_add_pcie_port().
This is often becausekirin_pcie_probelacks a__initannotation or the annotation ofkirin_add_pcie_portis wrong.Add the
__initannotation to bothkirin_pcie_probeandkirin_pcie_add_msithen usebuiltin_platform_driver_probeinstead ofbuiltin_platform_driver+ .probe to avoid a section mismatch warning withkirin_pcie_driver.Fixes fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
v1 -> v2:
Instead of removing the annotation on
kirin_add_pcie_port, add it tokirin_pcie_add_msiandkirin_pcie_probe. To avoid a warning with this configuration, usebuiltin_platform_driver_probe.drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/pci/controller/dwc/pcie-kirin.c +3
-3@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };drivers/pci/controller/dwc/pcie-kirin.c static const struct of_device_id kirin_pcie_match[] = { · line 542
Quoted 10 lines
drivers/pci/controller/dwc/pcie-kirin.c +1
-2static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);It would be good to get additional review from someone who knows more about driver callback lifecycles, but I think this is the correct fix. Thanks Nathan.
Quoted 1 line
Reviewed-by Nick Desaulniers <[email protected]>
AFAICS we can't use builtin_platform_driver_probe() if the probe() itself may need deferral (and I *reckon* it may need that, see eg clk_get()) so I suspect we have to go back to v1 for the patch, apologies if so.
Lorenzo
Quoted 77 lines · Lorenzo Pieralisi
[+Paul]
Quoted 72 lines · Nick Desaulniers
Quoted 56 lines · Nathan Chancellor
WARNING:
vmlinux.o(.text+0x4758cc): Section mismatch in reference from the functionkirin_pcie_probe()to the function .init.text:kirin_add_pcie_port()
The functionkirin_pcie_probe()references
the function__initkirin_add_pcie_port().
This is often becausekirin_pcie_probelacks a__initannotation or the annotation ofkirin_add_pcie_portis wrong.Add the
__initannotation to bothkirin_pcie_probeandkirin_pcie_add_msithen usebuiltin_platform_driver_probeinstead ofbuiltin_platform_driver+ .probe to avoid a section mismatch warning withkirin_pcie_driver.Fixes fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
v1 -> v2:
Instead of removing the annotation on
kirin_add_pcie_port, add it tokirin_pcie_add_msiandkirin_pcie_probe. To avoid a warning with this configuration, usebuiltin_platform_driver_probe.drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/pci/controller/dwc/pcie-kirin.c +3
-3@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };drivers/pci/controller/dwc/pcie-kirin.c static const struct of_device_id kirin_pcie_match[] = { · line 542
Quoted 10 lines
drivers/pci/controller/dwc/pcie-kirin.c +1
-2static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);It would be good to get additional review from someone who knows more about driver callback lifecycles, but I think this is the correct fix. Thanks Nathan.
Quoted 1 line
Reviewed-by Nick Desaulniers <[email protected]>
Quoted 4 lines
AFAICS we can't use
builtin_platform_driver_probe()if theprobe()itself may need deferral (and I *reckon* it may need that, see egclk_get()) so I suspect we have to go back to v1 for the patch, apologies if so.
I think that the best course of action consists in merging v1 since we have not reached a definitive conclusion on v2, please let me know.
Thanks,
Lorenzo
Quoted 83 lines · Lorenzo Pieralisi
Quoted 77 lines · Lorenzo Pieralisi
[+Paul]
Quoted 72 lines · Nick Desaulniers
Quoted 56 lines · Nathan Chancellor
WARNING:
vmlinux.o(.text+0x4758cc): Section mismatch in reference from the functionkirin_pcie_probe()to the function .init.text:kirin_add_pcie_port()
The functionkirin_pcie_probe()references
the function__initkirin_add_pcie_port().
This is often becausekirin_pcie_probelacks a__initannotation or the annotation ofkirin_add_pcie_portis wrong.Add the
__initannotation to bothkirin_pcie_probeandkirin_pcie_add_msithen usebuiltin_platform_driver_probeinstead ofbuiltin_platform_driver+ .probe to avoid a section mismatch warning withkirin_pcie_driver.Fixes fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
v1 -> v2:
Instead of removing the annotation on
kirin_add_pcie_port, add it tokirin_pcie_add_msiandkirin_pcie_probe. To avoid a warning with this configuration, usebuiltin_platform_driver_probe.drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/pci/controller/dwc/pcie-kirin.c +3
-3@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };drivers/pci/controller/dwc/pcie-kirin.c static const struct of_device_id kirin_pcie_match[] = { · line 542
Quoted 10 lines
drivers/pci/controller/dwc/pcie-kirin.c +1
-2static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);It would be good to get additional review from someone who knows more about driver callback lifecycles, but I think this is the correct fix. Thanks Nathan.
Quoted 1 line
Reviewed-by Nick Desaulniers <[email protected]>Quoted 4 lines
AFAICS we can't use
builtin_platform_driver_probe()if theprobe()itself may need deferral (and I *reckon* it may need that, see egclk_get()) so I suspect we have to go back to v1 for the patch, apologies if so.
Quoted 6 lines
I think that the best course of action consists in merging v1 since we have not reached a definitive conclusion on v2, please let me know.
Thanks,
Lorenzo
Hi Lorenzo,
I am perfectly fine with v1 being merged as either patch solves the warning. I agree with Nick that if this version works it would be more proper but it also carries more risk with regards to deferral like you stated. Please let me know if I need to resend it.
Thanks,
Nathan
Lorenzo Pieralisi
AppliedQuoted 91 lines · Nathan Chancellor
Quoted 83 lines · Lorenzo Pieralisi
Quoted 77 lines · Lorenzo Pieralisi
[+Paul]
Quoted 72 lines · Nick Desaulniers
Quoted 56 lines · Nathan Chancellor
WARNING:
vmlinux.o(.text+0x4758cc): Section mismatch in reference from the functionkirin_pcie_probe()to the function .init.text:kirin_add_pcie_port()
The functionkirin_pcie_probe()references
the function__initkirin_add_pcie_port().
This is often becausekirin_pcie_probelacks a__initannotation or the annotation ofkirin_add_pcie_portis wrong.Add the
__initannotation to bothkirin_pcie_probeandkirin_pcie_add_msithen usebuiltin_platform_driver_probeinstead ofbuiltin_platform_driver+ .probe to avoid a section mismatch warning withkirin_pcie_driver.Fixes fc5165db245a ("PCI: kirin: Add HiSilicon Kirin SoC PCIe controller driver")Reported-by Nick Desaulniers <[email protected]>Suggested-by Nick Desaulniers <[email protected]>Signed-off-by Nathan Chancellor <[email protected]>---
v1 -> v2:
Instead of removing the annotation on
kirin_add_pcie_port, add it tokirin_pcie_add_msiandkirin_pcie_probe. To avoid a warning with this configuration, usebuiltin_platform_driver_probe.drivers/pci/controller/dwc/pcie-kirin.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/pci/controller/dwc/pcie-kirin.c +3
-3@@ -448,8 +448,8 @@ static const struct dw_pcie_host_ops kirin_pcie_host_ops = { .host_init = kirin_pcie_host_init, }; -static int kirin_pcie_add_msi (struct dw_pcie *pci, -struct platform_device *pdev) +static int __init kirin_pcie_add_msi (struct dw_pcie *pci, +struct platform_device *pdev) {int irq;@@ -481,7 +481,7 @@ static int __init kirin_add_pcie_port(struct dw_pcie *pci,return dw_pcie_host_init (&pci->pp); } -static int kirin_pcie_probe (struct platform_device *pdev) +static int __init kirin_pcie_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct kirin_pcie *kirin_pcie;@@ -533,11 +533,10 @@ static const struct of_device_id kirin_pcie_match[] = { };drivers/pci/controller/dwc/pcie-kirin.c static const struct of_device_id kirin_pcie_match[] = { · line 542
Quoted 10 lines
drivers/pci/controller/dwc/pcie-kirin.c +1
-2static struct platform_driver kirin_pcie_driver = { - .probe = kirin_pcie_probe, .driver = { .name ="kirin-pcie" , .of_match_table = kirin_pcie_match, .suppress_bind_attrs = true, }, }; -builtin_platform_driver (kirin_pcie_driver); +builtin_platform_driver_probe (kirin_pcie_driver, kirin_pcie_probe);It would be good to get additional review from someone who knows more about driver callback lifecycles, but I think this is the correct fix. Thanks Nathan.
Quoted 1 line
Reviewed-by Nick Desaulniers <[email protected]>Quoted 4 lines
AFAICS we can't use
builtin_platform_driver_probe()if theprobe()itself may need deferral (and I *reckon* it may need that, see egclk_get()) so I suspect we have to go back to v1 for the patch, apologies if so.Quoted 6 lines
I think that the best course of action consists in merging v1 since we have not reached a definitive conclusion on v2, please let me know.
Thanks,
Lorenzo
Quoted 6 lines
Hi Lorenzo,
I am perfectly fine with v1 being merged as either patch solves the warning. I agree with Nick that if this version works it would be more proper but it also carries more risk with regards to deferral like you stated. Please let me know if I need to resend it.
I have applied v1 to my pci/dwc for v4.20 and dropped this patch, thanks for bearing with me and if there is any objection please let me know.
Thanks,
Lorenzo