diff mbox series

[1/4] mtd: rfd_ftl: allow use of MTD_RAM for testing purposes

Message ID 5f9ca4ce43ab49e900339e2cef26782825e3ab6f.1626169090.git.sean@mess.org
State Changes Requested
Headers show
Series Fix various issues with RFD and FTLs | expand

Commit Message

Sean Young July 13, 2021, 9:44 a.m. UTC
Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/mtd/rfd_ftl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Miquel Raynal Aug. 6, 2021, 6:16 p.m. UTC | #1
Hi Sean,

Sean Young <sean@mess.org> wrote on Tue, 13 Jul 2021 10:44:00 +0100:

You miss a commit message here.

Is this a real patch or just something for debugging purpose that we
should keep out of tree? I don't really see the reason for this patch
even though I am not strongly opposed to it.

> Signed-off-by: Sean Young <sean@mess.org>
> ---
>  drivers/mtd/rfd_ftl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
> index 6e0d5ce9b010..7b243f2b2fa3 100644
> --- a/drivers/mtd/rfd_ftl.c
> +++ b/drivers/mtd/rfd_ftl.c
> @@ -720,7 +720,8 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
>  {
>  	struct partition *part;
>  
> -	if (mtd->type != MTD_NORFLASH || mtd->size > UINT_MAX)
> +	if ((mtd->type != MTD_NORFLASH && mtd->type != MTD_RAM) ||
> +	    mtd->size > UINT_MAX)
>  		return;
>  
>  	part = kzalloc(sizeof(struct partition), GFP_KERNEL);

Thanks,
Miquèl
Sean Young Aug. 7, 2021, 7:53 a.m. UTC | #2
On Fri, Aug 06, 2021 at 08:16:29PM +0200, Miquel Raynal wrote:
> Hi Sean,
> 
> Sean Young <sean@mess.org> wrote on Tue, 13 Jul 2021 10:44:00 +0100:
> 
> You miss a commit message here.
> 
> Is this a real patch or just something for debugging purpose that we
> should keep out of tree? I don't really see the reason for this patch
> even though I am not strongly opposed to it.

This allows the mtdram module to be used as a test bed. This means
different mtd sizes can be tested and it can be tested on platforms
without an mtd device.

I'll add a better commit message for v2.

Thanks for the review

Sean

> 
> > Signed-off-by: Sean Young <sean@mess.org>
> > ---
> >  drivers/mtd/rfd_ftl.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
> > index 6e0d5ce9b010..7b243f2b2fa3 100644
> > --- a/drivers/mtd/rfd_ftl.c
> > +++ b/drivers/mtd/rfd_ftl.c
> > @@ -720,7 +720,8 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
> >  {
> >  	struct partition *part;
> >  
> > -	if (mtd->type != MTD_NORFLASH || mtd->size > UINT_MAX)
> > +	if ((mtd->type != MTD_NORFLASH && mtd->type != MTD_RAM) ||
> > +	    mtd->size > UINT_MAX)
> >  		return;
> >  
> >  	part = kzalloc(sizeof(struct partition), GFP_KERNEL);
> 
> Thanks,
> Miquèl
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
diff mbox series

Patch

diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index 6e0d5ce9b010..7b243f2b2fa3 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -720,7 +720,8 @@  static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
 	struct partition *part;
 
-	if (mtd->type != MTD_NORFLASH || mtd->size > UINT_MAX)
+	if ((mtd->type != MTD_NORFLASH && mtd->type != MTD_RAM) ||
+	    mtd->size > UINT_MAX)
 		return;
 
 	part = kzalloc(sizeof(struct partition), GFP_KERNEL);