From: <Tudor.Ambarus@microchip.com>
To: <p.yadav@ti.com>
Cc: vigneshr@ti.com, richard@nod.at, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com,
Takahiro.Kuwano@infineon.com
Subject: Re: [PATCH 1/2] mtd: spi-nor: core: Advance erase after the erase cmd has been completed
Date: Mon, 8 Feb 2021 12:14:19 +0000 [thread overview]
Message-ID: <4d4a96d0-1582-400b-b554-14f87df44509@microchip.com> (raw)
In-Reply-To: <20210208114101.txh7ao7bi66jezrb@ti.com>
On 2/8/21 1:41 PM, Pratyush Yadav wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 05/02/21 03:52PM, Tudor Ambarus wrote:
>> Wait for the erase cmd to complete and then advance the erase.
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
>> drivers/mtd/spi-nor/core.c | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
>> index 0522304f52fa..bcaa161bc7db 100644
>> --- a/drivers/mtd/spi-nor/core.c
>> +++ b/drivers/mtd/spi-nor/core.c
>> @@ -1618,12 +1618,12 @@ static int spi_nor_erase_multi_sectors(struct spi_nor *nor, u64 addr, u32 len)
>> if (ret)
>> goto destroy_erase_cmd_list;
>>
>> - addr += cmd->size;
>> - cmd->count--;
>> -
>> ret = spi_nor_wait_till_ready(nor);
>> if (ret)
>> goto destroy_erase_cmd_list;
>> +
>> + addr += cmd->size;
>> + cmd->count--;
>> }
>> list_del(&cmd->list);
>> kfree(cmd);
>> @@ -1704,12 +1704,12 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
>> if (ret)
>> goto erase_err;
>>
>> - addr += mtd->erasesize;
>> - len -= mtd->erasesize;
>> -
>> ret = spi_nor_wait_till_ready(nor);
>> if (ret)
>> goto erase_err;
>> +
>> + addr += mtd->erasesize;
>> + len -= mtd->erasesize;
>
> Do these changes have any practical benefit? IMO they are worth doing
> even if there is none but I'm curious what prompted this patch.
I saw these when reviewing Takahiro's patches. Addr and len were gratuitously
updated even when the wait failed. We'll avoid 2 extra ops on the error path.
Plus, having them updated before the wait can be misleading for someone that
tracks them down with some debug messages. I find the code better structured,
and the code will make more sense when it is read, if using this patch.
>
> Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Thanks,
ta
>
>> }
>>
>> /* erase multiple sectors */
>
> --
> Regards,
> Pratyush Yadav
> Texas Instruments Inc.
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2021-02-08 12:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 13:52 [PATCH 1/2] mtd: spi-nor: core: Advance erase after the erase cmd has been completed Tudor Ambarus
2021-02-05 13:52 ` [PATCH 2/2] mtd: spi-nor: core: Add dbg msg for spi_nor_erase_multi_sectors() Tudor Ambarus
2021-02-08 11:41 ` Pratyush Yadav
2021-02-08 11:59 ` Tudor.Ambarus
2021-02-08 11:41 ` [PATCH 1/2] mtd: spi-nor: core: Advance erase after the erase cmd has been completed Pratyush Yadav
2021-02-08 12:14 ` Tudor.Ambarus [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=4d4a96d0-1582-400b-b554-14f87df44509@microchip.com \
--to=tudor.ambarus@microchip.com \
--cc=Takahiro.Kuwano@infineon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=p.yadav@ti.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.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