[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8883471e-57b9-4492-8d4a-aca3b4538682@gmail.com>
Date: Mon, 4 Aug 2025 09:22:06 +0200
From: Gabor Juhos <j4g8y7@...il.com>
To: Konrad Dybcio <konrad.dybcio@....qualcomm.com>,
Mark Brown <broonie@...nel.org>,
Varadarajan Narayanan <quic_varada@...cinc.com>,
Sricharan Ramabadhran <quic_srichara@...cinc.com>,
Md Sadre Alam <quic_mdalam@...cinc.com>
Cc: linux-spi@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: spi-qpic-snand: fix calculating of ECC OOB regions'
properties
Hi Konrad,
2025. 08. 01. 13:56 keltezéssel, Konrad Dybcio írta:
> On 7/31/25 8:11 PM, Gabor Juhos wrote:
...
>> --- a/drivers/spi/spi-qpic-snand.c
>> +++ b/drivers/spi/spi-qpic-snand.c
>> @@ -213,8 +213,16 @@ static int qcom_spi_ooblayout_ecc(struct mtd_info *mtd, int section,
>> if (section > 1)
>> return -ERANGE;
>>
>> - oobregion->length = qecc->ecc_bytes_hw + qecc->spare_bytes;
>> - oobregion->offset = mtd->oobsize - oobregion->length;
>> + if (!section) {
>> + oobregion->offset = 0;
>> + oobregion->length = qecc->bytes * (qecc->steps - 1) +
>> + qecc->bbm_size;
>> + } else {
>> + oobregion->offset = qecc->bytes * (qecc->steps - 1) +
>> + qecc->bbm_size +
>> + qecc->steps * 4;
>> + oobregion->length = mtd->oobsize - oobregion->offset;
>> + }
>
> How about
>
> if (section == 0) {
> } else if (section == 1) {
> } else { return -ERANGE }
>
> ?
The current way follows the implementation in the qcom_nandc driver, so it makes
it easier to compare the two, but it can be changed of course.
However, since the 'section' parameter is an integer can we agree up on using a
switch statement instead of multiple ifs?
Regards,
Gabor
Powered by blists - more mailing lists