Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp291913ybh; Wed, 11 Mar 2020 01:02:33 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuVugr2BsVL5y9ijBPWUC3nLI41owKVTNXQJILYAW75ckxf+djziUdSrF7pOGz7CFsQDbVr X-Received: by 2002:a9d:1b7:: with SMTP id e52mr1288920ote.372.1583913752981; Wed, 11 Mar 2020 01:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583913752; cv=none; d=google.com; s=arc-20160816; b=wPaTkaQsyhl0PgMVG4tD8si2fmj3AVlGWpBwoQfluqORNQwywbNUK9DBYPkIypinWW LlMppuj+iztE0GiRwnp9rDv5haJmT1eR2IOjwIRkr9h9tkVR05wBl4Ba8PAtUv6cN8Kg PKXIWf4SWcP9HLUEaie2o7j9CED7XI1C5OV6dLNxpqOUkvR0+szfy/s+XdJG/Nep2Egb +40WP/88vgDfRg7BfglBQdF9QJP5vSiZtqAIOELj09WXrZL84oIJUiNUVw5PqTj/vT6t dkjhZqky8fHDVGTepKgrWEitY9nO1p+T60scuw9VdYiIs3FXDh2eIMZHToYTJsDID9dm W0dg== 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=l02IqNPAdu9gtX8Jl44xQQsw7J0g9XSMRbjtp55+gbs=; b=LIQIMnGAUu1hcjUxA7sDQvoCF08oqlzeCpPDDScGpf6vSuBCNHm5bYpzKrozr0/v// naYHo2uGRKW2hruWg2g4FptYAg5nlv50lSkD7pujOGowo1NGIeRuMykA5xOli7ZlGRUe ca9uaVovQaHFWRwiVew4PgVMVFyJXMkgMmca1W0T+12qWQOSAo0usg9H7noUDVBD7tIK UxgMOkvjgXNxcQB4ew2KYYiHuxMr9g3s8lHGU1RqJdSgXCEfuGVm7ezHdH5SpELA0ckv gkxfmH0BEUFMxfN7q8L75LptdTZ7rJZ3o7ao2msx6c1iXbduFShwcqmWrNBMMhbLituD jnJw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si767307oti.200.2020.03.11.01.02.05; Wed, 11 Mar 2020 01:02:32 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728544AbgCKIBG (ORCPT + 99 others); Wed, 11 Mar 2020 04:01:06 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:54836 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728242AbgCKIBG (ORCPT ); Wed, 11 Mar 2020 04:01:06 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 4C6DA28FD50; Wed, 11 Mar 2020 08:01:04 +0000 (GMT) Date: Wed, 11 Mar 2020 09:01:01 +0100 From: Boris Brezillon To: masonccyang@mxic.com.tw 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 Message-ID: <20200311090101.5ac66997@collabora.com> In-Reply-To: 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> Organization: Collabora X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Mar 2020 14:13:57 +0800 masonccyang@mxic.com.tw wrote: > 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().