mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Gabor Juhos <j4g8y7@gmail.com>, Mark Brown <broonie@kernel.org>,
	Varadarajan Narayanan <quic_varada@quicinc.com>,
	Sricharan Ramabadhran <quic_srichara@quicinc.com>,
	Md Sadre Alam <quic_mdalam@quicinc.com>
Cc: linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: spi-qpic-snand: fix calculating of ECC OOB regions' properties
Date: Mon, 4 Aug 2025 11:04:22 +0200	[thread overview]
Message-ID: <93403461-c0b2-4c0c-91b3-8cbd4c1c5ebe@oss.qualcomm.com> (raw)
In-Reply-To: <8883471e-57b9-4492-8d4a-aca3b4538682@gmail.com>

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

      reply	other threads:[~2025-08-04  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 18:11 Gabor Juhos
2025-08-01 11:56 ` Konrad Dybcio
2025-08-04  7:22   ` Gabor Juhos
2025-08-04  9:04     ` Konrad Dybcio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93403461-c0b2-4c0c-91b3-8cbd4c1c5ebe@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=j4g8y7@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=quic_mdalam@quicinc.com \
    --cc=quic_srichara@quicinc.com \
    --cc=quic_varada@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®