These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
---
drivers/misc/genwqe/card_base.c | 2 +-
drivers/scsi/aacraid/linit.c | 2 +-
drivers/scsi/be2iscsi/be_main.c | 2 +-
drivers/scsi/bfa/bfad.c | 2 +-
drivers/scsi/csiostor/csio_init.c | 2 +-
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/misc/genwqe/card_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/genwqe/card_base.c b/drivers/misc/genwqe/card_base.c
index 4fd21e8..8650046 100644
--- a/drivers/misc/genwqe/card_base.c
+++ b/drivers/misc/genwqe/card_base.c
@@ -1333,7 +1333,7 @@ static int genwqe_sriov_configure(struct pci_dev *dev, int numvfs)
return 0;
}
-static struct pci_error_handlers genwqe_err_handler = {
+static const struct pci_error_handlers genwqe_err_handler = {
.error_detected = genwqe_err_error_detected,
.mmio_enabled = genwqe_err_result_none,
.slot_reset = genwqe_err_slot_reset,
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 22998cb..52c163f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -9277,7 +9277,7 @@ bool scsih_ncq_prio_supp(struct scsi_device *sdev)
};
MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table);
-static struct pci_error_handlers _mpt3sas_err_handler = {
+static const struct pci_error_handlers _mpt3sas_err_handler = {
.error_detected = scsih_pci_error_detected,
.mmio_enabled = scsih_pci_mmio_enabled,
.slot_reset = scsih_pci_slot_reset,
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/scsi/bfa/bfad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index 5caf5f3..2861694 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -1683,7 +1683,7 @@ struct pci_device_id bfad_id_table[] = {
/*
* PCI error recovery handlers.
*/
-static struct pci_error_handlers bfad_err_handler = {
+static const struct pci_error_handlers bfad_err_handler = {
.error_detected = bfad_pci_error_detected,
.slot_reset = bfad_pci_slot_reset,
.mmio_enabled = bfad_pci_mmio_enabled,
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/scsi/csiostor/csio_init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
index 28a9c7d..ab4fbcf 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -1168,7 +1168,7 @@ static void csio_remove_one(struct pci_dev *pdev)
dev_err(&pdev->dev, "resume of device failed: %d\n", rv);
}
-static struct pci_error_handlers csio_err_handler = {
+static const struct pci_error_handlers csio_err_handler = {
.error_detected = csio_pci_error_detected,
.slot_reset = csio_pci_slot_reset,
.resume = csio_pci_resume,
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/scsi/be2iscsi/be_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index b4542e7..511732a 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -5786,7 +5786,7 @@ static void beiscsi_remove(struct pci_dev *pcidev)
}
-static struct pci_error_handlers beiscsi_eeh_handlers = {
+static const struct pci_error_handlers beiscsi_eeh_handlers = {
.error_detected = beiscsi_eeh_err_detected,
.slot_reset = beiscsi_eeh_reset,
.resume = beiscsi_eeh_resume,
These pci_error_handlers structures are only stored in the err_handler
field of a pci_driver structure, and this field is declared as const. Thus
the pci_error_handlers structures can be const too.
Done with the help of Coccinelle.
Signed-off-by: Julia Lawall <[email protected]>
---
drivers/scsi/aacraid/linit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index a8dedc3..2b978d8 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -2070,7 +2070,7 @@ static void aac_pci_resume(struct pci_dev *pdev)
dev_err(&pdev->dev, "aacraid: PCI error - resume\n");
}
-static struct pci_error_handlers aac_pci_err_handler = {
+static const struct pci_error_handlers aac_pci_err_handler = {
.error_detected = aac_pci_error_detected,
.mmio_enabled = aac_pci_mmio_enabled,
.slot_reset = aac_pci_slot_reset,
On Sat, Aug 12, 2017 at 07:44:28AM +0200, Julia Lawall wrote:
> These pci_error_handlers structures are only stored in the err_handler
> field of a pci_driver structure, and this field is declared as const. Thus
> the pci_error_handlers structures can be const too.
>
> Done with the help of Coccinelle.
If you're doing a scripted conversion of the pci_error_handlers
structured I'd much rather see that structure killed off and folded
into the pci_driver one.
On Sat, 12 Aug 2017, Christoph Hellwig wrote:
> On Sat, Aug 12, 2017 at 07:44:28AM +0200, Julia Lawall wrote:
> > These pci_error_handlers structures are only stored in the err_handler
> > field of a pci_driver structure, and this field is declared as const. Thus
> > the pci_error_handlers structures can be const too.
> >
> > Done with the help of Coccinelle.
>
> If you're doing a scripted conversion of the pci_error_handlers
> structured I'd much rather see that structure killed off and folded
> into the pci_driver one.
OK, sure. So to be precise, you want the fields error_detected,
mmio_enabled, etc to be added as new fields to the pci_driver structure?
They both have a resume field, though. What should the pci_error_handlers
resume function be renamed to? Would resume_after_error be too much?
julia
On Sat, Aug 12, 2017 at 09:52:28AM +0200, Julia Lawall wrote:
> OK, sure. So to be precise, you want the fields error_detected,
> mmio_enabled, etc to be added as new fields to the pci_driver structure?
Yes.
> They both have a resume field, though. What should the pci_error_handlers
> resume function be renamed to? Would resume_after_error be too much?
error_resume maybe?
FYI, I already killed it for the PCIe port drivers a while ago:
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/aer&id=c5dc3c69f17a7e77359f10c342d1816390bc8846
On Sat, 12 Aug 2017, Christoph Hellwig wrote:
> On Sat, Aug 12, 2017 at 09:52:28AM +0200, Julia Lawall wrote:
> > OK, sure. So to be precise, you want the fields error_detected,
> > mmio_enabled, etc to be added as new fields to the pci_driver structure?
>
> Yes.
>
> > They both have a resume field, though. What should the pci_error_handlers
> > resume function be renamed to? Would resume_after_error be too much?
>
> error_resume maybe?
OK
>
> FYI, I already killed it for the PCIe port drivers a while ago:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/aer&id=c5dc3c69f17a7e77359f10c342d1816390bc8846
Thanks for the pointer.
julia
Another issue arises in the files drivers/infiniband/hw/hfi1/pcie.c and
drivers/infiniband/hw/qib/qib_pcie.c, where the pci_error_handlers
structure is defined in one file and used in another file. The structure
definition references various functions that are static in the same file.
Should I try to move those functions to the file containing the pci_driver
structure? Or leave the functions where they are and remove the static
annotation?
thanks,
julia
>
> These pci_error_handlers structures are only stored in the err_handler field of a
> pci_driver structure, and this field is declared as const. Thus the
> pci_error_handlers structures can be const too.
>
> Done with the help of Coccinelle.
>
> Signed-off-by: Julia Lawall <[email protected]>
>
> ---
> drivers/scsi/aacraid/linit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index
> a8dedc3..2b978d8 100644
> --- a/drivers/scsi/aacraid/linit.c
> +++ b/drivers/scsi/aacraid/linit.c
> @@ -2070,7 +2070,7 @@ static void aac_pci_resume(struct pci_dev *pdev)
> dev_err(&pdev->dev, "aacraid: PCI error - resume\n"); }
>
> -static struct pci_error_handlers aac_pci_err_handler = {
> +static const struct pci_error_handlers aac_pci_err_handler = {
> .error_detected = aac_pci_error_detected,
> .mmio_enabled = aac_pci_mmio_enabled,
> .slot_reset = aac_pci_slot_reset,
Acked-by: Dave Carroll <[email protected]>
On Sat, Aug 12, 2017 at 01:51:21PM +0200, Julia Lawall wrote:
> Another issue arises in the files drivers/infiniband/hw/hfi1/pcie.c and
> drivers/infiniband/hw/qib/qib_pcie.c, where the pci_error_handlers
> structure is defined in one file and used in another file. The structure
> definition references various functions that are static in the same file.
> Should I try to move those functions to the file containing the pci_driver
> structure? Or leave the functions where they are and remove the static
> annotation?
I'd just leave them as-is and remove the static for now.