From: Boris Brezillon <boris.brezillon@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v2 09/11] sf_mtd: Simply mtd operations
Date: Tue, 4 Dec 2018 13:49:56 +0100 [thread overview]
Message-ID: <20181204134956.15b0a834@bbrezillon> (raw)
In-Reply-To: <20181204122659.14720-10-vigneshr@ti.com>
On Tue, 4 Dec 2018 17:56:57 +0530
Vignesh R <vigneshr@ti.com> wrote:
> Now that there is new SPI NOR framework, simplify mtd device
> registration and read/write/erase operations.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
> drivers/mtd/spi/sf_internal.h | 2 +-
> drivers/mtd/spi/sf_mtd.c | 39 ++++++++++++-----------------------
> drivers/mtd/spi/sf_probe.c | 2 +-
> 3 files changed, 15 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
> index 7e7d400cdbdf..8b445bb0b506 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -99,6 +99,6 @@ int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash);
>
> #ifdef CONFIG_SPI_FLASH_MTD
> int spi_flash_mtd_register(struct spi_flash *flash);
> -void spi_flash_mtd_unregister(void);
> +void spi_flash_mtd_unregister(struct spi_flash *flash);
> #endif
> #endif /* _SF_INTERNAL_H_ */
> diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c
> index 58d7e4439903..9c07ba3cadf7 100644
> --- a/drivers/mtd/spi/sf_mtd.c
> +++ b/drivers/mtd/spi/sf_mtd.c
> @@ -9,17 +9,15 @@
> #include <linux/mtd/mtd.h>
> #include <spi_flash.h>
>
> -static struct mtd_info sf_mtd_info;
> static char sf_mtd_name[8];
>
> static int spi_flash_mtd_erase(struct mtd_info *mtd, struct erase_info *instr)
> {
> - struct spi_flash *flash = mtd->priv;
> int err;
>
> instr->state = MTD_ERASING;
>
> - err = spi_flash_erase(flash, instr->addr, instr->len);
> + err = mtd->_erase(mtd, instr);
Please don't dereference mtd hooks directly. I'm pretty sure the
mtd_erase() overhead is negligible, and if it's not, you can
implement dummy wrappers for the SPL case to reduce it to zero.
next prev parent reply other threads:[~2018-12-04 12:49 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-04 12:26 [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 01/11] spi: spi-mem: Allow use of spi_mem_exec_op for all SPI modes Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 02/11] spi-mem: Claim SPI bus before spi mem access Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 03/11] spi: Add non DM version of SPI_MEM Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 04/11] sh: bitops: add hweight*() macros Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 05/11] mtd: spi: Port SPI NOR framework from Linux Vignesh R
2018-12-05 20:13 ` Simon Goldschmidt
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 06/11] mtd spi: Switch to new SPI NOR framework Vignesh R
2018-12-05 7:04 ` Simon Goldschmidt
2018-12-05 11:12 ` Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 07/11] mtd: spi: Remove unused files Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 08/11] mtd: spi: Add lightweight SPI flash stack for SPL Vignesh R
2018-12-05 7:01 ` Simon Goldschmidt
2018-12-05 11:09 ` Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 09/11] sf_mtd: Simply mtd operations Vignesh R
2018-12-04 12:49 ` Boris Brezillon [this message]
2018-12-05 8:00 ` Vignesh R
2018-12-05 8:27 ` Miquel Raynal
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 10/11] taurus_defconfig: Enable simple malloc in SPL Vignesh R
2018-12-04 12:26 ` [U-Boot] [RFC PATCH v2 11/11] axm_defconfig: " Vignesh R
2018-12-04 12:55 ` [U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework Boris Brezillon
2018-12-04 20:11 ` Simon Goldschmidt
2018-12-05 6:51 ` Vignesh R
2018-12-05 6:55 ` Simon Goldschmidt
2018-12-05 20:45 ` Simon Goldschmidt
2018-12-06 13:46 ` Vignesh R
2018-12-06 13:54 ` Simon Goldschmidt
2018-12-06 16:36 ` Simon Goldschmidt
2018-12-06 17:39 ` Vignesh R
2018-12-06 19:17 ` Simon Goldschmidt
2018-12-07 5:58 ` Vignesh R
2018-12-07 18:43 ` Simon Goldschmidt
2018-12-06 17:14 ` Jagan Teki
2018-12-06 18:18 ` Tom Rini
2018-12-06 18:25 ` Vignesh R
2018-12-06 19:22 ` Simon Goldschmidt
2018-12-07 9:51 ` Boris Brezillon
2018-12-09 8:54 ` Vignesh R
2018-12-10 13:02 ` Jagan Teki
2018-12-10 13:15 ` Boris Brezillon
2018-12-10 14:33 ` Tom Rini
2018-12-10 17:38 ` Vignesh R
2018-12-10 18:04 ` Miquel Raynal
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=20181204134956.15b0a834@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=u-boot@lists.denx.de \
/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