History log of /openbmc/linux/drivers/scsi/qla4xxx/ql4_nx.c (Results 1 – 25 of 163)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v5.15.41, v5.15.40, v5.15.39, v5.15.38, v5.15.37, v5.15.36, v5.15.35, v5.15.34, v5.15.33, v5.15.32, v5.15.31, v5.15.30, v5.15.29, v5.15.28, v5.15.27, v5.15.26, v5.15.25, v5.15.24, v5.15.23, v5.15.22, v5.15.21, v5.15.20, v5.15.19, v5.15.18, v5.15.17, v5.4.173, v5.15.16, v5.15.15, v5.15.10, v5.15.9, v5.15.8, v5.15.7, v5.15.6, v5.15.5, v5.15.4, v5.15.3, v5.15.2, v5.15.1, v5.15, v5.14.14, v5.14.13, v5.14.12, v5.14.11, v5.14.10, v5.14.9, v5.14.8, v5.14.7, v5.14.6, v5.10.67, v5.10.66, v5.14.5, v5.14.4, v5.10.65, v5.14.3, v5.10.64, v5.14.2, v5.10.63, v5.14.1, v5.10.62, v5.14, v5.10.61, v5.10.60, v5.10.53, v5.10.52, v5.10.51
# 33529018 16-Jul-2021 Dwaipayan Ray <dwaipayanray1@gmail.com>

scsi: qla4xxx: Convert uses of __constant_cpu_to_<foo> to cpu_to_<foo>

The macros cpu_to_le16() and cpu_to_le32() have special cases for
constants. Their __constant_<foo> versions are not required.

scsi: qla4xxx: Convert uses of __constant_cpu_to_<foo> to cpu_to_<foo>

The macros cpu_to_le16() and cpu_to_le32() have special cases for
constants. Their __constant_<foo> versions are not required.

On little endian systems, both cpu_to_le16() and __constant_cpu_to_le16()
expand to the same expression. Same is the case with cpu_to_le32().

On big endian systems, cpu_to_le16() expands to __swab16() which has a
__builtin_constant_p check. Similarly, cpu_to_le32() expands to __swab32().

Consequently these macros can be safely used with constants, and hence all
those uses are converted. This was discovered as a part of a checkpatch
evaluation, looking at all reports of WARNING:CONSTANT_CONVERSION error
type.

Link: https://lore.kernel.org/r/20210716112852.24598-1-dwaipayanray1@gmail.com
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v5.10.50, v5.10.49, v5.13, v5.10.46, v5.10.43, v5.10.42, v5.10.41, v5.10.40, v5.10.39, v5.4.119, v5.10.36, v5.10.35, v5.10.34, v5.4.116, v5.10.33, v5.12, v5.10.32, v5.10.31
# 11417cd5 15-Apr-2021 Bart Van Assche <bvanassche@acm.org>

scsi: qla4xxx: Remove an unused function

This was detected by building the kernel with clang and W=1.

Link: https://lore.kernel.org/r/20210415220826.29438-13-bvanassche@acm.org
Cc: Nilesh Javali <n

scsi: qla4xxx: Remove an unused function

This was detected by building the kernel with clang and W=1.

Link: https://lore.kernel.org/r/20210415220826.29438-13-bvanassche@acm.org
Cc: Nilesh Javali <njavali@marvell.com>
Acked-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v5.10.30, v5.10.27, v5.10.26, v5.10.25, v5.10.24, v5.10.23, v5.10.22, v5.10.21, v5.10.20, v5.10.19, v5.4.101, v5.10.18, v5.10.17, v5.11, v5.10.16, v5.10.15, v5.10.14, v5.10
# 3a5b9fa2 04-Dec-2020 Colin Ian King <colin.king@canonical.com>

scsi: qla4xxx: Remove redundant assignment to variable rval

The variable rval is being initialized with a value that is never read and
it is being updated later with a new value. The initialization

scsi: qla4xxx: Remove redundant assignment to variable rval

The variable rval is being initialized with a value that is never read and
it is being updated later with a new value. The initialization is
redundant and can be removed.

Link: https://lore.kernel.org/r/20201204191810.1150995-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Addresses-Coverity: ("Unused value")

show more ...


# 014aced1 26-Nov-2020 Ahmed S. Darwish <a.darwish@linutronix.de>

scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_rom_lock()

qla4_82xx_rom_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does

scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_rom_lock()

qla4_82xx_rom_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla4_82xx_rom_lock() is always called
from process context. Below is an analysis of its callers:

- ql4_nx.c: qla4_82xx_rom_fast_read(), all process context callers:
=> ql4_nx.c: qla4_82xx_pinit_from_rom(), GFP_KERNEL allocation
=> ql4_nx.c: qla4_82xx_load_from_flash(), msleep() in a loop

- ql4_nx.c: qla4_82xx_pinit_from_rom(), earlier discussed

- ql4_nx.c: qla4_82xx_rom_lock_recovery(), bound to "isp_operations"
->rom_lock_recovery() hook, which has one process context caller,
qla4_8xxx_device_bootstrap(), with callers:
=> ql4_83xx.c: qla4_83xx_need_reset_handler(), process, msleep()
=> ql4_nx.c: qla4_8xxx_device_state_handler(), multiple msleep()s

- ql4_nx.c: qla4_82xx_read_flash_data(), has cond_resched()

Remove the in_interrupt() check. Mark, qla4_82xx_rom_lock(), and the
->rom_lock_recovery() hook, with "Context: task, can sleep".

Change qla4_82xx_rom_lock() implementation to sleep 20ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches
the other implementations bound to ->rom_lock_recovery().

Link: https://lore.kernel.org/r/20201126132952.2287996-9-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


# 3627668c 26-Nov-2020 Ahmed S. Darwish <a.darwish@linutronix.de>

scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_idc_lock()

qla4_82xx_idc_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does

scsi: qla4xxx: Remove in_interrupt() from qla4_82xx_idc_lock()

qla4_82xx_idc_lock() spins on a certain hardware state until it is
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

While in_interrupt() is ill-defined and does not provide what the name
suggests, it is not needed here: qla4_82xx_idc_lock() is always called from
process context. Below is an analysis of its callers:

- ql4_nx.c: qla4_82xx_need_reset_handler(), 1-second msleep() in a
loop.

- ql4_nx.c: qla4_82xx_isp_reset(), calls
qla4_8xxx_device_state_handler(), which has multiple msleep()s.

Beside direct calls, qla4_82xx_idc_lock() is also bound to isp_operations
->idc_lock() hook. Other functions which are bound to the same hook,
e.g. qla4_83xx_drv_lock(), also have an msleep(). For completeness, below
is an analysis of all callers of that hook:

- ql4_83xx.c: qla4_83xx_need_reset_handler(), has an msleep()

- ql4_83xx.c: qla4_83xx_isp_reset(), calls
qla4_8xxx_device_state_handler(), which has multiple msleep()s.

- ql4_83xx.c: qla4_83xx_disable_pause(), all process context callers:
=> ql4_mbx.c: qla4xxx_mailbox_command(), msleep(), mutex_lock()
=> ql4_os.c: qla4xxx_recover_adapter(), schedule_timeout() in loop
=> ql4_os.c: qla4xxx_do_dpc(), workqueue context

- ql4_attr.c: qla4_8xxx_sysfs_write_fw_dump(), sysfs bin_attribute
->write() hook, process context

- ql4_mbx.c: qla4xxx_mailbox_command(), earlier discussed

- ql4_nx.c: qla4_8xxx_device_bootstrap(), callers:
=> ql4_83xx.c: qla4_83xx_need_reset_handler(), process, msleep()
=> ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed

- ql4_nx.c: qla4_8xxx_need_qsnt_handler(), callers:
=> ql4_nx.c: qla4_8xxx_device_state_handler(), multiple msleep()s
=> ql4_os.c: qla4xxx_do_dpc(), workqueue context

- ql4_nx.c: qla4_8xxx_update_idc_reg(), callers:
=> ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed
=> ql4_os.c: qla4_8xxx_error_recovery(), only called by
qla4xxx_pci_slot_reset(), which is bound to PCI ->slot_reset()
process-context hook

- ql4_nx.c: qla4_8xxx_device_state_handler(), earlier discussed

- ql4_os.c: qla4xxx_recover_adapter(), earlier discussed

- ql4_os.c: qla4xxx_do_dpc(), earlier discussed

Remove the in_interrupt() check. Mark, qla4_82xx_idc_lock(), and the
->idc_lock() hook itself, with "Context: task, can sleep".

Change qla4_82xx_idc_lock() implementation to sleep 100ms, instead of a
schedule(), for each spin. This is more deterministic, and it matches other
PCI HW locking functions in the driver.

Link: https://lore.kernel.org/r/20201126132952.2287996-8-bigeasy@linutronix.de
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


# a93c3835 26-Nov-2020 Ahmed S. Darwish <a.darwish@linutronix.de>

scsi: qla4xxx: Remove in_interrupt()

qla4_82xx_crb_win_lock() spins on a certain hardware state until it's
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(

scsi: qla4xxx: Remove in_interrupt()

qla4_82xx_crb_win_lock() spins on a certain hardware state until it's
updated. At the end of each spin, if in_interrupt() is true, it does 20
loops of cpu_relax(). Otherwise, it yields the CPU.

The in_interrupt() macro is ill-defined as it does not provide what the
name suggests, and it does not catch the intended use-case here.

qla4_82xx_crb_win_lock() is always invoked with scsi_qla_host::hw_lock
acquired, with disabled interrupts. If the caller is in process context, as
in qla4_82xx_need_reset_handler(), then in_interrupt() will return false
even though it is not allowed to call schedule().

Remove the in_interrupt() check.

Change qla4_82xx_crb_win_lock() specification to a purely atomic
function. Mark it as static, remove its forward declaration, and move it
above its callers. To avoid hammering the PCI bus while spinning, use a 10
micro-second delay instead of cpu_relax().

Link: https://lore.kernel.org/r/20201126132952.2287996-4-bigeasy@linutronix.de
Fixes: f4f5df23bf72 ("[SCSI] qla4xxx: Added support for ISP82XX")
Cc: Nilesh Javali <njavali@marvell.com>
Cc: Manish Rangankar <mrangankar@marvell.com>
Cc: <GR-QLogic-Storage-Upstream@marvell.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v5.8.17, v5.8.16, v5.8.15, v5.9, v5.8.14, v5.8.13
# 5ccdd101 29-Sep-2020 Ye Bin <yebin10@huawei.com>

scsi: qla4xxx: Fix inconsistent format argument type

Fix the following warning:

[drivers/scsi/qla4xxx/ql4_nx.c:3228]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type i

scsi: qla4xxx: Fix inconsistent format argument type

Fix the following warning:

[drivers/scsi/qla4xxx/ql4_nx.c:3228]: (warning) %ld in format string (no. 1)
requires 'long' but the argument type is 'unsigned long'.

Link: https://lore.kernel.org/r/20200930022228.2840587-1-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>

show more ...


Revision tags: v5.8.12, v5.8.11, v5.8.10, v5.8.9, v5.8.8
# e3976af5 08-Sep-2020 Thomas Gleixner <tglx@linutronix.de>

scsi/qla4xxx: Convert to SPDX license identifiers

All files in this driver directory contain the following notice:

See LICENSE.qla4xxx for copyright and licensing details.

LICENSE.qla4xxx can be

scsi/qla4xxx: Convert to SPDX license identifiers

All files in this driver directory contain the following notice:

See LICENSE.qla4xxx for copyright and licensing details.

LICENSE.qla4xxx can be found in Documentation/scsi/. The file contains:

- A copyright notice

This copyright notice is redundant as all files contain the same
copyright notice already

- A license notice

You may modify and redistribute the device driver code under the
GNU General Public License (a copy of which is attached hereto as
Exhibit A) published by the Free Software Foundation (version 2).

- The full GPLv2 license text

This can be replaced with the corresponding SPDX license identifier
(GPL-2.0-only) in the source files which reference this license
file.

- The full GPLv2 license text

A redundant copy of LICENSES/preferred/GPL-2.0

Remove the notices and add the SPDX license identifier GPL-2.0-only to the
source files.

Finally remove the now redundant LICENSE.qla4xxx file.

Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Jilayne Lovejoy <opensource@jilayne.com>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Acked-by: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

show more ...


Revision tags: v5.8.7, v5.8.6, v5.4.62, v5.8.5, v5.8.4, v5.4.61, v5.8.3, v5.4.60, v5.8.2, v5.4.59, v5.8.1, v5.4.58, v5.4.57, v5.4.56, v5.8, v5.7.12, v5.4.55, v5.7.11, v5.4.54, v5.7.10, v5.4.53
# 653557df 21-Jul-2020 Lee Jones <lee.jones@linaro.org>

scsi: qla4xxx: Supply description for 'code'

Demote other headers which are clearly not kerneldoc.

Fixes the following W=1 kernel build warning(s):

drivers/scsi/qla4xxx/ql4_nx.c:983: warning: Fun

scsi: qla4xxx: Supply description for 'code'

Demote other headers which are clearly not kerneldoc.

Fixes the following W=1 kernel build warning(s):

drivers/scsi/qla4xxx/ql4_nx.c:983: warning: Function parameter or member 'ha' not described in 'qla4_82xx_pinit_from_rom'
drivers/scsi/qla4xxx/ql4_nx.c:983: warning: Function parameter or member 'verbose' not described in 'qla4_82xx_pinit_from_rom'
drivers/scsi/qla4xxx/ql4_nx.c:3225: warning: Function parameter or member 'code' not described in 'qla4_8xxx_uevent_emit'
drivers/scsi/qla4xxx/ql4_nx.c:3697: warning: Function parameter or member 'ha' not described in 'qla4_82xx_read_optrom_data'
drivers/scsi/qla4xxx/ql4_nx.c:3697: warning: Function parameter or member 'buf' not described in 'qla4_82xx_read_optrom_data'
drivers/scsi/qla4xxx/ql4_nx.c:3697: warning: Function parameter or member 'offset' not described in 'qla4_82xx_read_optrom_data'
drivers/scsi/qla4xxx/ql4_nx.c:3697: warning: Function parameter or member 'length' not described in 'qla4_82xx_read_optrom_data'

Link: https://lore.kernel.org/r/20200721164148.2617584-34-lee.jones@linaro.org
Cc: QLogic-Storage-Upstream@qlogic.com
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


# f67e8164 21-Jul-2020 Lee Jones <lee.jones@linaro.org>

scsi: qla4xxx: Remove three set but unused variables

Fixes the following W=1 kernel build warning(s):

drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_84xx_minidump_process_rddfe’:
drivers/scsi/q

scsi: qla4xxx: Remove three set but unused variables

Fixes the following W=1 kernel build warning(s):

drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_84xx_minidump_process_rddfe’:
drivers/scsi/qla4xxx/ql4_nx.c:2648:23: warning: variable ‘data_size’ set but not used [-Wunused-but-set-variable]
2648 | uint32_t poll, mask, data_size, modify_mask;
| ^~~~~~~~~
drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_84xx_minidump_process_rdmdio’:
drivers/scsi/qla4xxx/ql4_nx.c:2745:11: warning: variable ‘poll’ set but not used [-Wunused-but-set-variable]
2745 | uint32_t poll, mask;
| ^~~~
drivers/scsi/qla4xxx/ql4_nx.c: In function ‘qla4_84xx_minidump_process_pollwr’:
drivers/scsi/qla4xxx/ql4_nx.c:2816:47: warning: variable ‘mask’ set but not used [-Wunused-but-set-variable]
2816 | uint32_t addr1, addr2, value1, value2, poll, mask, r_value;
| ^~~~

Link: https://lore.kernel.org/r/20200721164148.2617584-33-lee.jones@linaro.org
Cc: QLogic-Storage-Upstream@qlogic.com
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v5.4.52, v5.7.9, v5.7.8, v5.4.51, v5.4.50, v5.7.7, v5.4.49, v5.7.6, v5.7.5, v5.4.48, v5.7.4, v5.7.3, v5.4.47, v5.4.46, v5.7.2, v5.4.45, v5.7.1, v5.4.44, v5.7, v5.4.43, v5.4.42, v5.4.41, v5.4.40, v5.4.39, v5.4.38, v5.4.37, v5.4.36, v5.4.35, v5.4.34, v5.4.33, v5.4.32, v5.4.31, v5.4.30, v5.4.29, v5.6, v5.4.28, v5.4.27, v5.4.26, v5.4.25, v5.4.24, v5.4.23, v5.4.22, v5.4.21, v5.4.20, v5.4.19, v5.4.18, v5.4.17, v5.4.16, v5.5, v5.4.15, v5.4.14, v5.4.13, v5.4.12, v5.4.11, v5.4.10, v5.4.9, v5.4.8, v5.4.7, v5.4.6, v5.4.5, v5.4.4, v5.4.3, v5.3.15, v5.4.2, v5.4.1, v5.3.14, v5.4, v5.3.13, v5.3.12, v5.3.11, v5.3.10, v5.3.9, v5.3.8, v5.3.7, v5.3.6, v5.3.5, v5.3.4, v5.3.3, v5.3.2, v5.3.1, v5.3, v5.2.14, v5.3-rc8, v5.2.13, v5.2.12, v5.2.11, v5.2.10, v5.2.9, v5.2.8, v5.2.7, v5.2.6, v5.2.5, v5.2.4, v5.2.3, v5.2.2, v5.2.1, v5.2, v5.1.16, v5.1.15, v5.1.14, v5.1.13, v5.1.12, v5.1.11, v5.1.10, v5.1.9, v5.1.8, v5.1.7, v5.1.6, v5.1.5, v5.1.4, v5.1.3, v5.1.2, v5.1.1, v5.0.14, v5.1, v5.0.13, v5.0.12, v5.0.11, v5.0.10, v5.0.9, v5.0.8, v5.0.7, v5.0.6, v5.0.5, v5.0.4, v5.0.3, v4.19.29, v5.0.2, v4.19.28, v5.0.1, v4.19.27, v5.0, v4.19.26, v4.19.25, v4.19.24, v4.19.23, v4.19.22, v4.19.21, v4.19.20, v4.19.19, v4.19.18, v4.19.17, v4.19.16, v4.19.15, v4.19.14
# 750afb08 04-Jan-2019 Luis Chamberlain <mcgrof@kernel.org>

cross-tree: phase out dma_zalloc_coherent()

We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.

This change was generated w

cross-tree: phase out dma_zalloc_coherent()

We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.

This change was generated with the following Coccinelle SmPL patch:

@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@

-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


Revision tags: v4.19.13, v4.19.12, v4.19.11, v4.19.10, v4.19.9, v4.19.8, v4.19.7, v4.19.6, v4.19.5, v4.19.4, v4.18.20, v4.19.3, v4.18.19, v4.19.2, v4.18.18, v4.18.17, v4.19.1, v4.19, v4.18.16, v4.18.15, v4.18.14, v4.18.13, v4.18.12, v4.18.11, v4.18.10, v4.18.9, v4.18.7, v4.18.6, v4.18.5, v4.17.18, v4.18.4, v4.18.3, v4.17.17, v4.18.2, v4.17.16, v4.17.15, v4.18.1, v4.18, v4.17.14, v4.17.13, v4.17.12, v4.17.11, v4.17.10, v4.17.9, v4.17.8, v4.17.7, v4.17.6, v4.17.5, v4.17.4, v4.17.3, v4.17.2
# 6da2ec56 12-Jun-2018 Kees Cook <keescook@chromium.org>

treewide: kmalloc() -> kmalloc_array()

The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
patch replaces cases of:

kmalloc(a * b, gfp)

with:
kmalloc_array(a

treewide: kmalloc() -> kmalloc_array()

The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
patch replaces cases of:

kmalloc(a * b, gfp)

with:
kmalloc_array(a * b, gfp)

as well as handling cases of:

kmalloc(a * b * c, gfp)

with:

kmalloc(array3_size(a, b, c), gfp)

as it's slightly less ugly than:

kmalloc_array(array_size(a, b), c, gfp)

This does, however, attempt to ignore constant size factors like:

kmalloc(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 tools/ directory was manually excluded, since it has its own
implementation of kmalloc().

The Coccinelle script used for this was:

// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@

(
kmalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kmalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)

// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@

(
kmalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kmalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kmalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kmalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kmalloc(
- 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;
@@

(
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)

// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@

- kmalloc
+ kmalloc_array
(
- 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;
@@

(
kmalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kmalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kmalloc(
- 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;
@@

(
kmalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kmalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kmalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kmalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kmalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kmalloc(
- 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;
@@

(
kmalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kmalloc(
- 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;
@@

(
kmalloc(C1 * C2 * C3, ...)
|
kmalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kmalloc(
- 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;
@@

(
kmalloc(sizeof(THING) * C2, ...)
|
kmalloc(sizeof(TYPE) * C2, ...)
|
kmalloc(C1 * C2 * C3, ...)
|
kmalloc(C1 * C2, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kmalloc
+ kmalloc_array
(
- (E1) * E2
+ E1, E2
, ...)
|
- kmalloc
+ kmalloc_array
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kmalloc
+ kmalloc_array
(
- E1 * E2
+ E1, E2
, ...)
)

Signed-off-by: Kees Cook <keescook@chromium.org>

show more ...


Revision tags: v4.17.1, v4.17, v4.16, v4.15
# bb83e59d 23-Jan-2018 Bart Van Assche <bart.vanassche@wdc.com>

scsi: qla4xxx: Move an array from a .h into a .c file

This patch does not change any functionality but slightly reduces
the size of the compiled kernel module.

Signed-off-by: Bart Van Assche <bart.

scsi: qla4xxx: Move an array from a .h into a .c file

This patch does not change any functionality but slightly reduces
the size of the compiled kernel module.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Himanshu Madhani <himanshu.madhani@cavium.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


# d103adb3 30-Dec-2017 Himanshu Jha <himanshujha199640@gmail.com>

scsi: qla4xxx: Use zeroing allocator rather than allocator/memset

Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset
0.

Generated-by: scripts/coccinelle/api/alloc/kzalloc-simp

scsi: qla4xxx: Use zeroing allocator rather than allocator/memset

Use dma_zalloc_coherent instead of dma_alloc_coherent followed by memset
0.

Generated-by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci

Suggested-by: Luis R. Rodriguez <mcgrof@kernel.org>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v4.13.16, v4.14, v4.13.5, v4.13, v4.12, v4.10.17, v4.10.16, v4.10.15, v4.10.14, v4.10.13, v4.10.12, v4.10.11, v4.10.10, v4.10.9, v4.10.8, v4.10.7, v4.10.6, v4.10.5, v4.10.4, v4.10.3, v4.10.2, v4.10.1, v4.10, v4.9
# f5b893c9 06-Dec-2016 Christoph Hellwig <hch@lst.de>

scsi: qla4xxx: switch to pci_alloc_irq_vectors

And simplify the MSI-X logic in general - just request the two vectors
directly instead of going through an indirection table.

Signed-off-by: Christop

scsi: qla4xxx: switch to pci_alloc_irq_vectors

And simplify the MSI-X logic in general - just request the two vectors
directly instead of going through an indirection table.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nilesh Javali <nilesh.javali@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: openbmc-4.4-20161121-1, v4.4.33, v4.4.32, v4.4.31, v4.4.30, v4.4.29, v4.4.28
# d1d81bd0 22-Oct-2016 Oleksandr Khoshaba <oleksandr.khoshaba@gmail.com>

scsi: qla4xxx: print MAC and SID via %p[mM][R]

In the kernel we have nice specifier to print MAC by given pointer to
the address in a binary form.

Signed-off-by: Oleksandr Khoshaba <Oleksandr.Khosh

scsi: qla4xxx: print MAC and SID via %p[mM][R]

In the kernel we have nice specifier to print MAC by given pointer to
the address in a binary form.

Signed-off-by: Oleksandr Khoshaba <Oleksandr.Khoshaba@gmail.com>
Acked-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Cc: QLogic-Storage-Upstream@qlogic.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v4.4.27, v4.7.10, openbmc-4.4-20161021-1, v4.7.9, v4.4.26, v4.7.8, v4.4.25, v4.4.24, v4.7.7, v4.8, v4.4.23, v4.7.6, v4.7.5, v4.4.22, v4.4.21, v4.7.4, v4.7.3, v4.4.20
# 02ccda2a 29-Aug-2016 Baoyou Xie <baoyou.xie@linaro.org>

scsi: qla4xxx: Mark symbols static where possible

We get 1 warning when build kernel with W=1:
drivers/scsi/qla4xxx/ql4_nx.c:1846:10: warning: no previous prototype for 'ql4_84xx_ipmdio_rd_reg' [-Wm

scsi: qla4xxx: Mark symbols static where possible

We get 1 warning when build kernel with W=1:
drivers/scsi/qla4xxx/ql4_nx.c:1846:10: warning: no previous prototype for 'ql4_84xx_ipmdio_rd_reg' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static. This patch marks
this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

show more ...


Revision tags: v4.7.2, v4.4.19, openbmc-4.4-20160819-1, v4.7.1, v4.4.18, v4.4.17, openbmc-4.4-20160804-1, v4.4.16, v4.7, openbmc-4.4-20160722-1, openbmc-20160722-1, openbmc-20160713-1, v4.4.15, v4.6.4, v4.6.3, v4.4.14, v4.6.2, v4.4.13, openbmc-20160606-1, v4.6.1, v4.4.12, openbmc-20160521-1, v4.4.11, openbmc-20160518-1, v4.6, v4.4.10, openbmc-20160511-1, openbmc-20160505-1, v4.4.9, v4.4.8, v4.4.7, openbmc-20160329-2, openbmc-20160329-1, openbmc-20160321-1, v4.4.6, v4.5, v4.4.5, v4.4.4, v4.4.3, openbmc-20160222-1, v4.4.2, openbmc-20160212-1, openbmc-20160210-1, openbmc-20160202-2, openbmc-20160202-1, v4.4.1, openbmc-20160127-1, openbmc-20160120-1, v4.4, openbmc-20151217-1, openbmc-20151210-1, openbmc-20151202-1, openbmc-20151123-1, openbmc-20151118-1, openbmc-20151104-1, v4.3, openbmc-20151102-1, openbmc-20151028-1, v4.3-rc1, v4.2
# 2f8e2c87 28-Aug-2015 Christoph Hellwig <hch@lst.de>

move io-64-nonatomic*.h out of asm-generic

These are not implementations of default architecture code but helpers
for drivers. Move them to the place they belong to.

Signed-off-by: Christoph Hellwi

move io-64-nonatomic*.h out of asm-generic

These are not implementations of default architecture code but helpers
for drivers. Move them to the place they belong to.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Darren Hart <dvhart@linux.intel.com>
Acked-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

show more ...


Revision tags: v4.2-rc8, v4.2-rc7, v4.2-rc6, v4.2-rc5, v4.2-rc4, v4.2-rc3, v4.2-rc2, v4.2-rc1, v4.1, v4.1-rc8, v4.1-rc7, v4.1-rc6, v4.1-rc5, v4.1-rc4, v4.1-rc3, v4.1-rc2, v4.1-rc1, v4.0, v4.0-rc7, v4.0-rc6, v4.0-rc5, v4.0-rc4, v4.0-rc3, v4.0-rc2, v4.0-rc1, v3.19, v3.19-rc7, v3.19-rc6, v3.19-rc5, v3.19-rc4, v3.19-rc3, v3.19-rc2, v3.19-rc1, v3.18, v3.18-rc7, v3.18-rc6, v3.18-rc5, v3.18-rc4, v3.18-rc3, v3.18-rc2, v3.18-rc1, v3.17, v3.17-rc7, v3.17-rc6, v3.17-rc5, v3.17-rc4, v3.17-rc3, v3.17-rc2, v3.17-rc1, v3.16, v3.16-rc7, v3.16-rc6
# e88285d6 16-Jul-2014 Alexander Gordeev <agordeev@redhat.com>

qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two

qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()

As result of deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() or pci_enable_msi_exact()
and pci_enable_msix_range() or pci_enable_msix_exact()
interfaces.

Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Acked-By: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


Revision tags: v3.16-rc5, v3.16-rc4, v3.16-rc3, v3.16-rc2, v3.16-rc1, v3.15, v3.15-rc8, v3.15-rc7, v3.15-rc6, v3.15-rc5, v3.15-rc4, v3.15-rc3, v3.15-rc2, v3.15-rc1, v3.14, v3.14-rc8, v3.14-rc7, v3.14-rc6, v3.14-rc5
# 9c4f8d92 24-Feb-2014 Vikas Chaudhary <vikas.chaudhary@qlogic.com>

qla4xxx: Check for correct return status

Check for correct return status in function -
qla4_8xxx_minidump_pex_dma_read

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike

qla4xxx: Check for correct return status

Check for correct return status in function -
qla4_8xxx_minidump_pex_dma_read

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


# dd3b854e 24-Feb-2014 Vikas Chaudhary <vikas.chaudhary@qlogic.com>

qla4xxx: qla4xxx: Move qla4_8xxx_ms_mem_write_128b to ql4_nx.c

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph

qla4xxx: qla4xxx: Move qla4_8xxx_ms_mem_write_128b to ql4_nx.c

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


# 3c3cab17 24-Feb-2014 Tej Parkash <tej.parkash@qlogic.com>

qla4xxx: Added PEX DMA Support for ISP8022 Adapter

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michael

qla4xxx: Added PEX DMA Support for ISP8022 Adapter

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


# b1829789 24-Feb-2014 Tej Parkash <tej.parkash@qlogic.com>

qla4xxx: Added new opcodes for 84XX Minidump template

Updated driver with new opcode (RDDFE, RDMDIO and POLLWR) which are
added with latest firmware minidump template

Signed-off-by: Tej Parkash <te

qla4xxx: Added new opcodes for 84XX Minidump template

Updated driver with new opcode (RDDFE, RDMDIO and POLLWR) which are
added with latest firmware minidump template

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <hch@lst.de>

show more ...


Revision tags: v3.14-rc4, v3.14-rc3, v3.14-rc2, v3.14-rc1, v3.13, v3.13-rc8, v3.13-rc7, v3.13-rc6, v3.13-rc5
# 4ebbb5cf 16-Dec-2013 Vikas Chaudhary <vikas.chaudhary@qlogic.com>

[SCSI] qla4xxx: Reduce rom-lock contention during reset recovery.

Issue:
Driver holds rom-lock for too long during reset recovery.

During adapter reset testing, it was found that the driver
holds t

[SCSI] qla4xxx: Reduce rom-lock contention during reset recovery.

Issue:
Driver holds rom-lock for too long during reset recovery.

During adapter reset testing, it was found that the driver
holds the rom-lock for too long, because of which other
drivers fail to acquire the rom-lock, leading to reset
failures.
The primary cause is, in the bootstrap code, while
holding the rom-lock, the driver checks if the peg is
halted, causing a 2 second contention.

Fix:
When a reset recovery starts, the driver deduces the cause, and
sets appropriate flags in watchdog & recover_adapter routines.
This flag should be used to determine if bootstrap is invoked
from probe or reset context, reducing the rom-lock footprint of
the drivers.

Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

show more ...


# 58e2bbe9 16-Dec-2013 Tej Parkash <tej.parkash@qlogic.com>

[SCSI] qla4xxx: Driver not able to collect minidump for ISP84xx

Issue:
minidump data collection fails as driver reports data mismatch

Fix:
When the driver encounters a new entry type that it cannot

[SCSI] qla4xxx: Driver not able to collect minidump for ISP84xx

Issue:
minidump data collection fails as driver reports data mismatch

Fix:
When the driver encounters a new entry type that it cannot process,
it should just skip the entry and adjust the total buffer size by
subtracting the skipped bytes from it. This is to ensure that there
is no data mismatch because of the new entries.

Signed-off-by: Tej Parkash <tej.parkash@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

show more ...


1234567