Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1154040ybh; Wed, 11 Mar 2020 18:49:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsfbRNQZ0mSFam1znGPhmOzy26cJ76iQz2DTyviwtUudmJhaDu0NE5A5NkgfZIWuGR/wEfs X-Received: by 2002:a9d:567:: with SMTP id 94mr4264864otw.201.1583977757665; Wed, 11 Mar 2020 18:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583977757; cv=none; d=google.com; s=arc-20160816; b=np6udS00AqqPLgUtfI8dYXKol6BjGyVBc3wmCvPAVljNIxjs60AvlsIk5OeQizVj2V NvJcMgIMyn96RRSiHGETI1NWM2dH6DV2Or2ZEdiLTlNh/T0sGB6B2r6ilnktDgEF81xB X5qgo20YgIkdqgeaFwfzkYVVD2yipJHzhJ6+fXn1bRQ6LbxAm1AP0uvzJEu9WpBIc9eG yZ1nyfRynTvONbpedwJZ+KsojgwDM9HCmPILJ4B0FgzI7EL9o1btnvqFcvajmybbIoXZ ppsAFb9nKbpyKwt9/UZdvjAL6J7QO8qDnrrq83uRYOMVSpDjCwRXSYvVBrcGfX7EUEXp 6ihQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:from:message-id:mime-version:subject :cc:to:references:in-reply-to; bh=35V5CawweNTw3SL98PVZlYc3VbgoEBvihmt3OXzpRVg=; b=oj5wB/NozYFI/hPSQSKqWaZIHFRWlu+zvwV3bV9HIOtVjVYvGMo5zzy9HPCF54s3q+ 6FNPlPjlu2N//WpPSghWKkNMTpWBS3uqWo+IRbGaKRdOeSW4d6q5n1bflH3sUNZHZDpN pV5EA4C3XDwje9sGnEvjGBxLMgIB+HwU+OanxrNbjfd9uDSOAJRY9qdWpJV31brN1geP W8XGS6G3JNFLeRLrgfVM2nVlXJJ17/Q4MEzwfR7+Qq3EazG8sm3O/ORsD+A0ooZnKkvR T745ZQ5Om4F9APO8SQpLFlF2g/nXz7J3wpGr8WXKqODMVW/mUr1+pYMg4Ii4PIyrheCh CSrA== 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 x189si2029422oia.270.2020.03.11.18.49.06; Wed, 11 Mar 2020 18:49:17 -0700 (PDT) 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 S2387612AbgCLBsq (ORCPT + 99 others); Wed, 11 Mar 2020 21:48:46 -0400 Received: from twhmllg3.macronix.com ([211.75.127.131]:37120 "EHLO TWHMLLG3.macronix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387588AbgCLBsq (ORCPT ); Wed, 11 Mar 2020 21:48:46 -0400 Received: from twhfmlp1.macronix.com (twhfmlp1.macronix.com [172.17.20.91]) by TWHMLLG3.macronix.com with ESMTP id 02C1mcxx043812; Thu, 12 Mar 2020 09:48:38 +0800 (GMT-8) (envelope-from masonccyang@mxic.com.tw) Received: from MXML06C.mxic.com.tw (mxml06c.mxic.com.tw [172.17.14.55]) by Forcepoint Email with ESMTP id 43F1EBB4C362905B2749; Thu, 12 Mar 2020 09:48:38 +0800 (CST) In-Reply-To: <20200311090101.5ac66997@collabora.com> References: <1583220084-10890-1-git-send-email-masonccyang@mxic.com.tw> <1583220084-10890-4-git-send-email-masonccyang@mxic.com.tw> <20200310203930.2b8c0cfb@collabora.com> <20200310204142.540fc7c4@collabora.com> <20200311090101.5ac66997@collabora.com> To: "Boris Brezillon" Cc: allison@lohutok.net, bbrezillon@kernel.org, frieder.schrempf@kontron.de, juliensu@mxic.com.tw, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, miquel.raynal@bootlin.com, rfontana@redhat.com, richard@nod.at, s.hauer@pengutronix.de, stefan@agner.ch, tglx@linutronix.de, vigneshr@ti.com, yuehaibing@huawei.com Subject: Re: [PATCH v3 3/4] mtd: rawnand: Add support manufacturer specific suspend/resume operation MIME-Version: 1.0 X-KeepSent: 618C17D0:837A4D16-48258529:0009AFE3; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP4 SHF90 June 10, 2013 Message-ID: From: masonccyang@mxic.com.tw Date: Thu, 12 Mar 2020 09:48:38 +0800 X-MIMETrack: Serialize by Router on MXML06C/TAIWAN/MXIC(Release 9.0.1FP10 HF265|July 25, 2018) at 2020/03/12 AM 09:48:38, Serialize complete at 2020/03/12 AM 09:48:38 Content-Type: text/plain; charset="US-ASCII" X-MAIL: TWHMLLG3.macronix.com 02C1mcxx043812 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(). Got it, thanks! best regards, Mason CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== ============================================================================ CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. =====================================================================