summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'pci-v6.10-changes' of ↵Linus Torvalds2024-05-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci Pull pci updates from Bjorn Helgaas: "Enumeration: - Skip E820 checks for MCFG ECAM regions for new (2016+) machines, since there's no requirement to describe them in E820 and some platforms require ECAM to work (Bjorn Helgaas) - Rename PCI_IRQ_LEGACY to PCI_IRQ_INTX to be more specific (Damien Le Moal) - Remove last user and pci_enable_device_io() (Heiner Kallweit) - Wait for Link Training==0 to avoid possible race (Ilpo Järvinen) - Skip waiting for devices that have been disconnected while suspended (Ilpo Järvinen) - Clear Secondary Status errors after enumeration since Master Aborts and Unsupported Request errors are an expected part of enumeration (Vidya Sagar) MSI: - Remove unused IMS (Interrupt Message Store) support (Bjorn Helgaas) Error handling: - Mask Genesys GL975x SD host controller Replay Timer Timeout correctable errors caused by a hardware defect; the errors cause interrupts that prevent system suspend (Kai-Heng Feng) - Fix EDR-related _DSM support, which previously evaluated revision 5 but assumed revision 6 behavior (Kuppuswamy Sathyanarayanan) ASPM: - Simplify link state definitions and mask calculation (Ilpo Järvinen) Power management: - Avoid D3cold for HP Pavilion 17 PC/1972 PCIe Ports, where BIOS apparently doesn't know how to put them back in D0 (Mario Limonciello) CXL: - Support resetting CXL devices; special handling required because CXL Ports mask Secondary Bus Reset by default (Dave Jiang) DOE: - Support DOE Discovery Version 2 (Alexey Kardashevskiy) Endpoint framework: - Set endpoint BAR to be 64-bit if the driver says that's all the device supports, in addition to doing so if the size is >2GB (Niklas Cassel) - Simplify endpoint BAR allocation and setting interfaces (Niklas Cassel) Cadence PCIe controller driver: - Drop DT binding redundant msi-parent and pci-bus.yaml (Krzysztof Kozlowski) Cadence PCIe endpoint driver: - Configure endpoint BARs to be 64-bit based on the BAR type, not the BAR value (Niklas Cassel) Freescale Layerscape PCIe controller driver: - Convert DT binding to YAML (Frank Li) MediaTek MT7621 PCIe controller driver: - Add DT binding missing 'reg' property for child Root Ports (Krzysztof Kozlowski) - Fix theoretical string truncation in PHY name (Sergio Paracuellos) NVIDIA Tegra194 PCIe controller driver: - Return success for endpoint probe instead of falling through to the failure path (Vidya Sagar) Renesas R-Car PCIe controller driver: - Add DT binding missing IOMMU properties (Geert Uytterhoeven) - Add DT binding R-Car V4H compatible for host and endpoint mode (Yoshihiro Shimoda) Rockchip PCIe controller driver: - Configure endpoint BARs to be 64-bit based on the BAR type, not the BAR value (Niklas Cassel) - Add DT binding missing maxItems to ep-gpios (Krzysztof Kozlowski) - Set the Subsystem Vendor ID, which was previously zero because it was masked incorrectly (Rick Wertenbroek) Synopsys DesignWare PCIe controller driver: - Restructure DBI register access to accommodate devices where this requires Refclk to be active (Manivannan Sadhasivam) - Remove the deinit() callback, which was only need by the pcie-rcar-gen4, and do it directly in that driver (Manivannan Sadhasivam) - Add dw_pcie_ep_cleanup() so drivers that support PERST# can clean up things like eDMA (Manivannan Sadhasivam) - Rename dw_pcie_ep_exit() to dw_pcie_ep_deinit() to make it parallel to dw_pcie_ep_init() (Manivannan Sadhasivam) - Rename dw_pcie_ep_init_complete() to dw_pcie_ep_init_registers() to reflect the actual functionality (Manivannan Sadhasivam) - Call dw_pcie_ep_init_registers() directly from all the glue drivers, not just those that require active Refclk from the host (Manivannan Sadhasivam) - Remove the "core_init_notifier" flag, which was an obscure way for glue drivers to indicate that they depend on Refclk from the host (Manivannan Sadhasivam) TI J721E PCIe driver: - Add DT binding J784S4 SoC Device ID (Siddharth Vadapalli) - Add DT binding J722S SoC support (Siddharth Vadapalli) TI Keystone PCIe controller driver: - Add DT binding missing num-viewport, phys and phy-name properties (Jan Kiszka) Miscellaneous: - Constify and annotate with __ro_after_init (Heiner Kallweit) - Convert DT bindings to YAML (Krzysztof Kozlowski) - Check for kcalloc() failure in of_pci_prop_intr_map() (Duoming Zhou)" * tag 'pci-v6.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: (97 commits) PCI: Do not wait for disconnected devices when resuming x86/pci: Skip early E820 check for ECAM region PCI: Remove unused pci_enable_device_io() ata: pata_cs5520: Remove unnecessary call to pci_enable_device_io() PCI: Update pci_find_capability() stub return types PCI: Remove PCI_IRQ_LEGACY scsi: vmw_pvscsi: Do not use PCI_IRQ_LEGACY instead of PCI_IRQ_LEGACY scsi: pmcraid: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY scsi: mpt3sas: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY scsi: megaraid_sas: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY scsi: ipr: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY scsi: hpsa: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY scsi: arcmsr: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY wifi: rtw89: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACY dt-bindings: PCI: rockchip,rk3399-pcie: Add missing maxItems to ep-gpios Revert "genirq/msi: Provide constants for PCI/IMS support" Revert "x86/apic/msi: Enable PCI/IMS" Revert "iommu/vt-d: Enable PCI/IMS" Revert "iommu/amd: Enable PCI/IMS" Revert "PCI/MSI: Provide IMS (Interrupt Message Store) support" ...
| * scsi: pmcraid: Use PCI_IRQ_INTX instead of PCI_IRQ_LEGACYDamien Le Moal2024-05-161-1/+1
| | | | | | | | | | | | | | | | | | Use the macro PCI_IRQ_INTX instead of the deprecated PCI_IRQ_LEGACY macro. Link: https://lore.kernel.org/r/20240325070944.3600338-27-dlemoal@kernel.org Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
* | scsi: pmcraid: Switch to using ->device_configureChristoph Hellwig2024-04-111-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Switch to the ->device_configure method instead of ->slave_configure and update the block limits on the passed in queue_limits instead of using the per-limit accessors. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20240409143748.980206-17-hch@lst.de Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | scsi: pmcraid: Make pmcraid_class constantRicardo B. Marliere2024-03-101-9/+11
|/ | | | | | | | | | | | | | Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the pmcraid_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240302-class_cleanup-scsi-v1-2-b9096b990e27@marliere.net Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Add missing scsi_device_put() in ↵Hannes Reinecke2023-10-241-3/+6
| | | | | | | | | | | | | pmcraid_eh_target_reset_handler() When breaking out of an shost_for_each_device() loop one needs to do an explicit scsi_device_put(). Fixes: c2a14ab3b9b3 ("scsi: pmcraid: Select device in pmcraid_eh_target_reset_handler()") Signed-off-by: Hannes Reinecke <hare@suse.de> Link: https://lore.kernel.org/r/20231023072957.20191-1-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Fix kernel-doc commentYang Li2023-10-241-1/+1
| | | | | | | | | | | | | Fix kernel-doc comment to silence the warnings: drivers/scsi/pmcraid.c:2697: warning: Excess function parameter 'scsi_cmd' description in 'pmcraid_reset_device' drivers/scsi/pmcraid.c:2697: warning: Function parameter or member 'scsi_dev' not described in 'pmcraid_reset_device' Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6843 Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://lore.kernel.org/r/20231017025853.67562-1-yang.lee@linux.alibaba.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Select device in pmcraid_eh_target_reset_handler()Hannes Reinecke2023-10-131-2/+14
| | | | | | | | | | | The reset code requires a device to be selected, but we shouldn't rely on the command to provide a device for us. So select the first device on the target when sending down a target reset. Signed-off-by: Hannes Reinecke <hare@suse.de> Link: https://lore.kernel.org/r/20231002154328.43718-18-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Select device in pmcraid_eh_bus_reset_handler()Hannes Reinecke2023-10-131-8/+38
| | | | | | | | | | | The reset code requires a device to be selected, but we shouldn't rely on the command to provide a device for us. So select the first device on the bus when sending down a bus reset. Signed-off-by: Hannes Reinecke <hare@suse.de> Link: https://lore.kernel.org/r/20231002154328.43718-17-hare@suse.de Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Use pci_dev_id() to simplify the codeZheng Zengkai2023-08-211-2/+1
| | | | | | | | | | PCI core API pci_dev_id() can be used to get the BDF number for a PCI device. We don't need to compose it manually. Use pci_dev_id() to simplify the code a little bit. Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> Link: https://lore.kernel.org/r/20230811111310.32364-1-zhengzengkai@huawei.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* Merge tag 'driver-core-6.4-rc1' of ↵Linus Torvalds2023-04-271-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the large set of driver core changes for 6.4-rc1. Once again, a busy development cycle, with lots of changes happening in the driver core in the quest to be able to move "struct bus" and "struct class" into read-only memory, a task now complete with these changes. This will make the future rust interactions with the driver core more "provably correct" as well as providing more obvious lifetime rules for all busses and classes in the kernel. The changes required for this did touch many individual classes and busses as many callbacks were changed to take const * parameters instead. All of these changes have been submitted to the various subsystem maintainers, giving them plenty of time to review, and most of them actually did so. Other than those changes, included in here are a small set of other things: - kobject logging improvements - cacheinfo improvements and updates - obligatory fw_devlink updates and fixes - documentation updates - device property cleanups and const * changes - firwmare loader dependency fixes. All of these have been in linux-next for a while with no reported problems" * tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (120 commits) device property: make device_property functions take const device * driver core: update comments in device_rename() driver core: Don't require dynamic_debug for initcall_debug probe timing firmware_loader: rework crypto dependencies firmware_loader: Strip off \n from customized path zram: fix up permission for the hot_add sysfs file cacheinfo: Add use_arch[|_cache]_info field/function arch_topology: Remove early cacheinfo error message if -ENOENT cacheinfo: Check cache properties are present in DT cacheinfo: Check sib_leaf in cache_leaves_are_shared() cacheinfo: Allow early level detection when DT/ACPI info is missing/broken cacheinfo: Add arm64 early level initializer implementation cacheinfo: Add arch specific early level initializer tty: make tty_class a static const structure driver core: class: remove struct class_interface * from callbacks driver core: class: mark the struct class in struct class_interface constant driver core: class: make class_register() take a const * driver core: class: mark class_release() as taking a const * driver core: remove incorrect comment for device_create* MIPS: vpe-cmp: remove module owner pointer from struct class usage. ...
| * driver core: class: remove module * from class_create()Greg Kroah-Hartman2023-03-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The module pointer in class_create() never actually did anything, and it shouldn't have been requred to be set as a parameter even if it did something. So just remove it and fix up all callers of the function in the kernel tree at the same time. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Link: https://lore.kernel.org/r/20230313181843.1207845-4-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | scsi: pmcraid: Declare SCSI host template constBart Van Assche2023-03-241-1/+1
|/ | | | | | | | Make it explicit that the SCSI host template is not modified. Signed-off-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230322195515.1267197-64-bvanassche@acm.org Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Fix missing resource cleanup in error caseChengguang Xu2022-06-071-1/+1
| | | | | | | | | | Fix missing resource cleanup (when '(--i) == 0') for error case in pmcraid_register_interrupt_handler(). Link: https://lore.kernel.org/r/20220529153456.4183738-6-cgxu519@mykernel.net Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Fix typo in commentJulia Lawall2022-05-231-1/+1
| | | | | | | | | Spelling mistake (triple letters) in comment. Detected with the help of Coccinelle. Link: https://lore.kernel.org/r/20220521111145.81697-89-Julia.Lawall@inria.fr Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Remove unneeded semicolonJiapeng Chong2022-04-181-1/+1
| | | | | | | | | | | Fix the following coccicheck warning: ./drivers/scsi/pmcraid.c:4593:2-3: Unneeded semicolon. Link: https://lore.kernel.org/r/20220401030640.28246-1-jiapeng.chong@linux.alibaba.com Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Remove the PMCRAID_PASSTHROUGH_IOCTL ioctl implementationChristophe JAILLET2022-03-291-491/+0
| | | | | | | | | | | | | | | | | | | The whole passthrough ioctl path looks completely broken. For example it DMA maps the scatterlist and after that copies data to it, which is prohibited by the DMA API contract. Moreover, in pmcraid_alloc_sglist(), the pointer returned by a sgl_alloc_order() call is not recorded anywhere which is pointless. So remove the PMCRAID_PASSTHROUGH_IOCTL ioctl implementation entirely. Should it be needed, we should reimplement it using the proper block layer request mapping helpers. Link: https://lore.kernel.org/r/7f27a70bec3f3dcaf46a29b1c630edd4792e71c0.1648298857.git.christophe.jaillet@wanadoo.fr Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Don't use GFP_DMA in pmcraid_alloc_sglist()Christoph Hellwig2021-12-221-2/+2
| | | | | | | | | The driver doesn't express DMA addressing limitation under 32-bits anywhere else, so remove the spurious GFP_DMA allocation. Link: https://lore.kernel.org/r/20211222092247.928711-1-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Fix a kernel-doc warningBart Van Assche2021-11-291-1/+0
| | | | | | | | | | | Fix the following kernel-doc warning: drivers/scsi/pmcraid.c:3317: warning: Excess function parameter 'done' description in 'pmcraid_queuecommand_lck' Link: https://lore.kernel.org/r/20211129194609.3466071-12-bvanassche@acm.org Fixes: af049dfd0b10 ("scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Switch to attribute groupsBart Van Assche2021-10-161-5/+6
| | | | | | | | | struct device supports attribute groups directly but does not support struct device_attribute directly. Hence switch to attribute groups. Link: https://lore.kernel.org/r/20211012233558.4066756-37-bvanassche@acm.org Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functionsBart Van Assche2021-10-161-4/+1
| | | | | | | | | | | | The DEF_SCSI_QCMD() macro passes the addresses of the SCSI host lock and also that of the scsi_done function to the queuecommand_lck() function implementations. Remove the 'scsi_done' argument since its address is now a constant and instead call 'scsi_done' directly from inside the queuecommand_lck() functions. Link: https://lore.kernel.org/r/20211007204618.2196847-14-bvanassche@acm.org Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Call scsi_done() directlyBart Van Assche2021-10-161-6/+5
| | | | | | | | | Conditional statements are faster than indirect calls. Hence call scsi_done() directly. Link: https://lore.kernel.org/r/20211007202923.2174984-61-bvanassche@acm.org Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Correct function name pmcraid_show_adapter_id() in headerLee Jones2021-03-181-1/+1
| | | | | | | | | | | | | | Fixes the following W=1 kernel build warning(s): drivers/scsi/pmcraid.c:4079: warning: expecting prototype for pmcraid_show_io_adapter_id(). Prototype was for pmcraid_show_adapter_id() instead Link: https://lore.kernel.org/r/20210317091230.2912389-14-lee.jones@linaro.org Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Fix a whole host of kernel-doc issuesLee Jones2021-03-181-35/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes the following W=1 kernel build warning(s): drivers/scsi/pmcraid.c:455: warning: Function parameter or member 'intrs' not described in 'pmcraid_enable_interrupts' drivers/scsi/pmcraid.c:455: warning: Excess function parameter 'intr' description in 'pmcraid_enable_interrupts' drivers/scsi/pmcraid.c:543: warning: Function parameter or member '' not described in 'pmcraid_ioa_reset' drivers/scsi/pmcraid.c:543: warning: expecting prototype for pmcraid_bist_done(). Prototype was for pmcraid_ioa_reset() instead drivers/scsi/pmcraid.c:603: warning: Function parameter or member 't' not described in 'pmcraid_reset_alert_done' drivers/scsi/pmcraid.c:603: warning: Excess function parameter 'cmd' description in 'pmcraid_reset_alert_done' drivers/scsi/pmcraid.c:638: warning: Function parameter or member '' not described in 'pmcraid_notify_ioastate' drivers/scsi/pmcraid.c:638: warning: Function parameter or member 'u32' not described in 'pmcraid_notify_ioastate' drivers/scsi/pmcraid.c:638: warning: expecting prototype for pmcraid_reset_alert(). Prototype was for pmcraid_notify_ioastate() instead drivers/scsi/pmcraid.c:687: warning: Function parameter or member 't' not described in 'pmcraid_timeout_handler' drivers/scsi/pmcraid.c:687: warning: Excess function parameter 'cmd' description in 'pmcraid_timeout_handler' drivers/scsi/pmcraid.c:858: warning: expecting prototype for pmcraid_fire_command(). Prototype was for _pmcraid_fire_command() instead drivers/scsi/pmcraid.c:972: warning: Function parameter or member '' not described in 'pmcraid_querycfg' drivers/scsi/pmcraid.c:972: warning: expecting prototype for pmcraid_get_fwversion_done(). Prototype was for pmcraid_querycfg() instead drivers/scsi/pmcraid.c:1398: warning: Function parameter or member 'aen_msg' not described in 'pmcraid_notify_aen' drivers/scsi/pmcraid.c:1398: warning: Function parameter or member 'data_size' not described in 'pmcraid_notify_aen' drivers/scsi/pmcraid.c:1398: warning: Excess function parameter 'type' description in 'pmcraid_notify_aen' drivers/scsi/pmcraid.c:1781: warning: Function parameter or member '' not described in 'pmcraid_initiate_reset' drivers/scsi/pmcraid.c:1781: warning: expecting prototype for pmcraid_process_ldn(). Prototype was for pmcraid_initiate_reset() instead drivers/scsi/pmcraid.c:1887: warning: Function parameter or member '' not described in 'pmcraid_reinit_buffers' drivers/scsi/pmcraid.c:1887: warning: expecting prototype for pmcraid_reset_enable_ioa(). Prototype was for pmcraid_reinit_buffers() instead drivers/scsi/pmcraid.c:2704: warning: Function parameter or member 'timeout' not described in 'pmcraid_reset_device' drivers/scsi/pmcraid.c:3025: warning: expecting prototype for pmcraid_eh_xxxx_reset_handler(). Prototype was for pmcraid_eh_device_reset_handler() instead drivers/scsi/pmcraid.c:3327: warning: expecting prototype for pmcraid_queuecommand(). Prototype was for pmcraid_queuecommand_lck() instead drivers/scsi/pmcraid.c:3437: warning: Function parameter or member 'inode' not described in 'pmcraid_chr_open' drivers/scsi/pmcraid.c:3437: warning: Function parameter or member 'filep' not described in 'pmcraid_chr_open' drivers/scsi/pmcraid.c:3437: warning: expecting prototype for pmcraid_open(). Prototype was for pmcraid_chr_open() instead drivers/scsi/pmcraid.c:3457: warning: Function parameter or member 'fd' not described in 'pmcraid_chr_fasync' drivers/scsi/pmcraid.c:3457: warning: Function parameter or member 'filep' not described in 'pmcraid_chr_fasync' drivers/scsi/pmcraid.c:3457: warning: Function parameter or member 'mode' not described in 'pmcraid_chr_fasync' drivers/scsi/pmcraid.c:3457: warning: expecting prototype for pmcraid_fasync(). Prototype was for pmcraid_chr_fasync() instead drivers/scsi/pmcraid.c:3574: warning: Function parameter or member 'ioctl_cmd' not described in 'pmcraid_ioctl_passthrough' drivers/scsi/pmcraid.c:3574: warning: Function parameter or member 'buflen' not described in 'pmcraid_ioctl_passthrough' drivers/scsi/pmcraid.c:3574: warning: Excess function parameter 'cmd' description in 'pmcraid_ioctl_passthrough' drivers/scsi/pmcraid.c:3905: warning: Function parameter or member 'filep' not described in 'pmcraid_chr_ioctl' drivers/scsi/pmcraid.c:3905: warning: Function parameter or member 'cmd' not described in 'pmcraid_chr_ioctl' drivers/scsi/pmcraid.c:3905: warning: Function parameter or member 'arg' not described in 'pmcraid_chr_ioctl' drivers/scsi/pmcraid.c:3905: warning: expecting prototype for pmcraid_ioctl(). Prototype was for pmcraid_chr_ioctl() instead drivers/scsi/pmcraid.c:3969: warning: cannot understand function prototype: 'const struct file_operations pmcraid_fops = ' drivers/scsi/pmcraid.c:3993: warning: Function parameter or member 'attr' not described in 'pmcraid_show_log_level' drivers/scsi/pmcraid.c:4015: warning: Function parameter or member 'attr' not described in 'pmcraid_store_log_level' drivers/scsi/pmcraid.c:4055: warning: Function parameter or member 'attr' not described in 'pmcraid_show_drv_version' drivers/scsi/pmcraid.c:4081: warning: Function parameter or member 'attr' not described in 'pmcraid_show_adapter_id' drivers/scsi/pmcraid.c:4081: warning: expecting prototype for pmcraid_show_io_adapter_id(). Prototype was for pmcraid_show_adapter_id() instead drivers/scsi/pmcraid.c:4600: warning: Function parameter or member 'pinstance' not described in 'pmcraid_allocate_cmd_blocks' drivers/scsi/pmcraid.c:5153: warning: Function parameter or member 'minor' not described in 'pmcraid_release_minor' Link: https://lore.kernel.org/r/20210317091230.2912389-6-lee.jones@linaro.org Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Use generic power managementVaibhav Gupta2020-11-251-33/+10
| | | | | | | | | | | | | | | | | Drivers should do only device-specific jobs. But in general, drivers using legacy PCI PM framework for .suspend()/.resume() have to manage many PCI PM-related tasks themselves which can be done by PCI Core itself. This brings extra load on the driver and it directly calls PCI helper functions to handle them. Switch to the new generic framework by updating function signatures and define a "struct dev_pm_ops" variable to bind PM callbacks. Also, remove unnecessary calls to the PCI Helper functions along with the legacy .suspend & .resume bindings. Link: https://lore.kernel.org/r/20201102164730.324035-30-vaibhavgupta40@gmail.com Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Drop PCI Wakeup calls from .resumeVaibhav Gupta2020-11-251-1/+0
| | | | | | | | | | | | | | | The driver calls pci_enable_wake(...., false) in pmcraid_resume(), and there is no corresponding pci_enable_wake(...., true) in pmcraid_suspend(). Either it should do enable-wake the device in .suspend() or should not invoke pci_enable_wake() at all. Concluding that this driver doesn't support enable-wake and PCI core calls pci_enable_wake(pci_dev, PCI_D0, false) during resume, drop it from pmcraid_resume(). Link: https://lore.kernel.org/r/20201102164730.324035-29-vaibhavgupta40@gmail.com Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Remove set but not used 'res'Ye Bin2020-09-091-2/+0
| | | | | | | | | | | | | | | This addresses the following gcc warning with "make W=1": drivers/scsi/pmcraid.c: In function ‘pmcraid_abort_cmd’: drivers/scsi/pmcraid.c:2863:33: warning: variable ‘res’ set but not used [-Wunused-but-set-variable] struct pmcraid_resource_entry *res; ^ Link: https://lore.kernel.org/r/20200909082627.101984-2-yebin10@huawei.com Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Ye Bin <yebin10@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Remove superfluous memset()Li Heng2020-08-201-1/+0
| | | | | | | | | | | | Fixes coccicheck warning: ./drivers/scsi/pmcraid.c:4709:3-21: WARNING: dma_alloc_coherent use in pinstance -> hrrq_start [ i ] already zeroes out memory, so memset is not needed dma_alloc_coherent() already zeroes out memory so memset() is not needed. Link: https://lore.kernel.org/r/1596079918-41115-2-git-send-email-liheng40@huawei.com Signed-off-by: Li Heng <liheng40@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Replace dma_pool_malloc with dma_pool_zallocWu Bo2020-04-241-3/+1
| | | | | | | | | Replace dma_pool_malloc with dma_pool_zalloc to make the code more concise in pmcraid_allocate_control_blocks() function. Link: https://lore.kernel.org/r/1587197241-274646-1-git-send-email-wubo40@huawei.com Signed-off-by: Wu Bo <wubo40@huawei.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* compat_ioctl: move more drivers to compat_ptr_ioctlArnd Bergmann2019-10-231-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The .ioctl and .compat_ioctl file operations have the same prototype so they can both point to the same function, which works great almost all the time when all the commands are compatible. One exception is the s390 architecture, where a compat pointer is only 31 bit wide, and converting it into a 64-bit pointer requires calling compat_ptr(). Most drivers here will never run in s390, but since we now have a generic helper for it, it's easy enough to use it consistently. I double-checked all these drivers to ensure that all ioctl arguments are used as pointers or are ignored, but are not interpreted as integer values. Acked-by: Jason Gunthorpe <jgg@mellanox.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: David Sterba <dsterba@suse.com> Acked-by: Darren Hart (VMware) <dvhart@infradead.org> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Acked-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
* scsi: pmcraid: Fix a typo - pcmraid --> pmcraidChristophe JAILLET2019-08-121-1/+1
| | | | | | | This should be 'pmcraid', not 'pcmraid' Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* Merge tag 'scsi-sg' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsiLinus Torvalds2019-07-111-7/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull SCSI scatter-gather list updates from James Bottomley: "This topic branch covers a fundamental change in how our sg lists are allocated to make mq more efficient by reducing the size of the preallocated sg list. This necessitates a large number of driver changes because the previous guarantee that if a driver specified SG_ALL as the size of its scatter list, it would get a non-chained list and didn't need to bother with scatterlist iterators is now broken and every driver *must* use scatterlist iterators. This was broken out as a separate topic because we need to convert all the drivers before pulling the trigger and unconverted drivers kept being found, necessitating a rebase" * tag 'scsi-sg' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (21 commits) scsi: core: don't preallocate small SGL in case of NO_SG_CHAIN scsi: lib/sg_pool.c: clear 'first_chunk' in case of no preallocation scsi: core: avoid preallocating big SGL for data scsi: core: avoid preallocating big SGL for protection information scsi: lib/sg_pool.c: improve APIs for allocating sg pool scsi: esp: use sg helper to iterate over scatterlist scsi: NCR5380: use sg helper to iterate over scatterlist scsi: wd33c93: use sg helper to iterate over scatterlist scsi: ppa: use sg helper to iterate over scatterlist scsi: pcmcia: nsp_cs: use sg helper to iterate over scatterlist scsi: imm: use sg helper to iterate over scatterlist scsi: aha152x: use sg helper to iterate over scatterlist scsi: s390: zfcp_fc: use sg helper to iterate over scatterlist scsi: staging: unisys: visorhba: use sg helper to iterate over scatterlist scsi: usb: image: microtek: use sg helper to iterate over scatterlist scsi: pmcraid: use sg helper to iterate over scatterlist scsi: ipr: use sg helper to iterate over scatterlist scsi: mvumi: use sg helper to iterate over scatterlist scsi: lpfc: use sg helper to iterate over scatterlist scsi: advansys: use sg helper to iterate over scatterlist ...
| * scsi: pmcraid: use sg helper to iterate over scatterlistMing Lei2019-06-201-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike the legacy I/O path, scsi-mq preallocates a large array to hold the scatterlist for each request. This static allocation can consume substantial amounts of memory on modern controllers which support a large number of concurrently outstanding requests. To facilitate a switch to a smaller static allocation combined with a dynamic allocation for requests that need it, we need to make sure all SCSI drivers handle chained scatterlists correctly. Convert remaining drivers that directly dereference the scatterlist array to using the iterator functions. [mkp: clarified commit message] Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* | treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner2019-05-301-16/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Remove 'type' argument from access_ok() functionLinus Torvalds2019-01-031-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument of the user address range verification function since we got rid of the old racy i386-only code to walk page tables by hand. It existed because the original 80386 would not honor the write protect bit when in kernel mode, so you had to do COW by hand before doing any user access. But we haven't supported that in a long time, and these days the 'type' argument is a purely historical artifact. A discussion about extending 'user_access_begin()' to do the range checking resulted this patch, because there is no way we're going to move the old VERIFY_xyz interface to that model. And it's best done at the end of the merge window when I've done most of my merges, so let's just get this done once and for all. This patch was mostly done with a sed-script, with manual fix-ups for the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form. There were a couple of notable cases: - csky still had the old "verify_area()" name as an alias. - the iter_iov code had magical hardcoded knowledge of the actual values of VERIFY_{READ,WRITE} (not that they mattered, since nothing really used it) - microblaze used the type argument for a debug printout but other than those oddities this should be a total no-op patch. I tried to fix up all architectures, did fairly extensive grepping for access_ok() uses, and the changes are trivial, but I may have missed something. Any missed conversion should be trivially fixable, though. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* scsi: flip the default on use_clusteringChristoph Hellwig2018-12-181-1/+0
| | | | | | | | | | Most SCSI drivers want to enable "clustering", that is merging of segments so that they might span more than a single page. Remove the ENABLE_CLUSTERING define, and require drivers to explicitly set DISABLE_CLUSTERING to disable this feature. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: use generic DMA APIChristoph Hellwig2018-11-061-43/+36
| | | | | | | Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: don't allocate a dma coherent buffer for sense dataChristoph Hellwig2018-11-061-16/+8
| | | | | | | | | We can just dma map the sense buffer passed with the scsi command, and that gets us out of the nasty business of doing dma coherent allocations from irq context. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: simplify pmcraid_cancel_all a bitChristoph Hellwig2018-11-061-7/+6
| | | | | | | | No need for a local cmd_done variable, and pass boolean values as bool type instead of u32. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* treewide: kzalloc() -> kcalloc()Kees Cook2018-06-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The kzalloc() function has a 2-factor argument form, kcalloc(). This patch replaces cases of: kzalloc(a * b, gfp) with: kcalloc(a * b, gfp) as well as handling cases of: kzalloc(a * b * c, gfp) with: kzalloc(array3_size(a, b, c), gfp) as it's slightly less ugly than: kzalloc_array(array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: kzalloc(4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ type TYPE; expression THING, E; @@ ( kzalloc( - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | kzalloc( - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression COUNT; typedef u8; typedef __u8; @@ ( kzalloc( - sizeof(u8) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(__u8) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(char) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(unsigned char) * (COUNT) + COUNT , ...) | kzalloc( - sizeof(u8) * COUNT + COUNT , ...) | kzalloc( - sizeof(__u8) * COUNT + COUNT , ...) | kzalloc( - sizeof(char) * COUNT + COUNT , ...) | kzalloc( - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - kzalloc + kcalloc ( - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ identifier SIZE, COUNT; @@ - kzalloc + kcalloc ( - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( kzalloc( - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | kzalloc( - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | kzalloc( - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( kzalloc( - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | kzalloc( - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kzalloc( - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | kzalloc( - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ identifier STRIDE, SIZE, COUNT; @@ ( kzalloc( - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | kzalloc( - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression E1, E2, E3; constant C1, C2, C3; @@ ( kzalloc(C1 * C2 * C3, ...) | kzalloc( - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | kzalloc( - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | kzalloc( - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | kzalloc( - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( kzalloc(sizeof(THING) * C2, ...) | kzalloc(sizeof(TYPE) * C2, ...) | kzalloc(C1 * C2 * C3, ...) | kzalloc(C1 * C2, ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - kzalloc + kcalloc ( - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - kzalloc + kcalloc ( - (E1) * E2 + E1, E2 , ...) | - kzalloc + kcalloc ( - (E1) * (E2) + E1, E2 , ...) | - kzalloc + kcalloc ( - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
* scsi: pmcraid: Use sgl_alloc_order() and sgl_free_order()Bart Van Assche2018-02-131-39/+4
| | | | | | | | | | | Use the sgl_alloc_order() and sgl_free_order() functions instead of open coding these functions. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Cc: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: remove redundant initializations of pointer 'ioadl'Colin Ian King2018-02-131-4/+4
| | | | | | | | | | | | | | | | | | | There are several occurrances where pointer ioadl is initialized with a value that is never read and where it is re-assigned a new value later on, hence the initialization is redundant and can be removed. Cleans up clang warnings: drivers/scsi/pmcraid.c:1028:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:3178:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:5495:29: warning: Value stored to 'ioadl' during its initialization is never read drivers/scsi/pmcraid.c:5668:29: warning: Value stored to 'ioadl' during its initialization is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: use correct size unit when calling find_first_zero_bit()Niklas Cassel2017-12-071-1/+1
| | | | | | | | find_first_zero_bit()'s parameter 'size' is defined in bits, not in bytes. Signed-off-by: Niklas Cassel <niklas.cassel@axis.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* treewide: Remove TIMER_FUNC_TYPE and TIMER_DATA_TYPE castsKees Cook2017-11-211-5/+5
| | | | | | | | | | | | | | | | With all callbacks converted, and the timer callback prototype switched over, the TIMER_FUNC_TYPE cast is no longer needed, so remove it. Conversion was done with the following scripts: perl -pi -e 's|\(TIMER_FUNC_TYPE\)||g' \ $(git grep TIMER_FUNC_TYPE | cut -d: -f1 | sort -u) perl -pi -e 's|\(TIMER_DATA_TYPE\)||g' \ $(git grep TIMER_DATA_TYPE | cut -d: -f1 | sort -u) The now unused macros are also dropped from include/linux/timer.h. Signed-off-by: Kees Cook <keescook@chromium.org>
* scsi: pmcraid: Convert timers to use timer_setup()Kees Cook2017-11-011-20/+13
| | | | | | | | | | | | In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: fix duplicated code for different branchesGustavo A. R. Silva2017-08-241-6/+1
| | | | | | | | | Refactor code in order to avoid identical code for different branches. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: Replace PCI pool old APIRomain Perier2017-08-071-5/+5
| | | | | | | | | | The PCI pool API is deprecated. This commit replaces the PCI pool old API by the appropriate function with the DMA pool API. Signed-off-by: Romain Perier <romain.perier@collabora.com> Acked-by: Peter Senna Tschudin <peter.senna@collabora.com> Tested-by: Peter Senna Tschudin <peter.senna@collabora.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: remove redundant check to see if request_size is less than zeroColin Ian King2017-05-081-3/+0
| | | | | | | | | | | | The 2nd check to see if request_size is less than zero is redundant because the first check takes error exit path on this condition. So, since it is redundant, remove it. Detected by CoverityScan, CID#146149 ("Logically Dead Code") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: use normal copy_from_userArnd Bergmann2017-04-241-33/+7
| | | | | | | | | | | | | | | As pointed out by Al Viro for my previous series, the driver has no need to call access_ok() and __copy_from_user()/__copy_to_user(). Changing it to regular copy_from_user()/copy_to_user() simplifies the code without any real downsides, making it less error-prone at best. This patch by itself also addresses the warning about the access_ok() macro on MIPS, but both fixes improve the code, so ideally we apply them both. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: fix minor sparse warningsArnd Bergmann2017-04-241-3/+3
| | | | | | | | | | | | | | | | | pmcraid_minor is only used in this one file and should be 'static' as suggested by sparse: drivers/scsi/pmcraid.c:80:1: warning: symbol 'pmcraid_minor' was not declared. Should it be static? In Linux coding style, a literal '0' integer should not be used to represent a NULL pointer: drivers/scsi/pmcraid.c:348:29: warning: Using plain integer as NULL pointer drivers/scsi/pmcraid.c:4824:49: warning: Using plain integer as NULL pointer Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
* scsi: pmcraid: fix endianess sparse annotationsArnd Bergmann2017-04-241-48/+47
| | | | | | | | | | | | | | | | | | | | | | The use of le32_to_cpu() etc in this driver looks completely arbitrary. It may have made sense at some point, but it is not applied consistently, so this driver presumably won't work on big-endian kernel builds. Unfortunately it's unclear whether the type names or the calls to le32_to_cpu() are the correct ones. I'm taking educated guesses here and assume that most of the __le32 and __le16 annotations are correct, adding the conversion helpers whereever we access those fields. The exceptions are the 'fw_version' field that is always accessed as big-endian, so I'm changing the type here, and the 'hrrq' values that are accessed as little-endian, so I'm changing those the other way. None of these changes should have any effect on little-endian architectures like x86, but it addresses the sparse warnings. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>