From 9db7a472423d3470fb4bd114d74d0bc0027995ae Mon Sep 17 00:00:00 2001 From: Avri Altman Date: Thu, 28 Nov 2024 09:25:42 +0200 Subject: [PATCH 1/8] scsi: ufs: core: Do not hold any lock in ufshcd_hba_stop() This change is motivated by Bart's suggestion in [1], which enables to further reduce the SCSI host lock usage in the UFS driver. The reason why it makes sense, because although the legacy interrupt is disabled by some but not all ufshcd_hba_stop() callers, it is safe to nest disable_irq() calls as it checks the irq depth. [1] https://lore.kernel.org/linux-scsi/c58e4fce-0a74-4469-ad16-f1edbd670728@acm.org/ Suggested-by: Bart Van Assche Signed-off-by: Avri Altman Link: https://lore.kernel.org/r/20241128072542.219170-1-avri.altman@wdc.com Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/ufs/core/ufshcd.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 528a9f35cf37..3dfaeba5b691 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -4768,20 +4768,14 @@ EXPORT_SYMBOL_GPL(ufshcd_make_hba_operational); */ void ufshcd_hba_stop(struct ufs_hba *hba) { - unsigned long flags; int err; - /* - * Obtain the host lock to prevent that the controller is disabled - * while the UFS interrupt handler is active on another CPU. - */ - spin_lock_irqsave(hba->host->host_lock, flags); + ufshcd_disable_irq(hba); ufshcd_writel(hba, CONTROLLER_DISABLE, REG_CONTROLLER_ENABLE); - spin_unlock_irqrestore(hba->host->host_lock, flags); - err = ufshcd_wait_for_register(hba, REG_CONTROLLER_ENABLE, CONTROLLER_ENABLE, CONTROLLER_DISABLE, 10, 1); + ufshcd_enable_irq(hba); if (err) dev_err(hba->dev, "%s: Controller disable failed\n", __func__); } From 8d14bfb539522fff4cc0f90cd3c402d5aeef3c6a Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 4 Dec 2024 19:13:07 -0800 Subject: [PATCH 2/8] scsi: docs: Remove init_this_scsi_driver() Finish removing mention of init_this_scsi_driver() that was removed ages ago. Fixes: 83c9f08e6c6a ("scsi: remove the old scsi_module.c initialization model") Signed-off-by: Randy Dunlap Link: https://lore.kernel.org/r/20241205031307.130441-1-rdunlap@infradead.org Cc: Christoph Hellwig Cc: Martin K. Petersen Cc: James E.J. Bottomley Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: Martin K. Petersen --- Documentation/scsi/scsi_mid_low_api.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Documentation/scsi/scsi_mid_low_api.rst b/Documentation/scsi/scsi_mid_low_api.rst index a93df7c3ae50..941680487e90 100644 --- a/Documentation/scsi/scsi_mid_low_api.rst +++ b/Documentation/scsi/scsi_mid_low_api.rst @@ -625,7 +625,7 @@ Interface Functions =================== Interface functions are supplied (defined) by LLDs and their function pointers are placed in an instance of struct scsi_host_template which -is passed to scsi_host_alloc() [or scsi_register() / init_this_scsi_driver()]. +is passed to scsi_host_alloc() or scsi_register(). Some are mandatory. Interface functions should be declared static. The accepted convention is that driver "xyz" will declare its sdev_configure() function as:: @@ -636,8 +636,8 @@ and so forth for all interface functions listed below. A pointer to this function should be placed in the 'sdev_configure' member of a "struct scsi_host_template" instance. A pointer to such an instance -should be passed to the mid level's scsi_host_alloc() [or scsi_register() / -init_this_scsi_driver()]. +should be passed to the mid level's scsi_host_alloc() or scsi_register(). +. The interface functions are also described in the include/scsi/scsi_host.h file immediately above their definition point in "struct scsi_host_template". @@ -817,10 +817,6 @@ Details:: * The SCSI_IOCTL_PROBE_HOST ioctl yields the string returned by this * function (or struct Scsi_Host::name if this function is not * available). - * In a similar manner, init_this_scsi_driver() outputs to the console - * each host's "info" (or name) for the driver it is registering. - * Also if proc_info() is not supplied, the output of this function - * is used instead. * * Optionally defined in: LLD **/ From c17618cf664ddf54b264ea74df9e8ab3e3ceda3b Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 4 Dec 2024 20:18:39 -0800 Subject: [PATCH 3/8] scsi: Eliminate scsi_register() and scsi_unregister() usage & docs scsi_mid_low_api.rst refers to scsi_register() and scsi_unregister() but these functions don't exist. They have been replaced by more meaningful names. Update one driver (megaraid_mbox.c) that uses "scsi_unregister" in a warning message. Update scsi_mid_low_api.rst to eliminate references to scsi_register() and scsi_unregister(). Signed-off-by: Randy Dunlap Link: https://lore.kernel.org/r/20241205041839.164404-1-rdunlap@infradead.org Cc: James E.J. Bottomley Cc: Martin K. Petersen Cc: Bart Van Assche Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Cc: Kashyap Desai Cc: Sumit Saxena Cc: Shivasharan S Cc: Chandrakanth patil Cc: megaraidlinux.pdl@broadcom.com Signed-off-by: Martin K. Petersen --- Documentation/scsi/scsi_mid_low_api.rst | 55 +++---------------------- drivers/scsi/megaraid/megaraid_mbox.c | 2 +- include/scsi/scsi_host.h | 2 +- 3 files changed, 7 insertions(+), 52 deletions(-) diff --git a/Documentation/scsi/scsi_mid_low_api.rst b/Documentation/scsi/scsi_mid_low_api.rst index 941680487e90..9d15e20b0b5e 100644 --- a/Documentation/scsi/scsi_mid_low_api.rst +++ b/Documentation/scsi/scsi_mid_low_api.rst @@ -101,7 +101,7 @@ supplied functions" below. Those functions in group b) are listed in a section entitled "Interface functions" below. Their function pointers are placed in the members of "struct scsi_host_template", an instance of which is passed to -scsi_host_alloc() [#]_. Those interface functions that the LLD does not +scsi_host_alloc(). Those interface functions that the LLD does not wish to supply should have NULL placed in the corresponding member of struct scsi_host_template. Defining an instance of struct scsi_host_template at file scope will cause NULL to be placed in function @@ -116,9 +116,6 @@ should be static. For example the sdev_init() function in an LLD called "xxx" could be defined as ``static int xxx_sdev_init(struct scsi_device * sdev) { /* code */ }`` -.. [#] the scsi_host_alloc() function is a replacement for the rather vaguely - named scsi_register() function in most situations. - Hotplug initialization model ============================ @@ -302,14 +299,12 @@ Summary: - scsi_host_alloc - return a new scsi_host instance whose refcount==1 - scsi_host_get - increments Scsi_Host instance's refcount - scsi_host_put - decrements Scsi_Host instance's refcount (free if 0) - - scsi_register - create and register a scsi host adapter instance. - scsi_remove_device - detach and remove a SCSI device - scsi_remove_host - detach and remove all SCSI devices owned by host - scsi_report_bus_reset - report scsi _bus_ reset observed - scsi_scan_host - scan SCSI bus - scsi_track_queue_full - track successive QUEUE_FULL events - scsi_unblock_requests - allow further commands to be queued to given host - - scsi_unregister - [calls scsi_host_put()] Details:: @@ -474,27 +469,6 @@ Details:: void scsi_host_put(struct Scsi_Host *shost) - /** - * scsi_register - create and register a scsi host adapter instance. - * @sht: pointer to scsi host template - * @privsize: extra bytes to allocate in hostdata array (which is the - * last member of the returned Scsi_Host instance) - * - * Returns pointer to new Scsi_Host instance or NULL on failure - * - * Might block: yes - * - * Notes: When this call returns to the LLD, the SCSI bus scan on - * this host has _not_ yet been done. - * The hostdata array (by default zero length) is a per host scratch - * area for the LLD. - * - * Defined in: drivers/scsi/hosts.c . - **/ - struct Scsi_Host * scsi_register(struct scsi_host_template * sht, - int privsize) - - /** * scsi_remove_device - detach and remove a SCSI device * @sdev: a pointer to a scsi device instance @@ -524,7 +498,7 @@ Details:: * * Notes: Should only be invoked if the "hotplug initialization * model" is being used. It should be called _prior_ to - * scsi_unregister(). + * calling scsi_host_put(). * * Defined in: drivers/scsi/hosts.c . **/ @@ -601,31 +575,12 @@ Details:: void scsi_unblock_requests(struct Scsi_Host * shost) - /** - * scsi_unregister - unregister and free memory used by host instance - * @shp: pointer to scsi host instance to unregister. - * - * Returns nothing - * - * Might block: no - * - * Notes: Should not be invoked if the "hotplug initialization - * model" is being used. Called internally by exit_this_scsi_driver() - * in the "passive initialization model". Hence a LLD has no need to - * call this function directly. - * - * Defined in: drivers/scsi/hosts.c . - **/ - void scsi_unregister(struct Scsi_Host * shp) - - - Interface Functions =================== Interface functions are supplied (defined) by LLDs and their function pointers are placed in an instance of struct scsi_host_template which -is passed to scsi_host_alloc() or scsi_register(). +is passed to scsi_host_alloc(). Some are mandatory. Interface functions should be declared static. The accepted convention is that driver "xyz" will declare its sdev_configure() function as:: @@ -636,7 +591,7 @@ and so forth for all interface functions listed below. A pointer to this function should be placed in the 'sdev_configure' member of a "struct scsi_host_template" instance. A pointer to such an instance -should be passed to the mid level's scsi_host_alloc() or scsi_register(). +should be passed to the mid level's scsi_host_alloc(). . The interface functions are also described in the include/scsi/scsi_host.h @@ -1111,7 +1066,7 @@ of interest: hostdata[0] - area reserved for LLD at end of struct Scsi_Host. Size is set by the second argument (named 'xtr_bytes') to - scsi_host_alloc() or scsi_register(). + scsi_host_alloc(). vendor_id - a unique value that identifies the vendor supplying the LLD for the Scsi_Host. Used most often in validating diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index bc867da650b6..9463f11cc4c8 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -621,7 +621,7 @@ megaraid_io_attach(adapter_t *adapter) host = scsi_host_alloc(&megaraid_template_g, 8); if (!host) { con_log(CL_ANN, (KERN_WARNING - "megaraid mbox: scsi_register failed\n")); + "megaraid mbox: scsi_host_alloc failed\n")); return -1; } diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 8fccfd27393e..fac90ae884c7 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -595,7 +595,7 @@ struct Scsi_Host { * have some way of identifying each detected host adapter properly * and uniquely. For hosts that do not support more than one card * in the system at one time, this does not need to be set. It is - * initialized to 0 in scsi_register. + * initialized to 0 in scsi_host_alloc. */ unsigned int unique_id; From 9fe5b6130baf6dd15d46b41f8edf0abdb3541f4f Mon Sep 17 00:00:00 2001 From: Fedor Loshakov Date: Thu, 5 Dec 2024 15:19:30 +0100 Subject: [PATCH 4/8] scsi: zfcp: Correct kdoc parameter description for sending ELS and CT Since commit 7c7dc196814b ("[SCSI] zfcp: Simplify handling of ct and els requests") there are no more such structures as zfcp_send_els and zfcp_send_ct. Instead there is now one common fsf structure to hold zfcp data for ct and els requests. Fix parameter description for zfcp_fsf_send_ct() and zfcp_fsf_send_els() accordingly. Signed-off-by: Fedor Loshakov Reviewed-by: Steffen Maier Reviewed-by: Benjamin Block Signed-off-by: Nihar Panda Link: https://lore.kernel.org/r/20241205141932.1227039-2-niharp@linux.ibm.com Signed-off-by: Martin K. Petersen --- drivers/s390/scsi/zfcp_fsf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 22e82000334a..99d6b3f8692b 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -1218,7 +1218,7 @@ static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req, /** * zfcp_fsf_send_ct - initiate a Generic Service request (FC-GS) * @wka_port: pointer to zfcp WKA port to send CT/GS to - * @ct: pointer to struct zfcp_send_ct with data for request + * @ct: pointer to struct zfcp_fsf_ct_els with data for CT request * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req * @timeout: timeout that hardware should use, and a later software timeout */ @@ -1316,7 +1316,7 @@ static void zfcp_fsf_send_els_handler(struct zfcp_fsf_req *req) * zfcp_fsf_send_els - initiate an ELS command (FC-FS) * @adapter: pointer to zfcp adapter * @d_id: N_Port_ID to send ELS to - * @els: pointer to struct zfcp_send_els with data for the command + * @els: pointer to struct zfcp_fsf_ct_els with data for the ELS command * @timeout: timeout that hardware should use, and a later software timeout */ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id, From 32574fe6e19d3018a27e8003b1a75be2af584dae Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Thu, 5 Dec 2024 15:19:31 +0100 Subject: [PATCH 5/8] scsi: zfcp: Clarify zfcp_port refcount ownership during "link" test Reviewed-by: Benjamin Block Signed-off-by: Steffen Maier Signed-off-by: Nihar Panda Link: https://lore.kernel.org/r/20241205141932.1227039-3-niharp@linux.ibm.com Signed-off-by: Martin K. Petersen --- drivers/s390/scsi/zfcp_fc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index d6516ab00437..1d50f463afe7 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -537,6 +537,11 @@ static void zfcp_fc_adisc_handler(void *data) /* port is still good, nothing to do */ out: atomic_andnot(ZFCP_STATUS_PORT_LINK_TEST, &port->status); + /* + * port ref comes from get_device() in zfcp_fc_test_link() and + * work item zfcp_fc_link_test_work() passes ref via + * zfcp_fc_adisc() to here, if zfcp_fc_adisc() could send ADISC + */ put_device(&port->dev); kmem_cache_free(zfcp_fc_req_cache, fc_req); } @@ -603,7 +608,7 @@ void zfcp_fc_link_test_work(struct work_struct *work) retval = zfcp_fc_adisc(port); if (retval == 0) - return; + return; /* port ref passed to zfcp_fc_adisc(), no put here */ /* send of ADISC was not possible */ atomic_andnot(ZFCP_STATUS_PORT_LINK_TEST, &port->status); From bd55f56188caf170d6dbdc04638159bd91d8401b Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Thu, 5 Dec 2024 15:19:32 +0100 Subject: [PATCH 6/8] scsi: MAINTAINERS: Update zfcp entry Nihar takes over the zfcp maintainer work. Update the MAINTAINERS entry accordingly. Signed-off-by: Steffen Maier Acked-by: Steffen Maier Acked-by: Benjamin Block Acked-by: Nihar Panda Signed-off-by: Nihar Panda Link: https://lore.kernel.org/r/20241205141932.1227039-4-niharp@linux.ibm.com Signed-off-by: Martin K. Petersen --- MAINTAINERS | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1e930c7a58b1..463c213815c2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20656,8 +20656,7 @@ F: arch/s390/include/uapi/asm/zcrypt.h F: drivers/s390/crypto/ S390 ZFCP DRIVER -M: Steffen Maier -M: Benjamin Block +M: Nihar Panda L: linux-s390@vger.kernel.org S: Supported F: drivers/s390/scsi/zfcp_* From 6cb7063feb2eff2e52dc9624b2193a1f4cad69bf Mon Sep 17 00:00:00 2001 From: Michael Kelley Date: Wed, 2 Oct 2024 20:53:32 -0700 Subject: [PATCH 7/8] scsi: storvsc: Don't assume cpu_possible_mask is dense Current code allocates the stor_chns array with size num_possible_cpus(). This code assumes cpu_possible_mask is dense, which is not true in the general case per [1]. If cpu_possible_mask is sparse, the array might be indexed by a value beyond the size of the array. However, the configurations that Hyper-V provides to guest VMs on x86 and ARM64 hardware, in combination with how architecture specific code assigns Linux CPU numbers, *does* always produce a dense cpu_possible_mask. So the dense assumption is not currently causing failures. But for robustness against future changes in how cpu_possible_mask is populated, update the code to no longer assume dense. The correct approach is to allocate and initialize the array using size "nr_cpu_ids". While this leaves unused array entries corresponding to holes in cpu_possible_mask, the holes are assumed to be minimal and hence the amount of memory wasted by unused entries is minimal. [1] https://lore.kernel.org/lkml/SN6PR02MB4157210CC36B2593F8572E5ED4692@SN6PR02MB4157.namprd02.prod.outlook.com/ Signed-off-by: Michael Kelley Link: https://lore.kernel.org/r/20241003035333.49261-5-mhklinux@outlook.com Acked-by: Peter Zijlstra (Intel) Signed-off-by: Martin K. Petersen --- drivers/scsi/storvsc_drv.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index eab32abf1f49..5e3727e432d5 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -915,14 +915,13 @@ static int storvsc_channel_init(struct hv_device *device, bool is_fc) /* * Allocate state to manage the sub-channels. - * We allocate an array based on the numbers of possible CPUs - * (Hyper-V does not support cpu online/offline). - * This Array will be sparseley populated with unique - * channels - primary + sub-channels. - * We will however populate all the slots to evenly distribute - * the load. + * We allocate an array based on the number of CPU ids. This array + * is initially sparsely populated for the CPUs assigned to channels: + * primary + sub-channels. As I/Os are initiated by different CPUs, + * the slots for all online CPUs are populated to evenly distribute + * the load across all channels. */ - stor_device->stor_chns = kcalloc(num_possible_cpus(), sizeof(void *), + stor_device->stor_chns = kcalloc(nr_cpu_ids, sizeof(void *), GFP_KERNEL); if (stor_device->stor_chns == NULL) return -ENOMEM; From c9a71ca13f71bf0d32664a1e7d1f00378811d59c Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Sat, 7 Dec 2024 17:48:28 +0100 Subject: [PATCH 8/8] scsi: Constify struct pci_device_id 'struct pci_device_id' is not modified in these drivers. Constifying this structure moves some data to a read-only section, so increase overall security. On a x86_64, with allmodconfig, as an example: Before: ====== text data bss dec hex filename 70237 9137 320 79694 1374e drivers/scsi/3w-9xxx.o After: ===== text data bss dec hex filename 70461 8913 320 79694 1374e drivers/scsi/3w-9xxx.o Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/fc61b1946488c1ea8f7a17a06cf40fbd05dcc6de.1733590049.git.christophe.jaillet@wanadoo.fr Signed-off-by: Martin K. Petersen --- drivers/scsi/3w-9xxx.c | 2 +- drivers/scsi/3w-sas.c | 2 +- drivers/scsi/3w-xxxx.c | 2 +- drivers/scsi/BusLogic.c | 2 +- drivers/scsi/a100u2w.c | 2 +- drivers/scsi/advansys.c | 2 +- drivers/scsi/am53c974.c | 2 +- drivers/scsi/arcmsr/arcmsr_hba.c | 2 +- drivers/scsi/atp870u.c | 2 +- drivers/scsi/cxlflash/main.c | 2 +- drivers/scsi/dc395x.c | 2 +- drivers/scsi/dmx3191d.c | 2 +- drivers/scsi/elx/efct/efct_driver.c | 2 +- drivers/scsi/fdomain_pci.c | 2 +- drivers/scsi/fnic/fnic_main.c | 2 +- drivers/scsi/hptiop.c | 2 +- drivers/scsi/initio.c | 2 +- drivers/scsi/ipr.c | 2 +- drivers/scsi/megaraid.c | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 2 +- drivers/scsi/megaraid/megaraid_sas_base.c | 2 +- drivers/scsi/mvsas/mv_init.c | 2 +- drivers/scsi/nsp32.c | 2 +- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pmcraid.c | 2 +- drivers/scsi/qedi/qedi_main.c | 2 +- drivers/scsi/qla1280.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 2 +- drivers/scsi/qla4xxx/ql4_os.c | 2 +- drivers/scsi/snic/snic_main.c | 2 +- drivers/scsi/stex.c | 2 +- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index 97bcdf84386d..883d4a12a172 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c @@ -2261,7 +2261,7 @@ static int __maybe_unused twa_resume(struct device *dev) } /* End twa_resume() */ /* PCI Devices supported by this driver */ -static struct pci_device_id twa_pci_tbl[] = { +static const struct pci_device_id twa_pci_tbl[] = { { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_9550SX, diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index 8ed7126d82bb..9b6eab3b1e4d 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -1822,7 +1822,7 @@ static int __maybe_unused twl_resume(struct device *dev) } /* End twl_resume() */ /* PCI Devices supported by this driver */ -static struct pci_device_id twl_pci_tbl[] = { +static const struct pci_device_id twl_pci_tbl[] = { { PCI_VDEVICE(3WARE, PCI_DEVICE_ID_3WARE_9750) }, { } }; diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index 82fb9dc8dac9..89bd56f78ef9 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c @@ -2393,7 +2393,7 @@ static void tw_remove(struct pci_dev *pdev) } /* End tw_remove() */ /* PCI Devices supported by this driver */ -static struct pci_device_id tw_pci_tbl[] = { +static const struct pci_device_id tw_pci_tbl[] = { { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_1000, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_3WARE, PCI_DEVICE_ID_3WARE_7000, diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c index d04b5feec2eb..1f100270cd38 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -3716,7 +3716,7 @@ static void __exit blogic_exit(void) __setup("BusLogic=", blogic_setup); #ifdef MODULE -/*static struct pci_device_id blogic_pci_tbl[] = { +/*static const struct pci_device_id blogic_pci_tbl[] = { { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index b95147fb18b0..a8979f9e30ff 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c @@ -1206,7 +1206,7 @@ static void inia100_remove_one(struct pci_dev *pdev) scsi_host_put(shost); } -static struct pci_device_id inia100_pci_tbl[] = { +static const struct pci_device_id inia100_pci_tbl[] = { {PCI_VENDOR_ID_INIT, 0x1060, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0,} }; diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 8fededa1a751..3a2c336307c0 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -11409,7 +11409,7 @@ static struct eisa_driver advansys_eisa_driver = { }; /* PCI Devices supported by this driver */ -static struct pci_device_id advansys_pci_tbl[] = { +static const struct pci_device_id advansys_pci_tbl[] = { {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940, diff --git a/drivers/scsi/am53c974.c b/drivers/scsi/am53c974.c index fbb29dbb1e50..003e61831e33 100644 --- a/drivers/scsi/am53c974.c +++ b/drivers/scsi/am53c974.c @@ -513,7 +513,7 @@ static void pci_esp_remove_one(struct pci_dev *pdev) scsi_host_put(esp->host); } -static struct pci_device_id am53c974_pci_tbl[] = { +static const struct pci_device_id am53c974_pci_tbl[] = { { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SCSI, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, { } diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 6a32e3e0d516..b76f241862e9 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -172,7 +172,7 @@ static const struct scsi_host_template arcmsr_scsi_host_template = { .no_write_same = 1, }; -static struct pci_device_id arcmsr_device_id_table[] = { +static const struct pci_device_id arcmsr_device_id_table[] = { {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1110), .driver_data = ACB_ADAPTER_TYPE_A}, {PCI_DEVICE(PCI_VENDOR_ID_ARECA, PCI_DEVICE_ID_ARECA_1120), diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index 928151ec927a..401242912855 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -1743,7 +1743,7 @@ static const struct scsi_host_template atp870u_template = { .max_sectors = ATP870U_MAX_SECTORS, }; -static struct pci_device_id atp870u_id_table[] = { +static const struct pci_device_id atp870u_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP885_DEVID) }, { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID1) }, { PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID2) }, diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 60d62b93d624..76073a71c028 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c @@ -3177,7 +3177,7 @@ static struct dev_dependent_vals dev_briard_vals = { CXLFLASH_MAX_SECTORS, /* * PCI device binding table */ -static struct pci_device_id cxlflash_pci_table[] = { +static const struct pci_device_id cxlflash_pci_table[] = { {PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CORSA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (kernel_ulong_t)&dev_corsa_vals}, {PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_FLASH_GT, diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 235ebc851ca9..e71de2419758 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -4668,7 +4668,7 @@ static void dc395x_remove_one(struct pci_dev *dev) } -static struct pci_device_id dc395x_pci_table[] = { +static const struct pci_device_id dc395x_pci_table[] = { { .vendor = PCI_VENDOR_ID_TEKRAM, .device = PCI_DEVICE_ID_TEKRAM_TRMS1040, diff --git a/drivers/scsi/dmx3191d.c b/drivers/scsi/dmx3191d.c index dfb091d34363..d6d091b2f3c7 100644 --- a/drivers/scsi/dmx3191d.c +++ b/drivers/scsi/dmx3191d.c @@ -127,7 +127,7 @@ static void dmx3191d_remove_one(struct pci_dev *pdev) pci_disable_device(pdev); } -static struct pci_device_id dmx3191d_pci_tbl[] = { +static const struct pci_device_id dmx3191d_pci_tbl[] = { {PCI_VENDOR_ID_DOMEX, PCI_DEVICE_ID_DOMEX_DMX3191D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, { } diff --git a/drivers/scsi/elx/efct/efct_driver.c b/drivers/scsi/elx/efct/efct_driver.c index 55d2301bfd7d..8469c156ab33 100644 --- a/drivers/scsi/elx/efct/efct_driver.c +++ b/drivers/scsi/elx/efct/efct_driver.c @@ -470,7 +470,7 @@ efct_setup_msix(struct efct *efct, u32 num_intrs) return rc; } -static struct pci_device_id efct_pci_table[] = { +static const struct pci_device_id efct_pci_table[] = { {PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G6), 0}, {PCI_DEVICE(EFCT_VENDOR_ID, EFCT_DEVICE_LANCER_G7), 0}, {} /* terminate list */ diff --git a/drivers/scsi/fdomain_pci.c b/drivers/scsi/fdomain_pci.c index 3e05ce7b89e5..c15b2ce76e9f 100644 --- a/drivers/scsi/fdomain_pci.c +++ b/drivers/scsi/fdomain_pci.c @@ -47,7 +47,7 @@ static void fdomain_pci_remove(struct pci_dev *pdev) pci_disable_device(pdev); } -static struct pci_device_id fdomain_pci_table[] = { +static const struct pci_device_id fdomain_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_FD, PCI_DEVICE_ID_FD_36C70) }, {} }; diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index a6b667054792..6772f3683a8c 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(fnic_list_lock); static DEFINE_IDA(fnic_ida); /* Supported devices by fnic module */ -static struct pci_device_id fnic_id_table[] = { +static const struct pci_device_id fnic_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_CISCO, PCI_DEVICE_ID_CISCO_FNIC) }, { 0, } }; diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index 55eee5b0f0d7..21f1d9871a33 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -1634,7 +1634,7 @@ static struct hptiop_adapter_ops hptiop_mvfrey_ops = { .host_phy_flag = cpu_to_le64(1), }; -static struct pci_device_id hptiop_id_table[] = { +static const struct pci_device_id hptiop_id_table[] = { { PCI_VDEVICE(TTI, 0x3220), (kernel_ulong_t)&hptiop_itl_ops }, { PCI_VDEVICE(TTI, 0x3320), (kernel_ulong_t)&hptiop_itl_ops }, { PCI_VDEVICE(TTI, 0x3410), (kernel_ulong_t)&hptiop_itl_ops }, diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c index 625fd547ee60..8648bd965287 100644 --- a/drivers/scsi/initio.c +++ b/drivers/scsi/initio.c @@ -2941,7 +2941,7 @@ static void initio_remove_one(struct pci_dev *pdev) MODULE_LICENSE("GPL"); -static struct pci_device_id initio_pci_tbl[] = { +static const struct pci_device_id initio_pci_tbl[] = { {PCI_VENDOR_ID_INIT, 0x9500, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_INIT, 0x9400, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_INIT, 0x9401, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index f0444faf776a..1ea528f5d23d 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -9844,7 +9844,7 @@ static void ipr_shutdown(struct pci_dev *pdev) } } -static struct pci_device_id ipr_pci_table[] = { +static const struct pci_device_id ipr_pci_table[] = { { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_5702, 0, 0, 0 }, { PCI_VENDOR_ID_MYLEX, PCI_DEVICE_ID_IBM_GEMSTONE, diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 38976f94453e..adab151663dd 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c @@ -4551,7 +4551,7 @@ megaraid_shutdown(struct pci_dev *pdev) __megaraid_shutdown(adapter); } -static struct pci_device_id megaraid_pci_tbl[] = { +static const struct pci_device_id megaraid_pci_tbl[] = { {PCI_VENDOR_ID_AMI, PCI_DEVICE_ID_AMI_MEGARAID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_AMI, PCI_DEVICE_ID_AMI_MEGARAID2, diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index 9463f11cc4c8..60cc3372991f 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c @@ -199,7 +199,7 @@ MODULE_PARM_DESC(debug_level, "Debug level for driver (default=0)"); /* * PCI table for all supported controllers. */ -static struct pci_device_id pci_id_table_g[] = { +static const struct pci_device_id pci_id_table_g[] = { { PCI_VENDOR_ID_DELL, PCI_DEVICE_ID_PERC4_DI_DISCOVERY, diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 9739f389b1d0..b59713130a52 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -147,7 +147,7 @@ megasas_set_ld_removed_by_fw(struct megasas_instance *instance); /* * PCI ID table for all supported controllers */ -static struct pci_device_id megasas_pci_table[] = { +static const struct pci_device_id megasas_pci_table[] = { {PCI_DEVICE(PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_SAS1064R)}, /* xscale IOP */ diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 020037cbf0d9..2c72da6b8cf0 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c @@ -609,7 +609,7 @@ static void mvs_pci_remove(struct pci_dev *pdev) return; } -static struct pci_device_id mvs_pci_table[] = { +static const struct pci_device_id mvs_pci_table[] = { { PCI_VDEVICE(MARVELL, 0x6320), chip_6320 }, { PCI_VDEVICE(MARVELL, 0x6340), chip_6440 }, { diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c index b7987019686e..abc4ce9eae74 100644 --- a/drivers/scsi/nsp32.c +++ b/drivers/scsi/nsp32.c @@ -66,7 +66,7 @@ static const char *nsp32_release_version = "1.2"; /**************************************************************************** * Supported hardware */ -static struct pci_device_id nsp32_pci_table[] = { +static const struct pci_device_id nsp32_pci_table[] = { { .vendor = PCI_VENDOR_ID_IODATA, .device = PCI_DEVICE_ID_NINJASCSI_32BI_CBSC_II, diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index f8c81e53e93f..c32ceeba7ccb 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -1435,7 +1435,7 @@ static int __maybe_unused pm8001_pci_resume(struct device *dev) /* update of pci device, vendor id and driver data with * unique value for each of the controller */ -static struct pci_device_id pm8001_pci_table[] = { +static const struct pci_device_id pm8001_pci_table[] = { { PCI_VDEVICE(PMC_Sierra, 0x8001), chip_8001 }, { PCI_VDEVICE(PMC_Sierra, 0x8006), chip_8006 }, { PCI_VDEVICE(ADAPTEC2, 0x8006), chip_8006 }, diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index 2342ded7ee78..3ba53916fd86 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -113,7 +113,7 @@ static struct pmcraid_chip_details pmcraid_chip_cfg[] = { /* * PCI device ids supported by pmcraid driver */ -static struct pci_device_id pmcraid_pci_table[] = { +static const struct pci_device_id pmcraid_pci_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_PMC, PCI_DEVICE_ID_PMC_MAXRAID), 0, 0, (kernel_ulong_t)&pmcraid_chip_cfg[0] }, diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index 628d59dda20c..1cab66a1f4f6 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2869,7 +2869,7 @@ static void qedi_remove(struct pci_dev *pdev) __qedi_remove(pdev, QEDI_MODE_NORMAL); } -static struct pci_device_id qedi_pci_tbl[] = { +static const struct pci_device_id qedi_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, 0x165E) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, 0x8084) }, { 0 }, diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 360867838abd..1fd2da0264e3 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -501,7 +501,7 @@ struct qla_boards { }; /* NOTE: the last argument in each entry is used to index ql1280_board_tbl */ -static struct pci_device_id qla1280_pci_tbl[] = { +static const struct pci_device_id qla1280_pci_tbl[] = { {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP12160, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP1020, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 6b7388cfc55e..056e6daff8a9 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -8115,7 +8115,7 @@ static const struct pci_error_handlers qla2xxx_err_handler = { .reset_done = qla_pci_reset_done, }; -static struct pci_device_id qla2xxx_pci_tbl[] = { +static const struct pci_device_id qla2xxx_pci_tbl[] = { { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2200) }, { PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2300) }, diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 863071f80d39..062ec5f24758 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -9846,7 +9846,7 @@ static const struct pci_error_handlers qla4xxx_err_handler = { .resume = qla4xxx_pci_resume, }; -static struct pci_device_id qla4xxx_pci_tbl[] = { +static const struct pci_device_id qla4xxx_pci_tbl[] = { { .vendor = PCI_VENDOR_ID_QLOGIC, .device = PCI_DEVICE_ID_QLOGIC_ISP4010, diff --git a/drivers/scsi/snic/snic_main.c b/drivers/scsi/snic/snic_main.c index d3cf50088a37..1c24517e4e65 100644 --- a/drivers/scsi/snic/snic_main.c +++ b/drivers/scsi/snic/snic_main.c @@ -21,7 +21,7 @@ #define PCI_DEVICE_ID_CISCO_SNIC 0x0046 /* Supported devices by snic module */ -static struct pci_device_id snic_id_table[] = { +static const struct pci_device_id snic_id_table[] = { {PCI_DEVICE(0x1137, PCI_DEVICE_ID_CISCO_SNIC) }, { 0, } /* end of table */ }; diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 0e5c7609dcc4..63ed7f9aaa93 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -1488,7 +1488,7 @@ static const struct scsi_host_template driver_template = { .dma_boundary = PAGE_SIZE - 1, }; -static struct pci_device_id stex_pci_tbl[] = { +static const struct pci_device_id stex_pci_tbl[] = { /* st_shasta */ { 0x105a, 0x8350, PCI_ANY_ID, PCI_ANY_ID, 0, 0, st_shasta }, /* SuperTrak EX8350/8300/16350/16300 */ diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 9b8cb7319370..212d89d0d23e 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -2031,7 +2031,7 @@ static struct spi_function_template sym2_transport_functions = { .get_signalling = sym2_get_signalling, }; -static struct pci_device_id sym2_id_table[] = { +static const struct pci_device_id sym2_id_table[] = { { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C820,