lkml.org 
[lkml]   [2020]   [Mar]   [10]   [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 Tue,  3 Mar 2020 15:21:23 +0800
Mason Yang <masonccyang@mxic.com.tw> wrote:

> Patch nand_suspend() & nand_resume() for manufacturer specific
> suspend/resume operation.
>
> Signed-off-by: Mason Yang <masonccyang@mxic.com.tw>
> Reported-by: kbuild test robot <lkp@intel.com>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
> 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;
> mutex_unlock(&chip->lock);
>
> return 0;
> @@ -4342,11 +4344,14 @@ static void nand_resume(struct mtd_info *mtd)
> struct nand_chip *chip = mtd_to_nand(mtd);
>
> mutex_lock(&chip->lock);
> - if (chip->suspended)
> + if (chip->suspended) {
> + if (chip->_resume)
> + chip->_resume(chip);
> chip->suspended = 0;
> - else
> + } else {
> pr_err("%s called for a chip which is not in suspended state\n",
> __func__);
> + }
> mutex_unlock(&chip->lock);
> }
>
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index bc2fa3c..c0055ed 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -1064,6 +1064,8 @@ struct nand_legacy {
> * @lock: lock protecting the suspended field. Also used to
> * serialize accesses to the NAND device.
> * @suspended: set to 1 when the device is suspended, 0 when it's not.
> + * @_suspend: [REPLACEABLE] specific NAND device suspend operation
> + * @_resume: [REPLACEABLE] specific NAND device resume operation
> * @bbt: [INTERN] bad block table pointer
> * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
> * lookup.
> @@ -1119,6 +1121,8 @@ struct nand_chip {
>
> struct mutex lock;
> unsigned int suspended : 1;
> + int (*_suspend)(struct nand_chip *chip);
> + void (*_resume)(struct nand_chip *chip);

I thought we agreed on not prefixing new hooks with _ ?

>
> uint8_t *oob_poi;
> struct nand_controller *controller;

\
 
 \ /
  Last update: 2020-03-10 20:34    [W:0.106 / U:1.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site