Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2451249ybl; Thu, 9 Jan 2020 13:02:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxOlmNTu1y8GgHH80bB0d2Kp+ieZ6Z247oNwA0QBlLPQt4hSeoe7IvmltNBoLtOxzTGKwiz X-Received: by 2002:aca:d484:: with SMTP id l126mr4581215oig.114.1578603723734; Thu, 09 Jan 2020 13:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578603723; cv=none; d=google.com; s=arc-20160816; b=Hb0XUEF7cAxCfBFDAYXJQaCHEcPJhlOD9atrkieVsWoUdySfSo+s8Tk2qA4DmYSF/V xHU4jh9hM62xIMuP/uDVGUnTosN6XdDEWcOxEB6XLnNKfnQJXdsezuRi5FruSbVAQY72 f3hewic6fGiDGjtu9j2mqYDU45B1xzH3d2/dedil58Jy8u+Ob3lz4T8SpkaNMRvTuncf XLFmz+i80wHtzN9axDr1KrVJqTmjQd8aG1+GfSrRdcmCnv6eqy5MSsvn7GrthLwRPRMN uripDkDXFyoxgAqaZtP9vVsFoEcDGEF2Cll35GPUutrG/gPo/AQku/SW+UkTRcED339O 8Wig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=HonnuyY38bfI1JdhQccR4xaGH9vRQtRbCrzeVl8Rndo=; b=Z9y1ny/Mu5CyISVVHe9QZgg7DLZaSrhmb8TOtcOXv6oDUdutvZCuqayyijzHZTke16 VdOSlrnbMs9xgQj0JdzzEwm5KOFwePXGnsi63YwBqix/242CPNu8uwHMf5vv4ThkkMIe Ee6fOAWn8Yj2TivVO+UDUzT1KshBb2aukI22hFb+obyTCaFj8vGTaFfvU3WpqXLIpRqw zsW+0bbs5HCNCByDZN4kz39LRYzYUzhNwI5lwAGJYgO5BKoG/xqNr7KV10g57Yp9+MIL jnRpU+g6gKBet9fjF0GVRZ34Z1WwVsGrNly2NMws38sVkgPkJ7xljnIqNy2icTQuOlWg Un6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si4769546otp.131.2020.01.09.13.01.51; Thu, 09 Jan 2020 13:02:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731378AbgAIQmD convert rfc822-to-8bit (ORCPT + 99 others); Thu, 9 Jan 2020 11:42:03 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:60463 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbgAIQmD (ORCPT ); Thu, 9 Jan 2020 11:42:03 -0500 X-Originating-IP: 91.224.148.103 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 523B920002; Thu, 9 Jan 2020 16:42:00 +0000 (UTC) Date: Thu, 9 Jan 2020 17:41:59 +0100 From: Miquel Raynal To: Mason Yang Cc: richard@nod.at, marek.vasut@gmail.com, dwmw2@infradead.org, bbrezillon@kernel.org, computersforpeace@gmail.com, vigneshr@ti.com, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: Re: [PATCH v2 1/4] mtd: rawnand: Add support manufacturer specific lock/unlock operatoin Message-ID: <20200109174159.1737067f@xps13> In-Reply-To: <1572256527-5074-2-git-send-email-masonccyang@mxic.com.tw> References: <1572256527-5074-1-git-send-email-masonccyang@mxic.com.tw> <1572256527-5074-2-git-send-email-masonccyang@mxic.com.tw> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mason, Mason Yang 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 > --- > 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 Thanks, Miquèl