[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200109174159.1737067f@xps13>
Date: Thu, 9 Jan 2020 17:41:59 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Mason Yang <masonccyang@...c.com.tw>
Cc: richard@....at, marek.vasut@...il.com, dwmw2@...radead.org,
bbrezillon@...nel.org, computersforpeace@...il.com,
vigneshr@...com, juliensu@...c.com.tw,
linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org
Subject: Re: [PATCH v2 1/4] mtd: rawnand: Add support manufacturer specific
lock/unlock operatoin
Hi Mason,
Mason Yang <masonccyang@...c.com.tw> wrote on Mon, 28 Oct 2019 17:55:24
+0800:
> Add nand_lock() & nand_unlock() for manufacturer specific lock & unlock
> operation while the device supports Block Protection function.
>
> Signed-off-by: Mason Yang <masonccyang@...c.com.tw>
> ---
> drivers/mtd/nand/raw/nand_base.c | 32 ++++++++++++++++++++++++++++++--
> include/linux/mtd/rawnand.h | 3 +++
> 2 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index 5c2c30a..5e318ff 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4356,6 +4356,34 @@ static void nand_shutdown(struct mtd_info *mtd)
> nand_suspend(mtd);
> }
>
> +/**
> + * nand_lock - [MTD Interface] Lock the NAND flash
> + * @mtd: MTD device structure
> + */
> +static int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> +
> + if (!chip->_lock)
> + return -ENOTSUPP;
> +
> + return chip->_lock(chip, ofs, len);
> +}
> +
> +/**
> + * nand_unlock - [MTD Interface] Unlock the NAND flash
> + * @mtd: MTD device structure
> + */
> +static int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
> +{
> + struct nand_chip *chip = mtd_to_nand(mtd);
> +
> + if (!chip->_unlock)
> + return -ENOTSUPP;
> +
> + return chip->_unlock(chip, ofs, len);
> +}
> +
> /* Set default functions */
> static void nand_set_defaults(struct nand_chip *chip)
> {
> @@ -5782,8 +5810,8 @@ static int nand_scan_tail(struct nand_chip *chip)
> mtd->_read_oob = nand_read_oob;
> mtd->_write_oob = nand_write_oob;
> mtd->_sync = nand_sync;
> - mtd->_lock = NULL;
> - mtd->_unlock = NULL;
> + mtd->_lock = nand_lock;
> + mtd->_unlock = nand_unlock;
> mtd->_suspend = nand_suspend;
> mtd->_resume = nand_resume;
> mtd->_reboot = nand_shutdown;
> diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
> index 4ab9bcc..2430ecd 100644
> --- a/include/linux/mtd/rawnand.h
> +++ b/include/linux/mtd/rawnand.h
> @@ -1136,6 +1136,9 @@ struct nand_chip {
> const struct nand_manufacturer *desc;
> void *priv;
> } manufacturer;
> +
> + int (*_lock)(struct nand_chip *chip, loff_t ofs, uint64_t len);
> + int (*_unlock)(struct nand_chip *chip, loff_t ofs, uint64_t len);
Kernel documentation is missing here.
Also please fix kbuildtest robot warnings.
With all this done, please add my:
Reviewed-by: Miquel Raynal <miquel.raynal@...tlin.com>
Thanks,
Miquèl
Powered by blists - more mailing lists