Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2425155ybl; Thu, 9 Jan 2020 12:31:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzppFS/JLpVrMU91P1D/76B9vgfdZhAucTZhZBus5eMjbriIk9w22CGOWrxIB72jPHSQxOe X-Received: by 2002:a05:6830:139a:: with SMTP id d26mr10370461otq.75.1578601893953; Thu, 09 Jan 2020 12:31:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578601893; cv=none; d=google.com; s=arc-20160816; b=vAMzq/E2Db/7XE0xRbQIbeivcbih0aSJyI6SEdoTpJtSu9uNPsIlEsxlAsWwmhLnoq zEZKD9Idt+gUSimKrH6dNV/sAa2/STVO07zFWnudh0VlFEStskLx+cJfotevcyhQGNF9 njzIcwKOgfR/yfRJFsKoVS9tPxpvyNKe6Jhv49o3PDpHQHSLXR0IM5RHVuDzGCd4y/jv mGDX1HXsOYDZ9ZOZIptrdUtn4i53UDqWBvUaRMppsZm2IO+HbUWK/3w9XacW40iTNPwN fKx04/sK29V1Grm1yJgvI02ZVEZFzM0HE2/apQS2S+x6kvk2YulYmUQLFcRWJMhFNkBR yAtg== 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=ntxb+n67XAXLSTbwp5eOhjJ1JRxmV+tyFxz43MEmtmI=; b=vhERH3zhaGGVnRm2tDctzEz3Bq4Yk7S8VzKM8Lz8B2IqT0tfV87V/nGkrf38ueZgqw yo8vVCyc66J5IloQHMep46UwnhHBnZm8743uoL8YEPkEAJuqHJYtS3E/z0KFLSDTm/DI cH9bU8iXOvS8SeSrVR0Kwj49ZCfb79Pf2W0Kh+zxhKqNw9sPvlnqrq82NeeSumcfFsLB DGhuD7TitLIsr+gVN3k6e40Hyz45P3ACESS74nyVDOHfWvdtKRHkisHs4wABQIIIXzSZ Y/6s5FfSatKG6Kb5gaqsxKksXsBSrnygOdX+X4XtQd7CPKtrqmmLoCZAzlOSFtp+gTUF mKGQ== 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 c79si4384390oig.208.2020.01.09.12.31.17; Thu, 09 Jan 2020 12:31:33 -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 S2387912AbgAIQxZ convert rfc822-to-8bit (ORCPT + 99 others); Thu, 9 Jan 2020 11:53:25 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:53723 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729572AbgAIQxY (ORCPT ); Thu, 9 Jan 2020 11:53:24 -0500 Received: from xps13 (unknown [91.224.148.103]) (Authenticated sender: miquel.raynal@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 00206100014; Thu, 9 Jan 2020 16:53:19 +0000 (UTC) Date: Thu, 9 Jan 2020 17:53:18 +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 3/4] mtd: rawnand: Add support manufacturer specific suspend/resume operation Message-ID: <20200109175318.73ab8bd7@xps13> In-Reply-To: <1572256527-5074-4-git-send-email-masonccyang@mxic.com.tw> References: <1572256527-5074-1-git-send-email-masonccyang@mxic.com.tw> <1572256527-5074-4-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:26 +0800: > Patch nand_suspend() & nand_resume() for manufacturer specific > suspend/resume operation. > > Signed-off-by: Mason Yang > --- > drivers/mtd/nand/raw/nand_base.c | 9 +++++++-- > include/linux/mtd/rawnand.h | 2 ++ > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c > index 5e318ff..2a9c5bb 100644 > --- a/drivers/mtd/nand/raw/nand_base.c > +++ b/drivers/mtd/nand/raw/nand_base.c > @@ -4323,6 +4323,8 @@ static int nand_suspend(struct mtd_info *mtd) > struct nand_chip *chip = mtd_to_nand(mtd); > > mutex_lock(&chip->lock); > + if (chip->_suspend) > + chip->_suspend(chip); Return value should be checked! > chip->suspended = 1; > mutex_unlock(&chip->lock); > > @@ -4338,11 +4340,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 2430ecd..6b14041 100644 > --- a/include/linux/mtd/rawnand.h > +++ b/include/linux/mtd/rawnand.h > @@ -1117,6 +1117,8 @@ struct nand_chip { > > struct mutex lock; > unsigned int suspended : 1; > + int (*_suspend)(struct nand_chip *chip); > + void (*_resume)(struct nand_chip *chip); Please don't forget the kdoc! > > uint8_t *oob_poi; > struct nand_controller *controller; With this fixed, Reviewed-by: Miquel Raynal Thanks, Miquèl