[PATCH v1 01/14] mtd: spi-nor: export more function to be used in vendor modules

Tudor.Ambarus at microchip.com Tudor.Ambarus at microchip.com
Wed Feb 9 19:13:21 PST 2022


On 2/2/22 16:58, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> We will move vendor specific code into the vendor modules and thus we
> will have to export these functions so they can be called.
> 
> Signed-off-by: Michael Walle <michael at walle.cc>

please move this patch closer to where the vendors actually use the methods.
With that:

Reviewed-by: Tudor Ambarus <tudor.ambarus at microchip.com>

> ---
>  drivers/mtd/spi-nor/core.c | 10 +++++-----
>  drivers/mtd/spi-nor/core.h |  6 ++++++
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 04ea180118e3..f05ece6018dc 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -157,8 +157,8 @@ static int spi_nor_spimem_exec_op(struct spi_nor *nor, struct spi_mem_op *op)
>         return spi_mem_exec_op(nor->spimem, op);
>  }
> 
> -static int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
> -                                          u8 *buf, size_t len)
> +int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
> +                                   u8 *buf, size_t len)
>  {
>         if (spi_nor_protocol_is_dtr(nor->reg_proto))
>                 return -EOPNOTSUPP;
> @@ -166,8 +166,8 @@ static int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
>         return nor->controller_ops->read_reg(nor, opcode, buf, len);
>  }
> 
> -static int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
> -                                           const u8 *buf, size_t len)
> +int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
> +                                    const u8 *buf, size_t len)
>  {
>         if (spi_nor_protocol_is_dtr(nor->reg_proto))
>                 return -EOPNOTSUPP;
> @@ -683,7 +683,7 @@ static void spi_nor_clear_sr(struct spi_nor *nor)
>   *
>   * Return: 1 if ready, 0 if not ready, -errno on errors.
>   */
> -static int spi_nor_sr_ready(struct spi_nor *nor)
> +int spi_nor_sr_ready(struct spi_nor *nor)
>  {
>         int ret = spi_nor_read_sr(nor, nor->bouncebuf);
> 
> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
> index 2afb610853a9..c6578d3f598b 100644
> --- a/drivers/mtd/spi-nor/core.h
> +++ b/drivers/mtd/spi-nor/core.h
> @@ -554,6 +554,7 @@ int spi_nor_sr1_bit6_quad_enable(struct spi_nor *nor);
>  int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor);
>  int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor);
>  int spi_nor_read_sr(struct spi_nor *nor, u8 *sr);
> +int spi_nor_sr_ready(struct spi_nor *nor);
>  int spi_nor_read_cr(struct spi_nor *nor, u8 *cr);
>  int spi_nor_write_sr(struct spi_nor *nor, const u8 *sr, size_t len);
>  int spi_nor_write_sr_and_check(struct spi_nor *nor, u8 sr1);
> @@ -599,6 +600,11 @@ void spi_nor_try_unlock_all(struct spi_nor *nor);
>  void spi_nor_set_mtd_locking_ops(struct spi_nor *nor);
>  void spi_nor_set_mtd_otp_ops(struct spi_nor *nor);
> 
> +int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
> +                                   u8 *buf, size_t len);
> +int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
> +                                    const u8 *buf, size_t len);
> +
>  static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)
>  {
>         return container_of(mtd, struct spi_nor, mtd);
> --
> 2.30.2
> 



More information about the linux-mtd mailing list