public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] constify pci_error_handlers structures
@ 2017-08-12  5:44 Julia Lawall
  2017-08-12  5:44 ` [PATCH 1/6] scsi: mpt3sas: " Julia Lawall
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: linux-scsi; +Cc: bhumirks, kernel-janitors, MPT-FusionLinux.pdl, linux-kernel

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(-)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/6] scsi: mpt3sas: constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
@ 2017-08-12  5:44 ` Julia Lawall
  2017-08-12  5:44 ` [PATCH 3/6] scsi: aacraid: " Julia Lawall
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: Sathya Prakash
  Cc: bhumirks, kernel-janitors, Chaitra P B, Suganath Prabu Subramani,
	James E.J. Bottomley, Martin K. Petersen, MPT-FusionLinux.pdl,
	linux-scsi, linux-kernel

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] scsi: aacraid: constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
  2017-08-12  5:44 ` [PATCH 1/6] scsi: mpt3sas: " Julia Lawall
@ 2017-08-12  5:44 ` Julia Lawall
  2017-08-13  2:32   ` Dave Carroll
  2017-08-12  5:44 ` [PATCH 4/6] scsi: be2iscsi: " Julia Lawall
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions
  Cc: bhumirks, kernel-janitors, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] scsi: be2iscsi: constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
  2017-08-12  5:44 ` [PATCH 1/6] scsi: mpt3sas: " Julia Lawall
  2017-08-12  5:44 ` [PATCH 3/6] scsi: aacraid: " Julia Lawall
@ 2017-08-12  5:44 ` Julia Lawall
  2017-08-12  5:44 ` [PATCH 5/6] [SCSI] csiostor: " Julia Lawall
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: Subbu Seetharaman
  Cc: bhumirks, kernel-janitors, Ketan Mukadam, Jitendra Bhivare,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] [SCSI] csiostor: constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
                   ` (2 preceding siblings ...)
  2017-08-12  5:44 ` [PATCH 4/6] scsi: be2iscsi: " Julia Lawall
@ 2017-08-12  5:44 ` Julia Lawall
  2017-08-12  5:44 ` [PATCH 6/6] bfa: " Julia Lawall
  2017-08-12  7:44 ` [PATCH 0/6] " Christoph Hellwig
  5 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: James E.J. Bottomley
  Cc: bhumirks, kernel-janitors, Martin K. Petersen, linux-scsi,
	linux-kernel

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,

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] bfa: constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
                   ` (3 preceding siblings ...)
  2017-08-12  5:44 ` [PATCH 5/6] [SCSI] csiostor: " Julia Lawall
@ 2017-08-12  5:44 ` Julia Lawall
  2017-08-12  7:44 ` [PATCH 0/6] " Christoph Hellwig
  5 siblings, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  5:44 UTC (permalink / raw)
  To: Anil Gurumurthy
  Cc: bhumirks, kernel-janitors, Sudarsana Kalluru,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

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,

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
                   ` (4 preceding siblings ...)
  2017-08-12  5:44 ` [PATCH 6/6] bfa: " Julia Lawall
@ 2017-08-12  7:44 ` Christoph Hellwig
  2017-08-12  7:52   ` Julia Lawall
  5 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2017-08-12  7:44 UTC (permalink / raw)
  To: Julia Lawall
  Cc: linux-scsi, bhumirks, kernel-janitors, MPT-FusionLinux.pdl,
	linux-kernel, linux-pci

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12  7:44 ` [PATCH 0/6] " Christoph Hellwig
@ 2017-08-12  7:52   ` Julia Lawall
  2017-08-12  7:56     ` Christoph Hellwig
  0 siblings, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  7:52 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, bhumirks, kernel-janitors, MPT-FusionLinux.pdl,
	linux-kernel, linux-pci



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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12  7:52   ` Julia Lawall
@ 2017-08-12  7:56     ` Christoph Hellwig
  2017-08-12  8:00       ` Julia Lawall
  2017-08-12 11:51       ` Julia Lawall
  0 siblings, 2 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-08-12  7:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Christoph Hellwig, linux-scsi, bhumirks, kernel-janitors,
	MPT-FusionLinux.pdl, linux-kernel, linux-pci

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12  7:56     ` Christoph Hellwig
@ 2017-08-12  8:00       ` Julia Lawall
  2017-08-12 11:51       ` Julia Lawall
  1 sibling, 0 replies; 13+ messages in thread
From: Julia Lawall @ 2017-08-12  8:00 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, bhumirks, kernel-janitors, MPT-FusionLinux.pdl,
	linux-kernel, linux-pci



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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12  7:56     ` Christoph Hellwig
  2017-08-12  8:00       ` Julia Lawall
@ 2017-08-12 11:51       ` Julia Lawall
  2017-08-13 14:37         ` Christoph Hellwig
  1 sibling, 1 reply; 13+ messages in thread
From: Julia Lawall @ 2017-08-12 11:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-scsi, bhumirks, kernel-janitors, MPT-FusionLinux.pdl,
	linux-kernel, linux-pci

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 3/6] scsi: aacraid: constify pci_error_handlers structures
  2017-08-12  5:44 ` [PATCH 3/6] scsi: aacraid: " Julia Lawall
@ 2017-08-13  2:32   ` Dave Carroll
  0 siblings, 0 replies; 13+ messages in thread
From: Dave Carroll @ 2017-08-13  2:32 UTC (permalink / raw)
  To: Julia Lawall, dl-esc-Aacraid Linux Driver
  Cc: bhumirks@gmail.com, kernel-janitors@vger.kernel.org,
	James E.J. Bottomley, Martin K. Petersen,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

> 
> 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/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 <david.carroll@microsemi.com>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/6] constify pci_error_handlers structures
  2017-08-12 11:51       ` Julia Lawall
@ 2017-08-13 14:37         ` Christoph Hellwig
  0 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2017-08-13 14:37 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Christoph Hellwig, linux-scsi, bhumirks, kernel-janitors,
	MPT-FusionLinux.pdl, linux-kernel, linux-pci

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-08-13 14:37 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-12  5:44 [PATCH 0/6] constify pci_error_handlers structures Julia Lawall
2017-08-12  5:44 ` [PATCH 1/6] scsi: mpt3sas: " Julia Lawall
2017-08-12  5:44 ` [PATCH 3/6] scsi: aacraid: " Julia Lawall
2017-08-13  2:32   ` Dave Carroll
2017-08-12  5:44 ` [PATCH 4/6] scsi: be2iscsi: " Julia Lawall
2017-08-12  5:44 ` [PATCH 5/6] [SCSI] csiostor: " Julia Lawall
2017-08-12  5:44 ` [PATCH 6/6] bfa: " Julia Lawall
2017-08-12  7:44 ` [PATCH 0/6] " Christoph Hellwig
2017-08-12  7:52   ` Julia Lawall
2017-08-12  7:56     ` Christoph Hellwig
2017-08-12  8:00       ` Julia Lawall
2017-08-12 11:51       ` Julia Lawall
2017-08-13 14:37         ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox