spi: spi-qpic-snand: remove superfluous parameters of qcom_spi_check_error()
authorGabor Juhos <j4g8y7@gmail.com>
Tue, 20 May 2025 19:08:56 +0000 (21:08 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 21 May 2025 17:56:08 +0000 (18:56 +0100)
The qcom_spi_check_error() function determines the errors of a previous
page read operation solely by using the cached register values in the
register read buffer. The data pointed by the 'data_buf' and the 'oob_buf'
parameters are not used for that at all.

Remove the superfluous parameters of the function along with the related
local variables to simplify the code. Also, remove the variables from the
caller functions which became unused due to the change.

Note:
Althought the similar parse_read_errors() function in the 'qcom_nand'
driver has the same parameters, but that function passes down the
pointers to check_for_erased_page() at the end of the function.

It is not clear, that a similar call is missing here, or the superfluous
parameters are simply leftovers of the development process. Nevertheless,
if additional code is needed, the parameters can be added back later.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Link: https://patch.msgid.link/20250520-qpic-snand-superfluous-params-v1-1-86dd4963e90f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-qpic-snand.c

index a90829e..17bcd12 100644 (file)
@@ -601,7 +601,7 @@ static int qcom_spi_read_last_cw(struct qcom_nand_controller *snandc,
        return ret;
 }
 
-static int qcom_spi_check_error(struct qcom_nand_controller *snandc, u8 *data_buf, u8 *oob_buf)
+static int qcom_spi_check_error(struct qcom_nand_controller *snandc)
 {
        struct snandc_read_status *buf;
        struct qpic_ecc *ecc_cfg = snandc->qspi->ecc;
@@ -618,15 +618,6 @@ static int qcom_spi_check_error(struct qcom_nand_controller *snandc, u8 *data_bu
 
        for (i = 0; i < num_cw; i++, buf++) {
                u32 flash, buffer, erased_cw;
-               int data_len, oob_len;
-
-               if (i == (num_cw - 1)) {
-                       data_len = NANDC_STEP_SIZE - ((num_cw - 1) << 2);
-                       oob_len = num_cw << 2;
-               } else {
-                       data_len = ecc_cfg->cw_data;
-                       oob_len = 0;
-               }
 
                flash = le32_to_cpu(buf->snandc_flash);
                buffer = le32_to_cpu(buf->snandc_buffer);
@@ -650,11 +641,6 @@ static int qcom_spi_check_error(struct qcom_nand_controller *snandc, u8 *data_bu
                        snandc->qspi->ecc_stats.corrected += stat;
                        max_bitflips = max(max_bitflips, stat);
                }
-
-               if (data_buf)
-                       data_buf += data_len;
-               if (oob_buf)
-                       oob_buf += oob_len + ecc_cfg->bytes;
        }
 
        if (flash_op_err)
@@ -792,15 +778,12 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
                                  const struct spi_mem_op *op)
 {
        struct qpic_ecc *ecc_cfg = snandc->qspi->ecc;
-       u8 *data_buf = NULL, *data_buf_start, *oob_buf = NULL, *oob_buf_start;
+       u8 *data_buf = NULL, *oob_buf = NULL;
        int ret, i;
        u32 cfg0, cfg1, ecc_bch_cfg, num_cw = snandc->qspi->num_cw;
 
        data_buf = op->data.buf.in;
-       data_buf_start = data_buf;
-
        oob_buf = snandc->qspi->oob_buf;
-       oob_buf_start = oob_buf;
 
        snandc->buf_count = 0;
        snandc->buf_start = 0;
@@ -881,21 +864,18 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
                return ret;
        }
 
-       return qcom_spi_check_error(snandc, data_buf_start, oob_buf_start);
+       return qcom_spi_check_error(snandc);
 }
 
 static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
                                  const struct spi_mem_op *op)
 {
        struct qpic_ecc *ecc_cfg = snandc->qspi->ecc;
-       u8 *data_buf = NULL, *data_buf_start, *oob_buf = NULL, *oob_buf_start;
+       u8 *oob_buf = NULL;
        int ret, i;
        u32 cfg0, cfg1, ecc_bch_cfg, num_cw = snandc->qspi->num_cw;
 
        oob_buf = op->data.buf.in;
-       oob_buf_start = oob_buf;
-
-       data_buf_start = data_buf;
 
        snandc->buf_count = 0;
        snandc->buf_start = 0;
@@ -963,7 +943,7 @@ static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
                return ret;
        }
 
-       return qcom_spi_check_error(snandc, data_buf_start, oob_buf_start);
+       return qcom_spi_check_error(snandc);
 }
 
 static int qcom_spi_read_page(struct qcom_nand_controller *snandc,