diff mbox series

[1/7] mtd: replace name of 'rfree' field with 'free' in struct mtd_ooblayout_ops to better match it's description

Message ID 20221006031501.110290-1-mikhail.kshevetskiy@iopsys.eu
State Needs Review / ACK, archived
Delegated to: Dario Binacchi
Headers show
Series [1/7] mtd: replace name of 'rfree' field with 'free' in struct mtd_ooblayout_ops to better match it's description | expand

Commit Message

Mikhail Kshevetskiy Oct. 6, 2022, 3:14 a.m. UTC
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>

In the description of struct mtd_ooblayout_ops we see:

 * @free: function returning a free region in the OOB area.
 *	  Should return -ERANGE if %section exceeds the total number of
 *	  free sections.

but corresponding field of the structure named as 'rfree'. This is
wrong. Fix it the asme way as was done previously in linux kernel.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
 drivers/mtd/mtdcore.c                | 4 ++--
 drivers/mtd/nand/raw/denali.c        | 2 +-
 drivers/mtd/nand/raw/octeontx_nand.c | 2 +-
 drivers/mtd/nand/raw/rockchip_nfc.c  | 2 +-
 drivers/mtd/nand/spi/core.c          | 2 +-
 drivers/mtd/nand/spi/gigadevice.c    | 2 +-
 drivers/mtd/nand/spi/macronix.c      | 2 +-
 drivers/mtd/nand/spi/micron.c        | 2 +-
 drivers/mtd/nand/spi/toshiba.c       | 2 +-
 drivers/mtd/nand/spi/winbond.c       | 2 +-
 include/linux/mtd/mtd.h              | 4 ++--
 11 files changed, 13 insertions(+), 13 deletions(-)

Comments

Michael Nazzareno Trimarchi Oct. 7, 2022, 11:34 a.m. UTC | #1
Hi mikhail

On Thu, Oct 6, 2022 at 5:15 AM <mikhail.kshevetskiy@iopsys.eu> wrote:
>
> From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
>
> In the description of struct mtd_ooblayout_ops we see:
>
>  * @free: function returning a free region in the OOB area.
>  *        Should return -ERANGE if %section exceeds the total number of
>  *        free sections.
>
> but corresponding field of the structure named as 'rfree'. This is
> wrong. Fix it the asme way as was done previously in linux kernel.
>

About this change, there was a commit from Simon 8d38a8459b0
that was renamed. You ask basically to revert it

Michael

> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
> ---
>  drivers/mtd/mtdcore.c                | 4 ++--
>  drivers/mtd/nand/raw/denali.c        | 2 +-
>  drivers/mtd/nand/raw/octeontx_nand.c | 2 +-
>  drivers/mtd/nand/raw/rockchip_nfc.c  | 2 +-
>  drivers/mtd/nand/spi/core.c          | 2 +-
>  drivers/mtd/nand/spi/gigadevice.c    | 2 +-
>  drivers/mtd/nand/spi/macronix.c      | 2 +-
>  drivers/mtd/nand/spi/micron.c        | 2 +-
>  drivers/mtd/nand/spi/toshiba.c       | 2 +-
>  drivers/mtd/nand/spi/winbond.c       | 2 +-
>  include/linux/mtd/mtd.h              | 4 ++--
>  11 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index aa78d41a55..df8f3b8284 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -1208,10 +1208,10 @@ int mtd_ooblayout_free(struct mtd_info *mtd, int section,
>         if (!mtd || section < 0)
>                 return -EINVAL;
>
> -       if (!mtd->ooblayout || !mtd->ooblayout->rfree)
> +       if (!mtd->ooblayout || !mtd->ooblayout->free)
>                 return -ENOTSUPP;
>
> -       return mtd->ooblayout->rfree(mtd, section, oobfree);
> +       return mtd->ooblayout->free(mtd, section, oobfree);
>  }
>  EXPORT_SYMBOL_GPL(mtd_ooblayout_free);
>
> diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
> index c827f80281..ed24b84d82 100644
> --- a/drivers/mtd/nand/raw/denali.c
> +++ b/drivers/mtd/nand/raw/denali.c
> @@ -1166,7 +1166,7 @@ static int denali_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops denali_ooblayout_ops = {
>         .ecc = denali_ooblayout_ecc,
> -       .rfree = denali_ooblayout_free,
> +       .free = denali_ooblayout_free,
>  };
>
>  static int denali_multidev_fixup(struct denali_nand_info *denali)
> diff --git a/drivers/mtd/nand/raw/octeontx_nand.c b/drivers/mtd/nand/raw/octeontx_nand.c
> index b338b204f3..4023bbcec6 100644
> --- a/drivers/mtd/nand/raw/octeontx_nand.c
> +++ b/drivers/mtd/nand/raw/octeontx_nand.c
> @@ -435,7 +435,7 @@ static int nand_ooblayout_free_lp(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops nand_ooblayout_lp_ops = {
>         .ecc = nand_ooblayout_ecc_lp,
> -       .rfree = nand_ooblayout_free_lp,
> +       .free = nand_ooblayout_free_lp,
>  };
>
>  static inline struct octeontx_nand_chip *to_otx_nand(struct nand_chip *nand)
> diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
> index d016d25575..1ab429f430 100644
> --- a/drivers/mtd/nand/raw/rockchip_nfc.c
> +++ b/drivers/mtd/nand/raw/rockchip_nfc.c
> @@ -849,7 +849,7 @@ static int rk_nfc_ooblayout_ecc(struct mtd_info *mtd, int section,
>  }
>
>  static const struct mtd_ooblayout_ops rk_nfc_ooblayout_ops = {
> -       .rfree = rk_nfc_ooblayout_free,
> +       .free = rk_nfc_ooblayout_free,
>         .ecc = rk_nfc_ooblayout_ecc,
>  };
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 134bf22c80..4edb7ae952 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -1021,7 +1021,7 @@ static int spinand_noecc_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops spinand_noecc_ooblayout = {
>         .ecc = spinand_noecc_ooblayout_ecc,
> -       .rfree = spinand_noecc_ooblayout_free,
> +       .free = spinand_noecc_ooblayout_free,
>  };
>
>  static int spinand_init(struct spinand_device *spinand)
> diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
> index a2c93486f4..25d9f80d26 100644
> --- a/drivers/mtd/nand/spi/gigadevice.c
> +++ b/drivers/mtd/nand/spi/gigadevice.c
> @@ -154,7 +154,7 @@ static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
>
>  static const struct mtd_ooblayout_ops gd5fxgqxxexxg_ooblayout = {
>         .ecc = gd5fxgqxxexxg_ooblayout_ecc,
> -       .rfree = gd5fxgqxxexxg_ooblayout_free,
> +       .free = gd5fxgqxxexxg_ooblayout_free,
>  };
>
>  static const struct spinand_info gigadevice_spinand_table[] = {
> diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
> index 6d643a8000..6a1d6a1793 100644
> --- a/drivers/mtd/nand/spi/macronix.c
> +++ b/drivers/mtd/nand/spi/macronix.c
> @@ -51,7 +51,7 @@ static int mx35lfxge4ab_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops mx35lfxge4ab_ooblayout = {
>         .ecc = mx35lfxge4ab_ooblayout_ecc,
> -       .rfree = mx35lfxge4ab_ooblayout_free,
> +       .free = mx35lfxge4ab_ooblayout_free,
>  };
>
>  static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr)
> diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
> index 6bacf14aaf..3f5848aacd 100644
> --- a/drivers/mtd/nand/spi/micron.c
> +++ b/drivers/mtd/nand/spi/micron.c
> @@ -75,7 +75,7 @@ static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops micron_8_ooblayout = {
>         .ecc = micron_8_ooblayout_ecc,
> -       .rfree = micron_8_ooblayout_free,
> +       .free = micron_8_ooblayout_free,
>  };
>
>  static int micron_select_target(struct spinand_device *spinand,
> diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
> index c2cd3b426b..2a7b201bb1 100644
> --- a/drivers/mtd/nand/spi/toshiba.c
> +++ b/drivers/mtd/nand/spi/toshiba.c
> @@ -68,7 +68,7 @@ static int tx58cxgxsxraix_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops tx58cxgxsxraix_ooblayout = {
>         .ecc = tx58cxgxsxraix_ooblayout_ecc,
> -       .rfree = tx58cxgxsxraix_ooblayout_free,
> +       .free = tx58cxgxsxraix_ooblayout_free,
>  };
>
>  static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
> index c119486efb..119fa135b1 100644
> --- a/drivers/mtd/nand/spi/winbond.c
> +++ b/drivers/mtd/nand/spi/winbond.c
> @@ -61,7 +61,7 @@ static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section,
>
>  static const struct mtd_ooblayout_ops w25m02gv_ooblayout = {
>         .ecc = w25m02gv_ooblayout_ecc,
> -       .rfree = w25m02gv_ooblayout_free,
> +       .free = w25m02gv_ooblayout_free,
>  };
>
>  static int w25m02gv_select_target(struct spinand_device *spinand,
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index ff635bd716..03ccf28b06 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -129,8 +129,8 @@ struct mtd_oob_region {
>  struct mtd_ooblayout_ops {
>         int (*ecc)(struct mtd_info *mtd, int section,
>                    struct mtd_oob_region *oobecc);
> -       int (*rfree)(struct mtd_info *mtd, int section,
> -                    struct mtd_oob_region *oobfree);
> +       int (*free)(struct mtd_info *mtd, int section,
> +                   struct mtd_oob_region *oobfree);
>  };
>
>  /*
> --
> 2.35.1
>
Fabio Estevam Oct. 7, 2022, 11:58 a.m. UTC | #2
On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:

> About this change, there was a commit from Simon 8d38a8459b0
> that was renamed. You ask basically to revert it

Correct, what about fixing it like this?

diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index ff635bd716..09f5269887 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -122,7 +122,7 @@ struct mtd_oob_region {
  * @ecc: function returning an ECC region in the OOB area.
  *      Should return -ERANGE if %section exceeds the total number of
  *      ECC sections.
- * @free: function returning a free region in the OOB area.
+ * @rfree: function returning a free region in the OOB area.
  *       Should return -ERANGE if %section exceeds the total number of
  *       free sections.
  */
Michael Nazzareno Trimarchi Oct. 7, 2022, 11:59 a.m. UTC | #3
Hi

On Fri, Oct 7, 2022 at 1:58 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
> <michael@amarulasolutions.com> wrote:
>
> > About this change, there was a commit from Simon 8d38a8459b0
> > that was renamed. You ask basically to revert it
>
> Correct, what about fixing it like this?
>
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index ff635bd716..09f5269887 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -122,7 +122,7 @@ struct mtd_oob_region {
>   * @ecc: function returning an ECC region in the OOB area.
>   *      Should return -ERANGE if %section exceeds the total number of
>   *      ECC sections.
> - * @free: function returning a free region in the OOB area.
> + * @rfree: function returning a free region in the OOB area.
>   *       Should return -ERANGE if %section exceeds the total number of
>   *       free sections.
>   */

That's is anyway a fix

Michael
Michael Nazzareno Trimarchi Oct. 7, 2022, 2:01 p.m. UTC | #4
Hi Fabio

If you send the change of the comment, I will queue it

Michael

On Fri, Oct 7, 2022 at 1:59 PM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Hi
>
> On Fri, Oct 7, 2022 at 1:58 PM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
> > <michael@amarulasolutions.com> wrote:
> >
> > > About this change, there was a commit from Simon 8d38a8459b0
> > > that was renamed. You ask basically to revert it
> >
> > Correct, what about fixing it like this?
> >
> > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> > index ff635bd716..09f5269887 100644
> > --- a/include/linux/mtd/mtd.h
> > +++ b/include/linux/mtd/mtd.h
> > @@ -122,7 +122,7 @@ struct mtd_oob_region {
> >   * @ecc: function returning an ECC region in the OOB area.
> >   *      Should return -ERANGE if %section exceeds the total number of
> >   *      ECC sections.
> > - * @free: function returning a free region in the OOB area.
> > + * @rfree: function returning a free region in the OOB area.
> >   *       Should return -ERANGE if %section exceeds the total number of
> >   *       free sections.
> >   */
>
> That's is anyway a fix
>
> Michael
>
>
> --
> Michael Nazzareno Trimarchi
> Co-Founder & Chief Executive Officer
> M. +39 347 913 2170
> michael@amarulasolutions.com
> __________________________________
>
> Amarula Solutions BV
> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
> T. +31 (0)85 111 9172
> info@amarulasolutions.com
> www.amarulasolutions.com
Frieder Schrempf Nov. 24, 2022, 3:09 p.m. UTC | #5
On 07.10.22 13:58, Fabio Estevam wrote:
> On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
> <michael@amarulasolutions.com> wrote:
> 
>> About this change, there was a commit from Simon 8d38a8459b0
>> that was renamed. You ask basically to revert it
> 
> Correct, what about fixing it like this?
> 
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index ff635bd716..09f5269887 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -122,7 +122,7 @@ struct mtd_oob_region {
>   * @ecc: function returning an ECC region in the OOB area.
>   *      Should return -ERANGE if %section exceeds the total number of
>   *      ECC sections.
> - * @free: function returning a free region in the OOB area.
> + * @rfree: function returning a free region in the OOB area.
>   *       Should return -ERANGE if %section exceeds the total number of
>   *       free sections.
>   */

But do we really want to stay out of sync with the Linux kernel code? Is
the reasoning behind Simon's change in 8d38a8459b0 still valid today?
Simon Glass Dec. 5, 2022, 4:11 p.m. UTC | #6
Hi Frieder,

On Fri, 25 Nov 2022 at 04:09, Frieder Schrempf
<frieder.schrempf@kontron.de> wrote:
>
> On 07.10.22 13:58, Fabio Estevam wrote:
> > On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
> > <michael@amarulasolutions.com> wrote:
> >
> >> About this change, there was a commit from Simon 8d38a8459b0
> >> that was renamed. You ask basically to revert it
> >
> > Correct, what about fixing it like this?
> >
> > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> > index ff635bd716..09f5269887 100644
> > --- a/include/linux/mtd/mtd.h
> > +++ b/include/linux/mtd/mtd.h
> > @@ -122,7 +122,7 @@ struct mtd_oob_region {
> >   * @ecc: function returning an ECC region in the OOB area.
> >   *      Should return -ERANGE if %section exceeds the total number of
> >   *      ECC sections.
> > - * @free: function returning a free region in the OOB area.
> > + * @rfree: function returning a free region in the OOB area.
> >   *       Should return -ERANGE if %section exceeds the total number of
> >   *       free sections.
> >   */
>
> But do we really want to stay out of sync with the Linux kernel code? Is
> the reasoning behind Simon's change in 8d38a8459b0 still valid today?

See here:

https://patchwork.ozlabs.org/project/uboot/cover/20200203143618.74619-1-sjg@chromium.org/

I don't believe this patch even builds for sandbox:

drivers/mtd/mtdcore.c: In function ‘mtd_ooblayout_free’:
drivers/mtd/mtdcore.c:1214:58: error: macro "free" passed 3 arguments,
but takes just 1
 1214 |         return mtd->ooblayout->free(mtd, section, oobfree);

See malloc.h for the #define for free()

Regards,
Simon
Michael Nazzareno Trimarchi Dec. 5, 2022, 4:15 p.m. UTC | #7
Hi

On Mon, Dec 5, 2022 at 5:11 PM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Frieder,
>
> On Fri, 25 Nov 2022 at 04:09, Frieder Schrempf
> <frieder.schrempf@kontron.de> wrote:
> >
> > On 07.10.22 13:58, Fabio Estevam wrote:
> > > On Fri, Oct 7, 2022 at 8:34 AM Michael Nazzareno Trimarchi
> > > <michael@amarulasolutions.com> wrote:
> > >
> > >> About this change, there was a commit from Simon 8d38a8459b0
> > >> that was renamed. You ask basically to revert it
> > >
> > > Correct, what about fixing it like this?
> > >
> > > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> > > index ff635bd716..09f5269887 100644
> > > --- a/include/linux/mtd/mtd.h
> > > +++ b/include/linux/mtd/mtd.h
> > > @@ -122,7 +122,7 @@ struct mtd_oob_region {
> > >   * @ecc: function returning an ECC region in the OOB area.
> > >   *      Should return -ERANGE if %section exceeds the total number of
> > >   *      ECC sections.
> > > - * @free: function returning a free region in the OOB area.
> > > + * @rfree: function returning a free region in the OOB area.
> > >   *       Should return -ERANGE if %section exceeds the total number of
> > >   *       free sections.
> > >   */
> >
> > But do we really want to stay out of sync with the Linux kernel code? Is
> > the reasoning behind Simon's change in 8d38a8459b0 still valid today?
>

We will be stay in sync to linux as much as possible

Michael

> See here:
>
> https://patchwork.ozlabs.org/project/uboot/cover/20200203143618.74619-1-sjg@chromium.org/
>
> I don't believe this patch even builds for sandbox:
>
> drivers/mtd/mtdcore.c: In function ‘mtd_ooblayout_free’:
> drivers/mtd/mtdcore.c:1214:58: error: macro "free" passed 3 arguments,
> but takes just 1
>  1214 |         return mtd->ooblayout->free(mtd, section, oobfree);
>
> See malloc.h for the #define for free()
>
> Regards,
> Simon
diff mbox series

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index aa78d41a55..df8f3b8284 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1208,10 +1208,10 @@  int mtd_ooblayout_free(struct mtd_info *mtd, int section,
 	if (!mtd || section < 0)
 		return -EINVAL;
 
-	if (!mtd->ooblayout || !mtd->ooblayout->rfree)
+	if (!mtd->ooblayout || !mtd->ooblayout->free)
 		return -ENOTSUPP;
 
-	return mtd->ooblayout->rfree(mtd, section, oobfree);
+	return mtd->ooblayout->free(mtd, section, oobfree);
 }
 EXPORT_SYMBOL_GPL(mtd_ooblayout_free);
 
diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
index c827f80281..ed24b84d82 100644
--- a/drivers/mtd/nand/raw/denali.c
+++ b/drivers/mtd/nand/raw/denali.c
@@ -1166,7 +1166,7 @@  static int denali_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops denali_ooblayout_ops = {
 	.ecc = denali_ooblayout_ecc,
-	.rfree = denali_ooblayout_free,
+	.free = denali_ooblayout_free,
 };
 
 static int denali_multidev_fixup(struct denali_nand_info *denali)
diff --git a/drivers/mtd/nand/raw/octeontx_nand.c b/drivers/mtd/nand/raw/octeontx_nand.c
index b338b204f3..4023bbcec6 100644
--- a/drivers/mtd/nand/raw/octeontx_nand.c
+++ b/drivers/mtd/nand/raw/octeontx_nand.c
@@ -435,7 +435,7 @@  static int nand_ooblayout_free_lp(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops nand_ooblayout_lp_ops = {
 	.ecc = nand_ooblayout_ecc_lp,
-	.rfree = nand_ooblayout_free_lp,
+	.free = nand_ooblayout_free_lp,
 };
 
 static inline struct octeontx_nand_chip *to_otx_nand(struct nand_chip *nand)
diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index d016d25575..1ab429f430 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -849,7 +849,7 @@  static int rk_nfc_ooblayout_ecc(struct mtd_info *mtd, int section,
 }
 
 static const struct mtd_ooblayout_ops rk_nfc_ooblayout_ops = {
-	.rfree = rk_nfc_ooblayout_free,
+	.free = rk_nfc_ooblayout_free,
 	.ecc = rk_nfc_ooblayout_ecc,
 };
 
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 134bf22c80..4edb7ae952 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -1021,7 +1021,7 @@  static int spinand_noecc_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops spinand_noecc_ooblayout = {
 	.ecc = spinand_noecc_ooblayout_ecc,
-	.rfree = spinand_noecc_ooblayout_free,
+	.free = spinand_noecc_ooblayout_free,
 };
 
 static int spinand_init(struct spinand_device *spinand)
diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
index a2c93486f4..25d9f80d26 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
@@ -154,7 +154,7 @@  static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
 
 static const struct mtd_ooblayout_ops gd5fxgqxxexxg_ooblayout = {
 	.ecc = gd5fxgqxxexxg_ooblayout_ecc,
-	.rfree = gd5fxgqxxexxg_ooblayout_free,
+	.free = gd5fxgqxxexxg_ooblayout_free,
 };
 
 static const struct spinand_info gigadevice_spinand_table[] = {
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
index 6d643a8000..6a1d6a1793 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -51,7 +51,7 @@  static int mx35lfxge4ab_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops mx35lfxge4ab_ooblayout = {
 	.ecc = mx35lfxge4ab_ooblayout_ecc,
-	.rfree = mx35lfxge4ab_ooblayout_free,
+	.free = mx35lfxge4ab_ooblayout_free,
 };
 
 static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 6bacf14aaf..3f5848aacd 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -75,7 +75,7 @@  static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops micron_8_ooblayout = {
 	.ecc = micron_8_ooblayout_ecc,
-	.rfree = micron_8_ooblayout_free,
+	.free = micron_8_ooblayout_free,
 };
 
 static int micron_select_target(struct spinand_device *spinand,
diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
index c2cd3b426b..2a7b201bb1 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
@@ -68,7 +68,7 @@  static int tx58cxgxsxraix_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops tx58cxgxsxraix_ooblayout = {
 	.ecc = tx58cxgxsxraix_ooblayout_ecc,
-	.rfree = tx58cxgxsxraix_ooblayout_free,
+	.free = tx58cxgxsxraix_ooblayout_free,
 };
 
 static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index c119486efb..119fa135b1 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -61,7 +61,7 @@  static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section,
 
 static const struct mtd_ooblayout_ops w25m02gv_ooblayout = {
 	.ecc = w25m02gv_ooblayout_ecc,
-	.rfree = w25m02gv_ooblayout_free,
+	.free = w25m02gv_ooblayout_free,
 };
 
 static int w25m02gv_select_target(struct spinand_device *spinand,
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index ff635bd716..03ccf28b06 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -129,8 +129,8 @@  struct mtd_oob_region {
 struct mtd_ooblayout_ops {
 	int (*ecc)(struct mtd_info *mtd, int section,
 		   struct mtd_oob_region *oobecc);
-	int (*rfree)(struct mtd_info *mtd, int section,
-		     struct mtd_oob_region *oobfree);
+	int (*free)(struct mtd_info *mtd, int section,
+		    struct mtd_oob_region *oobfree);
 };
 
 /*