Skip to content

Commit 0f52957

Browse files
juhosgbroonie
authored andcommitted
spi: spi-qpic-snand: remove superfluous parameters of qcom_spi_check_error()
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>
1 parent 477d16c commit 0f52957

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

drivers/spi/spi-qpic-snand.c

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int qcom_spi_read_last_cw(struct qcom_nand_controller *snandc,
601601
return ret;
602602
}
603603

604-
static int qcom_spi_check_error(struct qcom_nand_controller *snandc, u8 *data_buf, u8 *oob_buf)
604+
static int qcom_spi_check_error(struct qcom_nand_controller *snandc)
605605
{
606606
struct snandc_read_status *buf;
607607
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
618618

619619
for (i = 0; i < num_cw; i++, buf++) {
620620
u32 flash, buffer, erased_cw;
621-
int data_len, oob_len;
622-
623-
if (i == (num_cw - 1)) {
624-
data_len = NANDC_STEP_SIZE - ((num_cw - 1) << 2);
625-
oob_len = num_cw << 2;
626-
} else {
627-
data_len = ecc_cfg->cw_data;
628-
oob_len = 0;
629-
}
630621

631622
flash = le32_to_cpu(buf->snandc_flash);
632623
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
650641
snandc->qspi->ecc_stats.corrected += stat;
651642
max_bitflips = max(max_bitflips, stat);
652643
}
653-
654-
if (data_buf)
655-
data_buf += data_len;
656-
if (oob_buf)
657-
oob_buf += oob_len + ecc_cfg->bytes;
658644
}
659645

660646
if (flash_op_err)
@@ -792,15 +778,12 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
792778
const struct spi_mem_op *op)
793779
{
794780
struct qpic_ecc *ecc_cfg = snandc->qspi->ecc;
795-
u8 *data_buf = NULL, *data_buf_start, *oob_buf = NULL, *oob_buf_start;
781+
u8 *data_buf = NULL, *oob_buf = NULL;
796782
int ret, i;
797783
u32 cfg0, cfg1, ecc_bch_cfg, num_cw = snandc->qspi->num_cw;
798784

799785
data_buf = op->data.buf.in;
800-
data_buf_start = data_buf;
801-
802786
oob_buf = snandc->qspi->oob_buf;
803-
oob_buf_start = oob_buf;
804787

805788
snandc->buf_count = 0;
806789
snandc->buf_start = 0;
@@ -881,21 +864,18 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
881864
return ret;
882865
}
883866

884-
return qcom_spi_check_error(snandc, data_buf_start, oob_buf_start);
867+
return qcom_spi_check_error(snandc);
885868
}
886869

887870
static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
888871
const struct spi_mem_op *op)
889872
{
890873
struct qpic_ecc *ecc_cfg = snandc->qspi->ecc;
891-
u8 *data_buf = NULL, *data_buf_start, *oob_buf = NULL, *oob_buf_start;
874+
u8 *oob_buf = NULL;
892875
int ret, i;
893876
u32 cfg0, cfg1, ecc_bch_cfg, num_cw = snandc->qspi->num_cw;
894877

895878
oob_buf = op->data.buf.in;
896-
oob_buf_start = oob_buf;
897-
898-
data_buf_start = data_buf;
899879

900880
snandc->buf_count = 0;
901881
snandc->buf_start = 0;
@@ -963,7 +943,7 @@ static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
963943
return ret;
964944
}
965945

966-
return qcom_spi_check_error(snandc, data_buf_start, oob_buf_start);
946+
return qcom_spi_check_error(snandc);
967947
}
968948

969949
static int qcom_spi_read_page(struct qcom_nand_controller *snandc,

0 commit comments

Comments
 (0)