lkml.org 
[lkml]   [2020]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/4] mtd: rawnand: Add support manufacturer specific suspend/resume operation
On Wed, 11 Mar 2020 14:13:57 +0800
masonccyang@mxic.com.tw wrote:

> Hi Boris,
>
> > > > ---
> > > > drivers/mtd/nand/raw/nand_base.c | 11 ++++++++---
> > > > include/linux/mtd/rawnand.h | 4 ++++
> > > > 2 files changed, 12 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/drivers/mtd/nand/raw/nand_base.c
> b/drivers/mtd/nand/raw/nand_base.c
> > > > index 769be81..b44e460 100644
> > > > --- a/drivers/mtd/nand/raw/nand_base.c
> > > > +++ b/drivers/mtd/nand/raw/nand_base.c
> > > > @@ -4327,7 +4327,9 @@ static int nand_suspend(struct mtd_info *mtd)
> > > > struct nand_chip *chip = mtd_to_nand(mtd);
> > > >
> > > > mutex_lock(&chip->lock);
> > > > - chip->suspended = 1;
> > > > + if (chip->_suspend)
> > > > + if (!chip->_suspend(chip))
> > > > + chip->suspended = 1;
> >
> > Shouldn't you propagate the error to the caller if chip->_suspend()
> > fails?
>
> Currently, chip->suspend() just do sending command to nand chip and
> I think caller could check chip->suspend = 1 or 0 to know the status
> of nand chip.

No, it can't. The caller (AKA the MTD layer) has no idea about this
chip->suspend field, actually it doesn't even know about the nand_chip
struct. The mtd->_suspend() hook is here to abstract HW details, so
it's the raw NAND framework responsibility to propagate the error code
returned by chip->suspend().

\
 
 \ /
  Last update: 2020-03-11 09:02    [W:0.075 / U:2.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site