[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <93403461-c0b2-4c0c-91b3-8cbd4c1c5ebe@oss.qualcomm.com>
Date: Mon, 4 Aug 2025 11:04:22 +0200
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Gabor Juhos <j4g8y7@...il.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
On 8/4/25 9:22 AM, Gabor Juhos wrote:
> 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?
That works too
Konrad
Powered by blists - more mailing lists