Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1710179 > unrolled thread

[PATCH 0/6] constify pci_error_handlers structures

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2017-08-12 08:20 +0200
Last post2017-08-13 16:40 +0200
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] constify pci_error_handlers structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-12 08:20 +0200
    [PATCH 5/6] [SCSI] csiostor: constify pci_error_handlers structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-12 08:20 +0200
    [PATCH 6/6] bfa: constify pci_error_handlers structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-12 08:20 +0200
    [PATCH 2/6] GenWQE: constify pci_error_handlers structures Julia Lawall <Julia.Lawall@lip6.fr> - 2017-08-12 08:20 +0200
    Re: [PATCH 0/6] constify pci_error_handlers structures Christoph Hellwig <hch@infradead.org> - 2017-08-12 09:50 +0200
      Re: [PATCH 0/6] constify pci_error_handlers structures Julia Lawall <julia.lawall@lip6.fr> - 2017-08-12 10:00 +0200
        Re: [PATCH 0/6] constify pci_error_handlers structures Christoph Hellwig <hch@infradead.org> - 2017-08-12 10:00 +0200
          Re: [PATCH 0/6] constify pci_error_handlers structures Julia Lawall <julia.lawall@lip6.fr> - 2017-08-12 10:10 +0200
          Re: [PATCH 0/6] constify pci_error_handlers structures Julia Lawall <julia.lawall@lip6.fr> - 2017-08-12 14:00 +0200
            Re: [PATCH 0/6] constify pci_error_handlers structures Christoph Hellwig <hch@infradead.org> - 2017-08-13 16:40 +0200

#1710179 — [PATCH 0/6] constify pci_error_handlers structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-08-12 08:20 +0200
Subject[PATCH 0/6] constify pci_error_handlers structures
Message-ID<udxW9-5qW-3@gated-at.bofh.it>
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(-)

[toc] | [next] | [standalone]


#1710180 — [PATCH 5/6] [SCSI] csiostor: constify pci_error_handlers structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-08-12 08:20 +0200
Subject[PATCH 5/6] [SCSI] csiostor: constify pci_error_handlers structures
Message-ID<udxW9-5qW-9@gated-at.bofh.it>
In reply to#1710179
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 <Julia.Lawall@lip6.fr>

---
 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,

[toc] | [prev] | [next] | [standalone]


#1710181 — [PATCH 6/6] bfa: constify pci_error_handlers structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-08-12 08:20 +0200
Subject[PATCH 6/6] bfa: constify pci_error_handlers structures
Message-ID<udxW9-5qW-13@gated-at.bofh.it>
In reply to#1710179
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 <Julia.Lawall@lip6.fr>

---
 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,

[toc] | [prev] | [next] | [standalone]


#1710182 — [PATCH 2/6] GenWQE: constify pci_error_handlers structures

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2017-08-12 08:20 +0200
Subject[PATCH 2/6] GenWQE: constify pci_error_handlers structures
Message-ID<udxW9-5qW-15@gated-at.bofh.it>
In reply to#1710179
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 <Julia.Lawall@lip6.fr>

---
 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,

[toc] | [prev] | [next] | [standalone]


#1710193

FromChristoph Hellwig <hch@infradead.org>
Date2017-08-12 09:50 +0200
Message-ID<udzlf-69b-5@gated-at.bofh.it>
In reply to#1710179
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.

[toc] | [prev] | [next] | [standalone]


#1710199

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-08-12 10:00 +0200
Message-ID<udzuV-6cl-3@gated-at.bofh.it>
In reply to#1710193

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

[toc] | [prev] | [next] | [standalone]


#1710200

FromChristoph Hellwig <hch@infradead.org>
Date2017-08-12 10:00 +0200
Message-ID<udzuV-6cl-7@gated-at.bofh.it>
In reply to#1710199
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

[toc] | [prev] | [next] | [standalone]


#1710203

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-08-12 10:10 +0200
Message-ID<udzEC-6uM-15@gated-at.bofh.it>
In reply to#1710200

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

[toc] | [prev] | [next] | [standalone]


#1710243

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-08-12 14:00 +0200
Message-ID<udDfb-fj-9@gated-at.bofh.it>
In reply to#1710200
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

[toc] | [prev] | [next] | [standalone]


#1710539

FromChristoph Hellwig <hch@infradead.org>
Date2017-08-13 16:40 +0200
Message-ID<ue2dA-8jJ-9@gated-at.bofh.it>
In reply to#1710243
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web